/* panel.ai.id design system v2: tokens (ADR-0075, docs/design/design-system-v2.md). The one source of colour, type,
   space, shape, depth and motion for the console (internal/web/static/tokens.css) and the marketing site
   (web/site/public/assets/tokens.css); both copies are byte-for-byte this file (scripts/check-design-tokens.sh).
   Components never use a raw value: they use a semantic token (the second block), which uses a primitive.

   Layers: 1 primitives (neutral scale, status hues, type, space, radii, motion), 2 semantic tokens (surfaces, text,
   lines, states, controls), 3 component tokens (app.css only reads layer 2 and 3).
   Themes: dark is the default; light follows prefers-color-scheme, and a viewer's explicit choice (html[data-theme])
   wins over both. Branding (/brand.css) sets --accent only; every accent tint below is mixed from it, so any
   provider colour re-colours the console on either theme.
   Motion: one easing family and four durations; html[data-motion="reduced"] or prefers-reduced-motion sets every
   duration to near zero, so components need no special case.
   Names kept from v1 (ADR-0029) because the public site reads them: --bg, --bg-2, --surface*, --text*, --muted,
   --faint, --border*, --ok*, --warn*, --bad*, --link, --accent-*, --btn-*, --shadow-*, --glow-*, --grid-line,
   --hex-line, --ember, --honey, --radius*, --space-*, --text-*, --dur-*, --ease*. */
:root {
  /* === 1. primitives ============================================================================================ */
  /* --- brand */
  --accent: #5060f0;          /* overridden per provider and reseller by /brand.css */
  --on-accent: #ffffff;       /* text on an accent fill; /brand.css may override it for a light accent */
  --ember: #f2561d;           /* the panel's own mark colour (Rack-P dot); never a state */
  --honey: #f5b83d;

  /* --- neutral scale, dark (n0 = page, n12 = strongest text). A cool graphite, not black. */
  --n0: #0a0b0f; --n1: #0f1015; --n2: #14161c; --n3: #1a1c24; --n4: #21242d; --n5: #2a2e39;
  --n6: #3a3f4c; --n7: #555b6b; --n8: #7a8091; --n9: #9ba1b0; --n10: #c2c6d0; --n11: #e3e5ea; --n12: #f6f7f9;

  /* --- status hues */
  --green: #2fc46b; --amber: #f0ad3c; --red: #ef4f56; --blue: #4f9dff;

  /* --- type */
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --text-2xs: 0.6875rem;      /* 11 px: table heads, eyebrows */
  --text-xs: 0.75rem;         /* 12 px: badges, hints */
  --text-sm: 0.8125rem;       /* 13 px: controls, tables, navigation */
  --text-md: 0.9375rem;       /* 15 px: body */
  --text-lg: 1.0625rem;       /* 17 px: card titles */
  --text-xl: 1.5rem;          /* 24 px: page titles */
  --text-2xl: clamp(1.75rem, 1.3rem + 1.6vw, 2.25rem);
  --text-hero: clamp(2.6rem, 1.4rem + 5vw, 5.25rem);
  --leading: 1.55;
  --leading-tight: 1.2;
  --tracking-tight: -0.015em;
  --tracking-hero: -0.04em;
  --weight-regular: 420;
  --weight-medium: 520;
  --weight-strong: 620;

  /* --- space: a 4 px grid */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 72px;

  /* --- shape: one radius scale */
  --radius-xs: 4px;           /* badges' inner marks, code */
  --radius-sm: 6px;           /* controls: buttons, fields, nav rows, tabs */
  --radius: 10px;             /* cards, tables, dialogs */
  --radius-lg: 14px;          /* hero panels, the sign-in card */
  --radius-pill: 999px;       /* badges, avatars, switches */
  --touch: 44px;              /* minimum touch target (WCAG 2.5.5 AAA, kept from v1) */
  --control: 36px;            /* a control's drawn height on a pointer device; its target stays --touch */
  --max: 1440px;
  --sidebar: 248px;
  --topbar: 56px;

  /* --- motion */
  --ease: cubic-bezier(.2, .8, .2, 1);        /* most transitions */
  --ease-out: cubic-bezier(.16, 1, .3, 1);    /* entrances, long settles */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1); /* small pops: a check mark, a toggle */
  --dur-1: 100ms;  /* hover, press */
  --dur-2: 180ms;  /* small state changes, menus */
  --dur-3: 320ms;  /* page parts, dialogs */
  --dur-4: 700ms;  /* hero entrances, charts */

  /* === 2. semantic tokens, dark ================================================================================== */
  --bg: var(--n0);
  --bg-2: var(--n1);
  --surface: var(--n2);
  --surface-solid: var(--n2);
  --surface-2: var(--n3);
  --surface-3: var(--n4);
  --surface-raised: var(--n3);  /* menus, dialogs, toasts */
  --text: var(--n12);
  --text-2: var(--n10);
  --muted: var(--n9);
  --faint: var(--n8);           /* large or decorative text only */
  --border: rgb(255 255 255 / 8%);
  --border-strong: rgb(255 255 255 / 14%);
  --scrim: rgb(0 0 0 / 60%);
  --hover: rgb(255 255 255 / 4%);
  --press: rgb(255 255 255 / 7%);

  --ok: var(--green);  --ok-bg: rgb(47 196 107 / 13%);  --ok-fg: #5bd68c;  --ok-line: rgb(47 196 107 / 32%);
  --warn: var(--amber); --warn-bg: rgb(240 173 60 / 13%); --warn-fg: #f4c069; --warn-line: rgb(240 173 60 / 32%);
  --bad: var(--red);   --bad-bg: rgb(239 79 86 / 14%);  --bad-fg: #f78a8f;  --bad-line: rgb(239 79 86 / 34%);
  --info: var(--blue); --info-bg: rgb(79 157 255 / 13%); --info-fg: #8bbcff; --info-line: rgb(79 157 255 / 32%);
  --danger: #e5484d;
  --muted-bg: rgb(255 255 255 / 5%);

  /* --- accent family (mixed from the brand accent) */
  --link: color-mix(in srgb, var(--accent) 70%, #ffffff);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 50%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 35%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent) 88%, #ffffff);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--accent) 75%, #ffffff);

  /* --- controls */
  --btn-bg: var(--accent); --btn-fg: var(--on-accent);
  --field-bg: var(--n1);
  --field-border: rgb(255 255 255 / 12%);

  /* --- depth: elevation 0 (flat) to 3 (dialog) */
  --shadow-1: 0 1px 0 rgb(255 255 255 / 3%) inset, 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-2: 0 1px 0 rgb(255 255 255 / 4%) inset, 0 8px 24px -8px rgb(0 0 0 / 60%);
  --shadow-3: 0 1px 0 rgb(255 255 255 / 5%) inset, 0 24px 64px -16px rgb(0 0 0 / 75%);
  --shadow-glow: 0 0 0 1px var(--accent-line), 0 18px 50px -22px var(--accent-glow);
  --blur: 14px;
  --grid-line: rgb(255 255 255 / 4%);
  --hex-line: rgb(255 255 255 / 4%);
  --glow-warm: rgb(242 86 29 / 12%);
  --glow-cool: color-mix(in srgb, var(--accent) 14%, transparent);

  color-scheme: dark;
}

