/* Layout: phone-first ops console. Sticky header with fleet status, one view at a time, bottom tab bar like an installed PWA. */
:root {
  --page: #eef0ec;
  --surface: #fcfcfb;
  --sunk: #f3f4f1;
  --ink: #111312;
  --ink-2: #4f534f;
  --muted: #858a84;
  --line: #e0e2dc;
  --axis: #c3c6bd;
  --accent: #2a78d6;
  --accent-soft: #dbe8f8;
  --good: #0a8f0a;
  --warn: #b97a00;
  --warn-bg: #fdf1d6;
  --crit: #c93434;
  --crit-bg: #fbe3e1;
  --good-bg: #e2f3e0;
  --ui: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0d0e0e; --surface: #181a19; --sunk: #121413; --ink: #eef0ec; --ink-2: #bcc0b8;
    --muted: #868b84; --line: #2a2d2b; --axis: #3a3e3b; --accent: #3987e5; --accent-soft: #1c2c40;
    --good: #2fb52f; --warn: #f0a92a; --warn-bg: #33270f; --crit: #ec6262; --crit-bg: #3a1a1a; --good-bg: #14290f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0d0e0e; --surface: #181a19; --sunk: #121413; --ink: #eef0ec; --ink-2: #bcc0b8;
  --muted: #868b84; --line: #2a2d2b; --axis: #3a3e3b; --accent: #3987e5; --accent-soft: #1c2c40;
  --good: #2fb52f; --warn: #f0a92a; --warn-bg: #33270f; --crit: #ec6262; --crit-bg: #3a1a1a; --good-bg: #14290f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; -webkit-text-size-adjust: 100%; background: var(--page); color: var(--ink); font-family: var(--ui); font-size: 14px; line-height: 1.4; }
.app { max-width: 960px; margin: 0 auto; padding-inline: 16px; padding-block: 0 96px; }
header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--page); padding-block: 12px 10px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); margin-inline: -16px; padding-inline: 16px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); font-family: var(--mono); letter-spacing: 0; }
.top .spacer { flex: 1; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }
.view { display: flex; flex-direction: column; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card.tap { cursor: pointer; }
.card.tap:hover { border-color: var(--axis); }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .grow { flex: 1; min-width: 0; }
.sub { color: var(--muted); font-size: 12px; font-family: var(--mono); overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); background: var(--good-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.crit { color: var(--crit); background: var(--crit-bg); }
.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.alert.warn { background: var(--warn-bg); }
.alert.crit { background: var(--crit-bg); }
.alert b { font-weight: 600; }
.alert .ic { font-weight: 700; font-family: var(--mono); }
.alert.warn .ic { color: var(--warn); }
.alert.crit .ic { color: var(--crit); }
.meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.meter .lab { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); gap: 6px; }
.meter .lab span:last-child { font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.bar { height: 6px; border-radius: 3px; background: var(--sunk); border: 1px solid var(--line); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar i.warn { background: var(--warn); }
.bar i.crit { background: var(--crit); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.stat .d { font-size: 12px; color: var(--ink-2); }
.stat .d.up { color: var(--good); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.mini { width: 70px; }
.seg { display: flex; gap: 4px; background: var(--sunk); border: 1px solid var(--line); padding: 3px; border-radius: 9px; overflow-x: auto; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 500; padding: 7px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg.small button { padding: 4px 8px; font-size: 12px; flex: 0 0 auto; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -100%); top: 0; font-family: var(--mono); }
.list { display: flex; flex-direction: column; gap: 8px; }
.li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .val { font-family: var(--mono); color: var(--ink-2); }
.li .bar { grid-column: 1 / -1; margin-top: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px 16px; font-size: 13px; }
.chk { display: flex; gap: 8px; align-items: baseline; }
.chk .ic { font-family: var(--mono); font-weight: 700; width: 1em; }
.chk.good .ic { color: var(--good); } .chk.warn .ic { color: var(--warn); } .chk.crit .ic { color: var(--crit); }
.chk .sub { margin-left: auto; }
.note { font-size: 12px; color: var(--muted); }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom, 0px); }
nav.tabs .in { display: flex; max-width: 560px; width: 100%; }
nav.tabs button { flex: 1; border: 0; background: none; font: inherit; font-size: 11px; color: var(--muted); padding: 8px 2px 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; position: relative; }
nav.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
nav.tabs button[aria-current="page"] { color: var(--accent); }
nav.tabs .dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--warn); border: 2px solid var(--surface); }
nav.tabs .dot.crit { background: var(--crit); }
@media (prefers-reduced-motion: no-preference) { .bar i { transition: width .4s ease; } }
.chk.unknown .ic { color: var(--muted); }
.pill.unknown { color: var(--muted); background: var(--sunk); }
.alert.good { background: var(--good-bg); }
.alert.good .ic { color: var(--good); }
.pad { padding: 24px 0; }
.tip.hidden, [hidden] { display: none !important; }
.ghost { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 999px; cursor: pointer; }
.ghost:hover { color: var(--ink); border-color: var(--axis); }
.empty { color: var(--muted); font-size: 13px; }
.login { max-width: 380px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 48px) 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.login .card { align-items: stretch; text-align: center; }
.login .note { margin: 0; }
.login .qr { width: 100%; max-width: 260px; align-self: center; border-radius: 8px; background: #fff; }
.button { display: block; text-align: center; background: var(--accent); color: #fff; font-weight: 600; padding: 12px; border-radius: 9px; text-decoration: none; }
.error { color: var(--crit); background: var(--crit-bg); padding: 8px 10px; border-radius: 8px; font-size: 13px; margin: 0; }
.nowrap { white-space: nowrap; }
