/* ==========================================================================
   Aksh Niti — Analysis, Stats and Tools.

   Loaded on top of portal.css, which owns the tokens and the shell. Everything
   here is a panel that appears on one of the three inner pages.
   ========================================================================== */

/* ==========================================================================
   Page header
   ========================================================================== */

.ak-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 24px 26px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(47, 109, 246, 0.10), transparent 58%),
        var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.ak-page-head h2 {
    font-size: clamp(1.3rem, 2.5vw, 1.7rem);
    letter-spacing: -0.035em;
}

.ak-page-head p {
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--muted);
    max-width: 60ch;
}

.ak-page-head-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

/* ==========================================================================
   KPI row
   ========================================================================== */

.ak-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 14px;
}

.ak-kpi {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 17px 18px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.ak-kpi-top {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.ak-kpi-top i {
    font-size: 0.8rem;
}

.ak-kpi strong {
    font-size: 1.72rem;
    font-weight: 750;
    letter-spacing: -0.04em;
    line-height: 1.15;
}

.ak-kpi small {
    font-size: 0.78rem;
    color: var(--muted);
}

.ak-kpi.is-good strong {
    color: var(--good);
}

.ak-kpi.is-warn strong {
    color: var(--warn);
}

.ak-kpi.is-bad strong {
    color: var(--bad);
}

.ak-kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.76rem;
    font-weight: 700;
}

.ak-kpi-delta.up {
    color: var(--good);
}

.ak-kpi-delta.down {
    color: var(--bad);
}

/* ==========================================================================
   Panels
   ========================================================================== */

.ak-panel {
    padding: 20px 22px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.ak-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.ak-panel-head h3 {
    font-size: 1.05rem;
}

.ak-panel-head p {
    margin-top: 3px;
    font-size: 0.81rem;
    color: var(--muted);
    max-width: 62ch;
}

.ak-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 16px;
}

.ak-grid-side {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

/* ==========================================================================
   Health hero (Analysis)
   ========================================================================== */

.ak-health {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 26px;
    align-items: center;
    padding: 24px 26px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.ak-health-ring {
    position: relative;
    width: 148px;
    height: 148px;
    display: grid;
    place-items: center;
}

.ak-health-ring .ak-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ak-health-ring-text {
    text-align: center;
    line-height: 1.1;
}

.ak-health-ring-text strong {
    display: block;
    font-size: 2.2rem;
    font-weight: 750;
    letter-spacing: -0.05em;
}

.ak-health-ring-text small {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.ak-health-copy h3 {
    font-size: 1.2rem;
}

.ak-health-copy p {
    margin-top: 7px;
    font-size: 0.88rem;
    color: var(--muted);
    max-width: 62ch;
}

.ak-health-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

/* ==========================================================================
   Charts
   ========================================================================== */

.ak-chart-empty {
    padding: 30px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.84rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

/* ── Line ────────────────────────────────────────────────────────────── */

.ak-line {
    width: 100%;
    height: 180px;
    display: block;
    overflow: visible;
}

.ak-line .ak-grid {
    stroke: var(--line);
    stroke-width: 1;
    stroke-dasharray: 3 5;
}

.ak-line .ak-stroke {
    fill: none;
    stroke: var(--brand);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.ak-line .ak-area {
    stroke: none;
}

.ak-line .ak-fill-top {
    stop-color: var(--brand);
    stop-opacity: 0.24;
}

.ak-line .ak-fill-bottom {
    stop-color: var(--brand);
    stop-opacity: 0;
}

.ak-line .ak-dot {
    fill: var(--brand);
}

.ak-line .ak-dot.is-last {
    fill: var(--surface);
    stroke: var(--brand);
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

/* ── Ring / donut ────────────────────────────────────────────────────── */

.ak-ring,
.ak-donut {
    width: 100%;
    height: 100%;
}

.ak-ring-track {
    fill: none;
    stroke: var(--surface-3);
}

.ak-ring-fill {
    fill: none;
    stroke: var(--brand);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.ak-health-ring[data-tone="good"] .ak-ring-fill {
    stroke: var(--good);
}

.ak-health-ring[data-tone="warn"] .ak-ring-fill {
    stroke: var(--warn);
}

.ak-health-ring[data-tone="bad"] .ak-ring-fill {
    stroke: var(--bad);
}

.ak-donut {
    transform: rotate(-90deg);
}

.ak-donut-arc {
    fill: none;
    stroke-linecap: butt;
}

.ak-donut-wrap {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
}

.ak-donut-box {
    position: relative;
    width: 148px;
    height: 148px;
    display: grid;
    place-items: center;
}

.ak-donut-box .ak-donut {
    position: absolute;
    inset: 0;
}

.ak-donut-center {
    text-align: center;
    line-height: 1.15;
}

.ak-donut-center strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 750;
    letter-spacing: -0.04em;
}

.ak-donut-center small {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.ak-legend {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ak-legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.ak-legend-row i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: 0 0 10px;
}

.ak-legend-row span {
    color: var(--muted);
}

.ak-legend-row b {
    margin-left: auto;
    font-weight: 700;
}

/* ── Bars ────────────────────────────────────────────────────────────── */

.ak-bars {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.ak-bar-row {
    display: grid;
    grid-template-columns: minmax(84px, 130px) minmax(0, 1fr) 52px;
    align-items: center;
    gap: 12px;
}

.ak-bar-label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ak-bar-track {
    height: 9px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

.ak-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--brand);
    transition: width 0.5s ease;
}

.ak-bar-value {
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ak-bar-note {
    margin: -4px 0 4px 142px;
    font-size: 0.76rem;
    color: var(--muted);
}

/* ── Heatmap ─────────────────────────────────────────────────────────── */

.ak-heat {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 1fr);
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.ak-cell {
    width: 13px;
    height: 13px;
    border-radius: 3.5px;
    background: var(--surface-3);
    display: block;
}

.ak-cell.is-pad {
    background: transparent;
}

.ak-cell[data-level="1"] {
    background: color-mix(in srgb, var(--good) 28%, var(--surface-3));
}

.ak-cell[data-level="2"] {
    background: color-mix(in srgb, var(--good) 50%, var(--surface-3));
}

.ak-cell[data-level="3"] {
    background: color-mix(in srgb, var(--good) 74%, var(--surface-3));
}

.ak-cell[data-level="4"] {
    background: var(--good);
}

.ak-heat-legend {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    font-size: 0.73rem;
    color: var(--muted);
}

/* ── Sparkline ───────────────────────────────────────────────────────── */

.ak-spark {
    width: 96px;
    height: 28px;
}

.ak-spark path {
    fill: none;
    stroke: var(--brand);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.ak-filters {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.ak-chip {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
}

.ak-chip:hover {
    border-color: var(--brand);
    color: var(--brand-ink);
}

.ak-chip.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
}

.ak-chip b {
    margin-left: 6px;
    opacity: 0.7;
    font-weight: 700;
}

.ak-select {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-soft);
    cursor: pointer;
}

.ak-filter-search {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.ak-filter-search i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.82rem;
}

.ak-filter-search input {
    width: 100%;
    padding: 8px 13px 8px 36px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 0.84rem;
}

.ak-filter-search input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

/* ==========================================================================
   Weakness rows (Analysis)
   ========================================================================== */

.ak-wk-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ak-wk {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.ak-wk:hover {
    border-color: color-mix(in srgb, var(--tone) 42%, var(--line));
    box-shadow: var(--shadow-sm);
}

.ak-wk-main {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.ak-wk-rank {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: color-mix(in srgb, var(--tone) 14%, transparent);
    color: var(--tone);
    font-weight: 750;
    font-size: 0.98rem;
    letter-spacing: -0.02em;
}

.ak-wk-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ak-wk-title strong {
    font-size: 0.94rem;
    letter-spacing: -0.01em;
}

.ak-wk-sub {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--tone);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ak-wk-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 5px;
    font-size: 0.78rem;
    color: var(--muted);
}

.ak-wk-meta b {
    color: var(--text-soft);
    font-weight: 650;
}

.ak-wk-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ak-wk-sev {
    text-align: right;
}

.ak-wk-sev strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.ak-wk-sev span {
    font-size: 0.66rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.ak-wk-caret {
    color: var(--muted);
    font-size: 0.82rem;
    transition: transform 0.2s ease;
}

.ak-wk.open .ak-wk-caret {
    transform: rotate(180deg);
}

.ak-wk-sevbar {
    height: 4px;
    background: var(--surface-3);
}

.ak-wk-sevbar span {
    display: block;
    height: 100%;
    background: var(--bad);
    transition: width 0.5s ease;
}

.ak-wk[data-status="weak"] .ak-wk-sevbar span {
    background: var(--warn);
}

.ak-wk[data-status="improving"] .ak-wk-sevbar span {
    background: var(--brand);
}

.ak-wk[data-status="recovered"] .ak-wk-sevbar span {
    background: var(--good);
}

.ak-wk-detail {
    display: none;
    padding: 4px 16px 16px;
    border-top: 1px solid var(--line-soft);
}

.ak-wk.open .ak-wk-detail {
    display: block;
}

.ak-wk-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.ak-fact {
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--surface-2);
}

.ak-fact strong {
    display: block;
    font-size: 1.06rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ak-fact span {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 650;
}

.ak-fact.is-bad strong {
    color: var(--bad);
}

.ak-fact.is-warn strong {
    color: var(--warn);
}

.ak-fact.is-good strong {
    color: var(--good);
}

.ak-wk-why {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--brand-soft);
    font-size: 0.85rem;
    color: var(--text-soft);
    line-height: 1.55;
}

.ak-wk-why b {
    color: var(--text);
}

.ak-wk-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 13px;
}

/* Status chips */
.ak-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ak-status[data-status="critical"] {
    background: var(--bad-soft);
    color: var(--bad);
}

.ak-status[data-status="weak"] {
    background: var(--warn-soft);
    color: var(--warn);
}

.ak-status[data-status="improving"] {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.ak-status[data-status="recovered"] {
    background: var(--good-soft);
    color: var(--good);
}

/* ==========================================================================
   Action plan
   ========================================================================== */

.ak-plan {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.ak-plan-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line-soft);
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.ak-plan-row:hover {
    transform: translateX(3px);
    border-color: var(--tone, var(--brand));
}

.ak-plan-step {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    background: var(--tone, var(--brand));
    color: #fff;
    font-size: 0.8rem;
    font-weight: 750;
}

.ak-plan-copy {
    flex: 1;
    min-width: 0;
}

.ak-plan-copy strong {
    display: block;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ak-plan-copy small {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
}

/* ==========================================================================
   Subject rank rows (Analysis + Stats)
   ========================================================================== */

.ak-rank {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ak-rank-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 13px;
    transition: background 0.16s ease;
}

.ak-rank-row:hover {
    background: var(--surface-2);
}

.ak-rank-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--tone) 15%, transparent);
    color: var(--tone);
    font-size: 0.86rem;
}

.ak-rank-body strong {
    display: block;
    font-size: 0.89rem;
}

.ak-rank-track {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-3);
    margin-top: 6px;
    overflow: hidden;
}

.ak-rank-track span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--tone);
    transition: width 0.5s ease;
}

.ak-rank-value {
    text-align: right;
}

.ak-rank-value strong {
    display: block;
    font-size: 0.98rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.ak-rank-value span {
    font-size: 0.7rem;
    color: var(--muted);
}

/* ==========================================================================
   Tables (Stats)
   ========================================================================== */

.ak-table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.ak-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 620px;
}

.ak-table th {
    text-align: left;
    padding: 9px 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.ak-table td {
    padding: 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

.ak-table tbody tr:last-child td {
    border-bottom: 0;
}

.ak-table tbody tr:hover {
    background: var(--surface-2);
}

.ak-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.ak-table-subject {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 650;
}

.ak-table-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 9px;
}

/* ==========================================================================
   Timeline (Stats)
   ========================================================================== */

.ak-timeline {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ak-tl-row {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    gap: 13px;
    align-items: center;
    padding: 11px 4px;
    border-bottom: 1px solid var(--line-soft);
}

.ak-tl-row:last-child {
    border-bottom: 0;
}

.ak-tl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tone, var(--brand));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone, var(--brand)) 18%, transparent);
}

.ak-tl-body strong {
    display: block;
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ak-tl-body small {
    font-size: 0.77rem;
    color: var(--muted);
}

.ak-tl-score {
    font-size: 0.92rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.ak-tl-score.is-good {
    color: var(--good);
}

.ak-tl-score.is-warn {
    color: var(--warn);
}

.ak-tl-score.is-bad {
    color: var(--bad);
}

/* ==========================================================================
   Tools
   ========================================================================== */

.ak-tool-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    align-items: start;
}

.ak-tool-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ak-tool {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.ak-tool:hover {
    transform: translateY(-2px);
    border-color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.ak-tool-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 0.95rem;
}

.ak-tool-copy {
    flex: 1;
    min-width: 0;
}

.ak-tool-copy strong {
    display: block;
    font-size: 0.92rem;
}

.ak-tool-copy small {
    display: block;
    font-size: 0.79rem;
    color: var(--muted);
    line-height: 1.45;
}

.ak-tool-go {
    color: var(--muted);
    font-size: 0.82rem;
}

.ak-tool.is-danger:hover {
    border-color: var(--bad);
}

.ak-tool.is-danger .ak-tool-icon {
    background: var(--bad-soft);
    color: var(--bad);
}

.ak-tool.is-good .ak-tool-icon {
    background: var(--good-soft);
    color: var(--good);
}

.ak-tool.is-warn .ak-tool-icon {
    background: var(--warn-soft);
    color: var(--warn);
}

.ak-storage {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ak-storage-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.85rem;
}

.ak-storage-row span {
    color: var(--muted);
}

.ak-storage-row strong {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.ak-note {
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    background: var(--warn-soft);
    border: 1px solid color-mix(in srgb, var(--warn) 24%, transparent);
    font-size: 0.83rem;
    color: var(--text-soft);
    line-height: 1.55;
}

.ak-note i {
    color: var(--warn);
    margin-right: 6px;
}

.ak-subject-quick {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.ak-quick-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 13px;
    border-radius: 13px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 0.86rem;
    font-weight: 600;
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.ak-quick-sub:hover {
    transform: translateY(-2px);
    border-color: var(--tone);
}

.ak-quick-sub i {
    color: var(--tone);
}

/* ==========================================================================
   About the developer
   ========================================================================== */

.ab-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 26px;
    align-items: center;
    padding: 28px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(47, 109, 246, 0.12), transparent 58%),
        var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

/* The source photo is small, so it is shown at close to its natural size inside
   a ring rather than blown up into a soft blur. Swapping in a larger
   profile.jpg sharpens it everywhere with no CSS change. */
.ab-photo {
    position: relative;
    width: 132px;
    height: 132px;
    flex: 0 0 132px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(140deg, var(--brand), #7b3ff2);
    box-shadow: 0 14px 34px rgba(47, 109, 246, 0.28);
}

.ab-photo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 3px solid var(--surface);
    background: var(--surface-2);
}

.ab-photo-fallback {
    display: none;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--surface);
    background: var(--surface-2);
    color: var(--brand);
    font-size: 2.1rem;
    font-weight: 750;
    letter-spacing: -0.03em;
}

.ab-photo.is-fallback .ab-photo-fallback {
    display: grid;
}

.ab-hero-copy h2 {
    font-size: clamp(1.5rem, 3vw, 2.05rem);
    letter-spacing: -0.04em;
}

.ab-role {
    margin: 4px 0 12px;
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--brand-ink);
}

.ab-hero-copy p {
    font-size: 0.93rem;
    color: var(--text-soft);
    line-height: 1.62;
    max-width: 62ch;
}

.ab-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

/* ── The letter ──────────────────────────────────────────────────────── */

.ab-letter {
    position: relative;
    padding: 28px 30px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.ab-letter::before {
    content: "";
    position: absolute;
    left: 0;
    top: 24px;
    bottom: 24px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--brand), transparent);
}

.ab-letter h3 {
    font-size: 1.28rem;
    margin-bottom: 16px;
}

.ab-letter p {
    max-width: 68ch;
    margin-bottom: 14px;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text-soft);
}

.ab-letter em {
    color: var(--text);
    font-style: italic;
}

.ab-letter strong {
    color: var(--text);
    font-weight: 650;
}

.ab-sign {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}

.ab-sign span {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
}

.ab-sign strong {
    display: block;
    margin-top: 4px;
    font-size: 1.18rem;
    letter-spacing: -0.02em;
    color: var(--brand-ink);
}

/* ── Principles ──────────────────────────────────────────────────────── */

.ab-principles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
    gap: 16px;
}

.ab-principles h4 {
    margin: 14px 0 7px;
    font-size: 1rem;
}

.ab-principles p {
    font-size: 0.86rem;
    color: var(--muted);
    line-height: 1.6;
}

.ab-principle-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1.05rem;
}

