/* ─────────────────────────────────────────────────────────────────────
 * Minutely design tokens — the only place colours, type, spacing and
 * motion are defined. Templates use var(--…) only.
 *
 * Palette
 *   primary  forest green #0B3D2E (hover #0F5240)  → filled buttons, selected
 *   mint     #5FD4A8                               → highlights, focus, success
 *   amber    #F5A524                               → attention
 *   red      #E5484D                               → destructive
 *   blue     #3E63DD                               → info
 *   neutrals 12-step warm grey per theme (Radix-style: 1–2 backgrounds,
 *            3–5 component fills, 6–8 borders, 9–10 solid, 11 secondary
 *            text ≥ 4.5:1, 12 primary text)
 * ───────────────────────────────────────────────────────────────────── */

:root,
[data-theme="light"],
[data-bs-theme="light"] {
  color-scheme: light;

  --grey-1: #fcfdfc;
  --grey-2: #f7f8f6;
  --grey-3: #eef0ed;
  --grey-4: #e6e9e5;
  --grey-5: #dee2dd;
  --grey-6: #d4d9d3;
  --grey-7: #c5ccc4;
  --grey-8: #aab3a9;
  --grey-9: #838c82;
  --grey-10: #747d73;
  --grey-11: #565e55;
  --grey-12: #161c18;

  --primary: #0b3d2e;
  --primary-hover: #0f5240;
  --primary-active: #082e23;
  --on-primary: #ffffff;
  --mint: #5fd4a8;
  --mint-strong: #157a55;            /* mint-family colour readable as text on light */
  --amber: #f5a524;
  --amber-text: #7a4900;
  --red: #e5484d;
  --red-text: #b01f25;
  --blue: #3e63dd;
  --blue-text: #3451c7;

  --canvas: var(--grey-2);
  --glass: rgba(255, 255, 255, 0.82);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-hairline: rgba(22, 28, 24, 0.07);
  --solid: #ffffff;
  --seg-active: #ffffff;
  --line: rgba(22, 28, 24, 0.09);
  --line-strong: rgba(22, 28, 24, 0.16);

  --orb-green: rgba(11, 61, 46, 0.12);
  --orb-mint: rgba(95, 212, 168, 0.10);
  --orb-teal: rgba(43, 179, 163, 0.14);
  --orb-warm: rgba(245, 165, 36, 0.10);
  --grain-opacity: 0.02;

  --shadow-1: 0 1px 2px rgba(22, 28, 24, 0.04), 0 6px 20px -10px rgba(22, 50, 40, 0.12);
  --shadow-2: 0 2px 4px rgba(22, 28, 24, 0.04), 0 16px 36px -12px rgba(22, 50, 40, 0.18);
  --shadow-3: 0 24px 64px -16px rgba(22, 50, 40, 0.28);
  --inner-light: inset 0 1px 0 rgba(255, 255, 255, 0.85);

  /* ── Legacy names (kept so older markup renders; new code uses the names above) ── */
  --bg-base: var(--canvas);
  --bg-surface: var(--glass);
  --bg-elevated: rgba(22, 28, 24, 0.04);
  --bg-border: var(--line);
  --bg-solid: var(--solid);
  --surface-base: var(--canvas);
  --surface-raised: var(--glass);
  --surface-overlay: var(--bg-elevated);
  --surface-inset: rgba(22, 28, 24, 0.04);
  --border-subtle: var(--line);
  --border-strong: var(--line-strong);
  --text-primary: var(--grey-12);
  --text-secondary: var(--grey-11);
  --text-muted: var(--grey-11);
  --text-tertiary: var(--grey-10);
  --text-inverse: #ffffff;
  --brand: var(--primary);
  --brand-hover: var(--primary-hover);
  --brand-soft: rgba(11, 61, 46, 0.08);
  --brand-border: rgba(11, 61, 46, 0.24);
  --brand-glow: rgba(95, 212, 168, 0.28);
  --text-on-brand: var(--on-primary);
  --accent: var(--amber);
  --accent-soft: rgba(245, 165, 36, 0.14);
  --success: var(--mint-strong);
  --success-soft: rgba(95, 212, 168, 0.18);
  --warning: var(--amber-text);
  --warning-soft: rgba(245, 165, 36, 0.16);
  --danger: var(--red-text);
  --danger-soft: rgba(229, 72, 77, 0.10);
  --info: var(--blue-text);
  --info-soft: rgba(62, 99, 221, 0.10);
  --hover: rgba(22, 28, 24, 0.045);
  --paper: var(--grey-2);
  --Primary-SurfaceDefault: var(--primary);
  --brand-primary: var(--primary);
  --brand-primary-hover: var(--primary-hover);
  --brand-primary-soft: var(--brand-soft);
  --signal: var(--amber);
  --signal-soft: var(--accent-soft);
  --glass-blur: blur(16px) saturate(140%);
  --glass-edge: var(--inner-light);
  --shadow-sm: var(--shadow-1);
  --shadow-md: var(--shadow-2);
  --shadow-lg: var(--shadow-3);
  --shadow-card: var(--shadow-1);
  --shadow-elevated: var(--shadow-3);
  --shadow-brand: 0 0 0 2px var(--mint);
  --shadow-glow: 0 4px 24px rgba(95, 212, 168, 0.22);
  --gradient-brand: linear-gradient(135deg, var(--primary) 0%, #1b7a5c 100%);
  --gradient-hero: var(--gradient-brand);
  --gradient-glow: none;
  --app-bg: var(--canvas);

  --bs-body-bg: var(--canvas);
  --bs-body-color: var(--grey-12);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 11, 61, 46;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 11, 61, 46;
  --bs-link-hover-color: var(--primary-hover);
  --bs-link-hover-color-rgb: 15, 82, 64;
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--grey-11);
  --bs-tertiary-color: var(--grey-10);

  /* App chrome: solid sidebar + modal scrim */
  --side-bg: #fbfcfb;
  --side-line: rgba(22, 28, 24, 0.08);
  --nav-active-bg: rgba(11, 61, 46, 0.075);
  --nav-active-fg: var(--primary);
  --nav-active-bar: var(--primary);
  --scrim: rgba(16, 24, 20, 0.38);
  --scrim-blur: blur(8px) saturate(120%);

  /* Icon tints: colourful duotone icons (fill layer + glyph), AA-safe on light surfaces */
  --tint-green: #157a55;
  --tint-teal: #0e7c86;
  --tint-blue: #2f5bd3;
  --tint-sky: #0b72b9;
  --tint-violet: #6d4fd6;
  --tint-pink: #c03a7a;
  --tint-amber: #a35f00;
  --tint-orange: #c2511a;
  --tint-slate: #56645c;
  --icon-tint-opacity: 0.28;
}

