/* ==========================================================================
   NZOTO — design tokens
   Purpose : single source of truth for every colour, size, radius, shadow,
             duration and layer used by base/components/layout/utilities.css.
   Rule    : component styles never contain raw hex or px values — only var().
             (Media-query breakpoints are the one exception: CSS cannot read
             custom properties there. They are listed at the end of this file.)
   Rebrand : change the five --brand-* values below. Everything else derives.
             Admin › Settings can override --brand-primary / --brand-accent at
             runtime (see app.js › applyThemeSettings).
   ========================================================================== */

@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/poppins/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/poppins/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/fonts/poppins/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/poppins/poppins-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 800; font-display: swap; src: url("../vendor/fonts/poppins/poppins-latin-800-normal.woff2") format("woff2"); }

:root {
  /* ---- 1. BRAND (one-line swaps; values from the NZOTO brand guidelines) ---- */
  --brand-primary: #151F29;      /* Deep Navy Blue   · CMYK 90/75/50/60 */
  --brand-accent: #DF542A;       /* Vermilion Orange · CMYK 0/80/100/0  */
  --brand-accent-alt: #E5702A;   /* Vivid Orange     · CMYK 0/65/100/0  */
  --brand-neutral: #E4E4E3;      /* Light Gray       · CMYK 0/0/0/10    */
  --brand-ink: #1A1919;          /* Black            · CMYK 0/0/0/100   */

  /* ---- 2. NEUTRAL RAMP (cool slate, tuned to sit with the navy) ---- */
  --neutral-0: #FFFFFF;
  --neutral-25: #FAFBFC;
  --neutral-50: #F5F7F9;
  --neutral-100: #EDF0F3;
  --neutral-200: #E1E5EA;
  --neutral-300: #CBD2D9;
  --neutral-400: #9AA5B1;
  --neutral-500: #6B7785;
  --neutral-600: #4E5A67;
  --neutral-700: #36414C;
  --neutral-800: #232D37;
  --neutral-900: #151F29;
  --neutral-950: #0D141B;

  /* ---- 3. SEMANTIC COLOUR ROLES (light theme) ---- */
  --color-bg: var(--neutral-0);
  --color-page: var(--neutral-0);          /* the canvas behind cards in the app shell, wizards and standalone pages — white */
  --color-bg-subtle: var(--neutral-25);
  --color-bg-muted: var(--neutral-50);
  --color-surface: var(--neutral-0);
  --color-surface-raised: var(--neutral-0);
  --color-surface-sunken: var(--neutral-50);
  --color-overlay: color-mix(in srgb, var(--neutral-950) 55%, transparent);
  --color-border: var(--neutral-200);
  --color-border-strong: var(--neutral-300);
  --color-text: var(--brand-ink);
  --color-text-secondary: var(--neutral-600);
  --color-text-muted: var(--neutral-500);
  --color-text-disabled: var(--neutral-400);
  --color-heading: var(--brand-primary);
  --color-link: var(--color-accent-strong);

  --color-primary: var(--brand-primary);
  --color-primary-hover: color-mix(in srgb, var(--brand-primary) 86%, white);
  --color-primary-active: color-mix(in srgb, var(--brand-primary) 94%, black);
  --color-primary-soft: color-mix(in srgb, var(--brand-primary) 7%, white);
  --color-on-primary: var(--neutral-0);

  --color-accent: var(--brand-accent);
  --color-accent-alt: var(--brand-accent-alt);
  /* AA-safe orange: white text on it and it on white both pass 4.5:1 */
  --color-accent-strong: color-mix(in srgb, var(--brand-accent) 86%, black);
  --color-accent-strong-hover: color-mix(in srgb, var(--brand-accent) 76%, black);
  --color-accent-soft: color-mix(in srgb, var(--brand-accent) 10%, white);
  --color-accent-soft-border: color-mix(in srgb, var(--brand-accent) 28%, white);
  --color-on-accent: var(--neutral-0);

  --color-success: #1A7F4B;
  --color-success-soft: #E7F5EC;
  --color-success-border: #B7DFC6;
  --color-warning: #A85B06;
  --color-warning-soft: #FEF3E2;
  --color-warning-border: #F5D6A3;
  --color-danger: #B42318;
  --color-danger-hover: #991D13;
  --color-danger-soft: #FDECEA;
  --color-danger-border: #F4C0BA;
  --color-info: #1D5FBF;
  --color-info-soft: #E8F0FC;
  --color-info-border: #BBD2F5;
  --color-star: #F2A20C;
  --color-on-dark-success: #4ADE8F;
  --color-on-dark-danger: #FF8A7E;
  --color-on-dark-warning: #F5B455;
  --color-on-dark-info: #7FB0F5;

  /* Sidebar / dark chrome (always dark, in both themes — mirrors the brand mockups) */
  --chrome-bg: var(--brand-primary);
  --chrome-bg-hover: color-mix(in srgb, var(--brand-primary) 84%, white);
  --chrome-bg-active: color-mix(in srgb, var(--brand-primary) 76%, white);
  --chrome-border: color-mix(in srgb, var(--brand-primary) 78%, white);
  --chrome-text: color-mix(in srgb, var(--neutral-0) 72%, var(--brand-primary));
  --chrome-text-strong: var(--neutral-0);

  /* Chart series */
  --chart-1: var(--brand-primary);
  --chart-2: var(--brand-accent);
  --chart-3: var(--neutral-400);
  --chart-grid: var(--neutral-200);

  /* ---- 4. TYPOGRAPHY ---- */
  --font-sans: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-size-2xs: 0.6875rem;  /* 11 */
  --font-size-xs: 0.75rem;     /* 12 */
  --font-size-sm: 0.8125rem;   /* 13 */
  --font-size-base: 0.875rem;  /* 14 — brand body size */
  --font-size-md: 1rem;        /* 16 */
  --font-size-lg: 1.125rem;    /* 18 — brand H3 */
  --font-size-xl: 1.375rem;    /* 22 — brand H2 */
  --font-size-2xl: 1.75rem;    /* 28 */
  --font-size-3xl: 2.125rem;   /* 34 — brand H1 */
  --font-size-4xl: 2.75rem;    /* 44 */
  --font-size-5xl: 3.5rem;     /* 56 */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --line-height-tight: 1.15;
  --line-height-snug: 1.3;
  --line-height-normal: 1.55;
  --line-height-relaxed: 1.7;
  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.08em;
  --measure: 68ch;

  /* ---- 5. SPACING (4px grid) ---- */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;
  --space-1: 0.25rem;
  --space-1-5: 0.375rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ---- 6. SIZES ---- */
  --control-height-sm: 2rem;
  --control-height: 2.5rem;
  --control-height-lg: 3rem;
  --touch-target: 2.75rem;       /* 44px minimum */
  --touch-target-lg: 3.25rem;    /* provider screens */
  --icon-xs: 0.875rem;
  --icon-sm: 1rem;
  --icon-md: 1.25rem;
  --icon-lg: 1.5rem;
  --icon-xl: 2rem;
  --icon-2xl: 2.75rem;
  --icon-stroke: 1.75;
  --avatar-xs: 1.5rem;
  --avatar-sm: 2rem;
  --avatar-md: 2.5rem;
  --avatar-lg: 3.5rem;
  --avatar-xl: 5.5rem;
  --border-width: 1px;
  --border-width-thick: 2px;
  --border-width-heavy: 3px;
  --sidebar-width: 16.5rem;
  --sidebar-rail-width: 4.5rem;
  --topbar-height: 4rem;
  --bottomnav-height: 4rem;
  --container-sm: 40rem;
  --container-md: 56rem;
  --container-lg: 75rem;
  --container-xl: 90rem;
  --modal-sm: 26rem;
  --modal-md: 34rem;
  --modal-lg: 48rem;
  --drawer-width: 20rem;
  --palette-width: 38rem;
  --thumb-size: 5.5rem;
  --chart-height: 16rem;
  --logo-height: 2rem;
  --logo-height-lg: 2.75rem;
  --grid-min-xs: 9rem;
  --grid-min-sm: 14rem;
  --grid-min-md: 18rem;
  --grid-min-lg: 22rem;
  --aside-width: 22rem;
  --auth-panel-width: 30rem;
  --thread-height: 28rem;
  --bubble-max: 34rem;
  --devbar-width: 22rem;
  --menu-min: 13rem;
  --table-min: 44rem;
  --hero-mark-size: 26rem;
  --stepper-dot: 1.75rem;
  --progress-height: 0.375rem;
  --switch-width: 2.75rem;
  --switch-height: 1.5rem;
  --switch-knob: 1.125rem;

  /* ---- 7. RADIUS ---- */
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.75rem;
  --radius-full: 999px;

  /* ---- 8. ELEVATION (soft, layered) ---- */
  --shadow-color: 21 31 41;   /* rgb triplet of the navy */
  --shadow-xs: 0 1px 2px rgb(var(--shadow-color) / 0.05);
  --shadow-sm: 0 1px 2px rgb(var(--shadow-color) / 0.06), 0 1px 3px rgb(var(--shadow-color) / 0.08);
  --shadow-md: 0 2px 4px rgb(var(--shadow-color) / 0.05), 0 6px 16px rgb(var(--shadow-color) / 0.08);
  --shadow-lg: 0 4px 8px rgb(var(--shadow-color) / 0.05), 0 16px 32px rgb(var(--shadow-color) / 0.12);
  --shadow-xl: 0 8px 16px rgb(var(--shadow-color) / 0.08), 0 32px 64px rgb(var(--shadow-color) / 0.18);
  --ring-width: 3px;
  --ring-offset: 2px;
  --ring-color: color-mix(in srgb, var(--brand-accent) 55%, transparent);
  --shadow-focus: 0 0 0 var(--ring-width) var(--ring-color);

  /* ---- 9. MOTION ---- */
  --duration-instant: 80ms;
  --duration-fast: 150ms;
  --duration: 200ms;
  --duration-slow: 250ms;
  --duration-counter: 900ms;
  --duration-pulse: 1.8s;
  --duration-shimmer: 1.4s;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --press-scale: 0.98;
  --lift-sm: -1px;
  --lift-md: -2px;
  --enter-offset: 0.5rem;

  /* ---- 10. LAYERS ---- */
  --z-base: 1;
  --z-sticky: 50;
  --z-header: 100;
  --z-sidebar: 200;
  --z-dropdown: 300;
  --z-drawer: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-devbar: 700;
  --z-palette: 800;

  color-scheme: light;
}

