:root {
  color-scheme: light;
  --page: #f9fafb;
  --card: #ffffff;
  --card-hover: #f9fafb;
  --ink: #111827;
  --ink-2: #4b5563;
  --muted: #9ca3af;
  --line: #e5e7eb;
  --line-soft: #f3f4f6;
  --accent: #4f46e5;
  --accent-ink: #4338ca;
  --accent-wash: rgba(99, 102, 241, 0.10);
  --accent-wash-2: rgba(99, 102, 241, 0.18);
  --bar: rgba(99, 102, 241, 0.11);
  --band: rgba(99, 102, 241, 0.13);
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 1px 3px rgba(17, 24, 39, 0.04);
  --shadow-pop: 0 10px 30px rgba(17, 24, 39, 0.14), 0 2px 6px rgba(17, 24, 39, 0.06);
  --good: #0a7d0a;
  --bad: #c53030;
  --sev-critical: #d03b3b;
  --sev-high: #ec835a;
  --sev-medium: #fab219;
  --sev-low: #9ca3af;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f1115;
    --card: #181b21;
    --card-hover: #1f232a;
    --ink: #f3f4f6;
    --ink-2: #c3c7cf;
    --muted: #7b818c;
    --line: #2a2f37;
    --line-soft: #22262d;
    --accent: #818cf8;
    --accent-ink: #a5b4fc;
    --accent-wash: rgba(129, 140, 248, 0.14);
    --accent-wash-2: rgba(129, 140, 248, 0.24);
    --bar: rgba(129, 140, 248, 0.16);
    --band: rgba(129, 140, 248, 0.17);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 12px 34px rgba(0, 0, 0, 0.55);
    --good: #3ccf3c;
    --bad: #f07272;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1115;
  --card: #181b21;
  --card-hover: #1f232a;
  --ink: #f3f4f6;
  --ink-2: #c3c7cf;
  --muted: #7b818c;
  --line: #2a2f37;
  --line-soft: #22262d;
  --accent: #818cf8;
  --accent-ink: #a5b4fc;
  --accent-wash: rgba(129, 140, 248, 0.14);
  --accent-wash-2: rgba(129, 140, 248, 0.24);
  --bar: rgba(129, 140, 248, 0.16);
  --band: rgba(129, 140, 248, 0.17);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 12px 34px rgba(0, 0, 0, 0.55);
  --good: #3ccf3c;
  --bad: #f07272;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; min-width: 0; }
.brand .muted { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); flex: none; }
.top-right { display: flex; align-items: center; gap: 10px; }
.health { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.health .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.icon-btn { border: 0; background: transparent; color: var(--ink-2); padding: 6px; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

/* Controls */
.controls-bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(8px); }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.controls-right { display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 320px;
  padding: 5px 6px 5px 10px; border-radius: 8px; background: var(--card); box-shadow: var(--shadow);
  font-size: 13px; white-space: nowrap;
}
.chip .k { color: var(--muted); }
.chip .v { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.chip button { border: 0; background: transparent; color: var(--muted); padding: 0 4px; border-radius: 4px; line-height: 1; font-size: 15px; }
.chip button:hover { color: var(--ink); background: var(--line-soft); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; border: 0;
  background: var(--card); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--card-hover); }
.btn.ghost { box-shadow: none; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn.primary { background: var(--accent); color: #fff; }
.link-btn { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 2px 4px; border-radius: 4px; }
.link-btn:hover { color: var(--accent-ink); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--card); box-shadow: var(--shadow); }
.seg button { border: 0; background: transparent; padding: 3px 10px; border-radius: 6px; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: var(--accent-wash-2); color: var(--accent-ink); font-weight: 600; }

/* Dropdowns / popovers */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px;
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; border: 1px solid var(--line);
}
.menu.left { left: 0; right: auto; }
.menu button.item {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; border: 0;
  background: transparent; padding: 7px 10px; border-radius: 6px; text-align: left; font-size: 13.5px;
}
.menu button.item:hover, .menu button.item.active { background: var(--line-soft); }
.menu .kbd { color: var(--muted); font-size: 12px; }
.menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu .custom { display: flex; gap: 6px; align-items: center; padding: 6px 8px; flex-wrap: wrap; }
.menu input[type="date"], .input {
  padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--page); font-size: 13px;
}
.search-pop { width: min(420px, calc(100vw - 32px)); }
.search-pop .input { width: 100%; padding: 8px 10px; font-size: 14px; }
.search-results { max-height: 360px; overflow: auto; margin-top: 6px; }
.search-results .group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.search-results .item .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Cards */
main { padding-bottom: 40px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 16px; position: relative; }
.loading .card, .card.loading { opacity: .55; transition: opacity .2s; }
.error { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--sev-critical) 12%, var(--card)); color: var(--ink); white-space: pre-wrap; font-size: 13px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 1px solid var(--line-soft); }
.kpi { border: 0; background: transparent; text-align: left; padding: 16px 18px 14px; position: relative; min-width: 0; }
.kpi:hover { background: var(--card-hover); }
.kpi:first-child { border-top-left-radius: var(--radius); }
.kpi:last-child { border-top-right-radius: var(--radius); }
.kpi .label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .val { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.kpi .big { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.kpi.on .label { color: var(--accent-ink); }
.kpi.on::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.delta { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--muted); }
.sev-mini { display: flex; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.sev-mini span { display: inline-flex; align-items: center; gap: 4px; }

/* Main chart */
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px 0; flex-wrap: wrap; }
.chart-title { font-size: 13px; color: var(--ink-2); }
.chart-title strong { color: var(--ink); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key-line { width: 14px; height: 2px; border-radius: 2px; background: var(--accent); display: inline-block; }
.key-dash { width: 14px; height: 0; border-top: 2px dashed var(--ink); display: inline-block; }
.key-band { width: 14px; height: 10px; border-radius: 3px; background: var(--band); display: inline-block; }
.key-sq { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { position: relative; height: 300px; padding: 4px 8px 8px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 13px; }
svg .grid line { stroke: var(--line-soft); }
svg .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg .baseline { stroke: var(--line); }
svg .crosshair { stroke: var(--muted); stroke-width: 1; }
svg .day-hl { fill: var(--accent-wash); }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none; min-width: 160px; max-width: 300px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-pop); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px;
}
.tooltip .t-date { color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .t-row .l { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tooltip .t-row b { font-variant-numeric: tabular-nums; }
.tooltip .t-note { margin-top: 4px; color: var(--muted); font-size: 11.5px; }

/* Breakdown cards */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.breakdown { display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 6px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 3px 8px; border-radius: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent-ink); background: var(--accent-wash); font-weight: 600; }
.list-head { display: flex; justify-content: space-between; padding: 6px 16px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.list { padding: 0 8px; flex: 1; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; padding: 0 8px; height: 34px; border-radius: 6px; text-align: left; position: relative;
}
.row:hover { background: var(--card-hover); }
.row .bar { position: absolute; left: 0; top: 3px; bottom: 3px; background: var(--bar); border-radius: 5px; transition: width .25s; }
.row .name { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: 8px; font-size: 13.5px; }
.row .name .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name .sub { color: var(--muted); font-size: 12px; white-space: nowrap; }
.row .vals { position: relative; display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 600; }
.row .vals .delta { font-size: 11.5px; min-width: 46px; text-align: right; }
.row:hover .open { opacity: 1; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; height: 18px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--line-soft); color: var(--ink-2); white-space: nowrap; flex: none;
}
.badge .dot { width: 6px; height: 6px; }
.badge.new { background: var(--accent-wash); color: var(--accent-ink); }
.badge.paused { background: color-mix(in srgb, var(--sev-medium) 22%, transparent); color: var(--ink); }
.card-foot { display: flex; justify-content: center; padding: 6px 0 12px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* Profile */
.profile-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; padding: 4px 16px 16px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 13px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.sub-title { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--ink); }
th.sorted { color: var(--accent-ink); }
th .arr { font-size: 10px; margin-left: 2px; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th.r, td.r { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--card-hover); }
td .main { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
td .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.sev { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-transform: capitalize; white-space: nowrap; }

/* Anomalies */
.anom-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 16px 10px; flex-wrap: wrap; }
.anom-tools .left, .anom-tools .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 12.5px; color: var(--ink-2); }
.toggle.on { border-color: transparent; background: var(--accent-wash-2); color: var(--accent-ink); font-weight: 600; }
.toggle .n { color: var(--muted); font-weight: 500; }
.anom-tools .input { width: 220px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 14px; font-size: 12.5px; color: var(--muted); }

/* Drawer + modal */
.scrim { position: fixed; inset: 0; background: rgba(15, 17, 21, 0.32); z-index: 45; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); z-index: 50; background: var(--page);
  box-shadow: var(--shadow-pop); transform: translateX(102%); transition: transform .22s ease; overflow-y: auto;
}
.drawer.open { transform: none; }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 12px; background: var(--page); border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 4px 0 2px; font-size: 18px; overflow-wrap: anywhere; }
.drawer-body { padding: 4px 20px 30px; }
.drawer .card { margin-top: 14px; }
.drawer .card-pad { padding: 14px 16px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat .label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat .big { font-size: 20px; font-weight: 700; margin-top: 2px; }
.stat .small { font-size: 12px; color: var(--muted); }
.hint { padding: 12px 14px; border-radius: 8px; background: var(--accent-wash); font-size: 13.5px; }
.mini-chart { height: 190px; position: relative; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.timeline { display: flex; gap: 3px; flex-wrap: wrap; }
.timeline span { width: 14px; height: 14px; border-radius: 3px; background: var(--line-soft); }
.modal { position: fixed; inset: 0; z-index: 55; display: grid; place-items: start center; padding: 6vh 16px; background: rgba(15, 17, 21, 0.32); overflow-y: auto; }
.modal-box { width: min(1000px, 100%); background: var(--card); border-radius: 12px; box-shadow: var(--shadow-pop); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 18px 10px; flex-wrap: wrap; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal .table-wrap { max-height: 70vh; overflow: auto; }
.modal thead th { position: sticky; top: 0; background: var(--card); }

.foot { padding: 24px 0 0; font-size: 12px; text-align: center; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-top-right-radius: var(--radius); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .profile-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .brand .muted, .health .extra { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 12px 14px; }
  .kpi .big { font-size: 20px; }
  .chart { height: 240px; }
  .anom-tools .input { width: 100%; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Categorical palette (reference instance, validated light / dark) + comparison line + diverging scale */
:root {
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300; --c7: #6250d6;
  --c-other: #c9ccd2; --ghost: #9ca3af;
  --div-neg: #d03b3b; --div-pos: #2a78d6; --div-mid: #f0efec;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9;
    --c-other: #4b5058; --ghost: #6b7280;
    --div-neg: #e66767; --div-pos: #3987e5; --div-mid: #2c2f35;
  }
}
:root[data-theme="dark"] {
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9;
  --c-other: #4b5058; --ghost: #6b7280;
  --div-neg: #e66767; --div-pos: #3987e5; --div-mid: #2c2f35;
}
.key-ghost { width: 14px; height: 0; border-top: 2px dotted var(--ghost); display: inline-block; }
.card-head .sub-head { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-head .head-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tabs.boxed { background: var(--line-soft); border-radius: 8px; padding: 2px; }
.tabs.boxed button.on { background: var(--card); box-shadow: var(--shadow); }
.note-btn { border: 0; background: transparent; color: var(--accent-ink); padding: 0; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Needs attention */
.attention-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 8px 24px; padding: 0 16px 16px; }
.attention-body .chart { height: 230px; padding: 0; }
.panel-title { font-size: 12.5px; color: var(--ink-2); margin: 4px 0 8px; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-title strong { color: var(--ink); }
.hbars { display: flex; flex-direction: column; gap: 2px; }
.hbar { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 36px; gap: 10px; align-items: center; border: 0; background: transparent; padding: 4px 6px; border-radius: 6px; text-align: left; font-size: 13px; }
.hbar:hover { background: var(--card-hover); }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { display: flex; gap: 2px; height: 14px; }
.hbar .track span { height: 100%; min-width: 2px; }
.hbar .track span:last-child { border-radius: 0 4px 4px 0; }
.hbar .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.summary { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 16px 12px; font-size: 13px; color: var(--ink-2); }
.summary b { color: var(--ink); }

/* Heatmap */
.heat-wrap { overflow-x: auto; padding: 4px 16px 6px; }
.heat { display: grid; gap: 2px; min-width: 560px; }
.heat .rl { border: 0; background: transparent; text-align: left; font-size: 12.5px; padding: 0 8px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); height: 24px; }
.heat .rl:hover { color: var(--accent-ink); }
.heat .cell { height: 24px; border-radius: 3px; border: 0; padding: 0; background: var(--div-mid); cursor: pointer; }
.heat .cell:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.heat .cell.na { background: transparent; box-shadow: inset 0 0 0 1px var(--line-soft); cursor: default; }
.heat .cell.sel { outline: 2px solid var(--accent); outline-offset: -1px; }
.heat .cl { font-size: 10.5px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; height: 16px; }
.heat .tot { font-size: 12px; color: var(--muted); text-align: right; padding-left: 8px; font-variant-numeric: tabular-nums; height: 24px; line-height: 24px; white-space: nowrap; }
.scale { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); padding: 6px 16px 14px; flex-wrap: wrap; }
.scale .ramp { width: 160px; height: 8px; border-radius: 4px; }

/* Composition */
.comp-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; padding: 0 16px 8px; }
.comp-body .chart { height: 240px; padding: 0; }
.legend.clickable button { border: 0; background: transparent; display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: 6px; font-size: 12px; color: var(--ink-2); }
.legend.clickable button:hover { background: var(--line-soft); color: var(--ink); }
.legend-row { padding: 2px 10px 14px; }

@media (max-width: 900px) {
  .attention-body, .comp-body { grid-template-columns: minmax(0, 1fr); }
}
.hnote { font-size: 12px; color: var(--muted); padding: 6px; }
.hbar.wide { grid-template-columns: 110px minmax(0, 1fr) 72px; }

/* Drawer: where to investigate */
.card-head-inline { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.card-head-inline .sub-title { margin: 0; }
.where-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(40px, 1fr) 64px 64px 44px; gap: 10px; align-items: center; width: 100%; border: 0; background: transparent; padding: 5px 6px; border-radius: 6px; text-align: left; font-size: 13px; }
button.where-row:hover { background: var(--card-hover); }
.where-row .lbl { display: flex; flex-direction: column; min-width: 0; }
.where-row .lbl .sub { color: var(--muted); font-size: 11.5px; }
.where-row .track { display: block; height: 10px; }
.where-row .bar { display: block; height: 100%; border-radius: 3px; min-width: 2px; }
.where-row .r { text-align: right; font-variant-numeric: tabular-nums; }
.where-row .strong { font-weight: 650; }
.where-head { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-bottom: 2px; }
@media (max-width: 560px) { .where-row { grid-template-columns: minmax(0, 1.4fr) 0 56px 56px 40px; } .where-row .track { display: none; } }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--card); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 28px 28px 26px; }
.login-card h1 { margin: 18px 0 2px; font-size: 22px; letter-spacing: -.01em; }
.login-card p { margin: 0 0 18px; font-size: 13px; }
.login-card form { display: flex; flex-direction: column; gap: 6px; }
.login-card label { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.login-card .input { width: 100%; padding: 9px 11px; font-size: 14.5px; }
.login-card .input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.login-card .pw { position: relative; }
.login-card .pw .input { padding-right: 62px; }
.login-card .pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.login-card .btn.primary { justify-content: center; margin-top: 16px; padding: 9px 12px; font-size: 14px; }
.login-card .btn:disabled { opacity: .6; cursor: default; }
.login-error { margin-top: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; background: color-mix(in srgb, var(--sev-critical) 12%, var(--card)); }
.account-btn { gap: 4px; align-items: center; padding: 3px 6px 3px 3px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-wash-2); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.account-menu { min-width: 180px; }
.menu-user { display: flex; flex-direction: column; padding: 6px 10px; font-size: 13px; overflow-wrap: anywhere; }
.menu-user .muted { font-size: 11.5px; }
.share { color: var(--muted); font-weight: 500; font-size: 12px; min-width: 40px; text-align: left; }
.row .vals .share { margin-left: -4px; }
.menu-user .badge { align-self: flex-start; margin-top: 4px; }
