/* Dark only. Chart colours are the dataviz reference palette's dark steps. */
:root {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1a1a19;
  --surface-2: #232321;
  --border: #33332f;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #8f8e86;
  --accent: #3987e5;      /* series 1 — blue */
  --series-2: #d95926;    /* series 2 — orange */
  --series-3: #199e70;    /* series 3 — aqua (protein) */
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #e66767;
  --grid: #2b2b28;
  --radius: 14px;
  --tabs-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(18,18,17,.94);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(6px);
}
.top small { color: var(--muted); font-size: 12px; }
.sync {
  min-height: 44px; padding: 0 2px 0 12px; margin: -10px 0; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 12px; -webkit-tap-highlight-color: transparent;
}
.sync:active { color: var(--text); }
.sync.stale { color: var(--warning); }
main { max-width: 640px; margin: 0 auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; outline: none; }
.pad { padding: 8px 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.card > h2, .sec { margin: 0 0 8px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.big { font-size: 28px; font-weight: 800; line-height: 1.1; }
.big small { font-size: 14px; color: var(--text-2); font-weight: 500; }
.dim { color: var(--text-2); font-size: 14px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spacer { flex: 1; }

.rings .ringwrap { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.ring text { font-weight: 800; fill: var(--text); }
.ring .lbl { font-size: 10px; fill: var(--text-2); font-weight: 500; }

.badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); }
.badge.good { border-color: var(--good); color: var(--text); }
.badge.warn { border-color: var(--warning); color: var(--text); }
.badge.closed { border-color: var(--critical); color: var(--text); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-top: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; border-top: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tblwrap { overflow-x: auto; }

.list { list-style: none; margin: 0; padding: 0; }
.list a, .list .item {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 4px;
  border-top: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.list li:first-child a, .list li:first-child .item { border-top: 0; }
.list .chev { color: var(--muted); font-size: 20px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip {
  flex: 0 0 auto; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }

input[type=search] {
  width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}

.note { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.note h2, .note h3, .note h4 { font-size: 15px; margin: 16px 0 6px; color: var(--text); }
.note ul, .note ol { padding-left: 20px; margin: 6px 0; }
.note li { margin: 4px 0; }
.note code { background: var(--surface-2); padding: 1px 5px; border-radius: 6px; font-size: 13px; }
.note .wl { color: var(--text-2); border-bottom: 1px dotted var(--muted); }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--text-2); font-size: 14px; }

.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .goal { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .cross { stroke: var(--text-2); stroke-width: 1; }
.chart .dl { fill: var(--text); font-size: 11px; font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin: 6px 0 2px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--text-2) 0 4px, transparent 4px 7px); }
.tip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 10px; font-size: 13px; color: var(--text); box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.spark { display: block; width: 100%; height: 44px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(18,18,17,.97); border-top: 1px solid var(--border);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; min-height: 48px;
}
.tabs a span { font-size: 20px; filter: grayscale(1); opacity: .7; }
.tabs a[aria-current="page"] { color: var(--accent); }
.tabs a[aria-current="page"] span { filter: none; opacity: 1; }
.back { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-weight: 600; }
.warnbox { border-color: var(--warning); }
