/* ============================================================
   theme.css — centralized design tokens. ONE place for colours,
   typography and shape.
   - The APP supports LIGHT + DARK, following the OS setting.
   - The LOGIN page is pinned to DARK regardless of the OS
     (see the body[data-page="login"] rule at the bottom).
   Change a value here and it updates across every page.
   ============================================================ */
:root{
  /* ---- Brand ---- */
  --brand:#EA6C0A; --brand-bright:#F97316; --brand-deep:#9A3412; --brand-soft:#FFF3E6;

  /* ---- Semantic / status colours ---- */
  --ok:#15803D; --ok-bright:#22C55E; --warn:#D97706; --bad:#DC2626; --info:#2563EB;

  /* ---- Typography: family ---- */
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;

  /* ---- Typography: sizes (the scale — change here, change everywhere) ---- */
  --fs-h1:1.6rem;
  --fs-h2:1.3rem;
  --fs-h3:1.05rem;
  --fs-subheading:.95rem;
  --fs-body:.92rem;
  --fs-hint:.8rem;
  --fs-small:.72rem;

  /* ---- Typography: weights ---- */
  --fw-heading:800;
  --fw-subheading:600;
  --fw-body:400;

  /* ---- Shape ---- */
  /* flatter corners read crisper/faster; big radii read soft and slow */
  --radius:10px; --radius-sm:7px; --radius-lg:14px;

  /* ---- Sidebar (always deep navy, in both modes, for brand consistency) ---- */
  --side-bg:#0B1220; --side-bg-2:#070C16;
  --side-text:#94A3B8; --side-text-strong:#E5EAF2;
  --side-active:#F97316; --side-active-bg:rgba(249,115,22,.14);
  --side-hover:rgba(255,255,255,.06); --side-border:rgba(148,163,184,.12);

  /* ---- THE light greys: ONE scale for the whole app (Apple's system greys, neutral and light). Every page's
          background, fills and lines come from these — the pages with their own token sheets (Home/Collect, the
          profile, the signer home) point at them too — so changing a grey HERE changes it everywhere. ---- */
  --gray-1:#FBFBFD; /* the faintest fill: a hovered row, zebra stripes, read-only fields */
  --gray-2:#F5F5F7; /* the page canvas behind cards (apple.com's grey) */
  --gray-3:#F2F2F7; /* chips, segmented controls, skeleton bars (iOS systemGray6) */
  --gray-4:#E5E5EA; /* hairlines and borders (iOS systemGray5) */
  --gray-5:#D1D1D6; /* stronger outlines (iOS systemGray4) */

  /* ---- Surfaces + text roles : LIGHT (default) ---- */
  --bg:var(--gray-2); --surface:#FFFFFF; --surface-2:var(--gray-1); --surface-3:var(--gray-3);
  --border:var(--gray-4); --field-bg:#FFFFFF;
  --shadow:0 10px 30px -18px rgba(15,23,42,.28);
  --shadow-sm:0 1px 2px rgba(15,23,42,.06);
  --text-heading:#0F172A; --text-subheading:#334155; --text-body:#1E293B; --text-hint:#64748B;
  --ico-bg:var(--brand-soft); --stat-num:var(--brand);
  /* ---- Cemetery lot status: legend swatches, the lot sheet (the map fill mirrors these in dashboard.js CEM_COLOR) ---- */
  --cem-available:#A78BFA; --cem-reserved:#0EA5E9; --cem-occupied:#6D28D9;
  --cem-available-ink:#6D28D9; --cem-reserved-ink:#0369A1; --cem-occupied-ink:#5B21B6;
  /* back-compat aliases */
  --text:var(--text-body); --text-muted:var(--text-hint);
}

/* ---- DARK : follows the OS system setting ---- */
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0B1220; --surface:#0F1A2E; --surface-2:#13203A; --surface-3:#16243F;
    --border:#1E2A44; --field-bg:#0B1426;
    --shadow:0 24px 60px -30px rgba(0,0,0,.7);
    --shadow-sm:0 1px 2px rgba(0,0,0,.4);
    --text-heading:#F1F5F9; --text-subheading:#CBD5E1; --text-body:#E5EAF2; --text-hint:#94A3B8;
    --ico-bg:rgba(249,115,22,.14); --stat-num:var(--brand-bright);
    --cem-occupied:#8B5CF6;
    --cem-available-ink:#C4B5FD; --cem-reserved-ink:#7DD3FC; --cem-occupied-ink:#DDD6FE;
  }
}

/* ---- LOGIN : always dark, regardless of the OS setting ---- */
body[data-page="login"]{
  --bg:#0B1220; --surface:#0F1A2E; --surface-2:#13203A; --surface-3:#16243F;
  --border:#1E2A44; --field-bg:#0B1426;
  --shadow:0 24px 60px -30px rgba(0,0,0,.7);
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --text-heading:#F1F5F9; --text-subheading:#CBD5E1; --text-body:#E5EAF2; --text-hint:#94A3B8;
  --ico-bg:rgba(249,115,22,.14); --stat-num:var(--brand-bright);
}
