/* ==========================================================================
   ReadTomato UI — Light Theme v2.0  (canonical since 2026-08-25)
   Single source of truth for every colour in every ReadTomato tool.

   Palette (Gly, 2026-08-25):
     #D71920 red        #B2282E deep red     #C03C2A red hover
     #76BC43 light grn  #2D9A47 green        #4A914D green hover
     #1A2D49 navy       #273249 deep navy
     #C5CACD grey       #B2B6BA grey hover
     #E9DFCD cream      #CEC8BB deep cream

   Rules this file encodes:
     - Light backgrounds only. No dark or near-dark page/card surfaces.
     - Every FILLED button is red. Navy is structure, never a button fill.
     - Red fill = a button. Red text = money lost. Never a red-filled number.
     - Blue / amber / purple are DATA-ONLY: badges, silo pills, charts.
       They never appear on chrome, buttons, borders or body text.

   Do not hardcode these values in a template. Import this file and use the
   variable, so the next palette change is one edit instead of ninety.
   ========================================================================== */

:root {
  /* ── Surfaces (light only) ───────────────────────────────────────────── */
  --bg:            #E9DFCD;   /* page — warm cream */
  --surface:       #FFFFFF;   /* cards, panels */
  --surface2:      #FBF8F1;   /* table row stripe, input fill, subtle panel */
  --surface3:      #F2EADB;   /* deeper cream highlight, hover rows */
  --surface-sunk:  #CEC8BB;   /* wells, disabled fills, inset areas */
  --scrim:         rgba(26,45,73,0.45);  /* modal backdrop — MUST stay translucent:
                                            it covers the whole viewport, so an
                                            opaque value hides the page entirely */

  /* ── Borders ─────────────────────────────────────────────────────────── */
  --border:        #D5D0C4;   /* default hairline on cream */
  --border-strong: #C5CACD;   /* emphasised divider, input outline */
  --border-muted:  #EDE8DE;   /* faint row separator inside white cards */

  /* ── Navy chrome (headers, nav, table headers, sidebars) ─────────────── */
  --navy:          #1A2D49;
  --navy-deep:     #273249;
  --chrome-bg:     #1A2D49;
  --chrome-text:   #F7F3EA;
  --chrome-muted:  #9DAABD;
  --chrome-border: rgba(255,255,255,0.14);

  /* ── Text (navy on cream) ────────────────────────────────────────────── */
  --text:  #1A2D49;
  --muted: rgba(26,45,73,0.70);   /* labels, helper text — 4.7:1 on cream */
  --dim:   rgba(26,45,73,0.60);   /* hints, timestamps, disabled */

  /* Opaque equivalents of --muted / --dim. Email clients render translucent
     colours inconsistently, so the HTML emails generated in Python inline
     these instead. Same visual result on both cream and white. */
  --muted-solid: #586372;
  --dim-solid:   #6C7684;

  /* ── Interactive accent — ALL filled buttons are red ─────────────────── */
  --accent:        #D71920;
  --accent-hover:  #C03C2A;
  --accent-deep:   #B2282E;   /* destructive / pressed */
  --accent-tint:   rgba(215,25,32,0.10);
  --on-accent:     #FFFFFF;
  --icon:          #D71920;   /* tomato body in brand badges */
  --tomato-mark:   #FFFFFF;

  /* ── Money semantics ─────────────────────────────────────────────────── */
  --green:        #2D9A47;   /* profit, success, paid */
  --green-hover:  #4A914D;
  --green-light:  #76BC43;   /* positive-but-watch */
  --green-text:   #1F6B32;   /* text on a green tint */
  --green-tint:   rgba(45,154,71,0.13);

  --red:          #D71920;   /* error, failed, destructive */
  --red-loss:     #B2282E;   /* negative P&L figures */
  --red-text:     #8E1B21;   /* text on a red tint */
  --red-tint:     rgba(215,25,32,0.11);

  /* ── Data-only colours (badges, silo pills, charts) ──────────────────── */
  --blue:        #378ADD;
  --blue-text:   #185FA5;
  --blue-tint:   rgba(55,138,221,0.12);

  --amber:       #BA7517;
  --amber-text:  #854F0B;
  --amber-tint:  rgba(186,117,23,0.14);

  --purple:      #7F77DD;
  --purple-text: #534AB7;
  --purple-tint: rgba(127,119,221,0.13);

  --teal:        #1D9E75;
  --teal-text:   #0F6E56;
  --teal-tint:   rgba(29,158,117,0.13);

  --cyan:        #0F8FA8;
  --cyan-text:   #0A6376;
  --cyan-tint:   rgba(15,143,168,0.13);

  --grey:        #C5CACD;
  --grey-hover:  #B2B6BA;

  /* ── Sales regions (data-only: Lead Picker region cards and maps) ────────
     Match Gly's official region map. The slug is the region name the server
     ships in /meta `regions` (lead_crm.region_catalog), so a region added
     there needs exactly one line here.
     No text is drawn ON these: they are stripes, dots and map fills, and the
     card text is navy on white. Measured contrast against white, for any
     future use: northwest 4.98:1, southwest 3.64:1, central 3.97:1,
     southeast 4.27:1 -- all pass the 3:1 graphics bar, only northwest passes
     4.5:1 for body text, so do not set white body text on the other three. */
  --region-northwest: #1F7A8C;
  --region-southwest: #B7791F;
  --region-central:   #5E8C3A;
  --region-southeast: #C9573F;

  /* ── Typography ──────────────────────────────────────────────────────── */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", "Consolas", monospace;

  /* ── Shape ───────────────────────────────────────────────────────────── */
  --radius:    8px;
  --radius-lg: 10px;
}

