/* Design tokens (spec 5.10, less-to-read spec 2), chart chrome, and the page shell (layout, filter chips, views). */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --card: #ffffff;
  --page: #f7f6f3;
  --line: #e7e5e0;
  --chip: #f2f1ec;
  --ink-1: #1a1a19;
  --ink-2: #5f5e5a;
  --ink-3: #6b6a65;
  --accent: #1d4ed8;
  --accent-soft: #e8eefb;
  --failing: #b42318;
  --waiting: #b54708;
  --running: #067647;
  --ended: #8a8984;
  --pill-bg: #fff8e1;
  --pill-line: #f2c94c;
  --pill-ink: #7a4b00;
  --surface-1: var(--card);
  --border: var(--line);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --seq-100: #cde2fb;
  --seq-150: #b7d3f6;
  --seq-200: #9ec5f4;
  --seq-250: #86b6ef;
  --seq-300: #6da7ec;
  --seq-350: #5598e7;
  --seq-400: #3987e5;
  --seq-450: #2a78d6;
  --seq-500: #256abf;
  --seq-550: #1c5cab;
  --seq-600: #184f95;
  --seq-650: #104281;
  --seq-700: #0d366b;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Dark: the same block under both scopes. The sequential ramp runs the other way so the step for "near zero"
   still recedes toward the surface. The chart status colours are fixed in both modes; the state colours (failing,
   waiting, running, ended) and the accent are lifted to read on the dark card. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --card: #1a1a19;
    --page: #0d0d0d;
    --line: rgba(255, 255, 255, 0.10);
    --chip: #2a2a28;
    --ink-1: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #8a897f;
    --accent: #6ea2f5;
    --accent-soft: #1c2a44;
    --failing: #f97066;
    --waiting: #f79009;
    --running: #47cd89;
    --ended: #8a8984;
    --pill-bg: #3a2c0c;
    --pill-line: #8a6a1c;
    --pill-ink: #fdd78a;
    --grid: #2c2c2a;
    --axis: #383835;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --seq-100: #0d366b;
    --seq-150: #104281;
    --seq-200: #184f95;
    --seq-250: #1c5cab;
    --seq-300: #256abf;
    --seq-350: #2a78d6;
    --seq-400: #3987e5;
    --seq-450: #5598e7;
    --seq-500: #6da7ec;
    --seq-550: #86b6ef;
    --seq-600: #9ec5f4;
    --seq-650: #b7d3f6;
    --seq-700: #cde2fb;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --card: #1a1a19;
  --page: #0d0d0d;
  --line: rgba(255, 255, 255, 0.10);
  --chip: #2a2a28;
  --ink-1: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #8a897f;
  --accent: #6ea2f5;
  --accent-soft: #1c2a44;
  --failing: #f97066;
  --waiting: #f79009;
  --running: #47cd89;
  --ended: #8a8984;
  --pill-bg: #3a2c0c;
  --pill-line: #8a6a1c;
  --pill-ink: #fdd78a;
  --grid: #2c2c2a;
  --axis: #383835;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --seq-100: #0d366b;
  --seq-150: #104281;
  --seq-200: #184f95;
  --seq-250: #1c5cab;
  --seq-300: #256abf;
  --seq-350: #2a78d6;
  --seq-400: #3987e5;
  --seq-450: #5598e7;
  --seq-500: #6da7ec;
  --seq-550: #86b6ef;
  --seq-600: #9ec5f4;
  --seq-650: #b7d3f6;
  --seq-700: #cde2fb;
}

/* ---- chart chrome */

