@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #07070f;
    --surface: #0d0d1e;
    --surface2: #13132a;
    --border: #1e1e3f;
    --text: #eceef2;
    --text-muted: #8888aa;
    --text-dim: #55556a;
    --primary: #ffe620;
    --primary-glow: rgba(255, 230, 32, 0.25);
    --green: #39e07a;
    --green-bg: #0d2e1a;
    --red: #ff5c57;
    --yellow: #ffb830;
    --blue: #00d4ff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
    --bg: #fafafa;
    --surface: #ffffff;
    --surface2: #f4f4f8;
    --border: #e0e0ee;
    --text: #111118;
    --text-muted: #5a5a7a;
    --text-dim: #8888aa;
    --primary: #c79100;
    --primary-glow: rgba(199, 145, 0, 0.18);
    --green: #158a45;
    --green-bg: #d0f0dc;
    --red: #cc2233;
    --yellow: #7a5800;
    --blue: #0055cc;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top nav ── */
.nav {
    background: linear-gradient(135deg, #0d0d20 0%, #0a0a18 50%, #0d0d1e 100%);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    height: 56px;
    position: sticky; top: 0; z-index: 50;
}
[data-theme="light"] .nav {
    background: linear-gradient(135deg, #ffffff 0%, #f4f4f8 100%);
}
.nav-logo {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 14px var(--primary-glow);
    letter-spacing: -0.02em;
}
.nav-spacer { flex: 1; }
.nav-meta { font-size: 0.78rem; color: var(--text-muted); }
.nav-meta strong { color: var(--text); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface2); border-color: var(--text-dim); }
.btn-primary { background: var(--primary); color: #07070f; border-color: var(--primary); font-weight: 700; }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-ghost { background: transparent; }

/* ── Sync progress banner ── */
.sync-progress {
    max-width: 1200px;
    margin: 1rem auto 0;
    padding: 0.6rem 1rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 0 0 1px var(--primary-glow), 0 4px 14px rgba(0, 0, 0, 0.18);
}
.sync-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 1rem;
}
.sync-phase {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}
.sync-elapsed { font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.sync-bar {
    height: 6px;
    background: var(--surface2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.sync-bar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary) 0%, #ffd000 100%);
    box-shadow: 0 0 12px var(--primary-glow);
    transition: width 0.6s ease-out;
    position: relative;
    overflow: hidden;
}
.sync-bar-fill::after {
    /* moving sheen so the bar feels alive even between width updates */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    animation: sheen 1.5s linear infinite;
}
@keyframes sheen {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ── Layout ── */
.main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}
.summary-card .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}
.summary-card .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}
.summary-card .value.accent { color: var(--primary); }

/* ── Toolbar ── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.toolbar input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    border-radius: 6px;
}
.toolbar input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Triple-input search group: dataset · company · language. Each input gets
   a proportional share of the row, with the language box narrower since
   it's usually a 2-letter code. */
.filter-group {
    display: flex;
    gap: 0.4rem;
    flex: 1;
    min-width: 280px;
    flex-wrap: wrap;
}
.filter-group .filter-input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    border-radius: 6px;
}
.filter-group .filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.filter-input-dataset { flex: 2 1 220px; }
.filter-input-company { flex: 2 1 160px; }
.filter-input-language { flex: 1 1 140px; }

/* ── Table ── */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    /* Let the table scroll horizontally when there are too many columns to
       fit. Without this, the right-hand columns (Deadline / Files / Notes)
       get clipped past the viewport edge with no way to reach them.
       `overflow-y: visible` is critical so the sticky <thead> can stick to
       the page's scroll context — if this were `hidden`/`auto`, the wrapper
       would trap sticky inside its own (non-scrolling) vertical extent. */
    overflow-x: auto;
    overflow-y: visible;
}
table.datasets {
    width: 100%;
    /* Floor the table at a width that lets every column breathe — especially
       the Dataset column (col-dataset is `auto`, so it consumes the slack
       after every fixed column). At 100% of a typical viewport, 12 columns
       cram each other; min-width forces the horizontal scrollbar in instead. */
    min-width: 1380px;
    border-collapse: collapse;
    font-size: 0.85rem;
    /* Fixed layout so long dataset names wrap inside their cell instead of
       blowing the table out horizontally. Widths come from <colgroup>. */
    table-layout: fixed;
}
table.datasets col.col-lang     { width: 60px; }
table.datasets col.col-star     { width: 36px; }
table.datasets col.col-company  { width: 150px; }
table.datasets col.col-dataset  { width: auto; }   /* takes the slack */
table.datasets col.col-progress { width: 200px; }
table.datasets col.col-num      { width: 70px; }
table.datasets col.col-deadline { width: 108px; }
table.datasets col.col-notes    { width: 220px; }
.notes-cell {
    cursor: pointer;
    max-width: 220px;
    font-size: 0.78rem;
    color: var(--text);
}
.notes-cell:hover { background: var(--surface2); }
.notes-snippet {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    max-height: 2.6em;
}
.notes-empty { color: var(--text-muted); font-size: 0.74rem; }
table.datasets col.col-trend    { width: 90px; }
table.datasets col.col-notes    { width: 140px; }
table.datasets thead th {
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    /* Keep the column headers in view as the user scrolls down a 2,400-row
       table. Sticky to the page (the body's scroll container, not
       .table-wrap, since the wrapper only scrolls horizontally). Solid
       background avoids text bleeding through from the rows behind. */
    position: sticky;
    top: 0;
    z-index: 5;
    /* Force a new stacking context so the row beneath doesn't paint over
       the sticky header in Safari/older Chrome (border-collapse + sticky
       has historically been buggy). */
    will-change: transform;
}
/* Also stick the <tr> inside thead — some browsers respect this and not the
   <th>, particularly when border-collapse:collapse is in play. */
table.datasets thead { position: sticky; top: 0; z-index: 5; }
table.datasets thead tr { position: sticky; top: 0; z-index: 5; background: var(--surface2); }

