/* ==========================================================================
   Little Chama Portal — Design tokens
   The LittleAccounts frame (left menu, slim app bar, Lexend at 13px, flat
   tinted chips) in Little's own green, pushed a step further: near-black
   surfaces with a whisper of green in them, hairline borders in place of
   shadows, 12px cards, and one emerald accent.
   Dark is the default; `data-theme="light"` on <html> switches the whole set
   (assets/js/theme-init.js sets it before first paint).

   Every value used by the portal is declared here. Component CSS reads the
   role tokens (--ink-*, --brand-*, --surface*, state pairs) and so follows the
   theme without knowing which one is on.

   To re-accent the portal change the ACCENT block in both themes — nothing
   else names the hue except the chart inks, which are validated per surface.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --------------------------------------------------------------- ACCENT
     Little green. --primary is the brand's own #0E9F6E; -strong and -bright
     are the steps either side of it, for gradients and pressed states.      */
  --primary: #0E9F6E;
  --primary-rgb: 14, 159, 110;
  --primary-hover: #0B8A5F;
  --primary-strong: #0A7D53;
  --primary-bright: #17B57F;
  --link: #4FC195;

  /* The accent as a scale. 600 is the solid; 700/800 are TEXT on a tint, so
     they are light here and dark on the light theme; 025–200 are the tints. */
  --brand-900: #042A1C;
  --brand-800: #AEE8CB;
  --brand-700: #4FC195;
  --brand-600: var(--primary);
  --brand-500: #17B57F;
  --brand-400: #4FC195;
  --brand-300: #7FD5AF;
  --brand-200: rgba(var(--primary-rgb), 0.35);
  --brand-100: rgba(var(--primary-rgb), 0.2);
  --brand-050: rgba(var(--primary-rgb), 0.13);
  --brand-025: rgba(var(--primary-rgb), 0.07);

  /* ------------------------------------------------------------- semantic */
  --success: #2FC98E;
  --danger: #F0506B;
  --danger-rgb: 240, 80, 107;
  --warning: #F5B341;

  /* ------------------------------------------------------------- surfaces
     Three steps of near-black, each with the same faint green cast as the
     accent so the greys sit with the brand instead of beside it.            */
  --bg-color: #0B0F0D;
  --bg-color-2: #0F1412;
  --card-bg: #121815;
  --surface-raised: #171E1A;
  --border-color: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --hover-bg: rgba(255, 255, 255, 0.05);
  --active-bg: rgba(255, 255, 255, 0.09);
  --row-hover: rgba(255, 255, 255, 0.03);

  --surface: var(--card-bg);
  --surface-sunken: var(--bg-color-2);
  --surface-app: var(--bg-color);
  --surface-glass: var(--card-bg);
  --surface-glass-strong: var(--card-bg);

  /* A soft green light falling on the top of the content column. */
  --glow-alpha: 0.16;
  --page-glow: radial-gradient(1100px 420px at 18% -160px, rgba(var(--primary-rgb), var(--glow-alpha)), transparent 70%);

  /* The one inverted pair — toasts and the solid "dark" button. */
  --inverse-bg: #E8EEEA;
  --inverse-fg: #0B0F0D;

  /* Code is always set on a dark slab, in both themes. */
  --code-bg: #080B0A;

  /* ----------------------------------------------------------------- text
     --ink-900 is the strongest text and --ink-400 the faintest readable tier
     (4.97:1 on the card); 300 is placeholder/decoration only. 100–200 are
     hairlines and fills, never text.                                        */
  --text-main: #E8EEEA;
  --text-muted: #A7B2AC;
  --text-light: #7E8983;

  --ink-900: #F4F8F6;
  --ink-800: var(--text-main);
  --ink-700: #CDD6D1;
  --ink-600: var(--text-muted);
  --ink-500: #96A19B;
  --ink-400: var(--text-light);
  --ink-300: #5B655F;
  --ink-200: var(--border-strong);
  --ink-150: var(--border-color);
  --ink-100: rgba(255, 255, 255, 0.055);

  --white: #ffffff;

  /* ---------------------------------------------------------------- frame */
  --sidebar-width: 224px;
  --sidebar-rail: 56px;
  --appbar-height: 52px;
  --sidebar-bg: #080B0A;
  --appbar-bg: var(--bg-color);
  --sidebar-divider: rgba(255, 255, 255, 0.06);
  --sidebar-section: #76817B;
  --sidebar-item-text: #98A39D;
  --sidebar-item-hover-bg: rgba(255, 255, 255, 0.05);
  --sidebar-item-hover-text: #E8EEEA;
  --sidebar-item-active-bg: rgba(var(--primary-rgb), 0.15);
  --sidebar-item-active-text: #F4F8F6;
  --sidebar-item-active-icon: var(--brand-700);

  /* ---------------------------------------------------------------- state
     Flat chips: a ~13%-alpha tint under a bright 400-shade label. No border,
     no dot. `info` is deliberately blue, not green, so it never reads as
     another shade of "good".                                               */
  --good-bg: rgba(34, 197, 94, 0.13);
  --good-fg: #4ADE80;
  --warn-bg: rgba(245, 158, 11, 0.13);
  --warn-fg: #FBBF24;
  --serious-bg: rgba(239, 68, 68, 0.13);
  --serious-fg: #F87171;
  --info-bg: rgba(59, 130, 246, 0.14);
  --info-fg: #7AB1FB;
  --neutral-bg: rgba(255, 255, 255, 0.07);
  --neutral-fg: #A7B2AC;
  --alert-dot: var(--danger);

  /* ----------------------------------------------------- stat-tile accents
     A tile is a plain card; the name picks the dot before its label and the
     faint wash in its corner.                                               */
  --tile-mint: #2FC98E;
  --tile-sage: #9BD67A;
  --tile-teal: #2DD4BF;
  --tile-peach: #F5A65B;
  --tile-lime: #C5E063;

  /* -------------------------------------------------------- avatar tints
     rgb triple for the fill (used at --tint-alpha) + the initials' colour.  */
  --tint-0: 52, 211, 153;   --tint-0-fg: #34D399;
  --tint-1: 163, 230, 53;   --tint-1-fg: #A3E635;
  --tint-2: 45, 212, 191;   --tint-2-fg: #2DD4BF;
  --tint-3: 251, 191, 36;   --tint-3-fg: #FBBF24;
  --tint-4: 96, 165, 250;   --tint-4-fg: #60A5FA;
  --tint-5: 167, 139, 250;  --tint-5-fg: #A78BFA;
  --tint-alpha: 0.16;

  /* ------------------------------------------------------------ chart ink
     Two series, one hue, split by lightness. Dark steps are chosen for this
     surface, not flipped from light. dataviz validator, surface #121815:
       #12AA76 ↔ #0A7550 · ΔE 15.9 normal · 15.6 deutan · 16.0 tritan
       both inside the dark lightness band · both >= 3:1            (PASS)   */
  --chart-surface: var(--card-bg);
  --chart-series-1: #12AA76;
  --chart-series-2: #0A7550;
  --chart-grid: rgba(255, 255, 255, 0.06);
  --chart-axis-label: #7E8983;

  /* Ordinal ramp — ORDERED buckets only. One hue, dim -> bright on dark.
       #0A7D53 #0E9F6E #4FC195 #AEE8CB
       monotone L PASS · adjacent dL >= 0.06 PASS · surface end 3.49:1 PASS
       single hue, spread 4deg PASS
     -ink is the label colour that reads on each step.                       */
  --chart-ord-1: #0A7D53;
  --chart-ord-2: #0E9F6E;
  --chart-ord-3: #4FC195;
  --chart-ord-4: #AEE8CB;
  --chart-ord-1-ink: #ffffff;
  --chart-ord-2-ink: #042A1C;
  --chart-ord-3-ink: #042A1C;
  --chart-ord-4-ink: #042A1C;

  /* Chart-scale status fills — reserved, always shipped with a label. */
  --chart-good: #2FC98E;
  --chart-warn: #F7CB1F;
  --chart-serious: #F4635C;

  /* --------------------------------------------------------------- radius */
  --radius-sm: 8px;    /* controls */
  --radius-md: 12px;   /* cards, tiles */
  --radius-lg: 16px;   /* sheets, the sign-in card */

  --r-xs: 6px;
  --r-sm: var(--radius-sm);
  --r-md: var(--radius-md);
  --r-lg: var(--radius-md);
  --r-xl: var(--radius-md);
  --r-2xl: var(--radius-lg);
  --r-pill: 999px;

  /* -------------------------------------------------------------- shadows
     Cards are drawn, not lifted: the "inset" slot is the 1px hairline plus
     a faint highlight along the top edge.                                   */
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --dropdown-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.75), 0 4px 12px -4px rgba(0, 0, 0, 0.5);

  --sh-xs: none;
  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sh-md: var(--card-shadow);
  --sh-lg: var(--dropdown-shadow), 0 0 0 1px var(--border-strong);
  --sh-xl: 0 32px 80px -24px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-color);
  --sh-pill: none;
  --sh-inset-card: inset 0 0 0 1px var(--border-color), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  --ring-brand: 0 0 0 3px rgba(var(--primary-rgb), 0.3);

  /* ---------------------------------------------------------------- space */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 56px;

  /* ------------------------------------------------------- content widths */
  --w-shell: 1680px;   /* the content column inside the app frame */
  --w-auth: 1280px;    /* the sign-in split */
  --w-form: 420px;     /* the sign-in card */

  /* ------------------------------------------------------------ typography */
  --font-sans: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI Variable",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-num: var(--font-sans);

  /* size / line-height / weight / tracking, named by role */
  --t-display-size: 30px;
  --t-display-lh: 1.1;
  --t-display-weight: 600;
  --t-display-track: -0.025em;

  --t-hero-size: 22px;
  --t-hero-lh: 1.2;
  --t-hero-weight: 500;
  --t-hero-track: -0.02em;

  --t-figure-size: 24px;
  --t-figure-weight: 600;
  --t-figure-track: -0.025em;

  --t-stat-size: 22px;
  --t-stat-weight: 600;
  --t-stat-track: -0.025em;

  --t-card-title-size: 14px;
  --t-card-title-weight: 600;
  --t-card-title-track: -0.005em;

  --t-body-size: 13px;
  --t-body-weight: 400;

  --t-cell-size: 13px;
  --t-cell-weight: 400;

  --t-label-size: 11.5px;
  --t-label-weight: 400;
  --t-label-track: 0;

  --t-micro-size: 10.5px;
  --t-micro-weight: 600;
  --t-micro-track: 0.07em;

  /* ---------------------------------------------------------------- motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 380ms;

  /* A very faint grain, inlined so it works offline. Used on the sign-in
     panel to keep the large gradient from looking flat. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Light theme — white cards on a faintly green paper. Only what differs.
   ========================================================================== */
