/* Curata Admin. Tokens follow the local dashboard (tracker/dashboard.py _PAGE_CSS)
   so both admin surfaces read as one product. Colour carries meaning only in the
   status banner and dots; brand red is the logo mark, never a status. */
:root {
  --bg: #f5f5f7; --fg: #1d1d1f; --muted: #6e6e73; --line: #d9d9de;
  --card: #ffffff; --accent: #0066cc; --accent-ink: #ffffff; --brand: #e0232e;
  --ok: #176c30; --ok-bg: #e3f4e8; --warn: #8a5a00; --warn-bg: #fff3d6;
  --bad: #c4271f; --bad-bg: #fde7e5; --stale: #4a4a50; --stale-bg: #e8e8ed; --off: #aeaeb2;
  --material: rgba(245, 245, 247, .82); --sep: rgba(60, 60, 67, .18);
  --radius: 14px; --gap: 10px; --pad: 16px;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --ease: cubic-bezier(.32, .72, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --fg: #f5f5f7; --muted: #98989f; --line: #38383a; --card: #1c1c1e;
    --accent: #4c9dff; --accent-ink: #0a0a0c; --brand: #ff5147;
    --ok: #32d74b; --ok-bg: #0f2a16; --warn: #ffb340; --warn-bg: #2e2208;
    --bad: #ff6961; --bad-bg: #331311; --stale: #c7c7cc; --stale-bg: #2c2c2e; --off: #636366;
    --material: rgba(22, 22, 24, .82); --sep: rgba(84, 84, 88, .6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
}
main {
  max-width: 640px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) var(--pad) calc(env(safe-area-inset-bottom) + 84px);
}
.boot { color: var(--muted); text-align: center; margin-top: 40vh; }

header.top { display: flex; align-items: center; gap: 8px; margin: 4px 2px 14px; }
header.top .mark { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
header.top h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
header.top button { min-height: 44px; }

/* The signature element: one full-width verdict. */
.banner { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.banner strong { display: block; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.banner span { font-size: 13px; opacity: .8; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.stale { background: var(--stale-bg); color: var(--stale); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: var(--gap); }
.card { background: var(--card); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile .label, .card .label { font-size: 12px; color: var(--muted); }
.tile .value {
  font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tile .sub { font-size: 12px; color: var(--muted); }

.meter { height: 6px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.storage .value { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

h2 {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 20px 4px 8px;
}
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 14px;
  border-bottom: 1px solid var(--sep);
}
.row:last-child { border-bottom: 0; }
.row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 14px; text-align: center; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.recording { background: var(--ok); }
.dot.paused, .dot.off { background: var(--off); }
.dot.silent { background: var(--warn); }
.dot.failing { background: var(--bad); }
.dot.up { background: var(--ok); }
.dot.down { background: var(--bad); }

.chart { margin-top: 6px; }
.chart svg { display: block; width: 100%; height: 120px; overflow: visible; }
.chart path.line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart path.area { fill: var(--accent); opacity: .08; }
.chart .axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.note { font-size: 12px; color: var(--muted); margin: 8px 4px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 6px; }
table.data td { padding: 8px 6px; border-top: 1px solid var(--sep); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Bottom tab bar (iOS pattern for 3-5 peer sections). */
.tabs {
  position: fixed; inset: auto 0 0 0; display: flex; justify-content: space-around;
  background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--sep); padding: 4px 4px calc(env(safe-area-inset-bottom) + 4px);
}
.tabs a {
  flex: 1; text-align: center; min-height: 44px; display: grid; place-items: center;
  font-size: 12px; color: var(--muted); text-decoration: none; border-radius: 10px;
}
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.tabs a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

form.login { background: var(--card); border-radius: var(--radius); padding: 20px; margin-top: 16vh; display: grid; gap: 12px; }
form.login h1 { font-size: 22px; margin: 0 0 4px; }
form.login label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
form.login input {
  font: 16px var(--sans); /* 16px stops iOS zooming on focus */
  min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg);
}
button {
  font: 600 15px var(--sans); min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
button.quiet { background: transparent; color: var(--accent); padding: 0 8px; font-weight: 500; }
.error { color: var(--bad); font-size: 13px; margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
