/* =============================================================================
   LokOS Dashboard — design system

   Tokens are adopted from the Figma library "LokOS Monitoring Dashboard"
   (file Q3t7E8l7JLvBq1pMXXcS4W): color/bg, color/text, color/brand, the type
   scale and the categorical chart ramp are the Figma variable values verbatim.
   That ramp is colour-blind validated (OKLab dE >= 8 between adjacent hues,
   >= 3:1 against the surface) — hues must not be substituted, and series colour
   is assigned in fixed order, never cycled.

   Layout: >=1280 full rail · 768-1279 icon rail · <768 bottom tab bar.
   ========================================================================== */

:root {
  color-scheme: light;

  /* surfaces & ink — Figma color/bg/canvas, color/text/* */
  --page: #f6f5f2;
  --surface: #fcfcfb;
  --surface-2: #f0efeb;
  --surface-3: #e6e4dd;
  --ink: #1a1a19;
  --ink-2: #4a4844;
  --muted: #7a776f;
  --hairline: #e3e1da;
  --border: #e3e1da;
  --border-strong: #d3d0c7;

  /* brand — Figma color/brand/primary */
  --accent: #2563eb;
  --accent-ink: #1d4ed8;
  --accent-soft: #e8f0fe;
  --on-accent: #ffffff;

  /* categorical ramp — Figma color/chart/categorical-1..6 */
  --chart-1: #2563eb;
  --chart-2: #0d9488;
  --chart-3: #d97706;
  --chart-4: #7c3aed;
  --chart-5: #dc2626;
  --chart-6: #0891b2;
  --series-2: var(--chart-3);
  --series-3: var(--chart-2);

  /* sequential ramp — completion bars, heatmap cells. One hue, light -> dark. */
  --seq-1: #e8f0fe;
  --seq-2: #bbd3fb;
  --seq-3: #7faaf5;
  --seq-4: #4a83ee;
  --seq-5: #1d4ed8;

  /* status — reserved; never reused as a series, always paired with a glyph.
     Each has a soft fill and a line colour so chips read as outlined pills. */
  --good: #15803d;
  --good-text: #15803d;
  --good-soft: #e3eee6;
  --good-line: #b7d7c2;
  --warning: #b45309;
  --warning-soft: #f4e9e0;
  --warning-line: #e6c9b2;
  --serious: #ea580c;
  --serious-soft: #fdeee4;
  --serious-line: #e6c9b2;
  --critical: #b91c1c;
  --critical-soft: #f5e3e2;
  --critical-line: #e8b9b8;
  --neutral-soft: #f0efeb;
  --neutral-line: #e3e1da;

  /* type — Figma text/* + leading/* */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", "Noto Sans Telugu", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
  --text-micro: 11px;   --leading-micro: 14px;
  --leading-telugu: 22px;
  --tracking-label: 0.6px;
  --text-small: 13px;   --leading-small: 18px;
  --text-body: 14px;    --leading-body: 20px;
  --text-h3: 15px;      --leading-h3: 20px;
  --text-h2: 20px;      --leading-h2: 26px;
  --text-h1: 28px;      --leading-h1: 34px;  --tracking-h1: -0.42px;
  --text-display: 40px; --leading-display: 44px;

  /* shape & depth */
  --radius-control: 8px;
  --radius: 12px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(26, 26, 25, 0.04);
  --shadow-modal: 0 24px 60px rgba(26, 26, 25, 0.18), 0 2px 8px rgba(26, 26, 25, 0.08);
  --rail: 240px;
}