.chart { position: relative; font-family: var(--font); color: var(--ink-1); }
.chart .plot { position: relative; }
.chart-svg { display: block; max-width: 100%; height: auto; }
.chart-svg text, .spark text, .meter text, .tile text { font: 12px var(--font); }
.chart-svg text { font-variant-numeric: tabular-nums; }
.chart-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart .crosshair { pointer-events: none; }
.chart .mark { transition: opacity 0.1s; }
.chart .mark.on { opacity: 0.75; }
.chart .cell.on { stroke: var(--ink-1); stroke-width: 1; }
.chart-svg:focus-visible .mark.on { stroke: var(--ink-1); stroke-width: 1.5; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.chart-bar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.chart-toggle {
  font: 12px var(--font); color: var(--ink-2); background: transparent;
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; cursor: pointer;
}
.chart-toggle:hover { color: var(--ink-1); }
.chart-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; padding: 0;
  font-size: 12px; color: var(--ink-2);
}
.legend li { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.legend .key { flex: none; }

.tooltip {
  position: absolute; z-index: 2; pointer-events: none; white-space: nowrap;
  background: var(--surface-1); color: var(--ink-1); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); padding: 6px 8px; font-size: 12px; line-height: 1.5;
}
.tooltip .tip-head { color: var(--ink-2); }
.tooltip .tip-row { display: flex; align-items: center; gap: 6px; }
.tooltip .tip-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip .tip-row span { color: var(--ink-2); }
.tooltip .tip-key { flex: none; width: 10px; height: 2px; border-radius: 1px; }

.chart .scroll { overflow-x: auto; }
.chart table { border-collapse: collapse; width: 100%; font-size: 12px; }
.chart th {
  text-align: left; font-weight: 600; color: var(--ink-2); padding: 4px 8px; border-bottom: 1px solid var(--axis);
  white-space: nowrap;
}
.chart td { padding: 4px 8px; color: var(--ink-1); border-bottom: 1px solid var(--grid); }
.chart td.num, .chart th.num { text-align: right; }

.spark { display: block; overflow: visible; }
.meter { display: block; overflow: visible; }
.meter .meter-label { font-size: 13px; font-weight: 600; }
.tile { display: block; overflow: visible; }
.tile .tile-label { font-size: 13px; }
.tile .tile-value { font-size: 28px; font-weight: 700; }

/* ---- page shell. Type scale: spec 2. */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0; background: var(--page); color: var(--ink-1); font: 14px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}
/* Not on body: Inter's tnum also widens the hyphen and other punctuation, so names would look spaced. Chart text
   needs its own selector at least as specific as the `font` shorthand above, which resets it. */
.num, .tile text, .meter .meter-value, .need-age, .job-age, .bar-value, .ph-meter .meta, .act-fig, .act-cover, .act-impact,
.act-cost, .cbar-value, .cache-figure, .sup-figure, .usage-pct, .ctx-num { font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 600; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex: none; vertical-align: -4px; }

.top {
  position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line);
}
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; padding: 0 24px; min-width: 0; }
.top h1 { font-size: 16px; font-weight: 600; flex: none; }
.top h1 a { color: var(--ink-1); text-decoration: none; }
.views { display: flex; gap: 0 18px; min-width: 0; }
.views a {
  padding: 16px 0 14px; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.views a:hover { color: var(--ink-1); }
.views a[aria-current="page"] { color: var(--ink-1); font-weight: 600; border-bottom-color: var(--accent); }
.top-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; padding: 10px 0; min-width: 0;
}
.help-link { font-size: 13px; color: var(--ink-2); padding: 6px 4px; text-decoration: none; }
.help-link:hover { color: var(--ink-1); }

/* A chip shows its select's chosen option (app.js fills .fchip-value); the select lies over it, invisible, so a
   click or a tap opens the native list. */
