:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --panel: #ffffff;
  --line: #e7e5de;
  --line-2: #efeee9;
  --ink: #12151c;
  --ink-2: #4f5562;
  --ink-3: #8a8f99;
  --brand: #141a2e;
  --brand-ink: #f6f5f1;
  --series: #2a78d6;
  --series-soft: #bcd3f1;
  --good: #0ca30c;
  --good-ink: #0b7a0b;
  --bad-ink: #b42626;
  --critical: #d03b3b;
  --warning: #fab219;
  --crit-bg: #fdf0ef;
  --warn-bg: #fff7e4;
  --track: #eceae4;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121314;
    --panel: #1a1b1d;
    --line: #2b2d31;
    --line-2: #242629;
    --ink: #f0efec;
    --ink-2: #b9bcc3;
    --ink-3: #82868f;
    --brand: #f0efec;
    --brand-ink: #141a2e;
    --series: #3987e5;
    --series-soft: #2c4566;
    --good-ink: #46c046;
    --bad-ink: #f08080;
    --crit-bg: #2c1919;
    --warn-bg: #2b2412;
    --track: #2b2d31;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121314; --panel: #1a1b1d; --line: #2b2d31; --line-2: #242629;
  --ink: #f0efec; --ink-2: #b9bcc3; --ink-3: #82868f; --brand: #f0efec; --brand-ink: #141a2e;
  --series: #3987e5; --series-soft: #2c4566; --good-ink: #46c046; --bad-ink: #f08080;
  --crit-bg: #2c1919; --warn-bg: #2b2412; --track: #2b2d31;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px max(16px, env(safe-area-inset-left)); padding-top: max(14px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; }
.mark-bg { fill: var(--brand); }
.mark-fg { stroke: var(--brand-ink); stroke-width: 2.6; stroke-linecap: round; }
.clock { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.fresh { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.fresh::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.fresh.stale::before { background: var(--warning); }

main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 48px; display: grid; gap: 18px; }
.loading { color: var(--ink-3); padding: 40px 0; text-align: center; }

/* Needs you */
.needs { display: grid; gap: 8px; }
.needs h2, .sec-h h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.01em; }
.needs-h { display: flex; align-items: baseline; justify-content: space-between; }
.alerts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.alert {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start;
  padding: 11px 13px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
}
.alert.red { background: var(--crit-bg); border-color: color-mix(in srgb, var(--critical) 35%, transparent); }
.alert.amber { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.alert .ic { grid-row: span 2; width: 20px; height: 20px; margin-top: 1px; }
.alert.red .ic { color: var(--critical); }
.alert.amber .ic { color: #c98500; }
.alert .t { font-weight: 600; font-size: 14.5px; }
.alert .d { color: var(--ink-2); font-size: 13px; }
.alert .tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-right: 6px; }
.clear { padding: 13px 15px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); display: flex; gap: 10px; align-items: center; }
.clear svg { color: var(--good); width: 20px; height: 20px; }