[data-theme="dark"],
[data-bs-theme="dark"] {
  color-scheme: dark;

  --grey-1: #0a0f0d;
  --grey-2: #101614;
  --grey-3: #161e1b;
  --grey-4: #1b2521;
  --grey-5: #212c28;
  --grey-6: #28352f;
  --grey-7: #33433c;
  --grey-8: #44574f;
  --grey-9: #6b7d75;
  --grey-10: #7c8e86;
  --grey-11: #b0beb7;
  --grey-12: #e4ebe7;

  --primary: #1b7a5c;
  --primary-hover: #1f8564;
  --primary-active: #176a50;
  --on-primary: #ffffff;
  --mint: #5fd4a8;
  --mint-strong: #5fd4a8;
  --amber: #f5a524;
  --amber-text: #f7b955;
  --red: #e5484d;
  --red-text: #ff7a7e;
  --blue: #3e63dd;
  --blue-text: #93a9f3;

  --canvas: #0c1210;
  --glass: rgba(20, 29, 26, 0.78);
  --glass-strong: rgba(24, 33, 30, 0.82);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hairline: rgba(255, 255, 255, 0.06);
  --solid: #141c19;
  --seg-active: #2a3833;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --orb-green: rgba(27, 122, 92, 0.18);
  --orb-mint: rgba(95, 212, 168, 0.22);
  --orb-teal: rgba(43, 179, 163, 0.09);
  --orb-warm: rgba(245, 165, 36, 0.04);
  --grain-opacity: 0.025;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 18px 40px -14px rgba(0, 0, 0, 0.7);
  --shadow-3: 0 28px 70px -18px rgba(0, 0, 0, 0.8);
  --inner-light: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --bg-elevated: rgba(255, 255, 255, 0.05);
  --surface-inset: rgba(0, 0, 0, 0.25);
  --text-inverse: #0a0f0d;
  --brand: var(--mint);              /* on dark, brand-coloured text and icons use mint */
  --brand-hover: #86e2bf;
  --brand-soft: rgba(95, 212, 168, 0.13);
  --brand-border: rgba(95, 212, 168, 0.32);
  --text-on-brand: #06281d;          /* text on a mint fill */
  --success: var(--mint);
  --success-soft: rgba(95, 212, 168, 0.14);
  --warning: var(--amber-text);
  --warning-soft: rgba(245, 165, 36, 0.14);
  --danger: var(--red-text);
  --danger-soft: rgba(229, 72, 77, 0.16);
  --info: var(--blue-text);
  --info-soft: rgba(62, 99, 221, 0.18);
  --hover: rgba(255, 255, 255, 0.05);
  --gradient-brand: linear-gradient(135deg, #1b7a5c 0%, var(--mint) 100%);

  --bs-body-bg: var(--canvas);
  --bs-body-color: var(--grey-12);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 27, 122, 92;
  --bs-link-color: var(--mint);
  --bs-link-color-rgb: 95, 212, 168;
  --bs-link-hover-color: #86e2bf;
  --bs-link-hover-color-rgb: 134, 226, 191;
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--grey-11);
  --bs-tertiary-color: var(--grey-10);

  --side-bg: #0f1614;
  --side-line: rgba(255, 255, 255, 0.07);
  --nav-active-bg: rgba(95, 212, 168, 0.11);
  --nav-active-fg: #e6f7ef;
  --nav-active-bar: var(--mint);
  --scrim: rgba(3, 7, 6, 0.55);
  --scrim-blur: blur(8px) saturate(110%);

  --tint-green: #5fd4a8;
  --tint-teal: #4fd1d9;
  --tint-blue: #8eaaf7;
  --tint-sky: #6cc4f5;
  --tint-violet: #b9a4ff;
  --tint-pink: #f598c4;
  --tint-amber: #f7c063;
  --tint-orange: #f9a274;
  --tint-slate: #a7b6af;
  --icon-tint-opacity: 0.32;
}