/* ── Feature grid ────────────────────────────────────────────────────── */

.ab-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 12px;
}

.ab-feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 17px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.ab-feature:hover {
    transform: translateY(-2px);
    border-color: var(--brand);
}

.ab-feature>i {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 0.92rem;
}

.ab-feature div {
    min-width: 0;
}

.ab-feature strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 3px;
}

.ab-feature small {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.55;
}

/* ── Steps ───────────────────────────────────────────────────────────── */

.ab-steps {
    display: grid;
    gap: 12px;
}

.ab-steps article {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 15px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line-soft);
}

.ab-steps span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 750;
}

.ab-steps div {
    min-width: 0;
}

.ab-steps strong {
    display: block;
    font-size: 0.91rem;
    margin-bottom: 2px;
}

.ab-steps small {
    display: block;
    font-size: 0.83rem;
    color: var(--muted);
    line-height: 1.55;
}

/* ── Connect ─────────────────────────────────────────────────────────── */

.ab-connect {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 10px;
}

.ab-connect a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 0.87rem;
    font-weight: 620;
    transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.ab-connect a:hover {
    transform: translateY(-2px);
    border-color: var(--brand);
    color: var(--brand-ink);
}

.ab-connect i {
    font-size: 1.05rem;
    color: var(--muted);
    width: 20px;
    text-align: center;
}