/* Dark is a selected second palette, not an inversion. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #121211; --surface: #1a1a19; --surface-2: #242422; --surface-3: #2e2e2b;
    --ink: #f2f1ee; --ink-2: #b9b6ae; --muted: #85827a;
    --hairline: #33322e; --border: #33322e; --border-strong: #45443f;
    --accent: #3d7fe6; --accent-ink: #8ab6f4; --accent-soft: #1b2b47;
    --chart-1: #3d7fe6; --chart-2: #0e9e8f; --chart-3: #c48414;
    --chart-4: #7d5fe6; --chart-5: #d64545; --chart-6: #0e90ad;
    --seq-1: #1b2b47; --seq-2: #23406c; --seq-3: #2d5795; --seq-4: #3a6fbe; --seq-5: #6b9ef0;
    --good: #4ade80; --good-text: #4ade80; --good-soft: #17321f; --good-line: #2f5f3f;
    --warning: #fbbf24; --warning-soft: #38290b; --warning-line: #6b5116;
    --serious: #fb923c; --serious-soft: #3a230f; --serious-line: #6d431f;
    --critical: #f87171; --critical-soft: #3a1a1a; --critical-line: #6b3030;
    --neutral-soft: #242422; --neutral-line: #45443f;
    --shadow: none; --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #121211; --surface: #1a1a19; --surface-2: #242422; --surface-3: #2e2e2b;
  --ink: #f2f1ee; --ink-2: #b9b6ae; --muted: #85827a;
  --hairline: #33322e; --border: #33322e; --border-strong: #45443f;
  --accent: #3d7fe6; --accent-ink: #8ab6f4; --accent-soft: #1b2b47;
  --chart-1: #3d7fe6; --chart-2: #0e9e8f; --chart-3: #c48414;
  --chart-4: #7d5fe6; --chart-5: #d64545; --chart-6: #0e90ad;
  --seq-1: #1b2b47; --seq-2: #23406c; --seq-3: #2d5795; --seq-4: #3a6fbe; --seq-5: #6b9ef0;
  --good: #4ade80; --good-text: #4ade80; --good-soft: #17321f; --good-line: #2f5f3f;
    --warning: #fbbf24; --warning-soft: #38290b; --warning-line: #6b5116;
    --serious: #fb923c; --serious-soft: #3a230f; --serious-line: #6d431f;
    --critical: #f87171; --critical-soft: #3a1a1a; --critical-line: #6b3030;
    --neutral-soft: #242422; --neutral-line: #45443f;
  --shadow: none; --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  font: var(--text-body) / var(--leading-body) var(--sans);
  color: var(--ink); background: var(--page); min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
.small { font-size: var(--text-small); line-height: var(--leading-small); }
.muted { color: var(--muted); }
.ok { color: var(--good-text); font-weight: 600; }
.bad { color: var(--critical); font-weight: 600; }
[hidden] { display: none !important; }
:where(a, button, select, input, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
main { min-width: 0; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--hairline);
  padding: 0 0 16px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px; z-index: 20;
}
.brand { padding: 16px; }
.brand h1 { margin: 0; font-size: var(--text-body); line-height: var(--leading-body); font-weight: 500; letter-spacing: 0; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: var(--text-micro); line-height: var(--leading-micro); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav { padding: 0 8px; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px;
  border-radius: var(--radius-control); color: var(--ink-2); font-weight: 500; position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.nav a.active svg { color: var(--accent); }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav a .dot { display: none; }
.sidebar .foot { margin-top: auto; padding: 12px 16px 0; color: var(--muted); font-size: var(--text-micro); line-height: 1.7; border-top: 1px solid var(--hairline); }
.sidebar .foot b { color: var(--ink-2); font-weight: 600; }
.sidebar .foot .theme-seg { width: 100%; margin-bottom: 10px; }
.sidebar .foot .theme-seg button { flex: 1; padding: 5px 0; font-size: var(--text-micro); }
.sidebar .foot .who { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sidebar .foot .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 600; }

main { padding: 24px 24px 32px; max-width: 1440px; display: flex; flex-direction: column; gap: 20px; }
.view.active { display: flex; flex-direction: column; gap: 20px; }
.view { display: none; }
.view.active { animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 16px 20px; flex-wrap: wrap; }
.view-head > div:first-child { min-width: 0; flex: 1 1 420px; }
.view-head h2 { margin: 0; font-size: var(--text-h1); line-height: var(--leading-h1); letter-spacing: var(--tracking-h1); font-weight: 600; }
.view-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 84ch; font-size: var(--text-small); line-height: var(--leading-small); }
.mobilebar, .tabbar { display: none; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
/* Panel header band: TITLE, an optional muted note, and an optional right-hand action. */
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border); margin: 0 !important;
}
.panel-head h3 { margin: 0 !important; padding: 0 !important; border: 0 !important; }
.panel-head .note { color: var(--muted); font-size: var(--text-small); flex: 1 1 auto; }
.panel-head .act { margin-left: auto; }

/* Health row: a label with a status chip under it. */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 20px; }
.health .k { color: var(--muted); font-size: var(--text-micro); line-height: var(--leading-micro); margin-bottom: 5px; }