/* Variant of .table-wrap that DOESN'T create a scroll container, so the
   datasets table's sticky <thead> can stick against the page scroll instead
   of the (non-scrolling) wrapper. Wide tables will let the page scroll
   horizontally if the viewport is narrower than the table's min-width. */
.table-wrap.table-wrap-page-scroll {
    overflow: visible;
    border: none;
    background: transparent;
    border-radius: 0;
}
table.datasets thead th:hover { color: var(--text); }
table.datasets thead th .arrow {
    color: var(--text-dim);
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.55;
    transition: opacity 0.12s, color 0.12s;
}
table.datasets thead th:hover .arrow { opacity: 1; color: var(--primary); }
table.datasets thead th.active .arrow { color: var(--primary); opacity: 1; font-weight: 700; }
table.datasets thead th.active { color: var(--primary); }

table.datasets tbody td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.datasets thead th + th,
table.datasets tbody td + td { border-left: 2px solid var(--border); }
.playlist-remove {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 3px;
    width: 18px;
    height: 18px;
    line-height: 1;
    margin-left: 0.3rem;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    vertical-align: middle;
}
.playlist-remove:hover { color: var(--danger, #ff6b6b); border-color: var(--danger, #ff6b6b); }
.playlist-remove:disabled { opacity: 0.4; cursor: wait; }
table.datasets col.col-select { width: 36px; }
table.datasets th.select-col,
table.datasets td.select-cell { text-align: center; padding-left: 0.35rem; padding-right: 0.35rem; }
table.datasets td.select-cell input,
table.datasets th.select-col input { cursor: pointer; vertical-align: middle; }
.btn.btn-primary { background: var(--primary, #6c8eef); color: #07070f; border-color: var(--primary, #6c8eef); }
.pass-num-row .pass-num-label {
    display: inline-block;
    min-width: 1.6em;
    margin-right: 0.45em;
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 600;
    text-align: left;
}
table.datasets tbody tr:last-child td { border-bottom: none; }
table.datasets tbody tr.expandable { cursor: pointer; }
table.datasets tbody tr.expandable:hover { background: var(--surface2); }
table.datasets tbody tr.detail { background: var(--bg); }
table.datasets tbody tr.detail td { padding: 0.85rem 1rem; }

td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dataset-name {
    font-weight: 600;
    color: var(--text);
    /* Wrap long names instead of overflowing the cell. */
    overflow-wrap: anywhere;
    word-break: break-word;
}
.muted { color: var(--text-muted); }

/* ── Progress bar ── */
.progress {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 180px;
}
.progress-track {
    flex: 1;
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green) 0%, #2bc46a 100%);
    transition: width 0.3s;
}
.progress-fill.low  { background: linear-gradient(90deg, var(--red) 0%, #cc4843 100%); }
.progress-fill.mid  { background: linear-gradient(90deg, var(--yellow) 0%, #cc8b1c 100%); }
.progress-fill.high { background: linear-gradient(90deg, var(--green) 0%, #2bc46a 100%); }
.progress-fill.done { background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%); }
.progress-pct {
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    min-width: 42px;
    text-align: right;
}

/* ── Inline per-pass bars + per-pass Done values (in the main table) ── */
.passes-cell,
.passes-num-cell {
    vertical-align: middle;
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
}
/* Done + Remaining + Unopened columns (per-pass stacked numbers): keep them
   narrow so they don't push the rest of the table around. */
table.datasets thead th[data-col="transcribed"],
table.datasets thead th[data-col="remaining"],
table.datasets thead th[data-col="unopened"],
table.datasets .passes-num-cell {
    width: 56px;
    min-width: 56px;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}
.pass-num-row {
    font-size: 0.72rem;
    line-height: 1.1;
    margin-bottom: 3px;       /* matches .pass-bar-row so rows line up */
    font-variant-numeric: tabular-nums;
}
.pass-num-row:last-child { margin-bottom: 0; }
.pass-num-zero { color: var(--green); opacity: 0.7; }
/* "Px not in HP" rows — the pass hasn't been created on this dataset in
   Hotpepper. Distinguishes "queued" (column data) from "doesn't exist". */
.pass-num-missing { color: var(--text-muted); font-style: italic; opacity: 0.7; }

/* The leading pill on each NEW-tab row is now a button: click → opens the
   add-to-playlist modal pre-filled with this dataset. Keeps the existing
   yellow chip styling but adds cursor + hover affordance. */
.cf-add-pl-pill {
    border: 1px solid var(--primary);
    cursor: pointer;
    font: inherit;
    text-transform: uppercase;
}
.cf-add-pl-pill:hover { filter: brightness(1.1); }
.pass-num-missing .pass-num-label { color: var(--text-muted); }
.pass-bar-row {
    display: grid;
    grid-template-columns: 22px 1fr 40px;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 3px;
    font-size: 0.72rem;
    line-height: 1.1;
}
.pass-bar-row:last-child { margin-bottom: 0; }
.pass-bar-label {
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.pass-bar-pct {
    color: var(--text-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
/* The shared progress-track defaults to height:8px and flex:1 (for flex
   layouts). Override for the grid-based pass rows. */
.passes-cell .progress-track {
    height: 5px;
    flex: none;
    border-radius: 3px;
}

/* ── Pass detail (when expanded) ── */
.passes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pass-row {
    display: grid;
    grid-template-columns: 100px 1fr 110px 100px 90px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.4rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
}
.pass-trend { text-align: center; }
.pass-trend .sparkline { width: 80px; height: 14px; }
.pass-label { font-weight: 600; color: var(--primary); }
.pass-meta { color: var(--text-muted); font-size: 0.78rem; }

/* ── Login ── */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(ellipse at top, var(--surface) 0%, var(--bg) 60%);
    padding: 2rem;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.login-card h1 {
    font-size: 1.3rem;
    color: var(--primary);
    text-shadow: 0 0 12px var(--primary-glow);
    margin-bottom: 0.4rem;
    text-align: center;
}
.login-card .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-card label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.login-card input[type="password"],
.login-card input[type="text"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.login-card input[type="password"]:focus,
.login-card input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.login-card .btn-primary { width: 100%; justify-content: center; padding: 0.7rem; font-size: 0.92rem; }
.login-error {
    background: #2e0f0f;
    border: 1px solid var(--red);
    color: var(--red);
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    margin-bottom: 1rem;
}
[data-theme="light"] .login-error { background: #fce8ea; }

/* ── Empty state ── */
.empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty h2 { color: var(--text); margin-bottom: 0.5rem; font-size: 1.15rem; }
.empty code {
    display: inline-block;
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-size: 0.82rem;
    color: var(--text);
}

/* ── Theme toggle ── */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-dim); }

/* ── Language chips ── */
.languages {
    margin: 0 0 1rem;
}
.languages-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}
.lang-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-height: 80px;
    overflow-y: auto;
    padding-right: 4px;
}
.lang-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.22rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    font-size: 0.76rem;
    font-family: inherit;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.lang-chip:hover { border-color: var(--text-dim); }
.lang-chip.active {
    background: var(--primary);
    color: #07070f;
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}
.lang-chip .lang-code {
    font-weight: 700;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}
.lang-chip .lang-meta {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
}
.lang-chip.active .lang-meta { color: rgba(7, 7, 15, 0.72); }

/* ── Completed badge + completed-row dim ── */
.badge-done {
    display: inline-block;
    color: var(--green);
    font-weight: 800;
    margin-right: 0.15rem;
    font-size: 0.9em;
}
tr.row-completed .dataset-name { color: var(--text-muted); }
tr.row-completed .dataset-name .badge-done { color: var(--green); }
/* Tint completed rows subtly so they don't dominate visually. */
tr.row-completed > td { background: var(--green-bg); }
tr.row-completed:hover > td { background: var(--surface2); }

/* ── Notes cell ── */
.note-cell {
    font-size: 0.78rem;
    cursor: pointer;
    max-width: 160px;
}
.note-cell:hover { background: var(--surface2); }
.note-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
    line-height: 1.25;
}
.note-empty {
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.72rem;
}
.note-cell:hover .note-empty { color: var(--primary); }

/* ── Trend sparkline cell ── */
.trend-cell {
    text-align: center;
    padding: 0.45rem 0.5rem !important;
}
.sparkline {
    display: inline-block;
    width: 80px;
    height: 18px;
    color: var(--text-dim);
    vertical-align: middle;
}
.sparkline.sl-pos  { color: var(--green); }
.sparkline.sl-neg  { color: var(--red); }
.sparkline.sl-flat { color: var(--text-muted); }
.sparkline.sl-single { color: var(--text-muted); }

/* ── Deadline cell (soft / hard / hp stacked) ── */
.deadline-cell {
    font-size: 0.72rem;
    cursor: pointer;
    padding-top: 0.4rem !important;
    padding-bottom: 0.4rem !important;
}
.deadline-cell:hover { background: var(--surface2); }
.dl-line {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 2px;
    line-height: 1.2;
}
.dl-line > .dl-tag { flex: 0 0 14px; }
.dl-line > .deadline { flex: 1 1 auto; min-width: 0; }
.dl-line:last-child { margin-bottom: 0; }
.dl-tag {
    display: inline-block;
    text-align: center;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.66rem;
    line-height: 1;
}
.dl-tag-hard { color: var(--primary); }
.dl-tag-hp   { color: var(--text-dim); font-weight: 400; }
.dl-tag-target { color: var(--green); }
.dl-target { color: var(--green); font-size: 0.74rem; }
.deadline {
    display: inline-block;
    padding: 0.14rem 0.4rem;
    border-radius: 4px;
    background: var(--surface2);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 0.72rem;
}
.deadline.soon   { background: var(--yellow-bg); color: var(--yellow); }
.deadline.urgent { background: var(--red-bg);    color: var(--red); font-weight: 700; }

/* Modal input styling — also reused by the deadlines date inputs. */
.modal-input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    color-scheme: dark;          /* makes native date picker readable on dark */
}
[data-theme="light"] .modal-input { color-scheme: light; }
.modal-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* ── Diff warning banner ── */
.diff-warning {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow);
    color: var(--yellow);
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    font-size: 0.82rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}
.diff-warning ul li { margin-bottom: 0.2rem; }

/* ── Day-over-day diff deltas ── */
.delta { font-variant-numeric: tabular-nums; font-weight: 600; }
.delta-pos { color: var(--green); }
.delta-neg { color: var(--red); }
.pass-delta {
    display: inline-block;
    margin-right: 0.35rem;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    background: var(--surface2);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.pass-delta.delta-pos { background: var(--green-bg); color: var(--green); }
.pass-delta.delta-neg { background: var(--red-bg); color: var(--red); }

/* ── Contributor drilldown rows ── */
tr.contributor-row { cursor: pointer; }
tr.contributor-row:hover > td { background: var(--surface2); }
tr.contributor-row .expand-cell {
    width: 18px;
    text-align: center;
    color: var(--text-muted);
    user-select: none;
}
tr.contributor-detail > td { background: var(--bg); padding: 0.5rem 0.7rem !important; }
table.contributor-drill {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin: 0.2rem 0;
}
table.contributor-drill th {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.35rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table.contributor-drill td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.contributor-drill td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.contributor-drill tbody tr:last-child td { border-bottom: none; }

/* ── Daily-totals / matrix tables for /last-7-days ── */
table.daily-totals, table.matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
table.daily-totals thead th, table.matrix thead th {
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.45rem 0.6rem;
    text-align: left;
    /* Same sticky-on-scroll behavior for /last-7-days and dataset detail
       page tables. */
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.daily-totals tbody td, table.matrix tbody td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-variant-numeric: tabular-nums;
}
table.daily-totals tbody td:first-child,
table.matrix tbody td:first-child { text-align: left; }
table.matrix td.num { text-align: right; }
table.matrix tbody tr:last-child td { border-bottom: none; }

.day-cell {
    transition: background 0.12s;
}

/* Per-dataset daily bar group — tiny vertical bars side by side. */
.daily-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 22px;
    min-width: 70px;
}
.daily-bar {
    display: inline-block;
    width: 8px;
    background: var(--green);
    border-radius: 1px;
    min-height: 1px;
}

/* ── Pivot table ── */
table.pivot {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    table-layout: fixed;
}
table.pivot thead th,
table.pivot tfoot th {
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.pivot thead th.num,
table.pivot tfoot th.num,
table.pivot td.num,
table.pivot td.pivot-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
table.pivot tbody td {
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.pivot tbody tr:last-child td { border-bottom: none; }
table.pivot .row-head { font-weight: 600; }
table.pivot .row-total { border-left: 2px solid var(--border); background: var(--surface2); }
table.pivot tfoot th { border-top: 2px solid var(--border); background: var(--surface2); }

.pivot-cell {
    line-height: 1.2;
}
.pivot-cell .pivot-pct {
    font-weight: 700;
    font-size: 0.86rem;
}
.pivot-cell .pivot-hours {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
/* Cell color reflects pct_done at-a-glance — green good, red bad. */
.pivot-cell.pivot-low  { background: rgba(255, 92, 87, 0.08); }
.pivot-cell.pivot-mid  { background: rgba(255, 184, 48, 0.08); }
.pivot-cell.pivot-high { background: rgba(57, 224, 122, 0.10); }
.pivot-cell.pivot-low  .pivot-pct { color: var(--red); }
.pivot-cell.pivot-mid  .pivot-pct { color: var(--yellow); }
.pivot-cell.pivot-high .pivot-pct { color: var(--green); }

/* /changes — snapshot diff page. */
.changes-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.4rem 0 0.8rem;
}
.cs-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    min-width: 120px;
}
.cs-card .label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cs-card .value { font-size: 1.1rem; font-weight: 700; }
.accent-green { color: var(--green); }
.accent-red { color: var(--red); }
.changes-status {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0.06rem 0.4rem;
    border-radius: 4px;
}
.changes-status-added   { background: rgba(57, 224, 122, 0.16); color: var(--green); }
.changes-status-removed { background: rgba(255, 92, 87, 0.16); color: var(--red); }
.changes-status-changed { background: var(--surface2); color: var(--text-muted); }
.pass-delta {
    display: inline-block;
    font-size: 0.72rem;
    margin-right: 0.4rem;
    font-variant-numeric: tabular-nums;
}
.changes-arrow { margin: 0 0.3rem; color: var(--text-muted); }
.changes-flag {
    margin-left: 0.4rem;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.06rem 0.35rem;
    border-radius: 4px;
}
.changes-flag-good { background: rgba(57, 224, 122, 0.16); color: var(--green); }
.changes-flag-warn { background: rgba(255, 184, 48, 0.16); color: var(--yellow); }
.small { font-size: 0.74rem; }

/* Live-update SSE badge (fixed bottom-right) + row flash. */
.live-badge {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 80;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    user-select: none;
}
.live-badge.live-pending { color: var(--text-muted); }
.live-badge.live-on      { color: var(--green); border-color: var(--green); }
.live-badge.live-warn    { color: var(--yellow); border-color: var(--yellow); }
.live-badge.live-error   { color: var(--red); border-color: var(--red); }

@keyframes row-live-pulse {
    0%   { background: rgba(57, 224, 122, 0.22); }
    100% { background: transparent; }
}
tr.row-live-updated > td { animation: row-live-pulse 1.6s ease-out; }

/* Per-playlist summary section (rendered on the unscoped home view). */
.playlist-summary-section {
    margin: 0.6rem 0 1.1rem;
    padding: 0.6rem 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.pls-title {
    margin: 0 0 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pls-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.8rem;
    align-items: start;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
}
.pls-row:first-of-type { border-top: none; }
.pls-name {
    font-weight: 600;
    font-size: 0.9rem;
    align-self: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pls-grid { margin: 0; }
@media (max-width: 700px) {
    .pls-row { grid-template-columns: 1fr; }
}

/* DONE card: per-pass progress lines (replacing the single % display). */
.done-passes {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    margin-top: 0.15rem;
}
.done-pass-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-variant-numeric: tabular-nums;
}
.done-pass-label {
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.done-pass-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

/* Last-sync line in the top nav. */
.last-sync-line { white-space: nowrap; }
.sync-trigger {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0.06rem 0.35rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.sync-trigger-manual { color: var(--primary); border-color: var(--primary); }
.sync-trigger-auto   { color: var(--text-muted); }

/* Mobile: keep the first column visible while the rest scrolls horizontally.
   Applied to wide tables that benefit from a stable left anchor — datasets,
   pivot, changes, and the watchlist pass-remaining variant. */
@media (max-width: 700px) {
    table.datasets thead th:first-child,
    table.datasets tbody td:first-child,
    table.pivot thead th:first-child,
    table.pivot tbody td:first-child,
    table.pivot tfoot th:first-child,
    table.changes-table thead th:first-child,
    table.changes-table tbody td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        /* Match the row's background so non-sticky cells don't show through
           the sticky one while scrolling. */
        background: var(--surface);
    }
    table.pivot thead th:first-child,
    table.pivot tfoot th:first-child,
    table.datasets thead th:first-child { background: var(--surface2); }
    /* Cap the WPR table's filter input so it stops blowing out the nav row. */
    .wpr-filter { min-width: 0; flex: 1; }
    .wpr-header { gap: 0.35rem; }
    /* Tighten the summary cards on changes so they don't push the page wider. */
    .cs-card { padding: 0.4rem 0.6rem; min-width: 0; flex: 1 1 calc(50% - 0.6rem); }
}

/* Watchlist Pass-Remaining table (top of ?watched=1 scope). */
.wpr-section { margin: 0.6rem 0 1.1rem 0; }
.wpr-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 0.45rem 0;
    flex-wrap: wrap;
}
.wpr-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.wpr-filter {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    font-size: 0.82rem;
    min-width: 200px;
}
.wpr-count { font-size: 0.75rem; }
table.pivot.wpr-table td.num,
table.pivot.wpr-table tfoot th.num { font-variant-numeric: tabular-nums; }
/* Sortable column headers on the WPR table. */
table.pivot.wpr-table thead th.wpr-sortable {
    cursor: pointer;
    user-select: none;
}
table.pivot.wpr-table thead th.wpr-sortable .arrow {
    margin-left: 0.25rem;
    font-size: 0.7em;
    opacity: 0.55;
    color: var(--text-muted);
}
table.pivot.wpr-table thead th.wpr-sortable.active { color: var(--primary); }
table.pivot.wpr-table thead th.wpr-sortable.active .arrow { color: var(--primary); opacity: 1; }
table.pivot.wpr-table thead th.wpr-sortable:hover { color: var(--text); }

/* Pass-completion cells: tint background + colored % + thin progress bar at
   the bottom of each cell. Same thresholds as the main per-pass bars
   (<20 red, 20-80 yellow, 80-99 green, ≥99 blue). */
.wpr-pass-cell { position: relative; padding-bottom: 0.55rem !important; }
.wpr-pass-cell .wpr-cell-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    pointer-events: none;
    transition: width 0.3s;
}
.wpr-pass-cell.wpr-low  { background: rgba(255, 92, 87, 0.07); }
.wpr-pass-cell.wpr-mid  { background: rgba(255, 184, 48, 0.07); }
.wpr-pass-cell.wpr-high { background: rgba(57, 224, 122, 0.10); }
.wpr-pass-cell.wpr-done { background: rgba(59, 130, 246, 0.12); }
.wpr-pass-cell.wpr-low  .wpr-cell-bar { background: var(--red); }
.wpr-pass-cell.wpr-mid  .wpr-cell-bar { background: var(--yellow); }
.wpr-pass-cell.wpr-high .wpr-cell-bar { background: var(--green); }
.wpr-pass-cell.wpr-done .wpr-cell-bar { background: #3b82f6; }
.wpr-pass-cell.wpr-low  .wpr-cell-pct { color: var(--red); font-weight: 600; }
.wpr-pass-cell.wpr-mid  .wpr-cell-pct { color: var(--yellow); font-weight: 600; }
.wpr-pass-cell.wpr-high .wpr-cell-pct { color: var(--green); font-weight: 600; }
.wpr-pass-cell.wpr-done .wpr-cell-pct { color: #3b82f6; font-weight: 700; }
/* Three-state breakdown: Complete · Open-but-untouched · Unopened. Hidden
   by default; revealed as a floating annotation below the cell on hover.
   When the contributors popover is open we suppress this so the two don't
   collide visually. */
.wpr-states {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 5;
    margin-top: 2px;
    padding: 0.4rem 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    flex-wrap: wrap;
    gap: 0.55rem;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    justify-content: flex-end;
    pointer-events: none;
}
.wpr-pass-cell:hover .wpr-states { display: flex; }
.wpr-pass-cell.is-open .wpr-states { display: none !important; }
.wpr-state-done     { color: var(--green); }
.wpr-state-open     { color: var(--yellow); }
.wpr-state-unopened { color: var(--red); }
table.pivot.wpr-table td.wpr-tip {
    cursor: pointer;
    position: relative;  /* popover anchors here */
}
table.pivot.wpr-table td.wpr-tip:hover,
table.pivot.wpr-table td.wpr-tip.is-open { background: var(--surface2); }

/* Click-to-open popover with the top contributing datasets. */
.wpr-popover {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 320px;
    max-width: 480px;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 50;
    text-align: left;
    padding: 0.35rem 0;
}
.wpr-pop-header,
.wpr-pop-footer {
    padding: 0.3rem 0.7rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.wpr-pop-footer { border-top: 1px solid var(--border); margin-top: 0.2rem; text-transform: none; }
.wpr-pop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.32rem 0.7rem;
    color: var(--text);
    text-decoration: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
}
.wpr-pop-item:hover { background: var(--surface2); color: var(--primary); }
.wpr-pop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpr-pop-hours {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ── Language column (leftmost) ── */
.lang-col { text-align: center; }
.lang-cell { text-align: center; padding: 0 0.4rem !important; }
.lang-badge {
    display: inline-block;
    min-width: 28px;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
}
.lang-badge-unknown {
    color: var(--text-dim);
    background: transparent;
    font-weight: 400;
}

/* ── Watchlist star ── */
.star-col { width: 32px; padding: 0 0.5rem !important; }
.star-cell { width: 32px; padding: 0.4rem 0 !important; cursor: pointer; text-align: center; }
.star {
    display: inline-block;
    width: 22px; height: 22px;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: color 0.12s, transform 0.12s;
}
.star::before { content: "☆"; }
.star:hover { color: var(--primary); transform: scale(1.15); }
.star.on { color: var(--primary); }
.star.on::before { content: "★"; }
.company-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

/* ── Watchlist toggle in toolbar ── */
.watchlist-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    padding: 0.4rem 0.7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    user-select: none;
}
.watchlist-toggle input[type="checkbox"] { cursor: pointer; accent-color: var(--primary); }
.watchlist-toggle:hover { border-color: var(--text-dim); }

/* ── Modal ── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}
/* The [hidden] HTML attribute would otherwise lose to .modal-backdrop's
   display:flex (same specificity, author stylesheet) and the modal would
   never close. Higher-specificity rule pins it shut. */
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.4rem 1.1rem;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.modal h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--text); }
.modal textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    color: var(--text);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.82rem;
    resize: vertical;
    min-height: 140px;
}
.modal textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

@media (max-width: 640px) {
    /* Layout (12 cols): 1=Lang 2=★ 3=Company 4=Dataset 5=Total 6=Done
       7=Remaining 8=Unopened 9=Progress 10=Deadline 11=Forecast 12=Files.
       Mobile keeps Lang/★/Company/Dataset/Done/Progress/Forecast. */
    table.datasets thead th:nth-child(5),
    table.datasets tbody td:nth-child(5),
    table.datasets thead th:nth-child(7),
    table.datasets tbody td:nth-child(7),
    table.datasets thead th:nth-child(8),
    table.datasets tbody td:nth-child(8),
    table.datasets thead th:nth-child(10),
    table.datasets tbody td:nth-child(10),
    table.datasets thead th:nth-child(12),
    table.datasets tbody td:nth-child(12) { display: none; }
    .company-cell { max-width: 100px; }
    .pass-row { grid-template-columns: 70px 1fr 70px; }
    .pass-row .pass-meta:nth-child(4),
    .pass-row .pass-meta:nth-child(5) { display: none; }
}

/* Capacity gauge — horizontal bar with a marker at "100% of required pace". */
.capacity-track {
    position: relative;
    width: 200px;
    height: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.capacity-fill {
    height: 100%;
    transition: width 0.2s;
}
.capacity-fill.capacity-on_pace { background: var(--green); }
.capacity-fill.capacity-tight { background: var(--yellow); }
.capacity-fill.capacity-short { background: var(--red); }
.capacity-fill.capacity-overdue { background: #fff; }
.capacity-marker {
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: var(--text-dim);
    opacity: 0.7;
}

/* Aborted% quality pill. Color escalates with rate. */
.aborted-pill {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--border);
}
.aborted-pill.aborted-low { color: var(--text-dim); }
.aborted-pill.aborted-mid { color: var(--yellow); border-color: var(--yellow); background: rgba(255, 184, 48, 0.08); }
.aborted-pill.aborted-high { color: #fff; background: var(--red); border-color: var(--red); font-weight: 700; }

/* Forecast pills (Dashboard + /last-7-days). Color reflects slack vs the
   strongest deadline; "stalled" + "late" both red, but stalled is loud. */
.forecast-pill {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--border);
    white-space: nowrap;
}
.forecast-pill.forecast-done { color: var(--green); border-color: var(--green); background: rgba(57, 224, 122, 0.08); }
.forecast-pill.forecast-on_pace { color: var(--green); border-color: var(--green); background: rgba(57, 224, 122, 0.08); }
.forecast-pill.forecast-tight { color: var(--yellow); border-color: var(--yellow); background: rgba(255, 184, 48, 0.08); }
.forecast-pill.forecast-late { color: var(--red); border-color: var(--red); background: rgba(255, 92, 87, 0.10); font-weight: 700; }
.forecast-pill.forecast-stalled { color: #fff; background: var(--red); border-color: var(--red); }
.forecast-pill.forecast-no_deadline { color: var(--text-dim); }

/* Tools dropdown in the nav (groups secondary actions so the header stays
   uncluttered). */
.nav-menu { position: relative; display: inline-block; }
.nav-menu-trigger { white-space: nowrap; }
.nav-menu-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 60;
    padding: 4px;
    display: flex;
    flex-direction: column;
}
/* `display: flex` above overrides the user-agent's `[hidden] { display: none }`,
   so when JS sets panel.hidden = true the menu stays visible. Force it. */
.nav-menu-panel[hidden] { display: none !important; }
.nav-menu-item {
    display: block;
    background: none;
    border: none;
    color: var(--text);
    text-align: left;
    padding: 0.5rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.nav-menu-item:hover { background: var(--surface2); color: var(--primary); }
.nav-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.7rem 0.2rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.nav-menu-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.3rem;
}
.nav-menu-close:hover { color: var(--text); }

/* Dataset autocomplete (nav-bar global jump-to). Cmd/Ctrl+K focuses. */
.dataset-search {
    position: relative;
    flex: 0 1 auto;
    margin-left: 0.8rem;
}
.dataset-search-input {
    width: 260px;
    max-width: 32vw;
    padding: 0.32rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82rem;
    font-family: inherit;
}
.dataset-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.dataset-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 420px;
    max-width: 80vw;
    max-height: 360px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 50;
    padding: 4px;
}
.dataset-search-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.82rem;
}
.dataset-search-row.is-highlighted,
.dataset-search-row:hover {
    background: var(--surface2);
}
.dataset-search-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dataset-search-co {
    color: var(--text-dim);
    font-size: 0.74rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dataset-search-flag { font-size: 0.78rem; color: var(--primary); }
.dataset-search-empty,
.dataset-search-more {
    padding: 0.5rem 0.7rem;
    color: var(--text-dim);
    font-size: 0.78rem;
}
@media (max-width: 640px) {
    .dataset-search-input { width: 160px; }
}

/* Collapsible "more details" section on the full dashboard. Keeps the
   primary surface (banners + summary + table) clean by default; users opt
   in to charts/chips/forecasts when they need them. */
details.more-details {
    margin: 0.6rem 0 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
details.more-details > summary {
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
    list-style: none;
}
details.more-details > summary::-webkit-details-marker { display: none; }
details.more-details > summary::before {
    content: '▸ ';
    color: var(--primary);
    transition: transform 0.12s;
    display: inline-block;
}
details.more-details[open] > summary::before { content: '▾ '; }
details.more-details > summary:hover { color: var(--primary); }
details.more-details > *:not(summary) {
    margin-left: 0;
    margin-right: 0;
}
details.more-details > section { padding: 0 0.9rem; }
details.more-details > .throughput-preview { margin-left: 0.9rem; margin-right: 0.9rem; }

/* Inline 30-day throughput preview at the top of the dashboard. Click-
   through to /throughput for the full chart. */
a.throughput-preview {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.8rem;
    margin: 0.4rem 0 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.12s;
}
a.throughput-preview:hover { border-color: var(--primary); }
.tp-preview-meta {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    flex: 0 0 auto;
    font-size: 0.82rem;
}
.tp-preview-label {
    text-transform: uppercase;
    color: var(--text-dim);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}
.tp-preview-num { color: var(--primary); font-size: 1rem; }
.tp-preview-spark {
    flex: 1 1 auto;
    width: 100%;
    max-width: 420px;
    height: 36px;
}

/* Scope bar — clarifies whether the dashboard aggregates apply to ALL
   datasets or just the user's watchlist. The toolbar checkbox drives the
   same state, but the bar is the always-visible labelled pill. */
.scope-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.4rem 0 0.6rem;
    font-size: 0.82rem;
}
.scope-label {
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    margin-right: 0.2rem;
}
.scope-pill {
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}
.scope-pill:hover { border-color: var(--text-dim); }
.scope-pill-active {
    color: #07070f;
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 700;
    box-shadow: 0 0 12px var(--primary-glow);
}
.scope-pill-active .muted { color: rgba(7, 7, 15, 0.6); }
.scope-pill-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.scope-pill-ghost {
    border-style: dashed;
    color: var(--text-dim);
}
.scope-pill-ghost:hover { color: var(--primary); border-color: var(--primary); }

.cw-refresh-deep { position: relative; display: inline-block; }
.cw-refresh-deep > summary { list-style: none; cursor: pointer; }
.cw-refresh-deep > summary::-webkit-details-marker { display: none; }
.cw-refresh-deep-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 30;
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

tr.row-no-data { opacity: 0.55; font-style: italic; }
tr.row-no-data:hover { opacity: 1; }
.no-data-tag {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-style: normal;
    color: var(--text-dim);
    border: 1px dashed var(--border);
    cursor: help;
}

.playlist-missing-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--yellow);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    margin: 0.4rem 0 0.8rem;
    font-size: 0.82rem;
}
.playlist-health-card {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin: 0.4rem 0 0.8rem;
}
.playlist-health-card .ph-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.playlist-health-card .ph-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.playlist-health-card .ph-value {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.1;
}
.playlist-health-card .ph-sub {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-dim);
    margin-left: 0.25rem;
}
.playlist-health-card .ph-warn { color: var(--yellow); }
.playlist-health-card .ph-good { color: var(--green, #2bbf7b); }
.playlist-health-card .ph-cell-link {
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    padding: 0 0.2rem;
    margin: 0 -0.2rem;
    transition: background-color 0.12s;
}
.playlist-health-card .ph-cell-link:hover {
    background: rgba(255, 255, 255, 0.04);
}
.ph-filter-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin: -0.4rem 0 0.6rem;
}
.ph-filter-hint a { color: var(--primary); text-decoration: underline; }
@media (max-width: 700px) {
    .playlist-health-card { grid-template-columns: repeat(2, 1fr); }
}
.scope-hint {
    font-size: 0.72rem;
    margin-left: 0.3rem;
}

/* Language × Pass remaining matrix (dashboard) */
.lang-pass-section { margin-top: 0.8rem; }
.lang-pass-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.3rem;
}
.lang-pass-toggle { display: inline-flex; gap: 4px; }
.lang-pass-toggle .btn { padding: 0.18rem 0.55rem; font-size: 0.74rem; }
.lang-pass-toggle .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.lang-pass-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    margin-top: 0.3rem;
}
table.lang-pass-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
table.lang-pass-matrix th,
table.lang-pass-matrix td {
    padding: 0.32rem 0.55rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-variant-numeric: tabular-nums;
}
table.lang-pass-matrix th {
    background: var(--surface2);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}
table.lang-pass-matrix td.num,
table.lang-pass-matrix th.num { text-align: right; }
table.lang-pass-matrix tbody tr:last-child td { border-bottom: none; }
table.lang-pass-matrix tbody tr:hover { background: var(--surface2); }

/* Per-dataset detail page */
.dataset-detail-head { margin-top: 0.3rem; }
.dataset-detail-title {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.dataset-detail-title .dataset-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1rem;
}
.burndown-wrap {
    margin-top: 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.8rem 0.7rem;
}
.burndown {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-top: 0.4rem;
}
a.dataset-link {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px dotted var(--border);
}
a.dataset-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.dataset-expand {
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
    margin-left: 0.3rem;
    font-size: 0.78rem;
}
.dataset-expand:hover { color: var(--primary); }

/* Bulk-deadlines result pills */
.bulk-result-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}
.bulk-pill {
    font-size: 0.78rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.bulk-pill-applied { color: var(--green); border-color: var(--green); background: rgba(57, 224, 122, 0.08); }
.bulk-pill-cleared { color: var(--text-dim); }
.bulk-pill-noop    { color: var(--text-dim); }
.bulk-pill-error   { color: #fff; background: var(--red); border-color: var(--red); }
.bulk-pill-warn    { color: var(--yellow); border-color: var(--yellow); }

.bulk-status {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}
.bulk-status-applied   { color: var(--green); border-color: var(--green); }
.bulk-status-cleared   { color: var(--text-dim); }
.bulk-status-no_change { color: var(--text-dim); }
.bulk-status-error     { color: #fff; background: var(--red); border-color: var(--red); }
.bulk-row-error td     { background: rgba(255, 92, 87, 0.06); }
.bulk-row-applied td   { background: rgba(57, 224, 122, 0.05); }

/* Watchlist summary — top of dashboard when the user has ≥1 starred dataset.
   Uses the same .summary-card primitive as the main grid but with a starred
   left border so it visually distinguishes "yours" from the global stats. */
.watchlist-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.55rem 0.8rem 0.7rem;
    margin: 0.6rem 0 1rem;
}
.watchlist-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.45rem;
}
.watchlist-summary-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    font-weight: 700;
}
.watchlist-grid { margin: 0 !important; }
.watchlist-top {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.9rem;
    align-items: center;
    font-size: 0.78rem;
}
.watchlist-top-label {
    color: var(--text-dim);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.watchlist-top-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-variant-numeric: tabular-nums;
}
.watchlist-top-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
}
.summary-card .value.accent-red { color: var(--red); }

/* Default-paged dataset table: rows beyond the first 100 are hidden until
   the user clicks "Show all". `display: none !important` so it wins over
   the row's own `hidden` attribute and CSS toggles in filterRows(). */
tr.page-hidden { display: none !important; }
.show-all-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-top: -1px;
}

