/* ------------------------------------------------------------------
   Cost Risk Analysis — design tokens
   Light and dark are both selected sets stepped from the same ramps,
   so the dark theme is a choice rather than an inversion.
   ------------------------------------------------------------------ */

:root {
    color-scheme: light;

    --page: #f9f9f7;
    --surface: #fcfcfb;
    --surface-sunken: #f2f2ee;
    --surface-hover: #f0f0ec;

    --ink: #0b0b0b;
    --ink-secondary: #52514e;
    --ink-muted: #898781;

    --line: rgba(11, 11, 11, 0.1);
    --line-strong: #c3c2b7;
    --grid: #e1e0d9;

    /* Aqua. --accent is the data hue; --accent-strong is a darker step of the
       same ramp so it clears 4.5:1 as text and as a button ground. */
    --accent: #17a271;
    --accent-strong: #0c7a55;
    --accent-stronger: #0a6e4d;
    --accent-wash: #e6f5ef;
    --accent-ink: #ffffff;

    --positive: #006300;
    --critical: #d03b3b;
    --critical-wash: #fdefef;
    --critical-ink: #8f2323;

    --shadow-sm: 0 1px 2px rgba(11, 11, 11, 0.05);
    --shadow-md: 0 1px 2px rgba(11, 11, 11, 0.05), 0 10px 26px rgba(11, 11, 11, 0.05);

    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 264px;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;

        --page: #0d0d0d;
        --surface: #1a1a19;
        --surface-sunken: #232321;
        --surface-hover: #272725;

        --ink: #ffffff;
        --ink-secondary: #c3c2b7;
        --ink-muted: #898781;

        --line: rgba(255, 255, 255, 0.1);
        --line-strong: #383835;
        --grid: #2c2c2a;

        /* Dark steps run lighter, not darker — text and grounds both need to
           lift off the dark surface. */
        --accent: #199e70;
        --accent-strong: #2ec296;
        --accent-stronger: #45cfa5;
        --accent-wash: rgba(25, 158, 112, 0.14);
        --accent-ink: #0d0d0d;

        --positive: #0ca30c;
        /* Status steps are fixed, not themed — #d03b3b clears 3:1 on both
           surfaces. Only the alert's text tone lifts for the dark ground. */
        --critical: #d03b3b;
        --critical-wash: rgba(208, 59, 59, 0.16);
        --critical-ink: #f0a3a3;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 26px rgba(0, 0, 0, 0.3);
    }
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--page);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure {
    margin: 0;
}

a {
    color: var(--accent-strong);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------- Sidebar */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    padding: 22px 16px;
    border-right: 1px solid var(--line);
    background: var(--surface);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 8px;
    margin-bottom: 28px;
    text-decoration: none;
    color: inherit;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 9px;
    background: var(--accent-strong);
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.02em;
}

.brand-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.brand-sub {
    display: block;
    color: var(--ink-muted);
    font-size: 12px;
    line-height: 1.3;
}

.nav {
    display: grid;
    gap: 2px;
}

