/* CompScope institutional app. Tokens on :root; dark values are redefined, not flipped.
   The diverging pair (--div-*) and status colours come from the dataviz reference palette. */
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e2e5ea;
  --text: #14171c;
  --text-2: #4a515c;
  --muted: #636a75;     /* small text: 5.0:1 on --bg, 4.8:1 on the tinted banners */
  --accent: #1f3a5f;
  --accent-ink: #ffffff;
  --series-1: #2a78d6;  /* chart series and focus ring: 4.4:1 on white, too little for small text */
  --series-1-soft: #cde2fb;
  --link: #2468bd;      /* blue text (links, chips): 5.5:1 on white, 5.1:1 on --bg */
  --target: #eb6834;
  --good: #0ca30c;
  --critical: #d03b3b;
  --pending: #fab219;
  --warning-bg: #fff6e0;
  --warning-ink: #7a5300;
  --info-bg: #e8f1fc;
  --info-ink: #184f95;
  --error-bg: #fdecec;
  --error-ink: #9b2222;
  --grid: #eceef1;
  --div-neg: #e34948;
  --div-mid: #f0efec;
  --div-pos: #2a78d6;
  --radius: 8px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111213;
    --surface: #1a1a19;
    --surface-2: #222220;
    --border: #33332f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8f8e86;
    --accent: #256abf;   /* button fill: white ink 5.4:1 (the series blue #3987e5 gives only 3.6:1) */
    --series-1: #3987e5;
    --series-1-soft: #184f95;
    --link: #4a93ea;      /* 5.1:1 on --surface-2 (the series blue gives 4.4:1 there) */
    --target: #d95926;
    --warning-bg: #3a2f12;
    --warning-ink: #f5d58a;
    --info-bg: #14263d;
    --info-ink: #9ec5f4;
    --error-bg: #3b1717;
    --error-ink: #f2a7a7;
    --grid: #2a2a27;
    --critical: #e66767;
    --div-neg: #e66767;
    --div-mid: #383835;
    --div-pos: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111213; --surface: #1a1a19; --surface-2: #222220; --border: #33332f;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86; --accent: #256abf;
  --series-1: #3987e5; --series-1-soft: #184f95; --link: #4a93ea; --target: #d95926;
  --warning-bg: #3a2f12; --warning-ink: #f5d58a; --info-bg: #14263d; --info-ink: #9ec5f4;
  --error-bg: #3b1717; --error-ink: #f2a7a7; --grid: #2a2a27; --critical: #e66767;
  --div-neg: #e66767; --div-mid: #383835; --div-pos: #3987e5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.locked { display: none !important; }   /* a feature the workspace's tier does not include */
body { margin: 0; background: var(--bg); color: var(--text); }
h2, h3 { margin: 0; }
h3 { font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint { font-size: 11.5px; color: var(--muted); margin: -2px 0 8px; }
.hint.inline { margin: 0; float: right; font-weight: 400; }
.hint.top { margin-top: 8px; }
.hint.note { margin: 6px 0 0; line-height: 1.4; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--surface); color: var(--text); padding: 6px 10px; border-radius: 6px; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }

