/* Shared design tokens + components for every page in this app - the fix
   for pages drifting apart when edited independently over time. */

:root { color-scheme: dark; }
* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: -apple-system, system-ui, 'Segoe UI', sans-serif;
  background: #0d0d0d;
  color: #f0efec;
}

body {
  min-height: 100vh;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom));
}

h1 { font-size: 1.15rem; font-weight: 700; margin: 0 0 16px; color: #f0efec; }

a { color: #3987e5; }

/* ── Bottom tab bar (fixed, every page) ──────────────────────────────────── */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: #1a1a19;
  border-top: 1px solid #383835;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tabbar a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none;
  color: #898781;
  font-size: 0.68rem;
  padding: 6px 2px;
  border-radius: 10px;
}
.tabbar a .icon { font-size: 1.15rem; line-height: 1; }
.tabbar a.active { color: #3987e5; }

/* ── Shared surfaces ──────────────────────────────────────────────────────── */
.card {
  background: #1a1a19;
  border: 1px solid #383835;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.card-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.card-sub { font-size: 0.78rem; color: #898781; margin-bottom: 10px; }

/* ── Tiles (stat summaries) ───────────────────────────────────────────────── */
.tiles { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tile { flex: 1; min-width: 100px; background: #1a1a19; border: 1px solid #383835; border-radius: 12px; padding: 12px 14px; }
.tile .label { font-size: 0.7rem; color: #898781; margin-bottom: 2px; }
.tile .value { font-size: 1.1rem; font-weight: 700; }

/* ── Form elements ────────────────────────────────────────────────────────── */
label { display: block; font-size: 0.78rem; color: #c3c2b7; margin-bottom: 4px; }
input, select {
  width: 100%;
  background: #0d0d0d;
  color: #f0efec;
  border: 1px solid #383835;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.95rem;
  margin-bottom: 14px;
  font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: #3987e5; }

button {
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.btn-primary {
  width: 100%;
  background: #3987e5;
  color: #0d0d0d;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px;
}
.btn-primary:disabled { background: #383835; color: #898781; }
.btn-secondary {
  background: #1a1a19;
  border: 1px solid #383835;
  color: #c3c2b7;
  font-size: 0.85rem;
  padding: 12px 14px;
}

/* ── Chips (categories, quick picks) ──────────────────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  background: #0d0d0d; border: 1px solid #383835; color: #c3c2b7;
  border-radius: 999px; padding: 6px 12px; font-size: 0.78rem; cursor: pointer;
}
.chip.selected, .chip:active { background: #3987e5; color: #0d0d0d; border-color: #3987e5; }

/* ── Empty states ─────────────────────────────────────────────────────────── */
.empty { color: #898781; font-size: 0.85rem; text-align: center; padding: 30px 0; }

/* ── Charts (shared axis/label/line tokens) ───────────────────────────────── */
svg { width: 100%; height: auto; overflow: visible; display: block; }
.axis-label { font-size: 9px; fill: #898781; }
.bar-label { font-size: 9px; fill: #c3c2b7; text-anchor: middle; }