:root[data-theme="light"] {
  color-scheme: light;

  /* --------------------------------------------------------------- ACCENT */
  --link: #0A7D53;
  --brand-800: #06452D;
  --brand-700: #0A7D53;
  --brand-200: rgba(var(--primary-rgb), 0.28);
  --brand-100: rgba(var(--primary-rgb), 0.15);
  --brand-050: rgba(var(--primary-rgb), 0.09);
  --brand-025: rgba(var(--primary-rgb), 0.045);

  --success: #0E9F6E;
  --danger: #DC2F4B;
  --danger-rgb: 220, 47, 75;
  --warning: #D98A00;

  --bg-color: #F5F8F6;
  --bg-color-2: #F0F4F1;
  --card-bg: #FFFFFF;
  --surface-raised: #FFFFFF;
  --border-color: #E3E9E5;
  --border-strong: #CDD6D0;
  --hover-bg: rgba(15, 26, 20, 0.045);
  --active-bg: rgba(15, 26, 20, 0.07);
  --row-hover: rgba(15, 26, 20, 0.025);

  --glow-alpha: 0.1;

  --inverse-bg: #0F1A14;
  --inverse-fg: #FFFFFF;
  --code-bg: #0E1512;

  --text-main: #0F1A14;
  --text-muted: #4D5B53;
  --text-light: #66726A;

  --ink-900: #0A120E;
  --ink-700: #26332B;
  --ink-500: #56635B;
  --ink-300: #A9B4AE;
  --ink-100: rgba(15, 26, 20, 0.05);

  --sidebar-bg: #FFFFFF;
  --appbar-bg: #FFFFFF;
  --sidebar-divider: #E3E9E5;
  --sidebar-section: #66726A;
  --sidebar-item-text: #3A463F;
  --sidebar-item-hover-bg: rgba(15, 26, 20, 0.045);
  --sidebar-item-hover-text: #0F1A14;
  --sidebar-item-active-bg: rgba(var(--primary-rgb), 0.11);
  --sidebar-item-active-text: #0A120E;

  --good-bg: rgba(22, 163, 74, 0.12);
  --good-fg: #15803D;
  --warn-bg: rgba(217, 119, 6, 0.12);
  --warn-fg: #B45309;
  --serious-bg: rgba(220, 38, 38, 0.1);
  --serious-fg: #B91C1C;
  --info-bg: rgba(59, 130, 246, 0.12);
  --info-fg: #1D4ED8;
  --neutral-bg: rgba(15, 26, 20, 0.055);
  --neutral-fg: #4D5B53;

  --tile-mint: #0E9F6E;
  --tile-sage: #5E9A3A;
  --tile-teal: #0D9488;
  --tile-peach: #D97706;
  --tile-lime: #7A9A1C;

  --tint-0: 5, 150, 105;    --tint-0-fg: #047857;
  --tint-1: 101, 163, 13;   --tint-1-fg: #4D7C0F;
  --tint-2: 13, 148, 136;   --tint-2-fg: #0F766E;
  --tint-3: 217, 119, 6;    --tint-3-fg: #B45309;
  --tint-4: 37, 99, 235;    --tint-4-fg: #1D4ED8;
  --tint-5: 124, 58, 237;   --tint-5-fg: #6D28D9;
  --tint-alpha: 0.12;

  /* dataviz validator, surface #FFFFFF:
       #0A7D53 ↔ #4FC195 · ΔE 21.2 normal · 21.1 deutan · 20.5 tritan  (PASS)
       #4FC195 is 2.24:1 on white — the legend carries every value and the
       second series is hatched, which is the relief that warning asks for.  */
  --chart-series-1: #0A7D53;
  --chart-series-2: #4FC195;
  --chart-grid: #E8EFEA;
  --chart-axis-label: #66726A;

  /* light -> dark on white: #4FC195 #0E9F6E #0A5C3B #042A1C (all PASS) */
  --chart-ord-1: #4FC195;
  --chart-ord-2: #0E9F6E;
  --chart-ord-3: #0A5C3B;
  --chart-ord-4: #042A1C;
  --chart-ord-1-ink: #042A1C;
  --chart-ord-2-ink: #042A1C;
  --chart-ord-3-ink: #ffffff;
  --chart-ord-4-ink: #ffffff;

  --chart-good: #0E9F6E;
  --chart-warn: #C98A08;
  --chart-serious: #B93B2F;

  --card-shadow: 0 1px 2px rgba(15, 26, 20, 0.05), 0 1px 1px rgba(15, 26, 20, 0.03);
  --dropdown-shadow: 0 16px 36px -12px rgba(15, 26, 20, 0.22), 0 2px 6px rgba(15, 26, 20, 0.06);
  --sh-sm: 0 1px 2px rgba(15, 26, 20, 0.06);
  --sh-xl: 0 32px 80px -28px rgba(15, 26, 20, 0.3), 0 0 0 1px var(--border-color);
  --sh-inset-card: inset 0 0 0 1px var(--border-color);
}
