/* =====================================================================
   CivicLens — Municipal Finance Transparency Platform
   An MHM Productions product.
   ---------------------------------------------------------------------
   NEUTRAL / WHITE-LABEL THEME.
   This is the default product theme, in the MHM Productions brand system.
   Every client municipality is onboarded by overriding the tokens in the
   :root block below (palette + logo + fonts) and dropping in their data —
   nothing else in the app needs to change.

   MHM palette (Jan 2026 system):
     MHM Red    #ef2600   ACCENT ONLY — CTAs, key figures, active state, dot
     Ink        #272222   Microphone Black — dark surfaces / strong text
     Paper      #ece5d6   Almost White — warm light surfaces / text on dark
     Dolphins (sparingly): Turquoise #00aea9 · Teal #007f95 · Green #669712
   Type: Rubik (self-hosted). The licensed MHM display faces are Adobe
   domain-locked, so this self-contained build ships Rubik, their fallback.
   ===================================================================== */

/* ---- Rubik (vendored, OFL — self-hosted, no CDN dependency) ---------- */
@font-face { font-family:'Rubik'; src:url('../assets/fonts/Rubik-400.ttf') format('truetype'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'Rubik'; src:url('../assets/fonts/Rubik-500.ttf') format('truetype'); font-weight:500; font-style:normal; font-display:swap; }
@font-face { font-family:'Rubik'; src:url('../assets/fonts/Rubik-600.ttf') format('truetype'); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:'Rubik'; src:url('../assets/fonts/Rubik-700.ttf') format('truetype'); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:'Rubik'; src:url('../assets/fonts/Rubik-800.ttf') format('truetype'); font-weight:800; font-style:normal; font-display:swap; }
@font-face { font-family:'Rubik'; src:url('../assets/fonts/Rubik-900.ttf') format('truetype'); font-weight:900; font-style:normal; font-display:swap; }

/* ====================================================================== */
:root {
  /* ---- MHM brand palette (the neutral product theme) ---- */
  --mhm-red: #ef2600;         /* accent only */
  --mhm-red-dark: #c81f00;
  --mhm-ink: #272222;         /* dark surface / strong text (NOT #000) */
  --mhm-paper: #ece5d6;       /* warm light surface (NOT #fff) */
  --mhm-turquoise: #00aea9;
  --mhm-teal: #007f95;
  --mhm-green: #669712;

  /* ---- Semantic tokens (a client theme overrides just these) ----
     Named generically so re-skinning per municipality is a values-only
     change. `--accent` leads; `--surface-dark` grounds; status = green/teal/red. */
  --accent: var(--mhm-red);
  --accent-dark: var(--mhm-red-dark);
  --surface-dark: var(--mhm-ink);
  --surface-deepest: #1b1717;
  --surface-dark-soft: #3a3230;
  --surface-warm: var(--mhm-paper);

  /* Back-compat aliases so the existing rules keep working after the fork */
  --wr-garnet: var(--accent);
  --wr-garnet-dark: var(--accent-dark);
  --wr-navy: var(--surface-dark);
  --wr-navy-900: var(--surface-deepest);
  --wr-navy-soft: var(--surface-dark-soft);
  --wr-sand: var(--surface-warm);
  --wr-salmon: var(--mhm-teal);
  --wr-light-salmon: #d5e7e5;

  --sand-deep: #ded3c0;       /* deeper paper for tracks / admin backdrop */
  --ink: #272222;             /* primary text */
  --muted: #58534d;           /* secondary text / labels / ticks (warm gray): ≥ 5.1:1 on white, Paper and the section tint */
  --line: rgba(39,34,34,.10); /* hairline card border */
  --field-line: #cabfa9;      /* form input border */
  --control-line: #8c8378;    /* border that identifies a control (search box): ≥ 3:1 on white */
  --white: #ffffff;
  --page: #ffffff;            /* page/section background */
  --card: var(--surface-warm);/* card surface = Paper, pops on white */

  /* Accent as TEXT, and as a fill behind white text. MHM Red itself is only
     4.2:1 on white, so small red text and white-on-red use deeper reds.
     A client theme points these at its own accent when that passes AA. */
  --accent-text: #b01b00;            /* eyebrows, links, headings on light surfaces (≥ 5:1) */
  --accent-text-strong: #b01b00;     /* on accent-tinted chips and callouts */
  --accent-tint: rgba(239,38,0,.08); /* background of accent chips (account numbers) */
  --accent-strong: var(--mhm-red-dark); /* fill behind white text: buttons, active nav, pills (5.8:1) */

  /* Keyboard focus ring (WCAG 2.4.7): the accent on light surfaces, white
     on the dark / accent-colored chrome where an accent ring would vanish
     (the rule below swaps it inside .topbar, .nav, .hero and .footer). */
  --focus-ring: var(--accent);
  --focus-ring-on-dark: #fff;

  /* Budget status: green = on track, teal = watch, red = over */
  --ok: var(--mhm-green);
  --watch: var(--mhm-teal);
  --over: var(--mhm-red);
  /* Status pills: text + tint pairs that reach 4.5:1 (the status colors
     themselves are for bars and borders, not small text). */
  --ok-text: #3e5c0b;     --ok-bg: rgba(102,151,18,.16);
  --watch-text: #005f70;  --watch-bg: rgba(0,127,149,.15);
  --over-bg: var(--accent-strong);

  --radius: 16px;
  --radius-sm: 8px;
  --shadow-sm: 0 6px 18px rgba(39,34,34,.08);
  --shadow-md: 0 10px 30px rgba(39,34,34,.18);
  --maxw: 1160px;
  --font: 'Rubik', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Rubik', ui-sans-serif, system-ui, sans-serif;

  /* Buttons */
  --btn-radius: 3px;
  --btn-pad-y: .72rem;
  --btn-pad-x: 1.15rem;
  --btn-track: .03em;
  --btn-shadow: 0 6px 14px rgba(39,34,34,.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;           /* Rubik regular body */
  color: var(--ink);
  background: var(--page);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* MHM type: display headings in Rubik; H1 uppercase, subheads title case. */
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--surface-dark); margin: 0 0 .4em; }
h1 { font-weight: 800; text-transform: uppercase; line-height: 1.0; font-size: clamp(2.2rem, 4vw, 3.5rem); letter-spacing: .005em; }
h2 { font-weight: 700; line-height: 1.1; font-size: clamp(1.55rem, 3vw, 2.2rem); letter-spacing: -0.01em; }
h3 { font-weight: 700; line-height: 1.2; font-size: clamp(1.2rem, 2.2vw, 1.5rem); }
h4 { font-weight: 700; line-height: 1.2; }
p { margin: 0 0 1rem; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
/* The hidden attribute always wins over a component's own display rule. */
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.eyebrow {
  font-weight: 900; text-transform: uppercase; letter-spacing: .14em;
  font-size: .74rem; color: var(--accent-text);
}
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* Accessibility: visually-hidden content for screen readers, and a skip link */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -56px; z-index: 1000; background: var(--accent-strong); color: #fff; font-weight: 800; padding: 10px 16px; border-radius: 0 0 10px 10px; text-decoration: none; transition: top .15s ease; }
.skip-link:focus { top: 0; outline: 3px solid #fff; outline-offset: -3px; }

/* Tabular numerals so dollar figures and percentages stay column-aligned
   and don't reflow when the data updates (a convention from the widgets). */
.stat-value, .figure-value, .rev-value, .progress-meta, .progress-meta .pct,
.admin-stat .v, .data-table td.calc, .data-table input.num, .trend,
.demo-creds code, .money { font-variant-numeric: tabular-nums; }

/* Garnet scrollbar — small brand signature carried over from the City site. */
html { scrollbar-width: thin; scrollbar-color: var(--wr-garnet) rgba(0,0,0,.08); }
html::-webkit-scrollbar { width: 12px; }
html::-webkit-scrollbar-track { background: rgba(0,0,0,.08); }
html::-webkit-scrollbar-thumb { background: var(--wr-garnet); border-radius: 9999px; border: 3px solid transparent; background-clip: padding-box; }
html::-webkit-scrollbar-thumb:hover { filter: brightness(1.1); }

/* Consistent focus ring for keyboard users (WCAG 2.4.7). --focus-ring is
   the accent on light surfaces and white on the dark / accent-colored
   chrome, so the ring never matches the background it sits on (an accent
   ring on the Wrangell garnet nav was 1:1, i.e. invisible). */
.topbar, .nav, .hero, .footer, .admin-topbar, .preview-banner { --focus-ring: var(--focus-ring-on-dark); }
a:focus-visible, button:focus-visible, .chip:focus-visible, .admin-tabs button:focus-visible,
.nav-links a:focus-visible, .nav-cta:focus-visible, .nav-toggle:focus-visible, .brand:focus-visible {
  outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px;
}
::selection { background: rgba(239,38,0,.18); }

/* ---- Top utility bar ------------------------------------------------ */
/* MHM system: ink is the dark surface; red is an accent only (CTA, active
   state, the live dot, key figures). Paper text on the dark chrome. */
.topbar { background: var(--surface-deepest); color: rgba(236,229,214,.85); font-size: .82rem; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; min-height: 40px; gap: 12px; }
.topbar .topbar-org { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar .topbar-org img { height: 22px; width: auto; display: block; }
.topbar a { color: #fff; font-weight: 600; }
.topbar-links { display: flex; align-items: center; gap: 18px; }
.topbar-links a { white-space: nowrap; }
.topbar-links .dot { opacity: .4; }

/* ---- Primary navigation -------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface-dark);
  box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; }
/* The brand may shrink (its title wraps) so the menu button always fits on
   a 320–375px phone; the button itself never shrinks. */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand .brand-text { min-width: 0; }
.brand img { height: 40px; width: auto; display: block; }
.brand .brand-text { color: #fff; line-height: 1.05; }
.brand .brand-text strong { display: block; font-weight: 900; font-size: 1.02rem; letter-spacing: .01em; }
.brand .brand-text span { display: block; font-size: .72rem; font-weight: 600; color: rgba(255,255,255,.85); letter-spacing: .04em; }
.brand:hover { text-decoration: none; }
.brand .brand-text strong { text-transform: uppercase; letter-spacing: .04em; font-weight: 800; }
/* CivicLens product mark — a red rounded square (no client logo in the neutral demo) */
.brand-dot { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); box-shadow: 0 0 0 4px rgba(239,38,0,.16); flex: none; display: inline-block; }
.foot-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; color: #fff; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
.foot-brand .brand-dot { width: 20px; height: 20px; border-radius: 6px; box-shadow: none; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  color: rgba(255,255,255,.82); font-weight: 600; font-size: .92rem;
  padding: 9px 14px; border-radius: 8px; text-decoration: none; transition: background .15s, color .15s;
}
.nav-links a:hover { background: rgba(236,229,214,.12); color: #fff; text-decoration: none; }
.nav-links a.active { color: #fff; background: var(--accent-strong); }

/* Sign-in CTA — the red accent, popping against the ink nav. */
.nav-cta {
  background: var(--accent-strong); color: #fff; font-weight: 700; font-size: .9rem;
  padding: 9px 16px; border-radius: var(--btn-radius); text-decoration: none;
}
.nav-cta:hover { background: var(--accent-dark); text-decoration: none; color:#fff; }

.nav-toggle {
  display: none; flex: none; background: transparent; border: 1.5px solid rgba(255,255,255,.7);
  color: #fff; border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 1rem; white-space: nowrap;
}

/* ---- Hero ----------------------------------------------------------- */
/* Ink surface with the MHM film-grain texture; red accents (eyebrow, live
   dot, primary CTA); paper text. Red is the accent, not the field. */
.hero {
  background:
    linear-gradient(150deg, rgba(39,34,34,.85) 0%, rgba(27,23,23,.95) 100%),
    var(--surface-dark) url('../assets/textures/texture-dark.jpg') center / cover;
  color: #fff; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -80px; top: -90px; width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(239,38,0,.30), transparent 60%);
}
.hero .container { padding-top: 66px; padding-bottom: 66px; position: relative; z-index: 1; }
.hero h1 { color: #fff; max-width: 18ch; }
.hero .lead { font-size: 1.16rem; max-width: 58ch; color: rgba(236,229,214,.92); font-weight: 400; }
.hero .eyebrow { color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.updated-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(236,229,214,.10); border: 1px solid rgba(236,229,214,.20);
  color: #fff; padding: 7px 14px; border-radius: 999px; font-size: .84rem; font-weight: 500;
}
.updated-chip .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(239,38,0,.7); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,38,0,.6);} 70% { box-shadow: 0 0 0 8px rgba(239,38,0,0);} 100% { box-shadow:0 0 0 0 rgba(239,38,0,0);} }

/* ---- Buttons -------------------------------------------------------- */
/* Brand buttons are sharp rectangles in Gilroy Heavy (from the City
   stylesheet): garnet primary, navy-outline secondary, garnet-text ghost.
   Hover lifts + dims slightly rather than swapping color. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font); font-weight: 900; font-size: .94rem; letter-spacing: var(--btn-track);
  padding: var(--btn-pad-y) var(--btn-pad-x); border-radius: var(--btn-radius); border: 2px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1.1;
  box-shadow: var(--btn-shadow);
  transition: transform .04s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease, border-color .18s ease, filter .18s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:focus-visible {
  outline: 3px solid var(--focus-ring); outline-offset: 2px; box-shadow: none;
}

.btn-primary { background: var(--accent-strong); color: #fff; border-color: var(--accent-strong); }
.btn-primary:hover { filter: brightness(.95); color: #fff; }
.btn-navy { background: var(--wr-navy); color: #fff; border-color: var(--wr-navy); }
.btn-navy:hover { filter: brightness(1.12); color: #fff; }
/* Secondary: navy outline on light surfaces, fills with Sand on hover. */
.btn-outline { background: transparent; color: var(--wr-navy); border-color: var(--wr-navy); box-shadow: none; }
.btn-outline:hover { background: var(--wr-sand); color: var(--wr-navy); }
/* Ghost: used on the dark hero + navy admin bar, so it stays white. */
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); box-shadow: none; }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
/* Danger: low-emphasis until hover (used for table Remove actions). */
.btn-danger { background: transparent; color: var(--wr-garnet); border-color: var(--wr-light-salmon); box-shadow: none; }
.btn-danger:hover { background: var(--wr-garnet); color: #fff; border-color: var(--wr-garnet); }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; }
.btn-lg { padding: .85rem 1.3rem; font-size: 1.02rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; filter: none; }

/* ---- Sections ------------------------------------------------------- */
/* Page is white so the Sand brand-cards read as warm panels; alternating
   sections get a faint Sand wash for gentle rhythm. */
.section { padding: 56px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-alt { background: #f6f1e7; }
.section-head { max-width: 64ch; margin-bottom: 30px; }
.section-head .lead { font-size: 1.06rem; color: var(--muted); font-weight: 600; }

/* ---- Overview KPI cards --------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  container-type: inline-size;
}
.stat-card::before { content:''; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--wr-garnet); }
.stat-card.is-navy::before { background: var(--wr-navy); }
.stat-card.is-salmon::before { background: var(--wr-salmon); }
.stat-card .stat-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
/* Full 1.9rem on roomy cards; auto-shrinks (never overflows) when a big
   9-figure total lands in a narrow card. */
.stat-card .stat-value { font-size: clamp(1.35rem, 13cqi, 1.9rem); font-weight: 900; color: var(--wr-navy); margin-top: 6px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card .stat-sub { font-size: .86rem; color: var(--muted); margin-top: 8px; font-weight: 600; }

/* ---- Filter / toolbar ---------------------------------------------- */
/* Budget free-text search */
.budget-search { position: relative; margin-bottom: 14px; max-width: 460px; }
.budget-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.15rem; pointer-events: none; }
.budget-search input[type="search"] {
  width: 100%; font-family: var(--font); font-weight: 600; font-size: .95rem; color: var(--ink);
  padding: 12px 14px 12px 40px; border: 1.5px solid var(--control-line); border-radius: 10px; background: #fff;
}
.budget-search input[type="search"]::placeholder { color: var(--muted); opacity: 1; }
.budget-search input[type="search"]:focus { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-color: var(--focus-ring); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--muted);
  font-weight: 700; font-size: .84rem; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-family: var(--font); transition: background-color .14s, color .14s, border-color .14s; /* not the focus ring */
}
.chip:hover { border-color: var(--wr-navy); color: var(--wr-navy); }
.chip.active { background: var(--wr-navy); color: #fff; border-color: var(--wr-navy); }

/* ---- Department cards ---------------------------------------------- */
/* minmax(0,1fr) lets tracks shrink below their content's min width, so cards
   never force the grid (and the page) wider than the viewport on mobile. */
.dept-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.dept-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 14px;
  min-width: 0; container-type: inline-size;
}
.dept-card .dept-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; min-width: 0; }
.dept-card .dept-top > div { min-width: 0; }
.dept-card .dept-name { font-weight: 900; font-size: 1.08rem; color: var(--wr-navy); overflow-wrap: anywhere; }
.dept-card .dept-cat { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 2px; }

.pill { font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .02em; }
/* Pills follow the theme's status tokens, so a card's pill matches its bar. */
.pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill-watch { background: var(--watch-bg); color: var(--watch-text); }
.pill-over { background: var(--over-bg); color: #fff; }

.dept-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.figure .figure-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.figure .figure-value { font-weight: 900; font-size: .95rem; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.figure .figure-value.neg { color: var(--accent-text); }
/* A short plain-language line under a figure: "No spending reported yet",
   spending with no adopted budget, spending below zero. */
.figure-note { font-size: .82rem; font-weight: 700; color: var(--muted); margin-top: 6px; }

/* When a card is too narrow for three money columns (small screens, the
   embedded demo, or the mid-width 3-up grid), stack the figures as
   label ↔ value rows so long 7–8 figure amounts never crowd or overlap. */
@container (max-width: 375px) {
  .dept-figures { grid-template-columns: 1fr; gap: 0; }
  .dept-figures .figure { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 6px 0; border-top: 1px solid var(--line); }
  .dept-figures .figure:first-child { border-top: 0; padding-top: 2px; }
  .dept-figures .figure .figure-value { margin-top: 0; }
}

.progress { margin-top: 2px; }
.progress-meta { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.progress-meta .pct { color: var(--wr-navy); }
.progress-track { height: 12px; background: var(--sand-deep); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--ok); transition: width .5s ease; }
.progress-fill.is-watch { background: var(--watch); }
.progress-fill.is-over { background: var(--over); }
.dept-note { font-size: .84rem; color: var(--muted); font-weight: 600; border-top: 1px dashed var(--line); padding-top: 10px; }

/* ---- Fund grouping (budget by fund) -------------------------------- */
.fund-groups { display: flex; flex-direction: column; gap: 36px; }
.fund-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 9px; border-bottom: 2px solid var(--wr-garnet);
}
.fund-group-head h3 { margin: 0; color: var(--wr-navy); font-weight: 800; font-size: 1.16rem; }
.fund-group-sub { color: var(--muted); font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }

/* Account number chip beneath the account name (matches the budget doc) */
.acct-no {
  display: inline-block; margin-top: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: var(--accent-text-strong); background: var(--accent-tint);
  padding: 2px 8px; border-radius: 5px;
}

/* Adopted-only card (reserves / pass-through / dedicated funds) */
.figure.figure-solo { margin-top: 2px; }
.figure-value.big { font-size: 1.5rem; font-weight: 900; color: var(--wr-navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.pill-adopted { background: rgba(39,34,34,.09); color: var(--wr-navy); }

/* Revenue card tag + flat (no-change) trend pill */
.rev-tag {
  display: inline-block; font-size: .64rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); background: rgba(39,34,34,.07);
  padding: 3px 9px; border-radius: 999px; margin-bottom: 10px;
}
.trend.flat { background: rgba(39,34,34,.07); color: var(--muted); font-weight: 700; }

/* Secondary hero lead */
.lead-sm { font-size: 1.02rem !important; margin-top: 14px; }

/* ---- Revenue cards -------------------------------------------------- */
.revenue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.revenue-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); border-top: 4px solid var(--wr-garnet);
}
.revenue-card.t-sales { border-top-color: var(--wr-garnet); }
.revenue-card.t-transient { border-top-color: var(--wr-navy); }
.revenue-card.t-property { border-top-color: var(--wr-salmon); }
.revenue-card .rev-label { font-weight: 900; font-size: 1.1rem; color: var(--wr-navy); }
.revenue-card .rev-value { font-size: 2rem; font-weight: 900; color: var(--wr-navy); margin: 8px 0 2px; line-height: 1; }
.revenue-card .rev-blurb { font-size: .86rem; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
/* Last year's amount, shown until the open year's is entered. */
.revenue-card .rev-carried { margin: 8px 0 8px; }
/* Trend pills follow the widget convention: garnet-tinted for an increase
   (the brand accent), navy-tinted for a decrease. */
.trend { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: .9rem; padding: .2rem .55rem; border-radius: 999px; letter-spacing: .02em; }
.trend.up { background: var(--ok-bg); color: var(--ok-text); }
.trend.down { background: rgba(39,34,34,.10); color: var(--surface-dark); }
.trend .arrow { font-size: .8rem; }
.rev-compare { font-size: .82rem; color: var(--muted); font-weight: 600; margin-top: 10px; }

/* ---- Charts --------------------------------------------------------- */
/* minmax(0,1fr) + min-width:0: a <canvas> is 300px wide until Chart.js
   sizes it, which would otherwise push a one-column card past a 320–360px
   phone screen. */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); min-width: 0;
}
.chart-wrap canvas { max-width: 100%; }
.chart-card.span-2 { grid-column: 1 / -1; }
.chart-card h3 { margin-bottom: 2px; }
.chart-card .chart-sub { font-size: .86rem; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
/* What a chart is missing (months not reported yet, a year with no data). */
.chart-card .chart-note {
  font-size: .84rem; font-weight: 600; color: var(--ink); line-height: 1.45;
  margin: -6px 0 14px; padding-left: 10px; border-left: 3px solid var(--surface-dark);
}
.chart-card .chart-note:empty { display: none; }
.chart-wrap { position: relative; height: 320px; }
.chart-wrap.tall { height: 420px; }

/* ---- Unaudited statement + reporting status ------------------------ */
.audit-note {
  margin: 18px 0 0; padding: 10px 14px; border-left: 4px solid var(--accent);
  background: var(--card); border-radius: 0 8px 8px 0;
  font-size: .9rem; font-weight: 600; color: var(--ink);
}
.totals-note { font-size: .84rem; margin-top: 14px; }
.actuals-note {
  margin: 0 0 20px; padding: 12px 16px; border: 1px solid var(--line); border-left: 4px solid var(--surface-dark);
  border-radius: 10px; background: #fff; font-size: .92rem; font-weight: 600; color: var(--ink);
}
.status-legend { font-size: .84rem; margin-top: 18px; }

/* ---- Disclaimer / methodology -------------------------------------- */
.callout {
  background: var(--wr-light-salmon); border: 1px solid var(--wr-salmon);
  border-radius: var(--radius); padding: 20px 22px; color: var(--wr-navy-900);
}
.callout strong { color: var(--accent-text-strong); }
.note-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.note-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.note-card h3 { color: var(--accent-text); }
/* Step labels are small text, so they use the dark surface color (the
   salmon / teal accents are below 4.5:1 on the card). */
.note-card .step-num { font-size: .8rem; font-weight: 900; color: var(--surface-dark); }
.about-extra { margin-top: 20px; font-size: .9rem; }

/* ---- Footer --------------------------------------------------------- */
.footer { background: var(--wr-navy-900); color: rgba(255,255,255,.78); padding: 44px 0 30px; }
.footer .container { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer .foot-blurb { max-width: 36ch; font-size: .9rem; }
.footer img.foot-logo { display: block; height: 46px; width: auto; max-width: 100%; margin-top: 16px; }
.footer h4 { color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 12px; }
.footer a { color: rgba(255,255,255,.82); font-weight: 600; display: block; margin-bottom: 8px; font-size: .92rem; }
.footer a:hover { color: #fff; }
.footer .foot-bottom { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.14); margin-top: 14px; padding-top: 18px; font-size: .8rem; color: rgba(255,255,255,.7); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.footer .foot-bottom a { display: inline; margin: 0; font-size: inherit; color: inherit; text-decoration: underline; }

/* =====================================================================
   STAFF ADMIN AREA
   ===================================================================== */
.admin-body { background: var(--sand-deep); }

/* Login */
.login-wrap { min-height: calc(100vh - 0px); display: grid; place-items: center; padding: 40px 20px;
  background: linear-gradient(160deg, var(--wr-navy) 0%, var(--wr-navy-900) 100%); }
.login-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-md); width: 100%; max-width: 430px; padding: 34px; }
.login-card .login-logo { height: 46px; margin: 0 auto 18px; display: block; }
.login-card h1 { font-size: 1.5rem; text-align: center; }
.login-card .login-sub { text-align: center; color: var(--muted); font-weight: 600; font-size: .92rem; margin-bottom: 22px; }
.demo-creds {
  background: var(--wr-sand); border: 1px dashed var(--wr-salmon); border-radius: 10px;
  padding: 12px 14px; font-size: .84rem; color: var(--wr-navy); margin-bottom: 20px; font-weight: 600;
}
.demo-creds code { background: #fff; padding: 1px 7px; border-radius: 5px; font-weight: 700; color: var(--wr-garnet-dark); }

/* Form fields */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: .88rem; color: var(--wr-navy); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font-family: var(--font); font-size: .95rem; font-weight: 600; color: var(--ink);
  padding: 11px 13px; border: 1.5px solid var(--field-line); border-radius: 9px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--wr-navy); box-shadow: 0 0 0 3px rgba(39,34,34,.12);
}
.field .help { font-size: .8rem; color: var(--muted); margin-top: 5px; font-weight: 600; }
.form-error { background: var(--wr-light-salmon); border: 1px solid var(--wr-salmon); color: var(--wr-garnet-dark);
  padding: 10px 13px; border-radius: 9px; font-size: .88rem; font-weight: 700; margin-bottom: 16px; }

/* Admin shell */
.admin-topbar { background: var(--wr-navy); color: #fff; }
.admin-topbar .container { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.admin-topbar .brand .brand-text span { color: var(--wr-light-salmon); }
.admin-user { display: flex; align-items: center; gap: 14px; font-size: .9rem; }
.admin-user .who { color: rgba(255,255,255,.85); font-weight: 600; }
.admin-user .who strong { color: #fff; }

.admin-main { padding: 30px 0 70px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-head .lead { color: var(--muted); font-weight: 600; }

.admin-tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin: 22px 0 26px; flex-wrap: wrap; }
.admin-tabs button {
  font-family: var(--font); font-weight: 700; font-size: .94rem; color: var(--muted);
  background: transparent; border: none; padding: 12px 18px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.admin-tabs button:hover { color: var(--wr-navy); }
.admin-tabs button.active { color: var(--wr-navy); border-bottom-color: var(--wr-garnet); }

.help-banner {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--wr-salmon);
  border-radius: 10px; padding: 14px 18px; font-size: .9rem; color: var(--muted); font-weight: 600; margin-bottom: 22px;
}
.help-banner strong { color: var(--wr-navy); }

/* Data tables */
.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 1360px; }
/* Everything centered for a neat, aligned grid. */
.data-table thead th {
  background: var(--wr-navy); color: #fff; font-weight: 700; text-align: center; padding: 13px 12px;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.data-table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: center; }
.data-table tbody tr:nth-child(even) { background: #f6f1e7; }
.data-table tbody tr.is-over { background: #fdeae6; }
.data-table input, .data-table select {
  width: 100%; font-family: var(--font); font-weight: 600; font-size: .9rem; color: var(--ink);
  padding: 8px 9px; border: 1.5px solid var(--field-line); border-radius: 7px; background: #fff;
}
.data-table input:focus, .data-table select:focus { outline: none; border-color: var(--wr-navy); box-shadow: 0 0 0 3px rgba(39,34,34,.10); }
.data-table input { text-align: center; }
.data-table input.num { text-align: center; }
.data-table td.calc { font-weight: 900; color: var(--wr-navy); text-align: center; white-space: nowrap; }
.data-table td.calc.neg { color: var(--wr-garnet); }
/* % used column: percent + status pill stay together, centered and aligned. */
.data-table td.pctcell { white-space: nowrap; }
.data-table td.pctcell .row-pill { margin-left: 6px; }
.data-table .col-narrow { width: 130px; }

/* Roomier columns so Fund group and Notes fields are fully visible. */
.data-table select[data-field="fundGroup"] { min-width: 184px; text-align: left; }
.data-table input[data-field="name"] { min-width: 150px; }
.data-table input[data-field="notes"] { min-width: 184px; }
.data-table input[data-field="approvedBudget"],
.data-table input[data-field="spendToDate"],
.data-table input[data-field="amount"] { min-width: 96px; }
.data-table input[type="date"] { min-width: 150px; }
.data-table input[type="month"] { min-width: 150px; }
.data-table .row-pill { display: inline-block; font-size: .68rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.data-table .row-pill.pill-adopted { background: rgba(39,34,34,.10); color: var(--wr-navy); }

/* Account-number editor (fund + dept) inside the admin table */
.acct-edit { display: flex; gap: 5px; }
.acct-edit .acct-fund { width: 66px; }
.acct-edit .acct-dept { width: 50px; }
.data-table .cell-na { color: var(--muted); font-style: italic; font-size: .82rem; white-space: nowrap; }

.cell-input-wrap { position: relative; }
.cell-input-wrap .prefix { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; font-size: .88rem; pointer-events: none; }
.cell-input-wrap input { padding-left: 22px; }

.admin-actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.admin-actions .spacer { flex: 1; }
.dirty-flag { color: var(--wr-garnet-dark); font-weight: 700; font-size: .86rem; display: none; }
.dirty-flag.show { display: inline; }

/* Toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--wr-navy); color: #fff; font-weight: 700; font-size: .92rem;
  padding: 13px 22px; border-radius: 999px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 100;
  display: flex; align-items: center; gap: 9px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .check { background: var(--wr-salmon); color: var(--wr-navy-900); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: .8rem; }

/* Stat row in admin */
.admin-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.admin-stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.admin-stat .l { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.admin-stat .v { font-size: 1.4rem; font-weight: 900; color: var(--wr-navy); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* The admin area gets a wider canvas so the editor table isn't cramped. */
.admin-topbar .container, .admin-main .container { max-width: 1400px; }

/* Sticky action toolbar (top of editable tabs) — Add + Save always in reach */
.sticky-actions {
  position: sticky; top: 8px; z-index: 6;
  margin: 0 0 16px; padding: 10px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 4px 16px rgba(39,34,34,.10);
}
.fy-inline { display: flex; align-items: center; gap: 8px; }
.fy-inline label { font-weight: 700; font-size: .84rem; color: var(--surface-dark); }
.fy-inline select {
  font-family: var(--font); font-weight: 600; font-size: .88rem; color: var(--ink);
  padding: 6px 9px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff;
}

/* ---- Fiscal Years tab ----------------------------------------------- */
.fy-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }
.fy-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.fy-card.is-open { border-left: 4px solid var(--accent); }
.fy-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fy-head h3 { margin: 0; }
.fy-figures { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 8px; }
.fy-fig span { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fy-fig strong { font-size: 1.18rem; font-weight: 800; color: var(--surface-dark); font-variant-numeric: tabular-nums; }
.fy-meta { font-size: .82rem; margin-bottom: 12px; }
.fy-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.fy-import { padding: 20px 22px; }
.fy-import-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.fy-import input[type="file"] { width: 100%; font-family: var(--font); font-size: .88rem; padding: 8px; border: 1.5px dashed var(--field-line); border-radius: 9px; background: #fff; }
.fy-import textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84rem; padding: 10px 12px; border: 1.5px solid var(--field-line); border-radius: 9px; background: #fff; resize: vertical; }
.fy-import code { background: var(--surface-warm); padding: 1px 6px; border-radius: 4px; font-size: .82em; }
.fy-import a { font-weight: 700; }

/* Collapsible full-budget import panel (Department Budgets tab) */
.import-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); margin-bottom: 16px; overflow: hidden; }
.import-panel > summary {
  cursor: pointer; list-style: none; padding: 13px 16px;
  font-weight: 700; font-size: .92rem; color: var(--surface-dark);
  display: flex; align-items: center; gap: 9px;
}
.import-panel > summary::-webkit-details-marker { display: none; }
.import-panel > summary:hover { background: var(--surface-warm); }
.import-panel[open] > summary { border-bottom: 1px solid var(--line); }
.import-panel-icon { color: var(--accent); font-weight: 900; font-size: 1.05rem; line-height: 1; }
.import-panel-body { padding: 16px; }
.import-panel-body input[type="file"] { width: 100%; font-family: var(--font); font-size: .88rem; padding: 8px; border: 1.5px dashed var(--field-line); border-radius: 9px; background: #fff; }
.import-panel-body textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84rem; padding: 10px 12px; border: 1.5px solid var(--field-line); border-radius: 9px; background: #fff; resize: vertical; }
.import-panel-body a { font-weight: 700; }

/* Import merge-mode selector (Update vs Replace) */
.import-mode { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.import-mode-label { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.import-mode-opt { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 9px; cursor: pointer; font-size: .9rem; color: var(--surface-dark); background: #fff; }
.import-mode-opt.is-on { border-color: var(--accent); background: rgba(239,38,0,.05); }
.import-mode-opt input { margin-top: 2px; flex: none; }

/* Manage revenue types — editor rows */
.rtype-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rtype-row:last-of-type { border-bottom: none; }
.rtype-color { width: 40px; height: 34px; padding: 2px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff; cursor: pointer; flex: none; }
.rtype-label { flex: 1 1 160px; min-width: 120px; font-family: var(--font); font-weight: 700; font-size: .92rem; color: var(--ink); padding: 8px 10px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff; }
.rtype-budget { flex: 0 0 150px; }
.rtype-blurb { flex: 2 1 220px; min-width: 160px; font-family: var(--font); font-weight: 600; font-size: .86rem; color: var(--ink); padding: 8px 10px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff; }
/* The year of the budgeted amount, and the public trend note with its arrow. */
.rtype-compare { flex: 2 1 220px; min-width: 160px; font-family: var(--font); font-weight: 600; font-size: .86rem; color: var(--ink); padding: 8px 10px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff; }
.rtype-fy, .rtype-dir { flex: none; font-family: var(--font); font-weight: 700; font-size: .86rem; color: var(--ink); padding: 7px 8px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff; }
.rtype-hint { flex: 1 1 100%; margin: -2px 0 0; font-size: .82rem; font-weight: 600; color: var(--muted); }

/* Per-row Track-spending toggle (Department table) */
.track-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.track-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; cursor: pointer; white-space: nowrap; }
.track-toggle input { cursor: pointer; }

/* Smart-import: column-mapping preview */
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; margin-bottom: 4px; }
.map-row { display: flex; align-items: center; gap: 10px; }
.map-row label { flex: 0 0 118px; font-weight: 700; font-size: .84rem; color: var(--surface-dark); }
.map-row select {
  flex: 1; min-width: 0; font-family: var(--font); font-weight: 600; font-size: .86rem; color: var(--ink);
  padding: 8px 9px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff;
}
.map-warn { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--accent); padding: 2px 7px; border-radius: 999px; }
/* Report month (revenue import): a month picker in Chrome and Edge, a text
   box in Safari and Firefox — the hint sits on its own line under it. */
.map-row-month { flex-wrap: wrap; }
.map-row-month input { flex: 1; min-width: 0; font-family: var(--font); font-weight: 600; font-size: .86rem; color: var(--ink); padding: 7px 9px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff; }
.map-row-month .map-hint { flex-basis: 100%; margin-left: 128px; font-size: .78rem; }
.map-subhead { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 8px; }
.map-warnings { margin: 12px 0 0; padding: 12px 14px 12px 30px; background: rgba(0,127,149,.08); border-left: 3px solid var(--mhm-teal); border-radius: 8px; color: var(--surface-dark); font-size: .86rem; }
.map-warnings li { margin: 2px 0; }

/* Revenue tab fiscal-year filter */
.rev-filter { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rev-filter label { font-weight: 700; font-size: .88rem; color: var(--surface-dark); }
.rev-filter select {
  font-family: var(--font); font-weight: 600; font-size: .9rem; color: var(--ink);
  padding: 8px 10px; border: 1.5px solid var(--field-line); border-radius: 8px; background: #fff;
}

/* History editor: left-aligned identity cells inside the centered table */
.data-table td.cell-left { text-align: left; }

@media (max-width: 900px) { .fy-grid { grid-template-columns: 1fr; } }

/* ---- Change history (audit log) ------------------------------------ */
.hist-list { display: flex; flex-direction: column; gap: 14px; }
.hist-entry {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--wr-garnet);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hist-when { font-weight: 800; color: var(--wr-navy); font-size: .92rem; font-variant-numeric: tabular-nums; }
.hist-area {
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--wr-garnet-dark); background: rgba(239,38,0,.08); padding: 3px 9px; border-radius: 999px;
}
.hist-summary { font-weight: 700; color: var(--ink); margin-top: 6px; }
.hist-user { font-size: .82rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.hist-changes {
  list-style: none; margin: 12px 0 0; padding: 12px 0 0;
  border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px;
}
.hist-change { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .86rem; }
.hist-label { color: var(--ink); font-weight: 600; }
.hist-delta { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist-from { color: var(--muted); text-decoration: line-through; }
.hist-arrow { color: var(--wr-garnet); font-weight: 800; }
.hist-to { color: var(--wr-navy); font-weight: 800; }

/* ---- Utilities ------------------------------------------------------ */
.hidden { display: none !important; }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .revenue-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-stat-row { grid-template-columns: repeat(2, 1fr); }
  .footer .container { grid-template-columns: 1fr 1fr; }
  .note-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .nav-links, .topbar-links .hide-sm { display: none; }
  .nav-links.open {
    display: flex; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column;
    background: var(--wr-garnet-dark); padding: 10px 16px 16px; gap: 2px; box-shadow: var(--shadow-md);
  }
  .nav-links.open a { padding: 12px 14px; color: #fff; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .nav { position: relative; }
  .dept-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-stat-row { grid-template-columns: 1fr; }
  .footer .container { grid-template-columns: 1fr; }
  .section { padding: 40px 0; }
  .hero .container { padding-top: 46px; padding-bottom: 46px; }
  .admin-head { align-items: flex-start; }
}

/* Small phones (320–420px): narrower gutters, a compact brand (title only,
   allowed to wrap) so the Menu button never runs off the screen. */
@media (max-width: 420px) {
  .container { padding: 0 16px; }
  .nav .container { gap: 10px; }
  .brand { gap: 10px; }
  .brand img { height: 30px; }
  .brand .brand-text strong { font-size: .9rem; }
  .brand .brand-text span { display: none; }
  .topbar .container { gap: 8px; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}

/* =====================================================================
   LIVE DATA — loading, notices, draft preview, publish bar, save status
   ===================================================================== */
/* Data sections stay hidden until the dashboard has loaded. */
body.cl-loading #public-app .section { visibility: hidden; }

/* Nothing published yet (or it couldn't load): show only the notice. */
#public-app.cl-notice-mode .section:not(.cl-notice),
#public-app.cl-notice-mode .hero-actions,
#public-app.cl-notice-mode .updated-chip,
#public-app.cl-notice-mode .lead-sm,
#public-app.cl-notice-mode .nav-links a:not(.nav-cta) { display: none; }
.cl-notice .section-head { max-width: 640px; }

/* Staff preview of the unpublished draft (index.html?preview). */
.preview-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px;
  padding: 12px 16px; background: var(--surface-dark); color: #fff;
  font-size: .9rem; line-height: 1.4; text-align: center;
  box-shadow: 0 -6px 18px rgba(0,0,0,.18);
}
.preview-banner a { color: #fff; font-weight: 700; text-decoration: underline; }
.preview-banner-warn { background: var(--sand-deep); color: var(--ink); --focus-ring: var(--accent-text-strong); }
.preview-banner-warn a { color: var(--ink); }
body.has-preview-banner { padding-bottom: 64px; }

/* Admin: where the draft stands relative to the public site. */
.publish-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  margin: 18px 0 6px; padding: 14px 18px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); border-left-width: 5px;
}
.publish-bar:empty { display: none; }
.publish-bar .pb-text { flex: 1 1 420px; font-size: .92rem; line-height: 1.5; }
.publish-bar .pb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.publish-bar-ok     { border-left-color: var(--ok); }
.publish-bar-warn   { border-left-color: var(--watch); }
.publish-bar-info   { border-left-color: var(--surface-dark); }
.publish-bar-danger { border-left-color: var(--over); }
.publish-bar button:disabled { opacity: .55; cursor: progress; }

/* Admin top bar: save status. */
.sync-state { font-size: .82rem; font-weight: 700; color: rgba(255,255,255,.72); white-space: nowrap; }
.sync-state.sync-saved { color: #fff; }
.sync-state.sync-error, .sync-state.sync-conflict { color: #ffd6cf; }
@media (max-width: 900px) {
  .admin-topbar .container { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .admin-user { flex-wrap: wrap; gap: 8px 12px; }
}

/* =====================================================================
   ADMIN — messages, unsaved edits, conflicts, year-end, change history
   ===================================================================== */
/* Sign-in / password screens: an informational note (not an error). */
.form-note { background: var(--surface-warm); border: 1px solid var(--line); border-left: 4px solid var(--wr-navy);
  color: var(--ink); padding: 10px 13px; border-radius: 9px; font-size: .88rem; font-weight: 600; margin-bottom: 16px; line-height: 1.45; }

/* "Download all data" beside the page title. */
.admin-head > div:first-child { flex: 1 1 520px; min-width: 0; }
.admin-head-actions { flex: 0 1 250px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.admin-head-actions .muted { font-size: .78rem; font-weight: 600; text-align: right; }
@media (max-width: 720px) { .admin-head-actions { align-items: flex-start; } .admin-head-actions .muted { text-align: left; } }

/* Messages under the publish bar: an error (with technical details
   collapsed) or a one-off notice. */
.admin-messages:empty { display: none; }
.admin-messages { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 6px; }
.admin-alert, .admin-notice {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--over);
  font-size: .9rem; line-height: 1.5; color: var(--ink);
}
.admin-notice-info { border-left-color: var(--surface-dark); }
.admin-notice-warn { border-left-color: var(--watch); }
.admin-alert strong { color: var(--accent-text-strong); }
.msg-body { flex: 1; min-width: 0; }
.msg-body .btn { margin-left: 6px; }
.msg-dismiss {
  flex: none; background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  color: var(--muted); font-size: .95rem; line-height: 1; padding: 6px 8px;
}
.msg-dismiss:hover { background: var(--surface-warm); color: var(--ink); }
.tech-details { margin-top: 8px; font-size: .82rem; color: var(--muted); }
.tech-details summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.tech-details dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 8px 0 4px; }
.tech-details dt { font-weight: 700; color: var(--ink); }
.tech-details dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-word; }
.tech-details p { margin: 4px 0 0; }

/* Publish bar: the two versions of a conflict, side by side in words. */
.conflict-list { margin: 8px 0 0; padding-left: 20px; }
.conflict-list li { margin: 2px 0; }
.pb-actions button[disabled][title] { cursor: not-allowed; }

/* Unsaved edits: the status in the top bar and a dot on the tab. */
.sync-state.sync-dirty { color: #ffe3a3; }
.tab-dirty { color: var(--accent-text-strong); font-weight: 900; }
.dirty-flag[role="status"] { white-space: nowrap; }

/* Revenue table: the fiscal year follows the month (read-only). */
.data-table td.fy-cell { font-weight: 700; color: var(--surface-dark); }

/* Fiscal Years tab: carried-over note, close-out / open-year review. */
.fy-carried { font-size: .82rem; color: var(--accent-text-strong); font-weight: 600; margin: -4px 0 12px; }
.closeout h3 { font-size: 1rem; margin: 18px 0 6px; }
.closeout h3:first-child { margin-top: 0; }
.closeout-list { margin: 0 0 6px; padding-left: 20px; font-size: .9rem; color: var(--ink); line-height: 1.55; }
.closeout-list li { margin: 3px 0; }
.closeout-list .btn { margin-left: 6px; }
.map-warnings-warn { border-left-color: var(--accent); background: rgba(239,38,0,.06); padding-left: 14px; }
.map-warnings-warn .btn { margin-left: 6px; }

/* Change history: entries not saved yet, and paging through older ones. */
.hist-heading { font-size: 1.05rem; margin: 22px 0 6px; }
.hist-count { font-size: .86rem; font-weight: 600; margin: 0 0 12px; }
.hist-tags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.hist-pending { background: #fff; border: 1px dashed var(--accent); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 8px; }
.hist-pending h3 { font-size: 1rem; margin: 0 0 2px; color: var(--accent-text-strong); }
.hist-pending > .muted { font-size: .86rem; margin: 0 0 12px; }
.hist-entry.is-pending { border-left-color: var(--watch); border-style: dashed; }
.hist-area.hist-unsaved { color: var(--watch-text); background: var(--watch-bg); }
.hist-more { margin-top: 10px; font-size: .86rem; }
.hist-more summary { cursor: pointer; font-weight: 700; color: var(--wr-navy); }

/* =====================================================================
   PROBLEM REPORTS — "Report a problem" (js/bugreport.js)
   ===================================================================== */
/* The footer's "Report a problem" is a button (it opens a dialog) that
   looks like the footer links beside it. */
.footer .foot-report {
  display: block; margin: 0 0 8px; padding: 0; border: 0; background: none; cursor: pointer;
  font-family: var(--font); font-size: .92rem; font-weight: 600; color: rgba(255,255,255,.82); text-align: left;
}
.footer .foot-report:hover { color: #fff; text-decoration: underline; }
/* The "couldn't load the dashboard" notice offers a report. */
.cl-notice-actions { margin-top: 18px; }
/* "Report this" under a failure message, and on the sign-in screen. */
.msg-actions { margin-top: 8px; }
.msg-actions .btn { margin-left: 0; }
.form-error .btn { margin-top: 8px; }

/* The dialog: the page behind it is inert (js/bugreport.js). */
html.bug-open, html.bug-open body { overflow: hidden; }
.bug-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 32px 16px; background: rgba(20,17,17,.62);
}
.bug-dialog {
  position: relative; width: 100%; max-width: 640px; margin: auto 0;
  background: #fff; color: var(--ink); border-radius: 14px; box-shadow: var(--shadow-md);
  text-align: left; line-height: 1.5;
}
/* Focusable (tabindex="-1") only so a click on its text keeps focus in the
   dialog; it is not a keyboard stop, so it draws no ring. */
.bug-dialog:focus { outline: none; }
.bug-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.bug-head h2 { font-size: 1.35rem; margin: 4px 0 0; }
.bug-head h2:focus { outline: none; }
.bug-close {
  flex: none; width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--field-line);
  background: #fff; color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.bug-close:hover { background: var(--surface-warm); }
.bug-body { padding: 8px 22px 22px; }
.bug-intro { color: var(--muted); font-weight: 600; font-size: .92rem; }
.bug-required, .bug-optional { font-weight: 600; color: var(--muted); font-size: .82rem; }
.bug-form .field textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.bug-form .field select { appearance: auto; }
.bug-form fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.bug-form legend { font-weight: 700; font-size: .88rem; color: var(--wr-navy); margin-bottom: 6px; padding: 0; }
.bug-urgency { display: grid; gap: 6px; }
.bug-urgency label {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; cursor: pointer;
  border: 1.5px solid var(--field-line); border-radius: 9px; font-size: .9rem; line-height: 1.35;
}
.bug-urgency label:has(input:checked) { border-color: var(--wr-navy); background: var(--surface-warm); }
.bug-urgency input { flex: none; margin: 3px 0 0; accent-color: var(--accent-strong); }
.bug-urgency strong { color: var(--ink); }
.bug-urgency .bug-u-text span { color: var(--muted); font-weight: 600; }
.bug-hint { margin: 8px 0 0; font-size: .85rem; font-weight: 700; color: var(--accent-text-strong); }
.bug-hint:empty { display: none; }
.bug-error { margin: 6px 0 0; font-size: .85rem; font-weight: 700; color: var(--accent-text-strong); }
.bug-form [aria-invalid="true"] { border-color: var(--accent-text-strong); }
.bug-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.bug-form input[type="radio"]:focus-visible, .bug-form input[type="checkbox"]:focus-visible,
.bug-form input[type="file"]:focus-visible, .bug-dialog summary:focus-visible {
  outline: 3px solid var(--focus-ring); outline-offset: 2px;
}
.bug-shot-preview {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 10px;
  padding: 10px; border-radius: 9px; background: var(--surface-warm);
}
.bug-shot-preview img { max-width: 160px; max-height: 110px; border: 1px solid var(--field-line); border-radius: 6px; background: #fff; }
.bug-shot-name { flex: 1 1 140px; min-width: 0; font-size: .84rem; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
.bug-tech { margin: 0 0 12px; }
.bug-check { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: .9rem; color: var(--wr-navy); cursor: pointer; }
.bug-tech .help { font-size: .8rem; color: var(--muted); font-weight: 600; margin: 4px 0 6px; }
.bug-details { margin: 4px 0 14px; font-size: .88rem; color: var(--ink); }
.bug-details summary { cursor: pointer; font-weight: 700; color: var(--wr-navy); }
.bug-details ul { margin: 8px 0; padding-left: 20px; }
.bug-details p { margin: 6px 0; }
.bug-details-inner { margin: 8px 0 0; }
.bug-tech-json {
  max-height: 260px; overflow: auto; margin: 8px 0 0; padding: 10px 12px; border-radius: 8px;
  background: var(--surface-warm); white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem; line-height: 1.45;
}
.bug-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.bug-actions-tight { margin-top: 8px; }
.bug-status { margin: 12px 0 0; font-size: .88rem; font-weight: 600; color: var(--muted); }
.bug-status:empty { display: none; }
.bug-note {
  margin: 0 0 16px; padding: 10px 13px; border-radius: 9px; border: 1px solid var(--line);
  border-left: 4px solid var(--wr-navy); background: var(--surface-warm); font-size: .88rem; font-weight: 600;
}
.bug-note p { margin: 0; }
.bug-result h3 { font-size: 1.15rem; margin: 6px 0 10px; }
.bug-result h3:focus { outline: none; }
.bug-ref { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.2rem; font-weight: 800; letter-spacing: .02em; color: var(--ink); }
.bug-small { margin: 14px 0 0; font-size: .84rem; color: var(--muted); font-weight: 600; }
.bug-copy-text {
  width: 100%; min-height: 140px; margin-top: 12px; padding: 10px; border: 1.5px solid var(--field-line); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem;
}
/* The honeypot: out of sight and out of the tab order (only bots fill it). */
.bug-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Phones, down to 320px: the dialog takes the whole screen. */
@media (max-width: 560px) {
  .bug-overlay { padding: 0; }
  .bug-dialog { max-width: none; min-height: 100%; border-radius: 0; box-shadow: none; }
  .bug-head { padding: 14px 16px 0; }
  .bug-body { padding: 6px 16px 20px; }
  .bug-two { grid-template-columns: minmax(0, 1fr); }
  .bug-actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .bug-dialog { animation: bug-in .16s ease-out; }
}
@keyframes bug-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