.filters { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.fchip, .pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; max-width: 220px;
  font: 13px var(--font); color: var(--ink-1); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; white-space: nowrap; text-decoration: none; cursor: pointer;
}
.fchip:hover, .pill:hover { border-color: var(--axis); }
.fchip-value { overflow: hidden; text-overflow: ellipsis; }
.fchip-value::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 2px 2px 8px;
  border: solid var(--ink-3); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.fchip select {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; opacity: 0; cursor: pointer;
  border: 0; padding: 0; margin: 0;
}
.fchip:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.fchip:has(select:disabled) { opacity: 0.5; cursor: default; }
.fchip.search { cursor: text; max-width: 260px; }
.fchip.time { max-width: 300px; }  /* "Oct 26 09:00 to Oct 27 09:00" */
.range-custom {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 6; display: grid; gap: 10px; padding: 12px;
  max-width: calc(100vw - 32px); font-size: 13px; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.range-form, .range-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range-form input[type="number"] { width: 96px; }
.range-error { margin: 0; color: var(--failing); }
.fchip.search input { border: 0; background: transparent; padding: 0; min-height: 0; width: 180px; outline: none; }
.pill[aria-pressed="true"] { background: var(--ink-1); border-color: var(--ink-1); color: var(--card); }
.pill.needs { background: var(--pill-bg); border-color: var(--pill-line); color: var(--pill-ink); font-weight: 600; }
.tag {
  display: inline-block; font-size: 12px; color: var(--ink-2); background: var(--chip); border-radius: 6px;
  padding: 2px 8px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.link-btn { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.st-failing { color: var(--failing); }
.st-waiting { color: var(--waiting); }
.st-running { color: var(--running); }
.st-ended { color: var(--ink-2); }
.st-ended .icon { color: var(--ended); }
#open-filters { display: none; }

select, input[type="search"], input[type="number"], input[type="text"], input[type="email"], input[type="datetime-local"],
.btn {
  font: 13px var(--font); color: var(--ink-1); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; min-height: 30px; max-width: 100%;
}
select { max-width: 220px; }
.btn { cursor: pointer; }
.btn:hover { border-color: var(--axis); }
select:disabled { opacity: 0.5; }

#sheet {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-1); padding: 16px;
  width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 12px 12px 0 0;
}
#sheet::backdrop { background: rgba(0, 0, 0, 0.4); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
#sheet .filters { flex-direction: column; align-items: stretch; gap: 12px; }
#sheet .fchip { max-width: none; min-height: 40px; }
#sheet .fchip.search input { width: 100%; }
#sheet .range-custom { position: static; box-shadow: none; }

#down {
  margin: 12px max(24px, calc((100% - 1160px) / 2)) 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--failing);
  background: var(--card); color: var(--ink-1);
}
#down::before { content: "Down: "; font-weight: 600; color: var(--failing); }
#billing, #range-note {
  margin: 12px max(24px, calc((100% - 1160px) / 2)) 0; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--status-critical); background: var(--card); color: var(--ink-1);
}
#range-note { border-color: var(--line); }

main, .help { display: block; padding: 24px; max-width: 1208px; margin: 0 auto; min-width: 0; }  /* 1160 + gutters */
.stale { color: var(--ink-2); font-size: 13px; margin: 0 0 12px; }

