/* 4Real Design System — tokens
   Drop in wwwroot/css/4real-tokens.css, load first in _Layout.cshtml.
   Fonts: add the Google Fonts <link> from 4real-fonts.html to <head>. */

:root {
  /* brand — sampled from the logo artwork */
  --color-green-50:#F4F9EA; --color-green-100:#E6F3CF; --color-green-200:#D0E9A9;
  --color-green-300:#B4DB7A; --color-green-400:#9DD055; --color-green-500:#8CC63F;
  --color-green-600:#74A831; --color-green-700:#5C8527; --color-green-800:#47661F;
  --color-green-900:#354C18;

  --color-lime-50:#FAFCE9; --color-lime-100:#F3F8C7; --color-lime-200:#E7F195;
  --color-lime-300:#D6E663; --color-lime-400:#CADE45; --color-lime-500:#BFD630;
  --color-lime-600:#9FB424; --color-lime-700:#7C8C1E; --color-lime-800:#5F6B1B;
  --color-lime-900:#495317;

  --color-kelly-100:#D3F2DF; --color-kelly-300:#66D08D;
  --color-kelly-500:#0CB14B; --color-kelly-700:#08853A;

  /* neutral */
  --color-n-0:#FFFFFF; --color-n-50:#F8F8F7; --color-n-100:#F0F0EF;
  --color-n-200:#E3E2E1; --color-n-300:#C9C7C6; --color-n-400:#9D9B9A;
  --color-n-500:#757272; --color-n-600:#565353; --color-n-700:#3E3B3B;
  --color-n-800:#2C2929; --color-n-900:#231F20;

  /* accent + semantic */
  --color-accent-100:#EAE4FE; --color-accent-300:#B4A2F8; --color-accent-500:#6C4CF0;
  --color-accent-700:#4A31B3; --color-accent-900:#2C1D6B;
  --color-success:#0CB14B; --color-warning:#E9A21B;
  --color-error:#E5484D;   --color-info:#2E7CF6;

  /* semantic aliases — retheme by remapping these only */
  --bg:var(--color-n-50);
  --surface:var(--color-n-0);
  --border:var(--color-n-200);
  --text:var(--color-n-800);
  --text-muted:var(--color-n-500);
  --action:var(--color-green-500);
  --action-hover:var(--color-green-600);
  --on-action:var(--color-n-900);
  --focus-ring:0 0 0 3px rgba(140,198,63,.4);

  /* ── Theme colour (runtime) ─────────────────────────────────────────────
     The one colour the end user can repaint at runtime (theme picker / a
     custom hex). It is NOT --action: --action is "things you can click"
     and stays DS green everywhere. --theme-primary is "the chrome that
     follows the brand colour the tenant picked" — sidebar/rail, page
     header accents, nav active/hover states. Default below is DS green-600
     (#74A831), not the portal's historical default preset (#78AD36,
     "lime") — that hex predates this design system.

     -dark / -light are picked from the nearest EXISTING steps on the
     green ramp, not freehand hex: running the portal's own custom-colour
     formula (wwwroot/js/custom.js deriveColors(), ~L2092-2106 — same hue/
     sat, lightness -18 for dark, lightness +35/sat -20 for light) on
     #74A831 lands within ~1.5pp lightness of --color-green-800 for dark;
     --color-green-50 is both the "light" step that formula points at AND
     the exact pairing the portal already hardcodes as its proven-legible
     default-theme override for the sidebar's selection pill (see
     4real-shell.css ~L1536-1543, ~L1604-1614: "green-50 / green-900", not
     green-700 — ink on --color-green-700 measures near 2:1 on that pale a
     background). Use --theme-primary-dark for the general "dark text on a
     tinted chip" role below; if you build a fully OPAQUE pale tile (not an
     alpha tint) the way that sidebar pill does, its text needs the extra
     contrast of --color-green-900, not -dark — see the tinted-pill note
     in the README before assuming one dark value covers both. */
  --theme-primary:var(--color-green-600);
  --theme-primary-rgb:116,168,49;
  --theme-primary-dark:var(--color-green-800);
  --theme-primary-light:var(--color-green-50);

  /* Back-compat aliases — the portal's shell CSS/JS already ships reading
     --pc-primary* (main.css theme presets, 4real-shell.css, 4real-shell.js).
     Point them at the DS names so existing code keeps working unmodified;
     new code should read --theme-primary* directly. */
  --pc-primary:var(--theme-primary);
  --pc-primary-rgb:var(--theme-primary-rgb);
  --pc-primary-dark:var(--theme-primary-dark);
  --pc-primary-light:var(--theme-primary-light);

  /* type */
  --font-display:'Outfit', system-ui, sans-serif;
  --font-body:'Manrope', system-ui, sans-serif;
  --font-mono:'JetBrains Mono', monospace;

  /* space */
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px;
  --space-6:24px; --space-8:32px; --space-12:48px; --space-16:64px;

  /* radius */
  --radius-xs:2px; --radius-sm:6px; --radius-md:10px;
  --radius-lg:16px; --radius-full:999px;

  /* elevation */
  --shadow-sm:0 1px 2px rgba(35,31,32,.06), 0 2px 8px rgba(35,31,32,.05);
  --shadow-md:0 4px 12px rgba(35,31,32,.08), 0 12px 28px rgba(35,31,32,.07);
  --shadow-lg:0 8px 24px rgba(35,31,32,.10), 0 24px 56px rgba(35,31,32,.10);

  /* ── Tooltip ──────────────────────────────────────────────────────────
     One tooltip identity for the whole product. Ported verbatim from the
     portal (wwwroot/css/4real-tokens.css ~L54-69), written after the
     portal found FOUR different tooltip appearances live at once across
     one screen (icon (i) balloons, payment methods, products, Chart.js).
     Anyone drawing a new tooltip should consume these, not pick values. */
  --tooltip-bg:        var(--color-n-900);
  --tooltip-fg:        var(--color-n-50);
  --tooltip-radius:    8px;
  --tooltip-pad-y:     10px;
  --tooltip-pad-x:     12px;
  --tooltip-shadow:    var(--shadow-md);
  --tooltip-font-size: 11px;
  --tooltip-weight:    500;
  --tooltip-line:      1.45;
}

/* Dark mode has two hooks on purpose. `data-theme` is free for a plain
   page to use for light/dark, but the portal already uses `data-theme` on
   <html>/<body> to carry the runtime THEME COLOUR (lime, blue, purple, a
   custom hex, …) — so [data-theme="dark"] never matches there, and dark
   mode is `body.dark-mode` instead (portal wwwroot/css/4real-shell.css
   ~L1365 remaps the same aliases under that class). Both selectors are
   defined here, together, so the two can never drift out of sync: a
   standalone page can use data-theme="dark" on <html>, a page with its own
   colour picker can use .dark-mode on <body>, and either gets the same
   remap. */
[data-theme="dark"],
.dark-mode {
  --bg:#191617;
  --surface:#201D1E;
  --border:#3A3637;
  --text:#EDECEB;
  --text-muted:#9D9B9A;
  --action:#9DD055;
  --on-action:var(--color-n-900);
}