/* Unified changefeed banner: one container, three tabs. Replaces the prior
   three stacked banners (at-risk, newly-stalled, newly-added). */
.cf-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--red);
    border-radius: 8px;
    margin: 0.6rem 0 1rem;
    padding: 0;
}
.cf-tabs {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.35rem 0.55rem 0;
    border-bottom: 1px solid var(--border);
}
.cf-tab {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.cf-tab:hover { color: var(--text); }
.cf-tab.active {
    color: var(--text);
    border-bottom-color: var(--primary);
    font-weight: 600;
}
.cf-tab-n {
    color: var(--text-dim);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}
.cf-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.cf-dot-red { background: var(--red); }
.cf-dot-yellow { background: var(--yellow); }
.cf-dot-primary { background: var(--primary); }
.cf-dot-green { background: var(--green); }
.cf-banner .at-risk-dismiss { margin-left: auto; align-self: center; }
.cf-tab-panel { margin: 0; padding: 0.4rem 0.8rem 0.6rem; }
.cf-tab-panel.hidden { display: none; }
/* Overflow rows past the first 8 stay hidden until the panel is expanded. */
.cf-tab-panel .cf-overflow { display: none; }
.cf-tab-panel.cf-expanded .cf-overflow { display: flex; }
.cf-toggle-row { list-style: none; padding: 0.4rem 0 0.1rem; }
.cf-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.22rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
}
.cf-toggle-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* Changefeed banners (newly stalled / newly added) — share visuals with
   the at-risk banner but recoloured. */
