/* vitals — the hq command center's tokens (fleet/dashboard/web/src/styles/tokens.css) plus chart series colours. */
@font-face { font-family: 'Instrument Sans Variable'; font-weight: 400 700; font-display: swap; src: url('/fonts/instrument-sans.woff2') format('woff2-variations'); }
@font-face { font-family: 'Iosevka'; font-weight: 400; font-display: swap; src: url('/fonts/iosevka-400.woff2') format('woff2'); }
@font-face { font-family: 'Iosevka'; font-weight: 500; font-display: swap; src: url('/fonts/iosevka-500.woff2') format('woff2'); }

:root {
  color-scheme: light;
  --paper: #f1f2f4;
  --surface: #ffffff;
  --sunken: #e9ebee;
  --line: #d9dde2;
  --line-soft: #e6e9ed;
  --ink: #15191d;
  --dim: #5b6670;
  --faint: #8c96a0;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --down: #c93b2b;
  --running: #2b6fe8;
  /* Chart series, in fixed order: the order is what keeps neighbours apart for colour-blind readers. */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --font-text: 'Instrument Sans Variable', sans-serif;
  --font-data: 'Iosevka', monospace;
  --radius: 4px;
  --bar-h: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0f1215;
    --surface: #161a1e;
    --sunken: #121517;
    --line: #272d33;
    --line-soft: #1f252a;
    --ink: #e4e8eb;
    --dim: #8a96a0;
    --faint: #5c6770;
    --ok: #3dd68c;
    --warn: #e5b84b;
    --down: #f26b5b;
    --running: #6fa8ff;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #008300;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.45 var(--font-text); -webkit-text-size-adjust: 100%; }
h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
h1 { font-size: 16px; font-weight: 650; }
h2 { font-size: 13px; font-weight: 600; color: var(--dim); margin-bottom: 8px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
h3 { font-size: 13px; font-weight: 600; }
.meta, .unit { font: 12px var(--font-data); color: var(--dim); font-weight: 400; }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

.top { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; align-self: center; }
.dot.ok { background: var(--ok); }
.dot.down { background: var(--down); }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { font: 12px var(--font-data); color: var(--dim); background: none; border: 0; border-left: 1px solid var(--line); padding: 6px 12px; min-height: 32px; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--surface); }
:focus-visible { outline: 2px solid var(--running); outline-offset: 2px; }

main { max-width: 1440px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
main.stale .u-wrap { opacity: 0.5; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 860px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid + .grid { margin-top: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile .label { font-size: 12px; color: var(--dim); }
.tile .value { font-size: 26px; font-weight: 600; line-height: 1.2; }
.tile .value small { font-size: 13px; font-weight: 500; color: var(--dim); margin-left: 3px; }
.tile .sub { font: 12px var(--font-data); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .sub.warn { color: var(--warn); }
.meter { height: var(--bar-h); margin: 6px 0; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--running); border-radius: 3px; }
.meter i.warn { background: var(--warn); }
.meter i.down { background: var(--down); }

.chart header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart .plot { height: 190px; margin-top: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 6px; font-size: 12px; color: var(--dim); }
.legend li { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend b { font: 500 12px var(--font-data); color: var(--ink); font-variant-numeric: tabular-nums; }
.key { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.key.line { height: 2px; border-radius: 1px; }
.u-cursor-x { border-right: 1px solid var(--faint) !important; }

.rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.rows li:first-child { border-top: 0; }
.rows .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.rows .name span { overflow: hidden; text-overflow: ellipsis; }
.rows .meta { white-space: nowrap; flex: none; }
.rows .lane { padding-left: 15px; }
.rows .empty, .bars .empty { color: var(--dim); display: block; }
h3 + .rows, h3 + .stats, h3 + .bars { margin-top: 6px; }
.tag { font: 11px var(--font-data); color: var(--dim); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; flex: none; }
.tag.down { color: var(--down); border-color: var(--down); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stats dt { font-size: 12px; color: var(--dim); }
.stats dd { font-size: 18px; font-weight: 600; }
.stats dd small { display: block; font: 12px var(--font-data); color: var(--dim); font-weight: 400; }

.bars li { padding: 6px 0; }
.bars .row { display: flex; justify-content: space-between; gap: 2px 12px; align-items: baseline; flex-wrap: wrap; }
.bars .name { display: flex; align-items: center; gap: 7px; }
.bars .meter i { background: var(--s1); }

table { width: 100%; border-collapse: collapse; margin-top: 6px; }
th { font-size: 12px; font-weight: 400; color: var(--dim); text-align: right; padding-top: 4px; padding-bottom: 4px; }
td { padding-top: 5px; padding-bottom: 5px; border-top: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
th, td { padding-left: 12px; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
td:first-child { max-width: 0; width: 60%; overflow: hidden; text-overflow: ellipsis; }

body.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(100%, 340px); display: grid; gap: 10px; padding: 20px; }
.login label { font-size: 12px; color: var(--dim); }
.login input { font: 14px var(--font-data); padding: 9px 10px; min-height: 40px; color: var(--ink); background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius); }
.login button { font: 600 14px var(--font-text); min-height: 40px; color: var(--surface); background: var(--ink); border: 0; border-radius: var(--radius); cursor: pointer; }
.denied { color: var(--down); font-size: 13px; }

@media (max-width: 520px) {
  main { padding: 12px; gap: 20px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile .value { font-size: 22px; }
  .tile .sub { white-space: normal; }
  .rows li { flex-wrap: wrap; gap: 2px 12px; }
  .rows .meta { white-space: normal; flex: 0 1 auto; }
  .chart .plot { height: 170px; }
  .seg button { padding: 6px 10px; }
}