/* Horizontal bar list — coverage, league tables, anywhere a share is compared. */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bars .brow { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 56px auto; gap: 12px; align-items: center; font-size: var(--text-small); }
.bars .blabel { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .btrack { height: 8px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.bars .btrack > i { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--seq-5); }
.bars .bpct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bars .bnote { color: var(--muted); font-size: var(--text-micro); white-space: nowrap; }
@media (max-width: 767px) {
  .bars .brow { grid-template-columns: 1fr auto; grid-template-areas: "l p" "t t" "n n"; gap: 4px 10px; }
  .bars .blabel { grid-area: l; white-space: normal; }
  .bars .bpct { grid-area: p; }
  .bars .btrack { grid-area: t; }
  .bars .bnote { grid-area: n; }
}

/* Panels carry a titled header band with a rule under it, then a padded body. */
.card { padding: 0; }
.card > h3:first-child {
  margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: var(--text-h3); line-height: var(--leading-h3); font-weight: 600;
  color: var(--ink-2); text-transform: uppercase; letter-spacing: var(--tracking-label);
}
.card > h3:first-child + * { margin-top: 0; }
.card > *:not(h3:first-child) { margin-left: 16px; margin-right: 16px; }
.card > *:nth-child(2) { margin-top: 14px; }
.card > *:last-child { margin-bottom: 16px; }
.card > h3:first-child:only-child { border-bottom: 0; }
.card h3, .rep-h {
  margin: 0 0 12px; font-size: var(--text-h3); line-height: var(--leading-h3);
  font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: var(--tracking-label);
}
/* a panel whose body is a table: let the table meet the panel edges */
.card > .table-wrap { margin: 0; }
.card > .table-wrap table { width: 100%; }
.card > .table-wrap th:first-child, .card > .table-wrap td:first-child { padding-left: 16px; }
.card > .table-wrap th:last-child, .card > .table-wrap td:last-child { padding-right: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
details.card.collapse > summary {
  cursor: pointer; list-style: none; font-size: var(--text-micro); font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
details.card.collapse > summary::-webkit-details-marker { display: none; }
details.card.collapse > summary::before { content: "▸"; font-size: 10px; transition: transform .15s; }
details.card.collapse[open] > summary::before { transform: rotate(90deg); }
details.card.collapse > summary:hover { color: var(--accent); }

/* ---------------------------------------------------------------- stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); position: relative; display: flex; flex-direction: column; gap: 8px;
}
.tile > * { margin: 0 !important; }
/* Each tile takes the next hue in the fixed categorical order and shows it as a small
   swatch beside the label — the identity mark from the design library. */
.tiles > .tile:nth-child(6n + 1) { --tile-hue: var(--chart-1); }
.tiles > .tile:nth-child(6n + 2) { --tile-hue: var(--chart-2); }
.tiles > .tile:nth-child(6n + 3) { --tile-hue: var(--chart-3); }
.tiles > .tile:nth-child(6n + 4) { --tile-hue: var(--chart-4); }
.tiles > .tile:nth-child(6n + 5) { --tile-hue: var(--chart-6); }
.tiles > .tile:nth-child(6n + 6) { --tile-hue: var(--chart-5); }
/* Where a tile names a CBO type, colour follows that entity rather than its position, so the
   same type keeps its hue as cards are added or filtered away (and a 100%% CLF is not painted red). */
.tiles > .tile.t-shg { --tile-hue: var(--chart-1); }
.tiles > .tile.t-vo  { --tile-hue: var(--chart-2); }
.tiles > .tile.t-clf { --tile-hue: var(--chart-4); }
.tile .bar > i { background: var(--tile-hue, var(--seq-5)); }
.tile .label { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-weight: 400; }
.tile .label::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--tile-hue, var(--chart-1));
  flex: none; margin-top: 4px;
}
.tile.ghost .label::before { background: var(--border-strong); }
.tile .label { color: var(--ink-2); font-size: var(--text-small); line-height: var(--leading-small); font-weight: 500; }
.tile .value {
  font-size: var(--text-h1); line-height: var(--leading-h1); font-weight: 600;
  letter-spacing: var(--tracking-h1); margin-top: 8px; font-variant-numeric: tabular-nums;
}
/* "1 / 26" — the total is quieter than the completed figure */
.tile .value .of { color: var(--muted); }
.tile .sub { color: var(--muted); font-size: var(--text-small); line-height: var(--leading-small); }
.tile.hero .value { font-size: var(--text-display); line-height: var(--leading-display); }
.tile.ghost { border-style: dashed; }
.tile.clickable { cursor: pointer; transition: border-color .14s, transform .14s, box-shadow .14s; }
.tile.clickable:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(37, 99, 235, .13); }
.tile.clickable .hint { font-size: var(--text-micro); color: var(--accent); margin-top: 8px; font-weight: 600; }
.tile.kpi { cursor: pointer; }
.tile.kpi.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 25%, transparent); }

.bar { height: 6px; border-radius: var(--radius-pill); background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--seq-4), var(--seq-5)); transition: width .3s ease-out; }
.tile .bar { margin-top: 0; }

/* ---------------------------------------------------------------- key/value */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; font-size: var(--text-small); line-height: var(--leading-small); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; min-width: 0; font-weight: 500; }
.kvline { display: flex; gap: 12px; padding: 4px 0; font-size: var(--text-small); align-items: baseline; }
.kvline .k { color: var(--muted); min-width: 132px; flex: none; }
.kvline .v { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; font-size: var(--text-small); }
.checklist .item { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--hairline); }
.checklist .item .mark { width: 16px; text-align: center; font-weight: 700; }
.checklist .item .k { color: var(--muted); font-family: var(--mono); font-size: var(--text-micro); width: 26px; }
.checklist .item.na { color: var(--muted); }

