/* Niborn Pi — sized for a 5" 800×480 panel viewed from a metre away.
   Dark by default (it is a screen that stays on), big numerals, few words. */
:root {
  color-scheme: dark;
  --page: #0b0b10;
  --surface: #15151d;
  --surface-2: #1d1d27;
  --ink: #f4f4f8;
  --ink-2: #b9b9c6;
  --muted: #7c7c8c;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #8b5cf6;      /* Niborn purple */
  --accent-2: #a78bfa;
  --good: #22c55e;
  --warn: #f5b731;
  --bad: #ef4444;
  --earn: #22c55e;
  --burn: #f97316;
  --blue: #3b82f6;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--page); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.25;
  user-select: none; cursor: none;
}
body.has-pointer { cursor: default; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- lock screen ---------------- */
.lock {
  height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.lock-brand, .brand { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.lock-brand span, .brand span { color: var(--accent-2); font-weight: 500; font-size: 12px; margin-left: 5px; vertical-align: super; }
.pin-dots { display: flex; gap: 14px; margin: 6px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); display: block; transition: background .1s; }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-msg { color: var(--ink-2); min-height: 20px; font-size: 14px; }
.pin-msg.err { color: var(--bad); }
.keypad { display: grid; grid-template-columns: repeat(3, 84px); gap: 10px; }
.keypad button {
  height: 56px; font-size: 24px; font-weight: 600; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font-family: inherit;
}
.keypad button:active { background: var(--accent); }
.keypad button.soft { color: var(--ink-2); font-size: 18px; }

/* ---------------- dashboard chrome ---------------- */
.dash { height: 100vh; display: flex; flex-direction: column; }
.progress { height: 3px; background: var(--surface-2); }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
.progress.paused div { background: var(--warn); }
.top { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 2px; }
.top .title { font-size: 18px; font-weight: 600; color: var(--ink-2); }
.top .clock { font-size: 20px; font-weight: 600; color: var(--ink-2); }
.page { flex: 1; min-height: 0; padding: 6px 12px; overflow: hidden; }
.bottom { display: flex; align-items: center; gap: 8px; padding: 4px 8px 8px; }
.bottom .nav {
  width: 44px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-2); font-size: 26px; line-height: 1; font-family: inherit;
}
.bottom .nav:active { background: var(--accent); color: white; }
.dots { display: flex; gap: 8px; align-items: center; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: block; }
.dots i.on { background: var(--accent); border-color: var(--accent); width: 20px; border-radius: 4px; }
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status.stale { color: var(--warn); }
.status.error { color: var(--bad); }
.pill-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 4px 10px; font-size: 13px; font-family: inherit;
}
.pill-btn.on { background: var(--warn); color: #111; border-color: var(--warn); }
.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: var(--bad); color: white; padding: 8px 14px; border-radius: 10px; font-size: 13px; max-width: 90vw;
}

/* ---------------- content primitives ---------------- */
.grid { display: grid; gap: 8px; height: 100%; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.rows-2 { grid-template-rows: auto 1fr; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px;
  min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.tile .label { color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; }
.tile .value { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin-top: 2px; }
.tile .value.md { font-size: 30px; }
.tile .value.sm { font-size: 24px; white-space: nowrap; }
.tile td .dim { color: var(--muted); font-size: 11px; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: auto; padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.good .value { color: var(--good); }
.tile.warn .value { color: var(--warn); }
.tile.bad .value { color: var(--bad); }
.tile.accent { border-color: rgba(139, 92, 246, .4); background: linear-gradient(180deg, rgba(139, 92, 246, .14), var(--surface)); }

.tile h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.tile table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tile td { padding: 3px 4px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.tile tr:last-child td { border-bottom: 0; }
.tile td.r { text-align: right; font-variant-numeric: tabular-nums; }
.tile td.dim { color: var(--muted); }
.tile .empty { color: var(--muted); font-size: 13px; margin: auto; text-align: center; }

.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); vertical-align: middle; }
.tag.good { color: var(--good); border-color: var(--good); }
.tag.bad { color: var(--bad); border-color: var(--bad); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.purple { color: var(--accent-2); border-color: var(--accent); }

.chart { flex: 1; min-height: 0; position: relative; }
.chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.legend { display: flex; gap: 12px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* burned vs earned bar */
.vs { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.vs .bar { height: 14px; border-radius: 7px; background: var(--surface-2); overflow: hidden; display: flex; }
.vs .bar b { display: block; height: 100%; }
.vs .row { display: flex; justify-content: space-between; font-size: 13px; }
.vs .row .k { color: var(--ink-2); }

/* pending badge list */
.pend { display: grid; grid-template-columns: 1fr; gap: 3px 10px; font-size: 14px; margin-top: 2px; }
.tile .sub.wrap { white-space: normal; line-height: 1.3; }
.pend div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 2px 0; }
.pend .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.pend .n.zero { color: var(--muted); font-weight: 500; }
