/* Pitboss. Calm by design: one sans serif, generous spacing, hairlines instead of boxes, colour only where it carries meaning.
   Colours: the reference data palette (light and dark steps validated separately), status colours reserved for status and always paired
   with an icon and a word. Light and dark: follows the device unless the person picks one (data-theme on <html>). */
:root {
  color-scheme: light;
  --page: #f6f6f3; --surface: #fcfcfb; --surface-2: #f1f0ec; --side: #efeee9; --hover: rgba(11, 11, 11, .045); --press: rgba(11, 11, 11, .08);
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #7c7a74; --line: #e1e0d9; --line-2: #ecebe5; --axis: #c3c2b7; --ring: rgba(11, 11, 11, .10);
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-soft: #e6effb; --on-accent: #fff;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --good: #0ca30c; --good-ink: #006300; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b; --info: #6a7f99;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 2px 8px rgba(11, 11, 11, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0f0f0e; --surface: #1a1a19; --surface-2: #222220; --side: #141413; --hover: rgba(255, 255, 255, .05); --press: rgba(255, 255, 255, .09);
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #8f8d86; --line: #2c2c2a; --line-2: #252523; --axis: #383835; --ring: rgba(255, 255, 255, .10);
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #17283d; --on-accent: #fff;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --good-ink: #0ca30c; --info: #8ea3bd; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f0f0e; --surface: #1a1a19; --surface-2: #222220; --side: #141413; --hover: rgba(255, 255, 255, .05); --press: rgba(255, 255, 255, .09);
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #8f8d86; --line: #2c2c2a; --line-2: #252523; --axis: #383835; --ring: rgba(255, 255, 255, .10);
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #17283d; --on-accent: #fff;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --good-ink: #0ca30c; --info: #8ea3bd; --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; margin: 0; }
h3 { font-size: 13px; font-weight: 650; margin: 0 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 10px; } small, .muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---- shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 18px 12px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand b { font-size: 17px; letter-spacing: -.01em; } .brand span { display: block; font-size: 12px; color: var(--muted); line-height: 1.2; }
.nav-label { font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 520; }
.nav a:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 650; min-width: 22px; height: 20px; border-radius: 10px; display: inline-grid; place-items: center; padding: 0 6px; background: var(--surface-2); color: var(--ink-2); }
.nav .count.crit { background: var(--critical); color: #fff; } .nav .count.warn { background: var(--warning); color: #0b0b0b; }
.side-foot { margin-top: auto; padding: 14px 10px 0; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.side-foot b { color: var(--ink-2); font-weight: 600; }
.main { min-width: 0; padding: 26px 34px 60px; max-width: 1480px; }
.topbar { display: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head p { margin: 4px 0 0; color: var(--ink-2); }
.head > div:first-child { flex: 1 1 420px; min-width: 0; } .head > .filters { flex: 0 0 auto; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* ---- filters: one row above the content they scope */
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 0 0 20px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 11px; border-radius: 7px; color: var(--ink-2); cursor: pointer; font-weight: 520; min-height: 32px; white-space: nowrap; }
.seg button:hover { color: var(--ink); background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
select, input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-height: 38px; min-width: 0; }
select { padding-right: 28px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[disabled], select[disabled], textarea[disabled] { opacity: .65; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { font-size: 12.5px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 8px; min-height: 38px; cursor: pointer; font-weight: 560; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; } .btn:active { background: var(--press); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); } .btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--critical); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { border: 0; background: none; width: 40px; height: 40px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--hover); } .icon-btn svg { width: 20px; height: 20px; }

/* ---- cards, tiles, grids */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card > .ch { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; flex-wrap: wrap; }
.card > .ch p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card > .cb { padding: 8px 18px 18px; }
.card > .cb.flush { padding: 0 0 6px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.tile { padding: 16px 18px; }
.tile .label { font-size: 13px; color: var(--ink-2); font-weight: 560; }
.tile .value { font-size: 27px; font-weight: 640; letter-spacing: -.02em; margin-top: 4px; line-height: 1.15; overflow-wrap: anywhere; }
.tile .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.delta { font-weight: 600; color: var(--ink-2); } .delta.up::before { content: "▲ "; font-size: 9px; vertical-align: 1px; } .delta.down::before { content: "▼ "; font-size: 9px; vertical-align: 1px; }
.tbc { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.note { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; color: var(--ink-2); font-size: 13.5px; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 22px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---- tables: readable for hours */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
th button { all: unset; cursor: pointer; } th button:hover { color: var(--ink); } th[aria-sort] button::after { content: " ↓"; } th[aria-sort="ascending"] button::after { content: " ↑"; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 240px; } td.wrap pre { white-space: pre-wrap; margin: 6px 0 0; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr.link { cursor: pointer; } tbody tr.link:hover td { background: var(--hover); }
tfoot td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
table .id { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 13px; }

/* ---- status: icon + word, never colour alone */
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; white-space: nowrap; color: var(--ink); }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status.good::before { background: var(--good); } .status.warning::before { background: var(--warning); } .status.serious::before { background: var(--serious); }
.status.critical::before { background: var(--critical); border-radius: 2px; transform: rotate(45deg); } .status.info::before { background: var(--info); }
.status.watch::before { background: var(--warning); opacity: .55; } .status.tbc::before, .status.collecting::before { background: transparent; border: 2px solid var(--muted); width: 7px; height: 7px; }
.alert { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 13px 18px; border-top: 1px solid var(--line-2); }
.alert:first-child { border-top: 0; }
.alert .ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); }
.alert .ic svg { width: 16px; height: 16px; }
.alert.critical .ic { background: var(--critical); color: #fff; } .alert.serious .ic { background: var(--serious); color: #fff; } .alert.warning .ic { background: var(--warning); color: #0b0b0b; } .alert.info .ic { color: var(--info); }
.alert b { font-weight: 620; } .alert p { margin: 2px 0 0; color: var(--ink-2); font-size: 13.5px; }
.alert .lv { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.on { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; } .chart .base { stroke: var(--axis); stroke-width: 1; }
.chart text { fill: var(--muted); font: 11.5px var(--font); font-variant-numeric: tabular-nums; }
.chart .xh { stroke: var(--axis); stroke-width: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); padding: 0 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 16px; height: 2px; border-radius: 2px; display: inline-block; } .legend i.box { width: 10px; height: 10px; border-radius: 3px; }
#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0, 0, 0, .14); border-radius: 9px; padding: 9px 12px; font-size: 13px; min-width: 150px; max-width: 280px; }
#tip .t { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
#tip .r { display: flex; align-items: center; gap: 8px; } #tip .r b { font-variant-numeric: tabular-nums; } #tip .r span { color: var(--ink-2); }
#tip .r i { width: 12px; height: 2px; border-radius: 2px; flex: none; }

/* ---- forms and settings */
.form { display: grid; gap: 14px; max-width: 640px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.err { color: var(--critical); font-size: 13.5px; font-weight: 560; } .ok { color: var(--good-ink); font-size: 13.5px; font-weight: 560; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 560; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; } .tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .tr { width: 38px; height: 22px; border-radius: 11px; background: var(--axis); position: relative; flex: none; transition: background .15s; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + .tr { background: var(--accent); } .switch input:checked + .tr::after { transform: translateX(16px); }
.switch input:focus-visible + .tr { outline: 2px solid var(--accent); outline-offset: 2px; }
.tri { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.tri button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 560; min-height: 30px; }
.tri button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.tri button[disabled] { cursor: default; }
.src { font-size: 12px; color: var(--muted); }
.feat { display: grid; grid-template-columns: minmax(140px, 220px) auto minmax(0, 1fr); gap: 8px 16px; align-items: center; }
.save-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.secret { font-family: var(--mono); font-size: 15px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; user-select: all; letter-spacing: .02em; }

/* ---- round view */
.mg { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; background: var(--surface-2); padding: 8px; border-radius: 10px; max-width: 420px; }
.mg div { aspect-ratio: 1; position: relative; display: grid; place-items: center; }
.mg img { width: 100%; height: 100%; object-fit: contain; }
.mg span { position: absolute; bottom: 1px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 700; background: rgba(8, 8, 8, .78); color: #fff; padding: 0 5px; border-radius: 5px; white-space: nowrap; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 46px; }
.spark i { flex: 1; min-width: 2px; max-width: 10px; background: var(--s1); border-radius: 2px 2px 0 0; }

/* ---- sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: 100%; max-width: 400px; padding: 28px 28px 24px; }
.login .brand { padding: 0 0 22px; }
.login h1 { font-size: 20px; margin-bottom: 4px; }
.login .form { max-width: none; margin-top: 18px; }

/* ---- iPad and smaller laptops */
@media (max-width: 1180px) {
  .main { padding: 22px 24px 60px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) { .g2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 280px; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  .shell.nav-open .side { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, .25); transition: transform .2s ease; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--page); border-bottom: 1px solid var(--line); padding: 8px 14px; }
  .topbar .brand { padding: 0; } .topbar .brand svg { width: 26px; height: 26px; }
  .nav a { min-height: 44px; }
  .g3 { grid-template-columns: minmax(0, 1fr); } .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .main { padding: 18px 16px 50px; } .g4 { grid-template-columns: minmax(0, 1fr); }
  .feat { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) { .seg button, .btn, select, input { min-height: 42px; } }
@media print { .side, .topbar, .filters, .btn { display: none !important; } .shell { display: block; } body { background: #fff; } }
.legend i.s1 { background: var(--s1); } .legend i.s2 { background: var(--s2); } .legend i.s3 { background: var(--s3); }
.main:focus { outline: none; }
h1.mono { font-size: 19px; word-break: break-all; }
p.links { margin: 12px 18px 16px; color: var(--muted); font-size: 13px; }
.dates { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
@media (prefers-reduced-motion: reduce) { .side { transition: none !important; } }
.sl svg { display: block; } .sl polyline { fill: none; stroke: var(--s1); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.legend i.box.s1 { background: var(--s1); } .legend i.box.s2 { background: var(--s2); }