/* Theme-independent scales */
:root {
  --font-display: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;
  --fs-40: 2.5rem;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  --radius-sm: 10px;    /* controls */
  --radius-md: 10px;
  --radius-lg: 16px;    /* cards */
  --radius-xl: 22px;    /* dialogs */
  --radius-pill: 999px;

  --control-sm: 36px;
  --control-lg: 44px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 160ms;
  --duration-base: 200ms;
  --duration-slow: 250ms;
}

/* Illustration and legacy constants: fixed colours that look the same in both themes
   (product demos on the website, third-party marks). Use theme tokens above for UI. */
:root {
  --amber-ink: #2b1a00;
  --aquamarine: #7fffd4;
  --blue-300: #7da2f0;
  --blue-500: #007bff;
  --blue-600: #1863dc;
  --coral: #e8603f;
  --coral-ink: #a8391f;
  --coral-light: #ff8a6f;
  --coral-wash: #fff1ec;
  --forest: #003c33;
  --forest-700: #0f5132;
  --forest-ink: #0c1f1a;
  --gold: #e0a43a;
  --ink-100: #eeece7;
  --ink-200: #d9d9dd;
  --ink-400: #93939f;
  --ink-500: #75758a;
  --ink-700: #3a3a43;
  --ink-780: #2e2f31;
  --ink-800: #2a2a31;
  --ink-850: #1f1f25;
  --ink-900: #17171c;
  --ink-950: #10131a;
  --ink-999: #050807;
  --mint: #5fd4a8;
  --mint-light: #86e2bf;
  --mint-wash: #edfce9;
  --ms-blue: #0078d4;
  --paper-100: #f2f2ee;
  --paper-200: #e6f2ee;
  --paper-300: #c5d6d0;
  --paper-300b: #e9ecef;
  --paper-50: #faf8f4;
  --paper-60: #f4f6fb;
  --red-200: #f5a0a8;
  --red-300: #ff8a96;
  --red-400: #f87171;
  --red-450: #e05a5a;
  --red-500: #e5484d;
  --red-700: #b3261e;
  --sage: #52796f;
  --teal: #2f9e7f;
}