/* ---------------------------------------------------------------- frame */
.app { display: grid; grid-template-rows: auto auto 1fr; height: 100vh; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 8px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0;
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo { color: var(--series-1); }
.tag { font-weight: 500; font-size: 11px; color: var(--muted); border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; }
.views { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; }
.views button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.views button:hover { background: var(--surface-2); }
.views button[aria-pressed="true"] { color: var(--text); font-weight: 600; background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--series-1); }
.top-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.ws-btn {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; max-width: 260px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text);
  padding: 3px 10px; font: inherit; cursor: pointer; text-align: right;
}
.ws-btn:hover { border-color: var(--muted); }
.ws-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.workspace { font-size: 12.5px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The website account (docs/ACCOUNTS_BILLING_CONTRACT.md §6): plan, usage, workspace and menu. */
.plan-badge {
  font-size: 11.5px; font-weight: 600; color: var(--info-ink); background: var(--info-bg);
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.usage { display: grid; gap: 3px; min-width: 110px; font-size: 11px; color: var(--text-2); }
.usage-text { white-space: nowrap; font-variant-numeric: tabular-nums; }
.usage-track { display: block; height: 5px; border-radius: 999px; background: var(--series-1-soft); overflow: hidden; }
.usage-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--series-1); }
.usage.full .usage-text { color: var(--error-ink); font-weight: 600; }
.usage.full .usage-fill { background: var(--critical); }
.ws-switch { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; max-width: 260px; }
.ws-pick { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.ws-switch select { width: auto; min-width: 0; max-width: 100%; margin: 0; padding: 2px 6px; font-size: 12.5px; font-weight: 600; }
.acct-menu { position: relative; }
.acct-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.acct-btn:hover, .acct-btn[aria-expanded="true"] { border-color: var(--series-1); color: var(--link); }
.acct-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 240px; max-width: calc(100vw - 32px); padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.acct-who { display: grid; gap: 1px; margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.acct-email { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.acct-email:empty { display: none; }
.acct-links { list-style: none; margin: 4px 0 0; padding: 0; }
.acct-links a, .acct-links button {
  display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none;
  font: inherit; font-size: 13px; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.acct-links a:hover, .acct-links button:hover { background: var(--surface-2); }
.acct-links button:disabled { opacity: .55; cursor: progress; }
.acct-msg { margin: 0; padding: 0 10px 6px; color: var(--muted); }
.acct-msg:empty { display: none; }
a.btn { text-decoration: none; display: inline-block; }

/* The plan notice spans both columns above them (row 1, empty and 0 high while hidden). */
.plan-notice {
  grid-column: 1 / -1; grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 8px 20px; border-bottom: 1px solid var(--border); border-left: 3px solid var(--series-1);
  background: var(--info-bg); color: var(--info-ink); font-size: 12.5px; line-height: 1.5;
}
.plan-notice p { flex: 1 1 320px; margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Signed in without a team workspace: the trial card replaces the screen controls. */
.no-workspace .layout { grid-template-columns: minmax(0, 1fr); }
.no-workspace .main { grid-column: 1; }
.no-workspace .sidebar, .no-workspace .providerbar, .no-workspace #viewTabs, .no-workspace #uploadBtn { display: none; }
.trial {
  max-width: 640px; margin: 48px auto; padding: 24px 28px; line-height: 1.55; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.trial h2 { color: var(--text); font-size: 20px; margin-bottom: 8px; }
.trial h2:focus { outline: none; }
.trial-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.providerbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 6px 20px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-2); min-width: 0;
}
.prov-select { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; }
.prov-select select { width: auto; margin: 0; padding: 3px 6px; font-size: 12px; }
.prov-name { font-weight: 600; color: var(--text); }
.prov-name:empty { display: none; }
.status { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 520px; }
.status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ok .dot { background: var(--good); }
.status.bad .dot { background: var(--critical); }
.status.bad .status-text { color: var(--text); }
.status.pending .dot { background: var(--pending); }
.prov-meta { color: var(--muted); }
.prov-note { color: var(--warning-ink); background: var(--warning-bg); padding: 1px 8px; border-radius: 4px; font-size: 11.5px; }

.layout { display: grid; grid-template-columns: 340px 1fr; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
/* Positioned so absolutely positioned descendants (.sr-only) stay inside each scroll container. */
.sidebar { grid-row: 2; grid-column: 1; position: relative; background: var(--surface); border-right: 1px solid var(--border); padding: 14px; overflow-y: auto; }
.main { grid-row: 2; grid-column: 2; position: relative; padding: 20px 24px 60px; min-width: 0; overflow-y: auto; }
.main:focus { outline: none; }

.panel { border-top: 1px solid var(--border); padding: 14px 0 6px; }
.panel h3 { margin-bottom: 10px; }
details.panel summary { cursor: pointer; list-style: none; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary h3 { display: inline; }
details.panel summary::before { content: "▸ "; color: var(--muted); }
details[open].panel summary::before { content: "▾ "; }
details[open].panel summary { margin-bottom: 10px; }

/* --------------------------------------------------------------- inputs */
label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
label.check { display: flex; gap: 8px; align-items: flex-start; }
.field { margin-bottom: 8px; }
.field label { margin-bottom: 0; }
input, select, textarea {
  width: 100%; margin-top: 3px; padding: 6px 8px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text);
}
textarea { resize: vertical; line-height: 1.4; }
input[type=checkbox] { width: auto; margin: 2px 0 0; accent-color: var(--series-1); }
input[type=range] { padding: 0; margin: 0 0 6px; accent-color: var(--series-1); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--series-1); outline-offset: -1px; }
input:disabled, select:disabled { opacity: .6; cursor: not-allowed; }
output { float: right; font-variant-numeric: tabular-nums; color: var(--text); }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-size: 12px; color: var(--text-2); margin-bottom: 4px; padding: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.checks label { display: flex; align-items: center; gap: 5px; margin: 0; color: var(--text); }
.checks.stack { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.span2 { grid-column: span 2; }

.seg { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 3px; margin-bottom: 4px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--text-2); padding: 7px 6px; border-radius: 6px; font: inherit; font-size: 12.5px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg button:disabled { color: var(--muted); cursor: not-allowed; text-decoration: line-through; text-decoration-color: var(--border); }
.seg.small { margin-bottom: 10px; }
.seg.tiny { margin: 0; padding: 2px; }
.seg.tiny button { padding: 3px 8px; font-size: 11.5px; white-space: nowrap; }

.btn { font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { font-size: 12px; padding: 3px 9px; }
.btn.danger { color: var(--critical); }
.btn.danger[data-armed="1"] { background: var(--critical); border-color: var(--critical); color: var(--surface); }
.btn.block { width: 100%; margin-top: 14px; padding: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--link); cursor: pointer; }
.link:hover { text-decoration: underline; }
h3 .link { float: right; font-weight: 400; }

.search { position: relative; }
.dropdown { position: absolute; z-index: 10; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15); max-height: 320px; overflow-y: auto; }
.dropdown li { padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.dropdown li:hover, .dropdown li.hl { background: var(--surface-2); }
.dropdown li.msg { cursor: default; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.dropdown .sub { font-size: 11.5px; color: var(--muted); }
.selected { margin-top: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; font-size: 12.5px; line-height: 1.45; }
.selected b { display: block; font-size: 13px; color: var(--text); }

.features .feat { display: grid; grid-template-columns: 18px 1fr 54px; align-items: center; gap: 6px; padding: 3px 0; }
.features .feat label { margin: 0; color: var(--text); font-size: 12.5px; }
.features .feat input[type=number] { margin: 0; padding: 3px 5px; text-align: right; }
.features .cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 0 2px; }

.idlist { list-style: none; margin: 6px 0 4px; padding: 0; font-size: 12.5px; }
.idlist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--grid); }
.idlist li:last-child { border-bottom: 0; }
.idlist .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* -------------------------------------------------------------- messages */
.notice { background: var(--warning-bg); color: var(--warning-ink); border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.banner { display: flex; align-items: flex-start; gap: 12px; border-radius: 6px; padding: 9px 12px; margin-bottom: 12px; font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.banner.error { background: var(--error-bg); color: var(--error-ink); }
.banner.info { background: var(--info-bg); color: var(--info-ink); }
.banner.wait { background: var(--warning-bg); color: var(--warning-ink); }   /* 503/429 with Retry-After */
.banner.upgrade { background: var(--info-bg); color: var(--info-ink); border-left: 3px solid var(--series-1); }   /* plan limits */
.banner-msg { flex: 1; min-width: 0; }
.banner-wait { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.banner .link { color: inherit; text-decoration: underline; white-space: nowrap; }
.banner .link:disabled { opacity: .55; cursor: not-allowed; text-decoration: none; }
.banner .x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 13px; padding: 0 2px; }
.warn { background: var(--warning-bg); color: var(--warning-ink); padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; font-size: 12.5px; }
.warn::before { content: "⚠ "; }
.warn.period { border-left: 3px solid var(--warning-ink); line-height: 1.45; }   /* Bloomberg fiscal-year caveat */
.disclaimer { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.err { color: var(--critical); }
.warn-list { margin: 6px 0 0; padding-left: 18px; color: var(--warning-ink); }

/* --------------------------------------------------------------- results */
.empty { max-width: 640px; margin: 60px auto; color: var(--text-2); line-height: 1.55; }
.empty h2 { color: var(--text); margin-bottom: 10px; }

.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.result-title { min-width: 0; }
.result-title h2 { overflow-wrap: anywhere; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.set-notes { margin: 6px 0 0; font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 720px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { font-size: 12px; color: var(--text-2); }
.tile .v { font-size: 24px; font-weight: 650; margin: 2px 0; }
.tile .s { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.card-head.wrap { flex-wrap: wrap; align-items: baseline; }
.card-head h3 .muted { font-weight: 400; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }

.football { padding: 10px 16px 14px; }
/* The body of an extension card or view (CS.card, CS.addView; ext/README.md). */
.ext-body { padding: 10px 16px 14px; min-width: 0; }
.football svg { display: block; width: 100%; }
.football text { fill: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.football .axis text { fill: var(--muted); font-size: 11px; }
.football .gridline { stroke: var(--grid); }
.football .bar { fill: var(--series-1); }
.football .med { stroke: var(--surface); stroke-width: 2; }
.football .hit { fill: transparent; cursor: default; }
.football .hit:focus { outline: none; stroke: var(--series-1); stroke-width: 1.5; }

/* --------------------------------------------------------------- tables */
/* Positioned so an absolutely positioned descendant (.sr-only in a header) is clipped by this
   scroller: otherwise it escapes to .main, which does not scroll on narrow screens, and widens the page. */
.table-wrap { position: relative; overflow-x: auto; max-width: 100%; container-type: inline-size; }
table.comps { border-collapse: collapse; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.comps th { text-align: right; font-weight: 600; color: var(--text-2); padding: 0; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
table.comps td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.comps th.l, table.comps td.l { text-align: left; }
table.comps th.ctl, table.comps td.ctl { text-align: left; padding: 4px 6px; width: 1%; }
.sort { display: block; width: 100%; border: 0; background: none; font: inherit; font-weight: 600; color: inherit; text-align: inherit; padding: 8px 10px; cursor: pointer; white-space: nowrap; }
.sort:hover { color: var(--text); }
.sort.on { color: var(--text); }
.sort .arrow { display: inline-block; width: 1em; font-size: 9px; margin-left: 3px; color: var(--series-1); }
th.mult, td.mult { background: color-mix(in srgb, var(--series-1) 4%, transparent); }
table.comps tr.row { cursor: pointer; }
table.comps tr.row:hover td { background: var(--surface-2); }
table.comps tr.pinned td:first-child { box-shadow: inset 3px 0 0 var(--series-1); }
table.comps tr.target td { background: color-mix(in srgb, var(--target) 10%, transparent); font-weight: 600; }
table.comps tr.stat td { background: var(--surface-2); font-weight: 600; }
table.comps tr.stat + tr.stat td { font-weight: 500; }
table.comps tr.row + tr.stat td, table.comps tr.detail + tr.stat td, table.comps tr.target + tr.stat td { border-top: 2px solid var(--border); }
table.comps td.name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.comps td .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
td.outlier { color: var(--muted); text-decoration: line-through; }
.chip { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-2); font-weight: 500; }
.chip.l0 { border-color: var(--series-1); color: var(--link); }
.sub .chip { margin-left: 6px; padding: 0 5px; }
.chip.pinned { border-color: var(--series-1); color: var(--link); }
.chip.out { border-color: var(--warning-ink); color: var(--warning-ink); background: var(--warning-bg); }
.score { display: inline-flex; align-items: center; gap: 6px; }
.score .track { width: 54px; height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.score .fill { display: block; width: 0; height: 100%; background: var(--series-1); border-radius: 3px; }
.score.stab .track { width: 40px; }
.icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0; vertical-align: middle; }
.icon:hover { background: var(--surface-2); color: var(--text); }
.icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.icon.expand svg { transition: transform .12s; }
.icon.expand[aria-expanded="true"] svg { transform: rotate(90deg); }
.icon.pin.on { color: var(--series-1); }
.icon.pin.on svg { fill: currentColor; }
.icon.strike:hover { color: var(--critical); }

tr.detail td { background: var(--surface-2); text-align: left; white-space: normal; padding: 12px 0; }
/* The row spans the whole (wide) table; keep its content in the visible part of the scroller. */
.detail-body { position: sticky; left: 0; width: 100cqw; padding: 0 16px; }
.why { margin-bottom: 10px; font-size: 12.5px; line-height: 1.45; }
.breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.breakdown h4 { margin: 0 0 8px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.drv { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.drv .track { height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.drv .fill { display: block; width: 0; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.drv .pct { text-align: right; color: var(--text-2); }
table.mini { border-collapse: collapse; width: 100%; font-size: 12px; }
table.mini td, table.mini th { padding: 3px 6px; text-align: right; border-bottom: 1px solid var(--grid); }
table.mini td:first-child, table.mini th:first-child { text-align: left; }

table.list { border-collapse: collapse; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.list th { text-align: right; font-weight: 600; color: var(--text-2); padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
table.list td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; vertical-align: top; }
table.list th.l, table.list td.l { text-align: left; }
table.list td.wide { white-space: normal; min-width: 180px; max-width: 420px; }
table.list td.msg { color: var(--muted); white-space: normal; padding: 16px; }
table.list .sub { display: block; font-size: 11.5px; color: var(--muted); }
table.list .notes { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 4.5em; overflow: hidden; }
table.list tr.current td { background: color-mix(in srgb, var(--series-1) 8%, transparent); }
.link.strong { font-size: 13px; font-weight: 600; text-align: left; overflow-wrap: anywhere; }

/* --------------------------------------------------------------- heatmap */
.heat-wrap { padding: 12px 16px 14px; }
table.heatmap { border-collapse: separate; border-spacing: 2px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
table.heatmap th { font-weight: 500; color: var(--text-2); padding: 2px 6px; }
table.heatmap thead th { vertical-align: bottom; text-align: center; max-width: 84px; white-space: normal; line-height: 1.2; }
table.heatmap tbody th { text-align: right; white-space: nowrap; }
table.heatmap td { width: 54px; min-width: 46px; height: 32px; text-align: center; border-radius: 3px; color: #14171c; }
table.heatmap td.ink-light { color: #ffffff; }
table.heatmap td.cell:hover { outline: 2px solid var(--text); outline-offset: -1px; }
table.heatmap td.void { background: none; }
.heat-legend { margin-top: 10px; max-width: 260px; font-size: 11px; color: var(--muted); }
.lg-strip { display: flex; gap: 2px; }
.lg-strip span { flex: 1; height: 10px; border-radius: 2px; }
.lg-labels { display: flex; justify-content: space-between; margin-top: 3px; }

.method { padding: 12px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 24px; font-size: 12.5px; overflow-wrap: anywhere; }
.method div b { display: block; color: var(--text-2); font-weight: 600; font-size: 11.5px; }
.method .full { grid-column: 1 / -1; color: var(--muted); line-height: 1.5; }

.tooltip { position: fixed; z-index: 50; pointer-events: none; max-width: 320px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-variant-numeric: tabular-nums; line-height: 1.45; }
.tooltip b { display: block; margin-bottom: 3px; }

dialog { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); width: min(460px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h3 { font-size: 16px; margin-bottom: 6px; }
dialog a { color: var(--link); display: block; margin: -4px 0 12px; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.spacer { flex: 1; }

@media (max-width: 1180px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { display: block; height: auto; }
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .sidebar, .main { grid-row: auto; grid-column: 1; }   /* stacked after the plan notice */
  .plan-notice { padding: 8px 16px; }
  .sidebar { overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
  .main { overflow: visible; padding: 16px; }
  .breakdown { grid-template-columns: minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px; }
  .views { order: 3; flex-basis: 100%; }
  .top-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .providerbar { padding: 6px 16px; }
  .status { max-width: 100%; }
  .status-text { white-space: normal; }
  .result-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .ws-btn, .ws-switch { max-width: 44vw; }
  .drv { grid-template-columns: 100px 1fr 36px; }
  /* The message keeps the first row beside the close button; the wait and the action go below it. */
  .banner { flex-wrap: wrap; row-gap: 6px; }
  .banner-msg { flex-basis: calc(100% - 40px); }
  .banner-wait, .banner-act { order: 1; }
  .checks.stack { grid-template-columns: 1fr; }
}