/* ---------------------------------------------------------------- chips, severity, tags */
/* Outlined status pills: soft fill + a line in the same family, and a glyph before the label. */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px;
  border-radius: var(--radius-pill); font-size: var(--text-small); line-height: var(--leading-small);
  background: var(--neutral-soft); color: var(--muted); border: 1px solid var(--neutral-line); white-space: nowrap;
}
.chip::before { content: "•"; font-size: var(--text-micro); line-height: 1; }
.chip.good { color: var(--good-text); background: var(--good-soft); border-color: var(--good-line); } .chip.good::before { content: "✓"; }
.chip.warn { color: var(--warning); background: var(--warning-soft); border-color: var(--warning-line); } .chip.warn::before { content: "⚠"; }
.chip.bad { color: var(--critical); background: var(--critical-soft); border-color: var(--critical-line); } .chip.bad::before { content: "✕"; }
.chip.run { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent); } .chip.run::before { content: "●"; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* severity: colour is never the only signal */
.sev { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-micro); font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.sev::before { font-size: 10px; }
.sev.critical { background: var(--critical-soft); color: var(--critical); } .sev.critical::before { content: "✕"; }
.sev.serious  { background: var(--serious-soft);  color: var(--serious);  } .sev.serious::before  { content: "▲"; }
.sev.warning  { background: var(--warning-soft);  color: var(--warning);  } .sev.warning::before  { content: "⚠"; }
.sev.good     { background: var(--good-soft);     color: var(--good-text);} .sev.good::before     { content: "✓"; }
/* a label, not a judgement - used where a tag names a kind rather than a severity */
.sev.neutral  { background: var(--surface-3);      color: var(--ink-2); }

.exc-tag {
  display: inline-block; font-family: var(--mono); font-size: var(--text-micro); font-weight: 500;
  padding: 2px 8px; border-radius: var(--radius-pill); background: var(--critical-soft);
  color: var(--critical); border: 1px solid var(--critical-line); margin: 1px 4px 1px 0; white-space: nowrap;
}
.exc-tag.ok { background: var(--good-soft); color: var(--good-text); border-color: var(--good-line); }
.exc-tag.extra { background: var(--neutral-soft); color: var(--muted); border-color: var(--neutral-line); }
.exc-tag.click { cursor: pointer; }
.exc-tag.click:hover { filter: brightness(.94); text-decoration: underline; }
.exc-detail { border: 1px solid var(--border); border-left: 3px solid var(--chart-5); border-radius: var(--radius-control); padding: 12px 14px; margin-bottom: 10px; background: var(--surface-2); }
.exc-detail .hd { display: flex; gap: 8px; align-items: baseline; margin-bottom: 5px; flex-wrap: wrap; }
.exc-detail .why { font-size: var(--text-small); line-height: var(--leading-small); }
.exc-detail .meta { font-size: var(--text-micro); color: var(--muted); margin-top: 6px; }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: var(--text-small); color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: var(--text-micro); color: var(--muted); }
.field input[type="text"], .field input[type="number"], .field select, .field textarea {
  padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  background: var(--surface); outline: none; min-width: 0;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field select[multiple] { min-height: 120px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check .cost { font-size: var(--text-micro); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn {
  padding: 8px 14px; border-radius: var(--radius-control); border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 500; color: var(--ink);
  transition: background .12s, border-color .12s; min-height: 36px;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--critical); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: var(--text-small); min-height: 30px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-control); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); padding: 6px 13px; font-size: var(--text-small); cursor: pointer; min-height: 32px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--surface-2); }