/* === light theme: the system's choice unless the viewer chose dark; the same values for an explicit choice ======= */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --n0: #f7f7f8; --n1: #f1f1f3; --n2: #ffffff; --n3: #f6f6f8; --n4: #ececf0; --n5: #e2e3e8;
    --n6: #c9cbd3; --n7: #9a9eab; --n8: #6c7180; --n9: #565b69; --n10: #3a3e4a; --n11: #23262e; --n12: #111318;
    --border: rgb(17 19 24 / 9%); --border-strong: rgb(17 19 24 / 16%); --scrim: rgb(17 19 24 / 35%);
    --hover: rgb(17 19 24 / 4%); --press: rgb(17 19 24 / 7%); --muted-bg: rgb(17 19 24 / 4%);
    --ok-bg: #e7f7ee; --ok-fg: #0f7a3d; --ok-line: #a6dfbe; --warn-bg: #fdf3dc; --warn-fg: #8a5a00; --warn-line: #efd28f;
    --bad-bg: #fdecec; --bad-fg: #b7262d; --bad-line: #f2b5b8; --info-bg: #e8f1ff; --info-fg: #1f5fbf; --info-line: #b5d0f7;
    --link: color-mix(in srgb, var(--accent) 80%, #000000);
    --accent-hover: color-mix(in srgb, var(--accent) 88%, #000000);
    --field-bg: #ffffff; --field-border: rgb(17 19 24 / 16%);
    --shadow-1: 0 1px 2px rgb(17 19 24 / 6%); --shadow-2: 0 1px 2px rgb(17 19 24 / 5%), 0 8px 24px -8px rgb(17 19 24 / 14%);
    --shadow-3: 0 1px 2px rgb(17 19 24 / 6%), 0 24px 64px -16px rgb(17 19 24 / 28%);
    --grid-line: rgb(17 19 24 / 5%); --hex-line: rgb(17 19 24 / 5%); --glow-warm: rgb(224 74 18 / 8%);
    --ember: #e04a12;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --n0: #f7f7f8; --n1: #f1f1f3; --n2: #ffffff; --n3: #f6f6f8; --n4: #ececf0; --n5: #e2e3e8;
  --n6: #c9cbd3; --n7: #9a9eab; --n8: #6c7180; --n9: #565b69; --n10: #3a3e4a; --n11: #23262e; --n12: #111318;
  --border: rgb(17 19 24 / 9%); --border-strong: rgb(17 19 24 / 16%); --scrim: rgb(17 19 24 / 35%);
  --hover: rgb(17 19 24 / 4%); --press: rgb(17 19 24 / 7%); --muted-bg: rgb(17 19 24 / 4%);
  --ok-bg: #e7f7ee; --ok-fg: #0f7a3d; --ok-line: #a6dfbe; --warn-bg: #fdf3dc; --warn-fg: #8a5a00; --warn-line: #efd28f;
  --bad-bg: #fdecec; --bad-fg: #b7262d; --bad-line: #f2b5b8; --info-bg: #e8f1ff; --info-fg: #1f5fbf; --info-line: #b5d0f7;
  --link: color-mix(in srgb, var(--accent) 80%, #000000);
  --accent-hover: color-mix(in srgb, var(--accent) 88%, #000000);
  --field-bg: #ffffff; --field-border: rgb(17 19 24 / 16%);
  --shadow-1: 0 1px 2px rgb(17 19 24 / 6%); --shadow-2: 0 1px 2px rgb(17 19 24 / 5%), 0 8px 24px -8px rgb(17 19 24 / 14%);
  --shadow-3: 0 1px 2px rgb(17 19 24 / 6%), 0 24px 64px -16px rgb(17 19 24 / 28%);
  --grid-line: rgb(17 19 24 / 5%); --hex-line: rgb(17 19 24 / 5%); --glow-warm: rgb(224 74 18 / 8%);
  --ember: #e04a12;
  color-scheme: light;
}

/* === reduced motion: the system's wish, or the viewer's light mode ============================================== */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 1ms; --dur-2: 1ms; --dur-3: 1ms; --dur-4: 1ms; }
}
:root[data-motion="reduced"] { --dur-1: 1ms; --dur-2: 1ms; --dur-3: 1ms; --dur-4: 1ms; }