.changefeed-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0.6rem 0 1rem;
    padding: 0.55rem 0.8rem;
}
.changefeed-banner.stalled { border-left: 4px solid var(--yellow); }
.changefeed-banner.added { border-left: 4px solid var(--primary); }
.changefeed-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
}
.changefeed-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.changefeed-banner.stalled .changefeed-title { color: var(--yellow); }
.changefeed-banner.added .changefeed-title { color: var(--primary); }
.changefeed-sub { font-size: 0.74rem; }
.changefeed-banner .at-risk-dismiss { margin-left: auto; }
.changefeed-reason-stalled {
    color: var(--yellow);
    border-color: var(--yellow);
    background: rgba(255, 184, 48, 0.10);
}
.changefeed-reason-added {
    color: #07070f;
    background: var(--primary);
    border-color: var(--primary);
}
.changefeed-reason-trashed {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
}
.changefeed-reason-active {
    color: var(--green);
    border-color: var(--green);
    background: rgba(57, 224, 122, 0.10);
}

/* At-risk banner (top of dashboard + /last-7-days). Severity drives the
   left border + reason chip color. */
.at-risk-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--red);
    border-radius: 8px;
    margin: 0.6rem 0 1rem;
    padding: 0.55rem 0.8rem;
}
.at-risk-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}
.at-risk-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--red);
    font-weight: 700;
}
.at-risk-dismiss {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.25rem;
}
.at-risk-dismiss:hover { color: var(--text); }
.at-risk-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.at-risk-item {
    display: grid;
    grid-template-columns: 160px 38px 1fr auto;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.82rem;
    padding: 0.25rem 0;
    border-top: 1px solid var(--border);
}
.at-risk-item:first-child { border-top: none; }
.at-risk-reason {
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    text-align: center;
}
.at-risk-item.sev-100 .at-risk-reason {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
}
.at-risk-item.sev-80 .at-risk-reason {
    color: var(--red);
    border-color: var(--red);
    background: rgba(255, 92, 87, 0.10);
}
.at-risk-item.sev-60 .at-risk-reason {
    color: var(--yellow);
    border-color: var(--yellow);
    background: rgba(255, 184, 48, 0.10);
}
.at-risk-item.sev-40 .at-risk-reason {
    color: var(--yellow);
    border-color: var(--yellow);
}
.at-risk-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.at-risk-meta {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
    /* Reflow the at-risk / changefeed rows: badge + lang on row 1,
       dataset name on row 2 (full width), meta on row 3 — so nothing
       is hidden and the dataset name no longer truncates. */
    .at-risk-item {
        grid-template-columns: auto auto;
        grid-template-areas:
            "reason lang"
            "name name"
            "meta meta";
        row-gap: 0.15rem;
    }
    .at-risk-item .at-risk-reason { grid-area: reason; justify-self: start; }
    .at-risk-item .lang-badge { grid-area: lang; justify-self: start; }
    .at-risk-item .at-risk-name { grid-area: name; white-space: normal; }
    .at-risk-item .at-risk-meta { grid-area: meta; }
}