.seg button.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* long codes / names wrap, but only where they occur — never inside table headers */
.kv dd, .kvline .v, .banner, .exc-detail, .view-head p, #voa-head > div, .tile .label, .tile .sub { overflow-wrap: anywhere; }
td.num, th.num { white-space: nowrap; }
#exc-matrix th, #exc-matrix td { white-space: nowrap; }
thead th { white-space: nowrap; }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
thead th {
  color: var(--muted); font-weight: 500; font-size: var(--text-small); line-height: var(--leading-small);
  position: sticky; top: 0; background: var(--surface-2); z-index: 1; border-bottom: 1px solid var(--border);
}
/* group names carry a Telugu second line - give it room */
td .telugu { display: block; color: var(--muted); font-size: var(--text-small); line-height: var(--leading-telugu); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* a percentage cell doubles as a bar chart: --pct is set by app.js from the cell text */
td.pctcell { position: relative; }
td.pctcell::before {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 3px;
  border-radius: 999px; background: var(--surface-3);
}
td.pctcell::after {
  content: ""; position: absolute; left: 12px; bottom: 3px; height: 3px; border-radius: 999px;
  width: calc((100% - 24px) * var(--pct, 0)); background: var(--seq-5); opacity: .85;
}
td.pctcell.low::after { background: var(--critical); }
td.pctcell.mid::after { background: var(--warning); }
td.pctcell.high::after { background: var(--good); }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-soft); }
tr.active td { background: var(--accent-soft); }
.table-wrap { overflow-x: auto; }
.trend-down { color: var(--critical); font-weight: 600; }
.trend-up { color: var(--good-text); font-weight: 600; }
#api-table th, #api-table td { white-space: nowrap; padding: 8px 12px; }
#api-table td:nth-child(2) { white-space: normal; min-width: 180px; }
#api-table td:nth-child(2) b { font-weight: 600; }
#api-table td:nth-child(3) { color: var(--ink-2); }
#api-table tr:hover td { background: var(--surface-2); }
#api-table input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
#exc-matrix table td.cell { text-align: right; font-variant-numeric: tabular-nums; cursor: pointer; }
#exc-matrix table td.cell:hover { background: var(--accent-soft); }
#exc-matrix table th.rot { font-family: var(--mono); font-size: var(--text-micro); white-space: nowrap; }
#exc-rules tr.click td { cursor: pointer; }
#exc-rules tr.active td { background: var(--accent-soft); }

/* ---------------------------------------------------------------- reports */
.stepper { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.stepper .step label { display: block; font-size: var(--text-micro); color: var(--muted); margin: 0 0 4px 2px; text-transform: uppercase; letter-spacing: .05em; }
.stepper .step select { max-width: 240px; }
.stepper .step.current select { border-color: var(--accent); }
.stepper .arrow { color: var(--muted); padding-bottom: 8px; }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.rep-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; cursor: pointer; transition: border-color .14s, transform .14s; box-shadow: var(--shadow); }
.rep-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.rep-tile .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-tile .sub { color: var(--muted); font-size: var(--text-micro); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-tile .pct { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rep-tile .pct small { font-size: var(--text-micro); color: var(--muted); font-weight: 400; margin-left: 6px; }
.pf-link { cursor: pointer; color: var(--accent); }
.pf-link:hover { text-decoration: underline; }
.crumb { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; color: var(--muted); font-size: var(--text-small); }
.crumb b { color: var(--ink); font-weight: 600; }
.crumb .sep { opacity: .5; }

/* ---------------------------------------------------------------- log console */
.console {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control);
  padding: 10px 12px; height: 340px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.55;
}
.console .line { white-space: pre-wrap; word-break: break-word; }
.console .line .t { color: var(--muted); margin-right: 8px; }
.console .line.warn { color: var(--warning); }
.console .line.error { color: var(--critical); }
.progress-bar { height: 6px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--seq-4), var(--seq-5)); width: 0; transition: width .3s; }

/* ---------------------------------------------------------------- explorer */
.tree { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tree .col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 420px; max-height: 70vh; box-shadow: var(--shadow); }
.tree .col h4 { margin: 0; padding: 11px 14px; font-size: var(--text-micro); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; }
.tree .col h4 span { font-weight: 400; }
.tree .list { overflow: auto; flex: 1; }
.tree .item { padding: 8px 14px; cursor: pointer; border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; gap: 8px; }
.tree .item:hover { background: var(--surface-2); }
.tree .item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.tree .item small { color: var(--muted); font-family: var(--mono); font-size: var(--text-micro); }
.tree .empty { padding: 20px 14px; color: var(--muted); font-size: var(--text-small); }
.tree .filter { padding: 8px 10px; border-bottom: 1px solid var(--hairline); }
.tree .filter input { width: 100%; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); }
.villages { padding: 4px 14px 10px 26px; font-size: var(--text-small); color: var(--ink-2); }
.villages div { padding: 2px 0; }

/* ---------------------------------------------------------------- api console */
.resp-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--text-small); color: var(--ink-2); margin-bottom: 10px; }
.resp-meta b { color: var(--ink); }
pre.json, .json {
  margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control);
  padding: 12px; max-height: 60vh; overflow: auto; white-space: pre; font-size: 12px;
}
.endpoint-desc { color: var(--ink-2); font-size: var(--text-small); margin: -4px 0 8px; }
.endpoint-path { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.method { display: inline-block; font-family: var(--mono); font-size: var(--text-micro); font-weight: 700; padding: 2px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-ink); margin-right: 6px; }