.help { padding-top: 8px; padding-bottom: 32px; color: var(--ink-2); font-size: 13px; outline: none; }  /* focused by script on open */
.help-head {
  display: flex; align-items: center; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--line);
}
.help h2 { color: var(--ink-1); }
.help h3 { margin: 16px 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-1); }
.help code { font-size: 12px; overflow-wrap: anywhere; }
.help ul { padding-left: 18px; }
#help, #stored { scroll-margin-top: 120px; }  /* under the sticky bar, also when its chips wrap */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px;
  min-width: 0;
}
.card > h2 { margin-bottom: 8px; }
.card p { margin: 6px 0; }
.note { color: var(--ink-2); font-size: 13px; }
.note:empty { display: none; }
.check { display: flex; align-items: center; gap: 8px; }
.fields { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.fields label { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
ul.plain { margin: 6px 0; padding-left: 18px; }

.scroll { overflow-x: auto; max-width: 100%; }
.scroll table { border-collapse: collapse; width: 100%; font-size: 14px; }
.scroll th {
  text-align: left; font-size: 12px; font-weight: 400; color: var(--ink-3); padding: 6px 8px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.scroll td { padding: 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.explore-table .scroll { max-height: 60vh; overflow-y: auto; }
.explore-table th { position: sticky; top: 0; background: var(--surface-1); }

.state::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.state-ok::before { background: var(--status-good); }
.state-quiet::before { background: var(--status-warning); }
.state-gone::before { background: var(--status-critical); }
.state-idle::before { background: var(--ended); }

.settings {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start;
}

/* ---- Fleet (the board page's parts) and Org */

.fleet, .org { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.fleet .meta, .fleet .note { color: var(--ink-2); font-size: 12px; }
.fleet h3 { margin: 0; font-size: 14px; }
.hot { color: var(--status-critical); font-weight: 600; }
.calm { color: var(--ink-2); }
.dim { opacity: 0.6; }
.warn, .alarm { color: var(--status-critical); font-weight: 600; }
.chip {
  display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.35; padding: 0 5px; margin-right: 2px;
  border: 1px solid currentColor; border-radius: 4px; white-space: nowrap; vertical-align: 1px;
}
.chip.s-red { color: var(--status-critical); }
.chip.s-amber { color: var(--ink-1); border-color: var(--status-warning); box-shadow: inset 3px 0 0 var(--status-warning); }
.chip.s-green, .chip.s-blue, .chip.s-grey { color: var(--ink-2); font-weight: 500; border-color: var(--axis); }
.chip.who { border-style: dotted; font-weight: 500; color: var(--ink-2); }
.feeds { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--ink-2); font-size: 12px; }
.feed.bad { color: var(--status-critical); font-weight: 600; }
.band.some { box-shadow: inset 4px 0 0 var(--status-critical); }
.band.none { color: var(--ink-2); }
.band p { margin: 0; }
.btn.att-dismiss { flex: none; font-size: 12px; padding: 0 6px; min-height: 22px; color: var(--ink-2); }
.controls { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 12px; }
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; } .seg .btn:first-child { border-radius: 6px 0 0 6px; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.btn[aria-pressed="true"] { border-color: var(--ink-1); font-weight: 600; }
.fleet .tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fleet .tools .btn { font-size: 12px; padding: 0 6px; min-height: 22px; color: var(--ink-2); }
.fold-btn { min-width: 26px; padding: 0 6px; min-height: 24px; }
.user-section { display: block; }
.user-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin-bottom: 8px; }
.project { padding: 8px 0; border-top: 1px solid var(--grid); min-width: 0; }
.user-head + .project, .project.by-project { border-top: 0; }
.project.by-project { padding: 14px 16px; margin-bottom: 12px; }
.project-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.project-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.project-name { overflow-wrap: anywhere; }
.project.calm .project-name { font-weight: 500; color: var(--ink-2); }
.facts { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.contrib { margin-top: 8px; padding-left: 8px; border-left: 2px solid var(--grid); }
.contrib-name { font-size: 12px; color: var(--ink-2); }
.group { margin-top: 12px; }
.group-name { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.group-name.hot { color: var(--status-critical); }
.job { padding: 4px 0; }
.job-title, .clamp { overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.pbar { display: block; height: 4px; margin: 3px 0 2px; border-radius: 2px; overflow: hidden; }
.pbar .bar-track { fill: var(--grid); }
.pbar .bar-fill { fill: var(--ink-3); }
.pbar .bar-fill.s-red-fill { fill: var(--status-critical); }
.pbar .bar-fill.s-amber-fill { fill: var(--status-warning); }
.pbar .bar-fill.s-green-fill { fill: var(--ink-2); }
.pbar.usage-bar { height: 8px; border-radius: 4px; }
.pbar.usage-bar .bar-fill { fill: var(--accent); }
.fleet td.main { width: 100%; min-width: 0; }
.scroll td.num, .scroll th.num { text-align: right; white-space: nowrap; }
.org .scroll td { white-space: nowrap; overflow-wrap: normal; }
.fleet .scroll td, .settings .scroll td { overflow-wrap: break-word; }  /* a host or path breaks between words; the table scrolls instead */
.fleet tr.agent td.main { padding-left: 22px; }
.fleet tr.agent td { border-bottom-style: dotted; }
.fleet .split-col { display: none; }
.fleet .split .split-col { display: table-cell; }
.fleet tr.toggle { cursor: pointer; }
.fleet tr.toggle:hover td { background: var(--page); }
.fleet details { margin-top: 4px; }
.fleet summary { cursor: pointer; color: var(--ink-2); padding: 4px 0; }
.pending { padding: 4px 0; overflow-wrap: anywhere; }
.pending-q { font-weight: 600; }
.archived-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 4px 0; color: var(--ink-2); }
.usage-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; margin-top: 4px; }
.usage-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; }
.usage-name { font-weight: 600; }
.fleet-hosts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 12px; align-items: start; }
#fleet-health, #fleet-installs { grid-column: 1 / -1; }
.ctx { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0 8px; font-size: 12px; cursor: auto; }
.ctx-head { flex: 1 1 100%; font-weight: 600; }
.ctx-left { flex: 0 1 300px; min-width: 0; }
.ctx-grid { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; width: 100%; max-width: 300px; }
.ctx-cell { aspect-ratio: 1; border-radius: 2px; }
.k-overhead { background: var(--ink-3); } .k-t1 { background: var(--series-1); } .k-t2 { background: var(--series-2); }
.k-t3 { background: var(--series-3); } .k-t4 { background: var(--series-4); } .k-text { background: var(--series-5); }
.k-other { background: var(--axis); } .k-free { background: transparent; box-shadow: inset 0 0 0 1px var(--grid); }
.ctx-legend { flex: 1 1 260px; min-width: 0; }
.ctx-key { display: flex; gap: 6px; align-items: baseline; padding: 1px 0; }
.ctx-swatch { flex: none; width: 10px; height: 10px; border-radius: 2px; align-self: center; }
.ctx-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ctx-num { flex: none; text-align: right; white-space: pre; }
.spark-bars { display: block; max-width: 300px; margin-top: 8px; border-bottom: 1px solid var(--grid); }
.spark-bar { fill: var(--ink-3); }
.org-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 12px; }

/* ---- Overview */

.overview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.overview .meta { color: var(--ink-2); font-size: 13px; }
.overview .scroll td { white-space: nowrap; overflow-wrap: normal; }
.kpis { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.kpi { padding: 16px 18px; }

.needs-card { padding: 6px 20px; }
.needs-card h2 { padding: 12px 0 2px; }
.needs-card .note { margin: 10px 0; }
.needs-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 4px; font-size: 13px; }
.needs-legend { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 8px 0; padding: 10px 12px;
  background: var(--chip); border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.need-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 8px 10px 6px 0; }
.need-table td { padding: 12px 10px 12px 0; border-top: 1px solid var(--line); vertical-align: top; }
.need-table .need-group th { padding-top: 14px; font-size: 13px; color: var(--ink-1); border-top: 1px solid var(--line); }
.need-what { min-width: 0; }
.ph-account .meta, .headroom .num .meta, .ph-meter .meta { display: block; overflow-wrap: anywhere; }
.need-text { display: block; font-weight: 600; overflow-wrap: anywhere; }
.need-age { font-size: 13px; color: var(--ink-3); }
.need-open { white-space: nowrap; text-align: right; font-size: 13px; }
.need-open .btn { margin-left: 8px; }
.need-mute { margin-left: 8px; font-size: 12px; min-height: 22px; padding: 0 4px; color: var(--ink-2); }
.needs-muted { margin: 8px 0; font-size: 13px; color: var(--ink-2); }
.needs-muted summary { cursor: pointer; }
.needs-muted ul { list-style: none; padding-left: 0; }
.needs-muted li { margin: 4px 0; }

.headroom table { width: 100%; }
.headroom .scroll td { vertical-align: top; white-space: normal; }
.ph-name { display: block; max-width: 220px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-meter { min-width: 160px; }
.ph-meter.passed { opacity: 0.5; }
.ph-label { display: none; }  /* the column header, shown in the cell when a phone hides the header row */
.ph-bar { display: block; margin: 6px 0 4px; }
.ph-track { fill: var(--accent-soft); }
.ph-fill, .overview .bar-fill { fill: var(--accent); }

.bars {
  display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 1fr) auto; gap: 10px 14px; align-items: center;
  margin-top: 12px;
}
.bar-row { display: contents; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-line { display: block; }
.overview .bar-track { fill: var(--chip); }
.bar-value { text-align: right; white-space: nowrap; }
.spend-projects .note, .top-savings table + .note { margin: 12px 0 0; }
.top-savings table { width: 100%; }
.top-savings .scroll td { white-space: normal; }

.usage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.usage .controls { margin-bottom: 0; }
.usage-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 12px; }
.usage .scroll td { white-space: nowrap; overflow-wrap: normal; }
.usage .fields { margin-top: 12px; }
.usage h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.usage input[type="number"] { width: 7em; }

.efficiency { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.efficiency .meta { color: var(--ink-2); font-size: 12px; }
.efficiency .scroll td { white-space: nowrap; overflow-wrap: normal; }
.efficiency .scroll td.main { white-space: normal; min-width: 200px; overflow-wrap: anywhere; }
.efficiency h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.efficiency .slider { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0 8px; }
.efficiency .slider input { flex: 1 1 160px; max-width: 280px; margin: 0; }
.efficiency .btn[data-act="more"] { margin-top: 8px; }
.efficiency .recs > .btn[data-act="more"] { margin: 12px 20px; }
.efficiency .link { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.efficiency .link:hover { text-decoration: underline; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.headline { margin: 6px 0 0; color: var(--ink-2); }
.headline strong { color: var(--ink-1); font-weight: 600; }
.page-head .meta { margin: 0; font-size: 13px; }
.efficiency .recs { padding: 0; overflow: hidden; }
.efficiency .recs > .note { padding: 16px 20px; margin: 0; }
.act {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) 160px 110px; gap: 16px; align-items: start;
  padding: 18px 20px; border-top: 1px solid var(--line);
}
.act:first-child { border-top: 0; }
.act-icon { margin-top: 2px; color: var(--ink-3); }
.act-kind { display: inline-flex; }
.act-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.act-legend span { display: inline-flex; align-items: center; gap: 4px; }
.act-legend .act-icon { margin-top: 0; }
.act.priced .act-icon { color: var(--accent); }
.act-title { display: block; font-size: 16px; font-weight: 600; color: var(--ink-1); overflow-wrap: anywhere; }
button.act-title {
  display: inline-flex; align-items: flex-start; gap: 6px; font: inherit; font-size: 16px; font-weight: 600; text-align: left;
  color: var(--ink-1); background: none; border: 0; padding: 0; cursor: pointer;
}
button.act-title:hover { color: var(--accent); }
.act-title .chev { width: 16px; height: 16px; margin-top: 3px; color: var(--ink-3); transition: transform 0.15s; }
.act-title[aria-expanded="true"] .chev { transform: rotate(180deg); }
.efficiency .act-pattern { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-width: 0; }
.act-cover { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-2); padding-top: 2px; }
.act-impact { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: 12px; color: var(--ink-3); }
.act-impact .usd { font-size: 16px; font-weight: 600; color: var(--ink-1); }
.act-impact .none { font-size: 13px; padding-top: 2px; }
.act-items { margin-top: 12px; border-top: 1px solid var(--line); }
.act-items .note { margin: 8px 0 0; }
.act-line {
  display: grid; grid-template-columns: minmax(0, 1fr) 120px 110px 70px; gap: 12px; align-items: baseline;
  padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--line);
}
.act-who { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.act-who .link { min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-proj { min-width: 0; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-fig { max-width: 100%; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-cost { text-align: right; white-space: nowrap; }
.act-items .link-btn { font-size: 13px; padding: 8px 0 0; }
.support { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; align-items: start; }
.support > .card { grid-column: 1 / -1; }
.sup {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font: inherit; text-align: left; color: var(--ink-1);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; cursor: pointer; min-width: 0;
}
.sup:hover { border-color: var(--axis); }
.sup[aria-expanded="true"] { border-color: var(--accent); }
.sup-name { flex: 1 1 100%; font-size: 13px; color: var(--ink-2); }
.sup-figure { font-size: 16px; font-weight: 600; }
.sup-note { font-size: 13px; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.burn-account + .burn-account { margin-top: 12px; }

.activity { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.activity .scroll td { white-space: nowrap; overflow-wrap: normal; }
.activity .scroll td.main { white-space: normal; min-width: 160px; overflow-wrap: anywhere; }
.activity .edits .scroll { margin-top: 12px; }

.sessions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.sessions .meta { color: var(--ink-2); font-size: 12px; }
.sessions .page-head { align-items: center; }
.page-name { display: flex; align-items: baseline; gap: 12px; }
.state-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sessions-table { padding: 0; overflow: hidden; }
.sessions-table > .note { padding: 16px 20px; margin: 0; }
.sessions-table table { table-layout: fixed; min-width: 880px; }  /* a floor for the Session column; .scroll scrolls below it */
.sessions-table th:first-child, .sessions-table td:first-child { padding-left: 20px; }
.sessions-table th:last-child, .sessions-table td:last-child { padding-right: 20px; }
.sessions-table th:nth-child(2) { width: 110px; }
.sessions-table th:nth-child(3) { width: 150px; }
.sessions-table th:nth-child(4) { width: 130px; }
.sessions-table th:nth-child(5) { width: 170px; }
.sessions-table th:nth-child(6) { width: 70px; }
.sessions-table th:nth-child(7) { width: 110px; }
.sessions-table td { padding-top: 12px; padding-bottom: 12px; vertical-align: top; font-size: 13px; overflow-wrap: normal; }
.sessions-table tbody tr:last-child td { border-bottom: 0; }
.sessions-table .sub { display: flex; gap: 8px; align-items: baseline; min-width: 0; margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.sessions-table td.cost { font-size: 14px; font-weight: 600; }
.sessions-table .link {
  display: block; max-width: 100%; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-1); background: none;
  border: 0; padding: 0; cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sessions-table .where { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sessions-table .agents-btn { flex: none; font-size: 13px; }
.sessions-table tr.session { cursor: pointer; }
.sessions-table tr.session:hover td { background: var(--page); }
.sessions-table tr.agent td { border-bottom-style: dotted; color: var(--ink-2); }
.sessions-table tr.agent td.main { padding-left: 36px; overflow-wrap: anywhere; }
.sessions-table th .sort, .need-table th .sort {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit;
}
.sessions-table .link:hover, .sessions-table th .sort:hover, .need-table th .sort:hover { color: var(--accent); }
.sessions-table th[aria-sort="ascending"], .sessions-table th[aria-sort="descending"] { color: var(--ink-1); }
.cbar { display: block; margin: 3px 0 4px; }
.cbar-track { fill: var(--chip); }
.cbar-fill { fill: var(--accent); }
.cbar.over .cbar-fill { fill: var(--waiting); }
.cbar-tick { fill: var(--ended); }
.cbar-value { font-size: 13px; color: var(--ink-2); }
.cbar-value.over { color: var(--waiting); }
.dbar { display: block; margin: 3px 0 2px; }
.pstrip { display: block; margin: 6px 0 0; }
.pstrip rect { stroke: var(--surface-1); stroke-width: 1px; }
.p-rule { fill: var(--running); }
.p-you { fill: var(--waiting); }
.p-hook { fill: var(--accent); }
.p-denied { fill: var(--failing); }
.p-other { fill: var(--ended); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 20; width: min(100%, 680px); overflow-y: auto;
  border-radius: 0; border-width: 0 0 0 1px; box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h2 { font-size: 16px; overflow-wrap: anywhere; }
.drawer-part { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--grid); }
.drawer-part h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.drawer .scroll td { white-space: nowrap; }

/* A tile's figures are SVG text, which never wraps: "+18.5k / -5.3k" at 28/700 needs about 190 px. */
@media (min-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi { grid-column: span 2; }
  .kpi.money { grid-column: span 3; }
}

@media (max-width: 719px) {
  .bar { padding: 0 16px; }
  .top h1 { order: 1; padding: 12px 0; }
  .top-tools { order: 2; padding: 8px 0; }
  .views { order: 3; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .views a { padding: 8px 0 10px; }
  .views::-webkit-scrollbar { display: none; }
  #filter-slot { display: none; }
  #open-filters { display: inline-flex; }
  #down, #billing, #range-note { margin: 12px 16px 0; }
  main, .help { padding: 16px; }
  .usage-rows { grid-template-columns: minmax(0, 1fr); }
  .act { grid-template-columns: 20px minmax(0, 1fr); gap: 8px 12px; padding: 16px; }
  .act-cover, .act-impact { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }
  .act-impact { justify-content: flex-start; text-align: left; }
  .act-line { display: flex; flex-wrap: wrap; gap: 2px 12px; }
  .act-who { flex: 1 1 100%; }
  .act-cost { margin-left: auto; }
  .ctx-left, .ctx-grid, .spark-bars { max-width: none; }
  .need-table thead tr { display: flex; gap: 16px; }  /* the sort buttons stay; the plain headers go */
  .need-table thead th:not([aria-sort]) { display: none; }
  .need-table tbody tr, .need-table td { display: block; }
  .need-table tr.need { border-top: 1px solid var(--line); padding: 10px 0; }
  .need-table td { border: 0; padding: 2px 0; text-align: left; }
  .bars { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) auto; }
  .headroom thead { display: none; }
  .headroom table, .headroom tbody { display: block; }
  .headroom tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .headroom .scroll td { padding: 0; border-bottom: 0; }
  .headroom .ph-account, .headroom td.num { grid-column: 1 / -1; text-align: left; }
  .ph-meter { min-width: 0; }
  .ph-label { display: block; font-size: 12px; color: var(--ink-3); }
  .sessions .page-head { align-items: flex-start; }
}

/* Seven columns need about 980 px of window for a Session column that shows a title; below that the rows stack. */
@media (min-width: 980px) and (max-width: 1199px) {
  .sessions-table th:nth-child(2) { width: 96px; }
  .sessions-table th:nth-child(3) { width: 124px; }
  .sessions-table th:nth-child(4) { width: 96px; }
  .sessions-table th:nth-child(5) { width: 130px; }
  .sessions-table th:nth-child(6) { width: 52px; }
  .sessions-table th:nth-child(7) { width: 96px; }
}
@media (max-width: 979px) {
  .sessions-table thead { display: none; }
  .sessions-table table, .sessions-table tbody { display: block; min-width: 0; }
  .sessions-table tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }
  .sessions-table tr:last-child { border-bottom: 0; }
  .sessions-table .scroll td { padding: 0; border: 0; }
  .sessions-table td.main { grid-column: 1 / -1; }
  .sessions-table td.num { text-align: left; }
  .sessions-table td[data-label]::before {
    content: attr(data-label); display: block; font-size: 12px; font-weight: 400; color: var(--ink-3);
  }
  .sessions-table tr.agent td.main { padding-left: 16px; }
}