/* /last-7-days: window toggle, search input, pace badges, dataset drilldown */
.window-toggle { display: inline-flex; gap: 2px; }
.window-toggle .btn { padding: 0.18rem 0.55rem; font-size: 0.78rem; }

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.3rem 0 0.1rem;
}
.filter-input {
    flex: 1;
    max-width: 420px;
    padding: 0.35rem 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82rem;
}
.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.filter-count { font-size: 0.75rem; }

.pace-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--border);
    white-space: nowrap;
}
.pace-on_pace { color: var(--green); border-color: var(--green); background: rgba(57, 224, 122, 0.08); }
.pace-tight { color: var(--yellow); border-color: var(--yellow); background: rgba(255, 184, 48, 0.08); }
.pace-stalled { color: var(--red); border-color: var(--red); background: rgba(255, 92, 87, 0.08); }
.pace-overdue { color: var(--red); border-color: var(--red); background: rgba(255, 92, 87, 0.18); font-weight: 700; }
.pace-no_deadline { color: var(--text-dim); }

.dataset-row { cursor: pointer; }
.dataset-row:hover { background: var(--surface2); }
.dataset-detail > td { background: var(--surface2); padding: 0.5rem 0.8rem; }

.matrix .pass-col { width: 64px; min-width: 64px; }

/* Click-to-sort headers */
.matrix th.sortable {
    cursor: pointer;
    user-select: none;
}
.matrix th.sortable:hover { color: var(--primary); }
.sort-arrow {
    display: inline-block;
    color: var(--text-dim);
    font-size: 0.7rem;
    min-width: 0.7rem;
    margin-left: 4px;
    opacity: 0.55;
    transition: opacity 0.12s, color 0.12s;
}
.matrix th.sortable:hover .sort-arrow { opacity: 1; color: var(--primary); }
/* Brighter arrow when this column is the active sort. The JS sets
   data-sort-dir on the active <th>. */
.matrix th.sortable[data-sort-dir] .sort-arrow {
    color: var(--primary);
    opacity: 1;
    font-weight: 700;
}