/* ---------------------------------------------------------------- files */
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; font-size: var(--text-small); margin-bottom: 12px; align-items: center; }
.crumbs a { cursor: pointer; }
.crumbs span { color: var(--muted); }
.files-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.file-list { max-height: 620px; overflow: auto; }
.file-list .item { display: flex; justify-content: space-between; gap: 8px; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.file-list .item:hover { background: var(--surface-2); }
.file-list .item.active { background: var(--accent-soft); color: var(--accent-ink); }
.file-list .item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .item .meta { color: var(--muted); font-size: var(--text-micro); white-space: nowrap; font-variant-numeric: tabular-nums; }
.file-list .item.dir .name::before { content: "▸ "; color: var(--muted); }

/* ---------------------------------------------------------------- banners, toast */
.banner {
  border-left: 3px solid var(--warning); padding: 12px 16px; background: var(--warning-soft);
  border-radius: var(--radius-control); display: flex; gap: 10px; align-items: flex-start; color: var(--ink);
}
.banner.bad { border-left-color: var(--critical); background: var(--critical-soft); }
.banner.good { border-left-color: var(--good); background: var(--good-soft); }
.banner code { background: var(--surface); padding: 1px 5px; border-radius: 4px; }
.empty { color: var(--muted); padding: 26px; text-align: center; }
.toast {
  position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: var(--page);
  padding: 11px 16px; border-radius: var(--radius-control); font-size: var(--text-small);
  box-shadow: var(--shadow-modal); opacity: 0; transform: translateY(8px); transition: all .2s;
  pointer-events: none; max-width: 420px; z-index: 100;
}
.toast.show { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- modals */
#voa-modal, #txn-modal, #exc-modal, #db-modal, #dl-modal {
  width: min(1100px, 94vw); max-height: 88vh; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0; background: var(--surface); color: var(--ink); overflow: hidden; box-shadow: var(--shadow-modal);
}
#exc-modal { width: min(760px, 94vw); }
#voa-modal::backdrop, #txn-modal::backdrop, #exc-modal::backdrop, #db-modal::backdrop, #dl-modal::backdrop { background: rgba(26, 26, 25, .5); }
#voa-modal .modal-head, #txn-modal .modal-head, #exc-modal .modal-head, #db-modal .modal-head, #dl-modal .modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
#voa-modal .modal-head h3, #txn-modal .modal-head h3, #exc-modal .modal-head h3, #db-modal .modal-head h3, #dl-modal .modal-head h3 { margin: 0 0 2px; font-size: var(--text-h2); line-height: var(--leading-h2); font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink); }
#voa-modal .modal-tools, #txn-modal .modal-tools, #exc-modal .modal-tools, #db-modal .modal-tools, #dl-modal .modal-tools { padding: 12px 20px; gap: 12px; align-items: center; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
#voa-modal .modal-body, #txn-modal .modal-body, #exc-modal .modal-body, #db-modal .modal-body, #dl-modal .modal-body { overflow: auto; max-height: 58vh; padding: 6px 20px 16px; }
#voa-modal .modal-foot, #txn-modal .modal-foot, #exc-modal .modal-foot, #db-modal .modal-foot, #dl-modal .modal-foot { padding: 12px 20px 16px; justify-content: space-between; border-top: 1px solid var(--border); }

/* ==========================================================================
   RESPONSIVE — 768-1279: icon rail
   ========================================================================== */
@media (max-width: 1279px) {
  :root { --rail: 68px; }
  .sidebar { padding: 16px 8px; align-items: center; }
  .brand { padding: 4px 0 14px; text-align: center; width: 100%; }
  .brand h1, .brand p { display: none; }
  .brand::before {
    content: "LK"; display: grid; place-items: center; width: 38px; height: 38px; margin: 0 auto;
    background: var(--accent); color: var(--on-accent); border-radius: 10px; font-weight: 700; font-size: 14px;
  }
  .nav { width: 100%; }
  .nav a { justify-content: center; padding: 0; font-size: 0; gap: 0; }
  .nav a::after {
    content: attr(data-view); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    background: var(--ink); color: var(--page); padding: 5px 10px; border-radius: 6px; font-size: 11px;
    text-transform: capitalize; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 30;
  }
  .nav a:hover::after { opacity: 1; }
  .sidebar .foot { display: none; }
  main { padding: 24px 20px 72px; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .files-layout { grid-template-columns: 1fr; }
  .tree { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   RESPONSIVE — <768: bottom tab bar, card lists, sheet modals
   ========================================================================== */
@media (max-width: 767px) {
  :root { --rail: 0px; }
  /* the sidebar is gone, so the remaining rows must not share 100vh between them */
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-content: start; }
  .sidebar { display: none; }

  .mobilebar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 30; padding: 12px 16px;
    background: var(--surface); border-bottom: 1px solid var(--hairline);
  }
  .mobilebar .t { font-weight: 600; font-size: var(--text-h3); }
  .mobilebar .s { color: var(--muted); font-size: var(--text-micro); }

  main { padding: 16px 16px calc(80px + env(safe-area-inset-bottom, 0px)); }
  .view-head { margin-bottom: 16px; }
  .view-head h2 { font-size: var(--text-h2); line-height: var(--leading-h2); letter-spacing: -0.01em; }
  .view-head p { font-size: var(--text-small); line-height: var(--leading-small); }
  .view-head { width: 100%; min-width: 0; }
  .view-head > div:first-child { min-width: 0; width: 100%; }
  .view-head p { overflow-wrap: anywhere; }
  .view-head .row { width: 100%; gap: 8px; }
  .view-head .row > * { flex: 1 1 100%; min-width: 0; width: 100%; max-width: 100%; }
  .view-head .row > .btn, .view-head .row > .seg { flex: 0 0 auto; width: auto; }
  .grid, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .card { padding: 15px 16px; }
  .tree { grid-template-columns: 1fr; }
  .tree .col { min-height: 260px; max-height: 50vh; }

  /* KPI tiles: horizontal snap carousel keeps the headline one swipe away */
  .tiles {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none;
  }
  .tiles::-webkit-scrollbar { display: none; }
  .tiles > * { flex: 0 0 78%; scroll-snap-align: start; }
  .rep-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* tables become card lists; labels come from data-label written by app.js */
  .table-wrap { overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  tbody tr {
    border: 1px solid var(--border); border-radius: var(--radius-control);
    padding: 10px 13px; margin-bottom: 10px; background: var(--surface); box-shadow: var(--shadow);
  }
  tbody td {
    display: flex; justify-content: space-between; gap: 14px; align-items: baseline;
    padding: 4px 0; border-bottom: 0; text-align: left !important;
  }
  tbody td::before {
    content: attr(data-label); color: var(--muted); font-size: var(--text-micro);
    text-transform: uppercase; letter-spacing: .05em; flex: 0 0 44%; font-weight: 600;
  }
  tbody td:first-child { font-weight: 600; font-size: var(--text-body); padding-bottom: 8px; border-bottom: 1px solid var(--hairline); margin-bottom: 6px; }
  tbody td:first-child::before { display: none; }
  tr.click:hover td, tr.active td { background: transparent; }
  #api-table th, #api-table td, #exc-matrix th, #exc-matrix td, thead th { white-space: normal; }

  .kv { grid-template-columns: 1fr; gap: 1px 0; }
  .kv dt { margin-top: 9px; font-size: var(--text-micro); text-transform: uppercase; letter-spacing: .05em; }
  .kvline { flex-direction: column; gap: 1px; padding: 6px 0; }
  .kvline .k { min-width: 0; font-size: var(--text-micro); text-transform: uppercase; letter-spacing: .05em; }
  .checklist { grid-template-columns: 1fr; }

  .stepper { flex-direction: column; align-items: stretch; }
  .stepper .step, .stepper .step select { max-width: none; width: 100%; }
  .stepper .arrow { display: none; }
  .console { height: 240px; }

  /* modals become full-screen sheets */
  /* Full-screen sheets - but only when actually open: an unqualified `display: flex` here beats
     the browser's `dialog:not([open]) { display: none }` and paints every popup inline. */
  #voa-modal[open], #txn-modal[open], #exc-modal[open], #db-modal[open] {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0;
    display: flex; flex-direction: column;
  }
  #voa-modal .modal-body, #txn-modal .modal-body, #exc-modal .modal-body, #db-modal .modal-body { max-height: none; flex: 1; }
  .toast { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-width: none; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--hairline);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); justify-content: space-around;
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 6px 2px; border-radius: var(--radius-control); color: var(--muted);
    font-size: 10px; font-weight: 600; text-align: center; min-height: 44px;
  }
  .tabbar a .dot { display: none; }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.active { color: var(--accent); background: var(--accent-soft); }
  .tabbar a:hover { text-decoration: none; }
}