.ab-connect a:hover i {
    color: var(--brand);
}

.ab-footnote {
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    padding: 4px 0 8px;
}

.ab-footnote a {
    color: var(--brand);
    font-weight: 620;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
    .ak-grid-side {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .ak-page-head {
        padding: 20px;
        border-radius: var(--radius);
    }

    .ab-hero {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        padding: 24px 18px;
        border-radius: var(--radius);
    }

    .ab-hero-copy p {
        margin-left: auto;
        margin-right: auto;
    }

    .ab-hero-chips {
        justify-content: center;
    }

    .ab-letter {
        padding: 22px 18px;
    }

    .ab-letter p {
        font-size: 0.91rem;
    }

    .ak-health {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        padding: 22px 18px;
    }

    .ak-health-copy p {
        margin-left: auto;
        margin-right: auto;
    }

    .ak-health-chips {
        justify-content: center;
    }

    .ak-donut-wrap {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .ak-legend {
        width: 100%;
    }

    .ak-panel {
        padding: 17px 16px;
    }

    .ak-wk-main {
        grid-template-columns: 38px minmax(0, 1fr) auto;
        gap: 11px;
        padding: 13px;
    }

    .ak-wk-rank {
        width: 38px;
        height: 38px;
        font-size: 0.88rem;
    }

    .ak-wk-right {
        gap: 9px;
    }

    .ak-bar-row {
        grid-template-columns: minmax(70px, 96px) minmax(0, 1fr) 46px;
        gap: 9px;
    }

    .ak-bar-note {
        margin-left: 105px;
    }

    /* ── Touch sizing for the filter controls ───────────────────────── */

    .ak-select,
    .ak-filter-search input {
        min-height: 44px;
    }

    /* Search takes its own row; the two selects split the next one, instead of
       three controls fighting over 340px. */
    .ak-filter-search {
        flex: 1 0 100%;
    }

    .ak-select {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
    }

    .ak-chip {
        min-height: 42px;
        padding: 10px 16px;
    }

    /* Status chips scroll sideways as one row. Wrapped, five of them stacked
       three rows deep and pushed the actual list off the first screen. */
    .ak-filters-scroll {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .ak-filters-scroll::-webkit-scrollbar {
        display: none;
    }

    .ak-filters-scroll .ak-chip {
        flex: 0 0 auto;
    }

    /* Subject names in the stats table were 20px tall — a coin-flip tap. */
    .ak-table td a {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
    }

    .ab-footnote a {
        display: inline-block;
        padding: 6px 4px;
    }
}
