/* CashaBarba design tokens — THE single source of truth for colour.
 *
 * Served at https://bar.cashabarba.com/tokens.css (content-hash ETag, like
 * appbar.js). Every web app links it; appbar.js reads the same custom
 * properties through the shadow boundary; the iOS palette is GENERATED from
 * this file by `scripts/gen-theme-swift.mjs` — run it after any edit here.
 *
 * Consumers alias these onto their local names with a literal fallback, e.g.
 *   --bg: var(--cb-paper, #FBFAF7);
 * so a page still renders (in the light palette) if this file is unreachable,
 * e.g. offline local dev. The fallbacks are cosmetic; this file is the truth.
 *
 * The shell (Paper/Sand/Line/Muted/Ink) is identical on every screen of every
 * app; only the section accent differs: Money = Pine, Training = Terracotta,
 * Food = Ochre. No pure white, no pure black.
 *
 * FORMAT CONTRACT: the Swift generator parses `--name: #HEX;` lines inside the
 * two :root blocks below. Keep one declaration per line, hex values only.
 */

:root {
  /* shell */
  --cb-paper: #FBFAF7;
  --cb-sand: #F1EEE7;
  --cb-field: #E9E5DB;
  --cb-line: #DFDAD0;
  --cb-muted: #8A867C;
  --cb-ink: #22211E;

  /* section accents — primary / hover / tint (large fills) / deep (text on tint) */
  --cb-pine: #3D6F62;
  --cb-pine-hover: #5E9184;
  --cb-pine-tint: #DCE7E2;
  --cb-pine-deep: #2A5045;

  --cb-terracotta: #C2603F;
  --cb-terracotta-hover: #D87F5F;
  --cb-terracotta-tint: #F6E2D8;
  --cb-terracotta-deep: #8F4229;

  --cb-ochre: #B08A2E;
  --cb-ochre-hover: #C7A455;
  --cb-ochre-tint: #F3EAD2;
  --cb-ochre-deep: #7A5E1B;

  /* semantic — status only, never money (amounts are always Ink) */
  --cb-ok: #4C7A4F;
  --cb-ok-soft: #E3EBD9;
  --cb-warn: #9A5B2F;
  --cb-warn-soft: #F2E3C9;
  --cb-danger: #B3372B;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* shell */
    --cb-paper: #1B1A18;
    --cb-sand: #262421;
    --cb-field: #2E2B27;
    --cb-line: #3A3731;
    --cb-muted: #9C978B;
    --cb-ink: #EDEBE6;

    /* section accents */
    --cb-pine: #5E9184;
    --cb-pine-hover: #7FA99E;
    --cb-pine-tint: #223530;
    --cb-pine-deep: #8FB3A8;

    --cb-terracotta: #D87F5F;
    --cb-terracotta-hover: #E29A80;
    --cb-terracotta-tint: #3A2A22;
    --cb-terracotta-deep: #E29A80;

    --cb-ochre: #C7A455;
    --cb-ochre-hover: #D8BC7A;
    --cb-ochre-tint: #332C1C;
    --cb-ochre-deep: #D8BC7A;

    /* semantic */
    --cb-ok: #7FB584;
    --cb-ok-soft: #2C3A2C;
    --cb-warn: #D9A05C;
    --cb-warn-soft: #3A2F1E;
    --cb-danger: #E06B5C;
  }
}
