/* Crumbs admin — Night Atlas chrome (docs/brand.md). Chart colours are the
   validated dark-surface categorical steps (dataviz palette, checked against
   #1A2233 on 2026-09-15). */
:root {
  color-scheme: dark;
  --page: #121726;
  --surface: #1A2233;
  --surface-2: #222b3f;
  --border: rgba(255, 255, 255, 0.10);
  --grid: #2c3244;
  --ink: #F6F4EF;
  --ink-2: #A8A8AD;
  --muted: #8A8A92;
  --accent: #C8923B;
  --good: #0ca30c;
  --warn: #fab219;
  --bad: #e66767;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
body { padding-inline: 16px; padding-block: 0 32px; }
h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; }
.sub-h { font-size: 13px; color: var(--ink-2); margin-top: 18px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; margin: 4px 0 10px; }
.error { color: var(--bad); }
.banner { background: rgba(230, 103, 103, 0.10); border: 1px solid rgba(230, 103, 103, 0.35); border-radius: 10px; padding: 10px 14px; }

.wordmark { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.wordmark span { color: var(--accent); font-weight: 500; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
input[type="email"], input[type="password"], .search {
  background: var(--page); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px;
}
.search { font-size: 13px; padding: 6px 10px; width: min(240px, 50vw); }
.btn { font: inherit; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); padding: 8px 16px; cursor: pointer; }
.btn:hover { background: #2a344b; }
.btn.primary { background: var(--ink); color: #121726; border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: #fff; }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 3px 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* top bar + filters */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 8px; gap: 12px; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.filters { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 8px 0 16px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.segmented button { font: inherit; font-size: 13px; background: transparent; color: var(--ink-2); border: 0; padding: 7px 14px; cursor: pointer; }
.segmented button:hover { background: rgba(255,255,255,0.05); }
.segmented button.on { background: var(--ink); color: #121726; font-weight: 600; }
.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.updated { margin-left: auto; font-size: 12px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.tile .label { font-size: 12.5px; color: var(--ink-2); }
.tile .value { font-size: 28px; font-weight: 600; margin-top: 4px; letter-spacing: -0.01em; }
.tile .sub { font-size: 12px; margin-top: 2px; }
.tile.hero { grid-column: span 2; }
.tile.hero .value { font-size: 52px; color: var(--accent); line-height: 1.05; }
.delta { font-size: 12px; margin-left: 6px; font-weight: 500; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

/* cards */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plot { position: relative; height: 260px; transition: opacity 0.2s; }
.loading .plot, .loading .tbl { opacity: 0.45; }

/* tables */
.tablewrap { overflow-x: auto; margin-top: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.tbl th { color: var(--ink-2); font-weight: 500; font-size: 12px; cursor: pointer; user-select: none; }
.tbl th.sorted::after { content: " ↓"; color: var(--accent); }
.tbl th.sorted.asc::after { content: " ↑"; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.blank { color: var(--muted); }
.tbl tr:hover td { background: rgba(255,255,255,0.03); }
.pill { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11px; background: var(--surface-2); color: var(--ink-2); }
.pill.seed { color: var(--accent); }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

/* health */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stat .label { font-size: 12px; color: var(--ink-2); }
.stat .value { font-size: 20px; font-weight: 600; margin-top: 2px; }
.stat .value .icon { font-size: 14px; margin-right: 4px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 48px; align-items: center; gap: 8px; font-size: 12.5px; }
.bar-row .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.foot { margin-top: 20px; }

@media (max-width: 560px) {
  .tile.hero { grid-column: span 2; }
  .tile .value { font-size: 24px; }
  .tile.hero .value { font-size: 42px; }
}