@media (min-width: 1600px) { main { padding-left: 44px; padding-right: 44px; } }

/* ---------------------------------------------------------------- drill-down child cards
   One card per child level (district, mandal, CLF, VO, SHG). Each metric keeps its own hue so a
   reader learns the colour once: SHG blue, VO teal, member amber, CLF purple. */
.drill { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.dcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow);
  transition: border-color .14s, transform .14s, box-shadow .14s;
}
.dcard:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(37, 99, 235, .13); }
.dcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dname { font-weight: 600; font-size: var(--text-body); line-height: var(--leading-body); overflow-wrap: anywhere; }
.dgo { color: var(--muted); font-size: 18px; line-height: 1; }
.drow { display: grid; grid-template-columns: 46px minmax(0, 1fr) 40px; gap: 4px 8px; align-items: center; margin-top: 6px; }
.dk { color: var(--muted); font-size: var(--text-micro); text-transform: uppercase; letter-spacing: var(--tracking-label); font-weight: 600; }
.dt { height: 6px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.dt > i { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--metric-hue, var(--seq-5)); }
.dv { text-align: right; font-size: var(--text-micro); font-weight: 600; font-variant-numeric: tabular-nums; }
.dn { grid-column: 2 / 4; color: var(--muted); font-size: var(--text-micro); font-variant-numeric: tabular-nums; }
.drow.d-shg { --metric-hue: var(--chart-1); }
.drow.d-vo { --metric-hue: var(--chart-2); }
.drow.d-member { --metric-hue: var(--chart-3); }
.drow.d-clf { --metric-hue: var(--chart-4); }
/* the four headline tiles use the same mapping, so a colour means the same thing on both */
.tiles > .tile.t-shg { --tile-hue: var(--chart-1); }
.tiles > .tile.t-vo { --tile-hue: var(--chart-2); }
.tiles > .tile.t-member { --tile-hue: var(--chart-3); }
.tiles > .tile.t-clf { --tile-hue: var(--chart-4); }