/* ---- DARK THEME — token overrides only; components never branch on theme ---- */
:root[data-theme="dark"] {
  --color-bg: #0B1117;
  --color-page: #0B1117;
  --color-bg-subtle: #0F161D;
  --color-bg-muted: #131C25;
  --color-surface: #151F29;
  --color-surface-raised: #1A2632;
  --color-surface-sunken: #0F161D;
  --color-overlay: color-mix(in srgb, #000000 68%, transparent);
  --color-border: #263340;
  --color-border-strong: #34434F;
  --color-text: #E9EDF1;
  --color-text-secondary: #B3BDC7;
  --color-text-muted: #8A96A3;
  --color-text-disabled: #5C6874;
  --color-heading: #F4F6F8;
  --color-link: color-mix(in srgb, var(--brand-accent) 78%, white);

  --color-primary: #E9EDF1;
  --color-primary-hover: #FFFFFF;
  --color-primary-active: #D5DBE1;
  --color-primary-soft: #1E2B37;
  --color-on-primary: #151F29;

  --color-accent-soft: color-mix(in srgb, var(--brand-accent) 16%, #151F29);
  --color-accent-soft-border: color-mix(in srgb, var(--brand-accent) 38%, #151F29);

  --color-success: #4ADE8F;
  --color-success-soft: #10291C;
  --color-success-border: #1E4A33;
  --color-warning: #F5B455;
  --color-warning-soft: #2C2110;
  --color-warning-border: #55401C;
  --color-danger: #FF8A7E;
  --color-danger-hover: #FFA79D;
  --color-danger-soft: #2E1614;
  --color-danger-border: #5A2925;
  --color-info: #7FB0F5;
  --color-info-soft: #122238;
  --color-info-border: #24406A;

  --chrome-bg: #0F161D;
  --chrome-bg-hover: #182430;
  --chrome-bg-active: #1E2C3A;
  --chrome-border: #202D39;

  --chart-1: #9FB4C8;
  --chart-grid: #263340;

  --shadow-color: 0 0 0;
  --shadow-xs: 0 1px 2px rgb(var(--shadow-color) / 0.4);
  --shadow-sm: 0 1px 3px rgb(var(--shadow-color) / 0.5);
  --shadow-md: 0 6px 16px rgb(var(--shadow-color) / 0.5);
  --shadow-lg: 0 16px 32px rgb(var(--shadow-color) / 0.55);
  --shadow-xl: 0 32px 64px rgb(var(--shadow-color) / 0.6);

  color-scheme: dark;
}

/* ---- PROVIDER SCALE — larger type and touch targets for less technical users ---- */
:root[data-ui="large"] {
  --font-size-base: 1rem;
  --font-size-sm: 0.875rem;
  --control-height: 3rem;
  --control-height-lg: 3.5rem;
  --touch-target: 3.25rem;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast: 0ms;
    --duration: 0ms;
    --duration-slow: 0ms;
    --duration-counter: 0ms;
    --press-scale: 1;
    --lift-sm: 0;
    --lift-md: 0;
    --enter-offset: 0;
  }
}

/* BREAKPOINTS (literal values used in @media — keep in sync):
   sm 30em (480px) · md 48em (768px) · lg 64em (1024px) · xl 80em (1280px) · 2xl 90em (1440px) */