/* ==========================================================================
   Button contract — every filled button is red, no exceptions.
   ========================================================================== */

.btn,
button.btn,
a.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  padding: 8px 15px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

/* Primary — the only filled style */
.btn,
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn:hover,
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active,
.btn-primary:active { background: var(--accent-deep); border-color: var(--accent-deep); }

/* Secondary — navy outline, never a navy fill */
.btn-secondary {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}
.btn-secondary:hover { background: rgba(26,45,73,0.06); }

/* Tertiary — quiet grey outline */
.btn-tertiary,
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border-strong);
}
.btn-tertiary:hover,
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

/* Destructive — outlined deep red, so it never reads as the happy path */
.btn-danger {
  background: transparent;
  color: var(--accent-deep);
  border-color: var(--accent-deep);
}
.btn-danger:hover { background: var(--accent-deep); color: var(--on-accent); }

.btn:disabled,
.btn[disabled] {
  background: var(--surface-sunk);
  color: var(--dim);
  border-color: var(--border-strong);
  cursor: not-allowed;
}

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Money — red text means lost, never a red fill on a figure.
   ========================================================================== */

/* Figures use the darker shade of each hue: #2D9A47 is only 3.6:1 on white,
   which fails AA at table-row sizes. The palette green stays for fills, dots
   and chart series, where contrast is not a reading requirement. */
.money-pos, .positive, .profit { color: var(--green-text); }
.money-neg, .negative, .loss   { color: var(--red-loss); }
.money { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Badges / pills — tint background, dark same-family text.
   ========================================================================== */

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  line-height: 1.4;
}
.badge-green  { background: var(--green-tint);  color: var(--green-text); }
.badge-red    { background: var(--red-tint);    color: var(--red-text); }
.badge-blue   { background: var(--blue-tint);   color: var(--blue-text); }
.badge-amber  { background: var(--amber-tint);  color: var(--amber-text); }
.badge-purple { background: var(--purple-tint); color: var(--purple-text); }
.badge-teal   { background: var(--teal-tint);   color: var(--teal-text); }
.badge-cyan   { background: var(--cyan-tint);   color: var(--cyan-text); }
.badge-dim    { background: var(--surface-sunk); color: var(--muted); }

/* ==========================================================================
   Compatibility aliases.

   The doc-style pages (bill_it, cs_structure, marketing_strategy, the SOP and
   methodology pages) grew their own warm "paper" vocabulary before this file
   existed. Rather than rename them across every template — and risk missing
   one — they are folded in here as aliases onto the same palette, so there is
   still exactly one definition of each colour.
   ========================================================================== */

:root {
  --ground:      var(--bg);            /* page */
  --paper:       var(--surface);       /* card */
  --ink:         var(--text);
  --ink-soft:    var(--muted);
  --line:        var(--border);
  --sans:        var(--font);
  --serif:       Iowan Old Style, "Palatino Linotype", Palatino, Georgia, serif;

  --good:        var(--green);         /* on track */
  --wait:        var(--amber);         /* pending */
  --flag:        var(--red-loss);      /* needs attention */
  --flag-soft:   var(--red-tint);
  --accent-soft: var(--accent-tint);

  /* service tiers — data-only, kept distinguishable */
  --tier-a:      var(--teal);
  --tier-b:      var(--amber);
  --tier-c:      #C4704F;

  --pink:        #D4537E;
  --orange:      #D85A30;

  /* Darker text partners for the alias hues. Same job as the green one:
     readable when placed on a tint of their own colour. */
  --orange-text: #993C1D;
  --pink-text:   #993556;
  --tier-a-text: var(--teal-text);
  --tier-b-text: var(--amber-text);
  --tier-c-text: #993C1D;
  --good-text:   var(--green-text);
  --wait-text:   var(--amber-text);
  --flag-text:   var(--red-text);

  --card:        var(--surface);
  --headbg:      var(--chrome-bg);      /* dark panel header -> navy chrome */
  --go:          var(--green);
  --go-soft:     var(--green-tint);
  --warn:        var(--amber);
  --wait-soft:   var(--amber-tint);
}

/* --proj-color is deliberately absent: board.html sets it per project from
   user data, with var(--blue) as the fallback. It is not a theme token. */