/* Business panels */
.biz { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.biz > *, main > * { min-width: 0; }
@media (min-width: 960px) { .biz { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel-h h2 { margin: 0; font-size: 15px; font-weight: 650; display: flex; gap: 9px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.panel-h .sub { color: var(--ink-3); font-size: 12.5px; }
.hero { padding: 18px 18px 6px; }
.hero .label { color: var(--ink-2); font-size: 13px; }
.hero .value { font-size: 44px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.1; margin-top: 2px; }
.hero .value small { font-size: 0.42em; font-weight: 500; color: var(--ink-3); margin-right: 4px; letter-spacing: 0; }
.hero .note { color: var(--ink-2); font-size: 13.5px; margin-top: 6px; }
.up { color: var(--good-ink); font-weight: 600; }
.down { color: var(--bad-ink); font-weight: 600; }
.flat { color: var(--ink-3); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line-2); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); margin-top: 14px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--panel); padding: 12px 18px; min-width: 0; }
.tile .l { color: var(--ink-2); font-size: 12.5px; }
.tile .v { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .s { color: var(--ink-3); font-size: 12px; margin-top: 1px; }

.chart { padding: 14px 18px 4px; }
.chart .ch { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.chart .ch .t { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chart .ch .k { font-size: 12px; color: var(--ink-3); }
.chart svg { display: block; width: 100%; height: 132px; margin-top: 8px; overflow: visible; }
.chart .bar { fill: var(--series-soft); }
.chart .bar.now { fill: var(--series); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g:hover .bar { fill: var(--series); }
.chart .axis { fill: var(--ink-3); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; }

.list { padding: 6px 18px 14px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.row:last-child { border-bottom: 0; }
.row .k { color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.row .v small { display: inline-block; }
.row .v small { color: var(--ink-3); font-weight: 500; margin-left: 4px; }

.meter { margin-top: 6px; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--series); }
.meter.warn > span { background: var(--warning); }
.meter.crit > span { background: var(--critical); }
.split { display: grid; grid-template-columns: minmax(0, 1fr); }
.split > * { min-width: 0; }
@media (min-width: 560px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .split > .list + .list { border-left: 1px solid var(--line-2); } }
.sub-h { padding: 12px 18px 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* Systems */
.sys { display: grid; grid-template-columns: 1fr; }
@media (min-width: 960px) { .sys { grid-template-columns: 1.4fr 1fr; } .sys > div + div { border-left: 1px solid var(--line-2); } }
.sites { padding: 6px 18px 14px; display: grid; grid-template-columns: 1fr; column-gap: 24px; }
@media (min-width: 560px) { .sites { grid-template-columns: 1fr 1fr; } }
.site { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.site .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site .n em { font-style: normal; color: var(--ink-3); margin-right: 6px; font-size: 12px; }
.site .m { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.site.down .n, .site.down .m { color: var(--bad-ink); font-weight: 600; }
.st { width: 9px; height: 9px; border-radius: 50%; background: var(--good); }
.st.down { background: var(--critical); }
.st.warn { background: var(--warning); }
.hosts { padding: 6px 18px 14px; display: grid; gap: 4px; }
.host { padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.host:last-child { border-bottom: 0; }
.host .hh { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.host .hh b { font-weight: 600; }
.host .hh span { color: var(--ink-3); font-size: 12px; text-align: right; }
.host .bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.host .bars .bl { font-size: 11.5px; color: var(--ink-3); display: flex; justify-content: space-between; }
.host .bars .meter { margin-top: 3px; height: 6px; }

.foot { color: var(--ink-3); font-size: 12px; text-align: center; }

.tip {
  position: fixed; z-index: 20; pointer-events: none;
  background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.35;
  padding: 7px 9px; border-radius: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.18);
  white-space: nowrap; transform: translate(-50%, calc(-100% - 10px));
}
.tip b { font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  main.first .panel, main.first .alert { animation: rise 0.28s ease-out both; }
  @keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}

/* Sign in */
body.login { min-height: 100dvh; display: grid; place-items: center; }
.signin { width: 100%; max-width: 380px; padding: 24px 16px; display: grid; gap: 22px; justify-items: center; }
.brand.big { font-size: 22px; gap: 12px; }
.brand.big svg { width: 36px; height: 36px; }
.card { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 10px; }
.card[hidden] { display: none; }
.card h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.card .hint { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }
.card label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.card input { font: inherit; font-size: 17px; padding: 12px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); outline: none; letter-spacing: 0.02em; }
.card input:focus { border-color: var(--series); box-shadow: 0 0 0 3px color-mix(in srgb, var(--series) 22%, transparent); }
#code { font-size: 24px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.card button[type=submit] { font: inherit; font-weight: 600; font-size: 15px; padding: 12px; border-radius: 10px; border: 0; background: var(--brand); color: var(--brand-ink); cursor: pointer; margin-top: 4px; }
.card button[type=submit]:disabled { opacity: 0.6; cursor: default; }
.card .link { font: inherit; font-size: 13.5px; border: 0; background: none; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; justify-self: center; }
.card .msg { margin: 0; min-height: 1.2em; font-size: 13.5px; color: var(--ink-2); }
.card .msg.bad { color: var(--bad-ink); }
.top .out { color: var(--ink-3); font-size: 13px; text-decoration: none; }
.top .out:hover { color: var(--ink); }