@media (max-width: 767px) {
  .drill { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- heat map + breakdown tree
   Three bands only, and they are RELATIVE: a card is shaded against the other cards on the same
   page, not against a fixed scale. Statewide SHG completion runs 0-15%, so absolute thirds would
   paint everything the same colour and say nothing. The legend states this, because a colour that
   means "behind its peers" must never be read as "bad in absolute terms". */
.dcard[data-band="low"] { border-left: 3px solid var(--critical); }
.dcard[data-band="mid"] { border-left: 3px solid var(--warning); }
.dcard[data-band="high"] { border-left: 3px solid var(--good-text); }
.dcard[data-band="none"] { border-left: 3px solid var(--border-strong); }
.dfoot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hairline); display: flex; gap: 14px; flex-wrap: wrap; }
.linkbtn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: var(--text-micro); font-weight: 600; font-family: inherit;
}
.linkbtn:hover { text-decoration: underline; }
.tile .dfoot { margin-top: 10px; }

.heat-legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: var(--text-micro); }
.heat-legend .hk { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.heat-legend .hk::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--border-strong); }
.heat-legend .hk[data-band="low"]::before { background: var(--critical); }
.heat-legend .hk[data-band="mid"]::before { background: var(--warning); }
.heat-legend .hk[data-band="high"]::before { background: var(--good-text); }

.dlchips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.dlchip {
  font-size: var(--text-micro); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 4px 11px; font-variant-numeric: tabular-nums;
}
.tree-lv { display: flex; flex-direction: column; gap: 2px; }
.tree-kids { margin-left: 18px; border-left: 1px solid var(--hairline); padding-left: 8px; margin-top: 2px; }
.tree-row {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center;
  width: 100%; text-align: left; border: 0; background: none; font-family: inherit; cursor: pointer;
  padding: 7px 10px 7px 6px; border-radius: var(--radius-control); font-size: var(--text-small);
  border-left: 3px solid transparent;
}
.tree-row:hover { background: var(--surface-2); }
.tree-row[data-band="low"] { border-left-color: var(--critical); }
.tree-row[data-band="mid"] { border-left-color: var(--warning); }
.tree-row[data-band="high"] { border-left-color: var(--good-text); }
.tree-row .tw { color: var(--muted); font-size: 11px; }
.tree-row .tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.tree-row .tm { color: var(--muted); font-size: var(--text-micro); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tree-row .tm.txn { color: var(--chart-3); font-weight: 600; }

@media (max-width: 767px) {
  .tree-row { grid-template-columns: 16px minmax(0, 1fr); grid-auto-rows: auto; }
  .tree-row .tn { white-space: normal; }
  .tree-row .sev, .tree-row .tm { grid-column: 2; }
  #dl-modal[open] { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; display: flex; flex-direction: column; }
  #dl-modal .modal-body { max-height: none; flex: 1; }
}

/* the headline card that the cards below are reporting on */
.tile.focused { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 22%, transparent); }
.focusmark { font-size: var(--text-micro); font-weight: 600; color: var(--muted); }
.tile.focused .focusmark { color: var(--accent); }

/* completeness rules: the ticked rows are the ones that decide, so they read as active */
.rules-table td:first-child, .rules-table th:first-child { width: 64px; text-align: center; }
.rules-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.rules-table tr.on { background: var(--accent-soft); }
.rules-table tr.on td:nth-child(3) > div:first-child { font-weight: 600; }
