/* ==========================================================================
   MoneyPilot — base.css
   Webfonts, design tokens, reset, typography, utilities.
   components.css and layout.css read from these tokens and declare no
   raw colour of their own.
   ========================================================================== */

/* --- Webfonts ------------------------------------------------------------
   Self-hosted so the prototype needs no CDN and no network.

   IBM Plex Sans    UI, body, controls              SIL Open Font License 1.1
   IBM Plex Serif   headlines, headline figures     SIL Open Font License 1.1
   IBM Plex Mono    ledgers, codes, provenance      SIL Open Font License 1.1

   The serif is the "classic" half of the ledger look: statements, banknotes
   and receipts have always set their headline figures in a serif, and a
   budget reads as a document you can trust when it looks like one. It is the
   same superfamily as Sans and Mono, so the three share metrics and never
   fight each other on a line.

   latin-ext is not optional: the naira sign this entire product is
   denominated in (U+20A6) lives in the U+20A0–20AB block. Checked against
   each file's cmap before shipping — the latin files do NOT carry it, the
   latin-ext files do, in Serif exactly as in Sans.
   ---------------------------------------------------------------------- */
@font-face { font-family:'Plex Sans'; font-style:normal; font-weight:400; font-display:swap;
  src:url('../fonts/plex-sans-400-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Sans'; font-style:normal; font-weight:400; font-display:swap;
  src:url('../fonts/plex-sans-400-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family:'Plex Sans'; font-style:normal; font-weight:500; font-display:swap;
  src:url('../fonts/plex-sans-500-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Sans'; font-style:normal; font-weight:500; font-display:swap;
  src:url('../fonts/plex-sans-500-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family:'Plex Sans'; font-style:normal; font-weight:600; font-display:swap;
  src:url('../fonts/plex-sans-600-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Sans'; font-style:normal; font-weight:600; font-display:swap;
  src:url('../fonts/plex-sans-600-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family:'Plex Mono'; font-style:normal; font-weight:400; font-display:swap;
  src:url('../fonts/plex-mono-400-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Mono'; font-style:normal; font-weight:400; font-display:swap;
  src:url('../fonts/plex-mono-400-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family:'Plex Mono'; font-style:normal; font-weight:500; font-display:swap;
  src:url('../fonts/plex-mono-500-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Mono'; font-style:normal; font-weight:500; font-display:swap;
  src:url('../fonts/plex-mono-500-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family:'Plex Serif'; font-style:normal; font-weight:400; font-display:swap;
  src:url('../fonts/plex-serif-400-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Serif'; font-style:normal; font-weight:400; font-display:swap;
  src:url('../fonts/plex-serif-400-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family:'Plex Serif'; font-style:italic; font-weight:400; font-display:swap;
  src:url('../fonts/plex-serif-400i-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Serif'; font-style:italic; font-weight:400; font-display:swap;
  src:url('../fonts/plex-serif-400i-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family:'Plex Serif'; font-style:normal; font-weight:500; font-display:swap;
  src:url('../fonts/plex-serif-500-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Serif'; font-style:normal; font-weight:500; font-display:swap;
  src:url('../fonts/plex-serif-500-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

@font-face { font-family:'Plex Serif'; font-style:normal; font-weight:600; font-display:swap;
  src:url('../fonts/plex-serif-600-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Plex Serif'; font-style:normal; font-weight:600; font-display:swap;
  src:url('../fonts/plex-serif-600-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }


/* --- Tokens: light (default) ---------------------------------------------
   "The ledger." Warm paper neutrals rather than cool porcelain: this product
   is about money people hold and spend, and paper is what money, receipts
   and statements have always been printed on. Ink navy carries the brand,
   market amber the physical world of prices.

   Cards stay pure #ffffff on the paper ground, so the categorical chart ramp
   below — validated against white — still holds without re-validation.

   Every text token clears WCAG AA (4.5:1) on both --surface and --bg; the
   old --text-3 (#7b8698) managed ~3.7:1 and carried most of the small print. */
:root {
  /* Surfaces */
  --bg:            #f4f1ea;
  --surface:       #ffffff;
  --surface-2:     #faf8f3;
  --surface-3:     #ede8de;
  --overlay:       rgba(20, 17, 12, .52);

  /* Lines */
  --border:        #e4ded2;
  --border-strong: #cdc5b5;
  --hairline:      #dcd5c7;

  /* Ink */
  --text:          #17191e;
  --text-2:        #4d525b;
  --text-3:        #686d76;
  --text-inv:      #ffffff;

  /* Brand — ink navy. The colour of a signature on a cheque, not a fintech
     gradient. */
  --primary:       #1b365d;
  --primary-hover: #142a4a;
  --primary-soft:  #e6ebf2;
  --primary-line:  #b7c3d5;
  --primary-ink:   #132846;

  /* Accent — market amber. Used for the human, physical side of the
     product: prices, markets, the things people actually buy. Deepened a
     step so it passes AA as text (#b8681a sat at 4.2:1). */
  --accent:        #a85d14;
  --accent-hover:  #8f4e0f;
  --accent-soft:   #f8ecdb;
  --accent-line:   #e6c9a3;
  --accent-ink:    #7f4610;

  /* Semantic — reserved. Never reused as a chart series colour.
     Success is banknote green rather than traffic-light green. */
  --success:       #1d6b4a;
  --success-soft:  #e2efe7;
  --warn:          #8a5a06;
  --warn-soft:     #f8ecd3;
  --danger:        #a3322b;
  --danger-soft:   #f8e5e2;
  --info:          #245d86;
  --info-soft:     #e4edf4;

  /* Data-viz categorical ramp.
     Validated with the palette checker in this order against #ffffff:
     lightness band PASS, chroma floor PASS, normal-vision floor PASS,
     contrast PASS, CVD separation WARN on c5↔c6 (ΔE 6.4 deutan).
     That WARN is why every chart in this product ships a legend AND direct
     labels AND a 2px surface gap between fills — colour is never the only
     thing carrying identity. Assign in order; never cycle. */
  --c1: #2563a8;   /* blue   */
  --c2: #b8681a;   /* amber  */
  --c3: #0d8f83;   /* teal   */
  --c4: #7a45b5;   /* violet */
  --c5: #4f8b23;   /* olive  */
  --c6: #c23a63;   /* rose   */

  /* Chart furniture — recessive by design */
  --grid:          #ece7dd;
  --track:         #ece7de;
  --plot:          #ffffff;

  /* Type */
  --font:    'Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --serif:   'Plex Serif', Georgia, "Times New Roman", serif;
  --mono:    'Plex Mono', ui-monospace, "SFMono-Regular", Consolas, monospace;

  --t-xs:   11.5px;
  --t-sm:   13px;
  --t-base: 15px;
  --t-md:   17px;
  --t-lg:   20px;
  --t-xl:   26px;
  --t-2xl:  34px;
  --t-3xl:  46px;
  --t-4xl:  62px;

  /* Geometry — deliberately not one radius everywhere. Member cards are a
     step softer than the console's, which stays a tight, flat tool. */
  --r-xs: 4px; --r-sm: 8px; --r-md: 11px; --r-lg: 16px; --r-xl: 24px;
  --r-pill: 999px;
  --r-card: 14px;

  /* Elevation — restrained, and warm-tinted so shadows sit on paper rather
     than floating above it. Structure still comes from hairlines. */
  --sh-1: 0 1px 2px rgba(40, 32, 20, .05);
  --sh-2: 0 1px 2px rgba(40, 32, 20, .05), 0 10px 26px -10px rgba(40, 32, 20, .14);
  --sh-3: 0 26px 64px -14px rgba(30, 24, 14, .30);

  /* Motion */
  --ease: cubic-bezier(.32, .72, .28, 1);
  --fast: 120ms var(--ease);
  --med:  220ms var(--ease);
  --slow: 520ms var(--ease);

  /* Shell metrics */
  --sidebar-w:  246px;
  --app-side-w: 256px;
  --topbar-h:   60px;
  --phone-w:    440px;
}

/* --- Tokens: dark --------------------------------------------------------
   "Night ledger." Selected against the dark surface, not flipped: the ink
   is a warm off-white, like the same paper under a lamp, so the two themes
   read as one product. The categorical ramp was re-validated at #171b21
   rather than lightened arithmetically, and the surfaces here sit within a
   hair of that, so it still holds.                                       */
:root[data-theme="dark"] {
  --bg:            #0f1115;
  --surface:       #171a20;
  --surface-2:     #1c2027;
  --surface-3:     #252a33;
  --overlay:       rgba(0, 0, 0, .66);

  --border:        #2a2f38;
  --border-strong: #3b414c;
  --hairline:      #30353f;

  --text:          #ece7dd;
  --text-2:        #b3aea4;
  --text-3:        #8a867e;
  --text-inv:      #0f1115;

  --primary:       #8fb4e3;
  --primary-hover: #a9c6ec;
  --primary-soft:  #182538;
  --primary-line:  #2d4466;
  --primary-ink:   #c4d8f1;

  --accent:        #e0a060;
  --accent-hover:  #eab47c;
  --accent-soft:   #2d2316;
  --accent-line:   #574027;
  --accent-ink:    #f0c592;

  --success:       #5fb88d;
  --success-soft:  #142820;
  --warn:          #dcab55;
  --warn-soft:     #2c2416;
  --danger:        #e57b70;
  --danger-soft:   #311d1b;
  --info:          #6aa8da;
  --info-soft:     #15232f;

  --c1: #5b98d8;
  --c2: #bd8130;
  --c3: #159f92;
  --c4: #9575d0;
  --c5: #6da148;
  --c6: #d15f85;

  --grid:          #23272f;
  --track:         #262b34;
  --plot:          #171a20;

  --sh-1: 0 1px 1px rgba(0, 0, 0, .32);
  --sh-2: 0 1px 2px rgba(0, 0, 0, .40), 0 6px 16px rgba(0, 0, 0, .34);
  --sh-3: 0 18px 56px rgba(0, 0, 0, .58);
}


/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

img, svg, video { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: var(--primary-soft); color: var(--primary-ink); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}


/* --- Typography ---------------------------------------------------------- */
h1, h2, h3, h4, h5 { line-height: 1.18; font-weight: 600; letter-spacing: -.016em; text-wrap: balance; }
h1 { font-size: var(--t-xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }
h4 { font-size: var(--t-base); }

/* Display voice: Plex Sans 600, large, tight. */
.display {
  font-weight: 600;
  letter-spacing: -.032em;
  line-height: 1.04;
  text-wrap: balance;
}
.d-4xl { font-size: clamp(38px, 7vw, var(--t-4xl)); }
.d-3xl { font-size: clamp(30px, 5.2vw, var(--t-3xl)); }
.d-2xl { font-size: clamp(25px, 4vw, var(--t-2xl)); }

/* The ledger voice: serif for headlines and the figures they announce.
   Lining, tabular numerals so a column of amounts still aligns by digit. */
.serif {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.012em;
}
.fig {
  font-family: var(--serif);
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.018em;
  line-height: 1;
}
.italic { font-style: italic; }

.lede { font-size: var(--t-md); color: var(--text-2); line-height: 1.6; }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  display: block;
}
.eyebrow-accent { color: var(--accent); }

.tiny   { font-size: var(--t-xs); line-height: 1.45; }
.small  { font-size: var(--t-sm); line-height: 1.5; }
.md     { font-size: var(--t-md); }
.lg     { font-size: var(--t-lg); }

.strong { font-weight: 600; }
.medium { font-weight: 500; }
.muted  { color: var(--text-2); }
.dim    { color: var(--text-3); }
.ink    { color: var(--text); }

.mono, .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
.num-plain { font-variant-numeric: tabular-nums; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.link { color: var(--primary); font-weight: 500; }
.link-accent { color: var(--accent); font-weight: 500; }

.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;
}


/* --- Layout utilities ---------------------------------------------------- */
.row  { display: flex; align-items: center; gap: 10px; }
.col  { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.none { flex: none; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.center  { text-align: center; }
.middle  { display: flex; align-items: center; justify-content: center; }
.start   { align-items: flex-start; }
.end     { justify-content: flex-end; }

.g-2{gap:2px}.g-4{gap:4px}.g-6{gap:6px}.g-8{gap:8px}.g-10{gap:10px}
.g-12{gap:12px}.g-14{gap:14px}.g-16{gap:16px}.g-20{gap:20px}.g-24{gap:24px}.g-32{gap:32px}

.mt-4{margin-top:4px}.mt-8{margin-top:8px}.mt-12{margin-top:12px}
.mt-16{margin-top:16px}.mt-20{margin-top:20px}.mt-24{margin-top:24px}.mt-32{margin-top:32px}
.mb-4{margin-bottom:4px}.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}
.mb-16{margin-bottom:16px}.mb-20{margin-bottom:20px}.mb-24{margin-bottom:24px}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  /* Stat tiles are short and read fine two-up even on a narrow phone.
     Stacking four of them wastes most of a screen the user has to scroll. */
  .grid-2.keep-2, .grid-3.keep-2, .grid-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.hidden { display: none !important; }
.rule { height: 1px; background: var(--border); border: 0; }
.spacer { flex: 1 1 auto; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