.nav-label {
    padding: 0 8px;
    margin-bottom: 8px;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--ink-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.nav a:hover {
    background: var(--surface-hover);
    color: var(--ink);
}

.nav a[aria-current="page"] {
    background: var(--accent-wash);
    color: var(--accent-strong);
    font-weight: 600;
}

.nav svg {
    width: 16px;
    height: 16px;
    flex: none;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-foot {
    margin-top: auto;
    padding: 12px 10px 0;
    border-top: 1px solid var(--line);
    color: var(--ink-muted);
    font-size: 12px;
}

/* ------------------------------------------------------------------- Main */

.main {
    margin-left: var(--sidebar-w);
    padding: 28px 32px 72px;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 22px;
    margin-bottom: 26px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

h1 {
    margin-top: 4px;
    font-size: 26px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2 {
    font-size: 16px;
    font-weight: 620;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.muted {
    color: var(--ink-secondary);
}

.section {
    margin-bottom: 26px;
}

.section-head {
    margin-bottom: 12px;
}

.section-head p {
    margin-top: 2px;
    color: var(--ink-secondary);
    font-size: 13.5px;
}

/* ------------------------------------------------------------------ Cards */

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

.card-head {
    margin-bottom: 16px;
}

.card-head p {
    margin-top: 3px;
    color: var(--ink-secondary);
    font-size: 13.5px;
}

/* --------------------------------------------------------------- Controls */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--accent-strong);
    color: var(--accent-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.button:hover {
    background: var(--accent-stronger);
}

.button-secondary {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--ink);
}

.button-secondary:hover {
    background: var(--surface-hover);
}

.button svg {
    width: 15px;
    height: 15px;
    flex: none;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.field span {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.field small {
    display: block;
    margin-top: 6px;
    color: var(--ink-muted);
    font-size: 12px;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

input[type="number"]:focus-visible,
input[type="text"]:focus-visible,
select:focus-visible {
    border-color: var(--accent);
    outline: 2px solid var(--accent-wash);
    outline-offset: 0;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
        linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) 16px,
        calc(100% - 11px) 16px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 30px;
}

/* ------------------------------------------------------------ Upload form */

.upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 32px;
    align-items: start;
}

.analysis-form {
    display: grid;
    gap: 16px;
}

.dropzone {
    display: block;
    padding: 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    cursor: pointer;
}

.dropzone:hover,
.dropzone:focus-within {
    border-color: var(--accent);
    background: var(--accent-wash);
}

.dropzone-inner {
    display: flex;
    align-items: center;
    gap: 13px;
}

.dropzone svg {
    width: 20px;
    height: 20px;
    flex: none;
    stroke: var(--accent-strong);
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dropzone-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.dropzone-hint {
    display: block;
    color: var(--ink-secondary);
    font-size: 13px;
}

.dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.field-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.form-foot p {
    color: var(--ink-muted);
    font-size: 12.5px;
}

/* ---------------------------------------------------------- Manual table */

.activity-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.manual-form {
    display: grid;
    gap: 16px;
}

.editable-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.editable-table {
    min-width: 980px;
}

.editable-table th,
.editable-table td {
    padding: 8px;
}

.editable-table th:first-child,
.editable-table td:first-child {
    width: 25%;
}

.editable-table th:nth-child(2),
.editable-table td:nth-child(2) {
    width: 17%;
}

.editable-table th:nth-child(3),
.editable-table td:nth-child(3),
.editable-table th:nth-child(4),
.editable-table td:nth-child(4),
.editable-table th:nth-child(5),
.editable-table td:nth-child(5) {
    width: 11%;
}

.editable-table th:nth-child(6),
.editable-table td:nth-child(6) {
    width: 16%;
}

.editable-table th:last-child,
.editable-table td:last-child {
    width: 48px;
    text-align: center;
}

.editable-table input,
.editable-table select {
    min-height: 34px;
    font-size: 13px;
}

.icon-button {
    display: inline-grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-secondary);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--critical);
    color: var(--critical);
    background: var(--critical-wash);
}

.manual-foot {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.field-pair.compact {
    max-width: 430px;
    flex: 1 1 360px;
}

/* ------------------------------------------------------------ Spec blocks */

.spec {
    display: grid;
    gap: 18px;
}

.spec-title {
    margin-bottom: 9px;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-sunken);
    color: var(--ink-secondary);
    font-size: 12.5px;
    font-weight: 500;
}

.chip-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

/* ----------------------------------------------------------------- Alerts */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid var(--critical);
    border-radius: var(--radius-sm);
    background: var(--critical-wash);
    color: var(--critical-ink);
    font-size: 14px;
}

.alert svg {
    width: 17px;
    height: 17px;
    flex: none;
    margin-top: 1px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ------------------------------------------------------- Headline figures */

.headline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    margin-bottom: 14px;
}

.headline-label {
    color: var(--ink-secondary);
    font-size: 13.5px;
}

.hero-figure {
    display: block;
    margin: 2px 0 6px;
    font-size: 52px;
    font-weight: 650;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.headline-note {
    color: var(--ink-secondary);
    font-size: 13.5px;
}

.headline-note strong {
    color: var(--ink);
    font-weight: 600;
}

.confidence {
    display: grid;
    gap: 6px;
    justify-items: end;
    text-align: right;
}

.confidence-value {
    font-size: 22px;
    font-weight: 620;
    letter-spacing: -0.01em;
}

.confidence-label {
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}

.kpi {
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    color: var(--ink-secondary);
    font-size: 13px;
}

.kpi-value {
    display: block;
    margin-top: 7px;
    font-size: 25px;
    font-weight: 620;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.kpi-meta {
    display: block;
    margin-top: 3px;
    color: var(--ink-muted);
    font-size: 12.5px;
}

/* ----------------------------------------------------------- Run metadata */

.run-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 14px 18px;
    margin-bottom: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-sunken);
}

.run-facts {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--ink-secondary);
    font-size: 13.5px;
}

.run-facts strong {
    color: var(--ink);
    font-weight: 600;
}

.run-facts .sep {
    color: var(--line-strong);
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ----------------------------------------------------------------- Charts */

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.chart-card {
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.chart-card-wide {
    grid-column: 1 / -1;
}

.chart-card img {
    display: block;
    width: 100%;
    height: auto;
}

.chart-card figcaption {
    padding: 13px 20px 15px;
    border-top: 1px solid var(--line);
    color: var(--ink-secondary);
    font-size: 13px;
}

/* -------------------------------------------------- Interactive chart */

.chart-head {
    padding: 20px 24px 4px;
}

.chart-head p {
    max-width: 68ch;
    margin-top: 3px;
    color: var(--ink-secondary);
    font-size: 13.5px;
}

.chart-head-controls {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 12px;
}

.marker-control {
    display: inline-flex;
    flex: none;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
}

.marker-control button {
    min-width: 48px;
    min-height: 31px;
    padding: 5px 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ink-secondary);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.marker-control button:hover {
    color: var(--ink);
}

.marker-control button.is-active {
    background: var(--surface);
    color: var(--accent-strong);
    box-shadow: var(--shadow-sm);
}

.s-curve-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: center;
    gap: 14px;
    padding-right: 22px;
}

.s-curve-canvas svg {
    display: block;
}

.s-curve-summary {
    padding: 16px;
    border-left: 3px solid var(--accent);
    background: var(--surface-sunken);
}

.s-curve-summary span {
    display: block;
    color: var(--ink-muted);
    font-size: 11.5px;
    font-weight: 600;
}

.s-curve-summary strong {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 20px;
    font-variant-numeric: tabular-nums;
}

.s-curve-summary p {
    margin-top: 4px;
    color: var(--ink-secondary);
    font-size: 12.5px;
}

.activity-distributions {
    padding: 0;
    overflow: hidden;
}

.activity-distribution-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}

.activity-distribution-head p {
    margin-top: 3px;
    color: var(--ink-secondary);
    font-size: 13.5px;
}

.chart-filter {
    display: grid;
    flex: 0 1 320px;
    gap: 5px;
}

.chart-filter span {
    color: var(--ink-muted);
    font-size: 11.5px;
    font-weight: 600;
}

.chart-filter select {
    width: 100%;
    min-width: 220px;
}

.activity-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activity-preview {
    min-width: 0;
    padding: 18px 22px 12px;
    border-bottom: 1px solid var(--line);
}

.activity-preview:nth-child(odd) {
    border-right: 1px solid var(--line);
}

.activity-preview[hidden] {
    display: none;
}

.activity-preview-grid.is-filtered {
    grid-template-columns: minmax(0, 1fr);
}

.activity-preview-grid.is-filtered .activity-preview {
    border-right: 0;
}

.activity-preview header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.activity-preview h3 {
    overflow-wrap: anywhere;
    font-size: 14px;
    font-weight: 620;
}

.activity-preview header p {
    margin-top: 2px;
    color: var(--ink-muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.activity-preview-plot svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 250px;
}

.activity-axis {
    stroke: var(--line-strong);
}

.activity-percentile {
    stroke: var(--ink-muted);
    stroke-width: 1;
    stroke-dasharray: 4 3;
}

.activity-percentile-strong {
    stroke: var(--ink);
    stroke-width: 1.5;
}

.activity-percentile-label,
.activity-axis-label {
    fill: var(--ink-muted);
    font-family: var(--sans);
    font-size: 12px;
}

.activity-percentile-label {
    fill: var(--ink-secondary);
    font-weight: 600;
}

.chart-plot {
    /* No horizontal padding: the tooltip is positioned in SVG coordinates. */
    position: relative;
    padding: 0 0 8px;
}

.chart-canvas {
    display: block;
    cursor: crosshair;
}

.chart-canvas:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: var(--radius-sm);
}

.chart-canvas svg {
    display: block;
}

.chart-tooltip {
    position: absolute;
    z-index: 5;
    min-width: 172px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

.chart-tooltip[hidden] {
    display: none;
}

.tooltip-range {
    margin-bottom: 7px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.tooltip-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 5px;
}

/* Value leads, label follows. */
.tooltip-row strong {
    color: var(--ink);
    font-size: 16px;
    font-weight: 620;
    letter-spacing: -0.01em;
}

.tooltip-row span {
    color: var(--ink-secondary);
    font-size: 12.5px;
}

.tooltip-note {
    color: var(--ink-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ----------------------------------------------------------------- Tables */

.table-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.table-card > header {
    padding: 16px 20px 14px;
}

.table-card > header p {
    margin-top: 2px;
    color: var(--ink-secondary);
    font-size: 13px;
}

.sensitivity-ranking thead button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.sensitivity-ranking th.num button {
    margin-left: auto;
}

.sensitivity-ranking thead button::after {
    width: 8px;
    content: "";
    color: var(--accent-strong);
    font-size: 10px;
}

.sensitivity-ranking th[aria-sort="ascending"] button::after {
    content: "\2191";
}

.sensitivity-ranking th[aria-sort="descending"] button::after {
    content: "\2193";
}

.rank-cell {
    width: 64px;
    color: var(--ink);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead th {
    position: sticky;
    top: 0;
    padding: 9px 20px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody td {
    padding: 10px 20px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-secondary);
    vertical-align: middle;
}

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

tbody tr:hover td {
    background: var(--surface-hover);
}

td.name {
    color: var(--ink);
    font-weight: 500;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

td.num {
    color: var(--ink);
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-sunken);
    color: var(--ink-secondary);
    font-size: 11.5px;
    font-weight: 500;
}

.pill {
    display: inline-block;
    min-width: 40px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-wash);
    color: var(--accent-strong);
    font-size: 11.5px;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ Empty state */

.empty {
    padding: 34px 22px;
    text-align: center;
    color: var(--ink-secondary);
}

/* ------------------------------------------------------------ Responsive */

@media (max-width: 1080px) {
    .chart-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .activity-preview-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .activity-preview:nth-child(odd) {
        border-right: 0;
    }
}

@media (max-width: 920px) {
    .sidebar {
        position: static;
        width: auto;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        padding: 12px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand {
        margin-bottom: 0;
        padding: 0;
    }

    .nav {
        display: flex;
        gap: 4px;
    }

    .nav-label,
    .sidebar-foot {
        display: none;
    }

    .main {
        margin-left: 0;
        padding: 22px 18px 56px;
    }

    .topbar,
    .headline {
        grid-template-columns: minmax(0, 1fr);
        align-items: flex-start;
        flex-direction: column;
    }

    .activity-distribution-head {
        align-items: stretch;
        flex-direction: column;
    }

    .chart-head-controls {
        flex-direction: column;
    }

    .s-curve-layout {
        grid-template-columns: minmax(0, 1fr);
        padding-right: 0;
    }

    .s-curve-summary {
        margin: 0 18px 18px;
    }

    .chart-filter {
        flex-basis: auto;
    }

    .confidence {
        justify-items: start;
        text-align: left;
    }

    .upload-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-figure {
        font-size: 42px;
    }
}

@media (max-width: 520px) {
    .field-pair {
        grid-template-columns: minmax(0, 1fr);
    }
}
