/* Seller Admin: tokens. The whole vocabulary, and the only file that may hold a
   colour literal (tests/test_design_system.py). Components name ROLES
   (--bg-*, --border*, --ink*, --accent*, the five tones), never the ramp.

   Type: six sizes, each married to one line box (12/16, 13/20, 14/20, 16/24,
   20/28, 24/32); weights 400/500/600. Space: the 4px grid. Radius: 4/6/8/12
   and 50% for circles. Depth: two shadows. Motion: 120ms and 180ms (160ms for
   a modal), one easing.

   Contrast, measured (scripts/ui_metrics.py --gate re-measures it painted):
     light  ink-muted #6b6b74: 5.3:1 on white, 4.8:1 on --bg-selected
            border-control #88888f: 3.5:1 on white, 3.2:1 on --bg-selected
            accent #4658d6: 5.8:1 on white; tone inks on their fills 5.1-7.1:1
     dark   ink-muted #94949e: 5.9:1 on surface, 5.0:1 on --bg-selected, 4.6:1 on
            --accent-subtle and --danger-subtle (a checked option's hint)
            border-control #75757f: 3.3:1 on --bg-selected
            accent #8190f5: 6.1:1 on surface, ink-on-accent 6.9:1 */
:root{
  color-scheme:light;

  /* type */
  --font-sans:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-mono:ui-monospace,SFMono-Regular,"Cascadia Mono",Consolas,monospace;
  --text-xs:.75rem;--leading-xs:1rem;
  --text-sm:.8125rem;--leading-sm:1.25rem;
  --text-md:.875rem;--leading-md:1.25rem;
  --text-lg:1rem;--leading-lg:1.5rem;
  --text-xl:1.25rem;--leading-xl:1.75rem;
  --text-2xl:1.5rem;--leading-2xl:2rem;
  --weight-regular:400;--weight-medium:500;--weight-semibold:600;
  --track-tight:-.01em;--track-title:-.015em;

  /* neutral ramp (zinc; --n-500 is tuned a step darker so muted text holds AA
     on the selected fill) */
  --n-0:#ffffff;--n-25:#fcfcfc;--n-50:#fafafa;--n-100:#f4f4f5;--n-150:#ececee;
  --n-200:#e4e4e7;--n-300:#d4d4d8;--n-400:#a1a1aa;--n-500:#6b6b74;--n-600:#52525b;
  --n-700:#3f3f46;--n-800:#27272a;--n-900:#18181b;--n-950:#09090b;

  /* accent: intent only (primary action, selection, focus, active nav icon,
     links in prose) */
  --accent:#4658d6;--accent-hover:#3748ba;--accent-subtle:#eef0fd;--accent-ink:#3443b4;
  --ink-on-accent:var(--n-0);

  /* the five tones: -ink for text and icons, -subtle for fills, -border rare */
  --ok-ink:#087a55;--ok-subtle:#ecfdf3;--ok-border:#b5d7cc;
  --info-ink:var(--accent-ink);--info-subtle:var(--accent-subtle);--info-border:#c7cdf6;
  --warn-ink:#8a5a00;--warn-subtle:#fef7e6;--warn-border:#ecd7a8;
  --danger-ink:#b42318;--danger-subtle:#fef3f2;--danger-border:#f2c4bf;
  --neutral-ink:var(--n-700);--neutral-subtle:var(--n-100);--neutral-border:var(--n-200);
  /* a destructive confirm is the one danger FILL; its label is white in both schemes */
  --danger-solid:#b42318;--danger-solid-hover:#912018;--ink-on-danger:#ffffff;

  /* roles */
  --bg-canvas:var(--n-0);
  --bg-surface:var(--n-0);
  --bg-subtle:var(--n-50);
  --bg-hover:var(--n-50);
  --bg-selected:var(--n-100);
  --bg-sidebar:var(--n-50);
  --bg-sidebar-hover:var(--n-100);
  --bg-sidebar-selected:var(--n-150);
  --bg-inverse:var(--n-900);
  --border:var(--n-200);
  --border-subtle:var(--n-150);
  --border-strong:var(--n-300);
  --border-control:#88888f;
  --border-control-hover:var(--n-500);
  --ink:var(--n-900);
  --ink-secondary:var(--n-600);
  --ink-muted:var(--n-500);
  --ink-disabled:var(--n-400);
  --ink-inverse:var(--n-0);
  --focus:var(--accent);
  --scrim:rgba(9,9,11,.32);
  --scroll-thumb:rgba(24,24,27,.22);
  --scroll-thumb-hover:rgba(24,24,27,.38);
  /* what is switched OFF: a hidden product's picture, said quietly */
  --picture-off:grayscale(.6) opacity(.75);
  /* chart series: the accent, then two neutrals; every series also has a dash */
  --viz-1:var(--accent);
  --viz-2:var(--n-700);
  --viz-3:var(--n-500);

  /* space: the 4px grid */
  --space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:20px;
  --space-6:24px;--space-8:32px;--space-10:40px;--space-12:48px;--space-16:64px;
  /* the plan's two named half-steps (plan 4.3 and 5) */
  --gap-icon:6px;      /* icon to label inside a button or a menu item */
  --input-pad-x:10px;  /* a field's inline padding */
  /* a table cell's block padding: 4px, so a row's 28px control (the kebab, a
     thumb, a small button) fits the 36px row (plan 5, row height) */
  --cell-pad-y:var(--space-1);
  /* a label over its control, on every field */
  --label-gap:var(--space-1);
  /* the air each side of a tab's label, where its focus ring sits */
  --tab-pad-x:var(--space-2);

  /* sizes */
  --control-h:32px;--control-h-sm:28px;--control-h-lg:40px;
  --chip-h:20px;--hit:24px;
  --icon:16px;--icon-sm:14px;--icon-lg:20px;--spinner:12px;
  --avatar:24px;--avatar-md:32px;--avatar-lg:40px;
  --row-h:36px;--row-h-head:32px;--cell-pad-x:12px;--cell-pad-edge:16px;
  --dot:8px;--thumb-mark:16px;--meter-h:4px;

  /* shape and depth */
  --radius-xs:4px;--radius-sm:6px;--radius-md:8px;--radius-lg:12px;--radius-round:50%;
  --border-w:1px;--rail-w:2px;--focus-w:2px;--focus-offset:0px;
  --shadow-popover:0 4px 12px rgba(9,9,11,.08),0 1px 2px rgba(9,9,11,.06);
  --shadow-modal:0 16px 48px rgba(9,9,11,.16),0 2px 6px rgba(9,9,11,.08);

  /* motion */
  --dur-fast:120ms;--dur-modal:160ms;--dur-base:180ms;
  --ease:cubic-bezier(.2,0,0,1);

  /* layout */
  --sidebar-w:232px;--sidebar-rail-w:56px;--nav-gap:2px;
  --content-pad-y:24px;--content-pad-x:32px;--content-pad-end:48px;
  --page-max:1600px;
  --sheet-w:720px;--sheet-wide-w:1160px;
  --modal-sm:440px;--modal-md:560px;--modal-lg:720px;
  --dialog-gutter:48px;
  --search-w:320px;
  --search-min:192px;
  --scroll-region:480px;--scroll-region-sm:320px;
  --preview-h:232px;--popover-w:288px;--toast-w:360px;
  --facts-label-w:160px;--field-cell-min:176px;
  --editor-h:160px;--editor-h-max:340px;
  --warranty-rail-w:240px;--warranty-nav-h:56px;
  --col-label:160px;--measure:72ch;--scrollbar:12px;

  /* stacking: a <dialog> lives in the top layer and outranks all of these */
  --z-sticky:10;--z-sidebar:20;--z-toast:60;--z-popover:100;
}

/* The dark scheme: roles re-pointed, nothing else. Tone fills are the tone at
   about 14% over the surface, written out. */
@media(prefers-color-scheme:dark){
  :root{
    color-scheme:dark;
    --accent:#8190f5;--accent-hover:#95a2f7;--accent-subtle:#292b3e;--accent-ink:#9aa5f7;
    --ink-on-accent:#09090b;
    --ok-ink:#3fcf8e;--ok-subtle:#1d322b;--ok-border:#265843;
    --info-border:#3d4267;
    --warn-ink:#e5a53c;--warn-subtle:#352c20;--warn-border:#604927;
    --danger-ink:#f8918a;--danger-subtle:#37292b;--danger-border:#664242;
    --neutral-ink:#c4c4cc;--neutral-subtle:#26262b;--neutral-border:#2a2a30;
    --danger-solid:#c4321f;--danger-solid-hover:#ad2a19;
    --bg-canvas:#111113;
    --bg-surface:#18181b;
    --bg-subtle:#1f1f23;
    --bg-hover:#1f1f23;
    --bg-selected:#26262b;
    --bg-sidebar:#141416;
    --bg-sidebar-hover:#1f1f23;
    --bg-sidebar-selected:#26262b;
    --bg-inverse:#ededf0;
    --border:#2a2a30;
    --border-subtle:#232328;
    --border-strong:#3a3a42;
    --border-control:#75757f;
    --border-control-hover:#8e8e98;
    --ink:#ededf0;
    --ink-secondary:#b4b4bc;
    --ink-muted:#94949e;
    --ink-disabled:#5a5a63;
    --ink-inverse:#18181b;
    --scrim:rgba(0,0,0,.56);
    --scroll-thumb:rgba(255,255,255,.2);
    --scroll-thumb-hover:rgba(255,255,255,.34);
    --viz-2:#c4c4cc;
    --viz-3:#6b6b75;
    --shadow-popover:0 4px 16px rgba(0,0,0,.4),0 0 0 1px rgba(255,255,255,.04);
    --shadow-modal:0 16px 48px rgba(0,0,0,.56),0 0 0 1px rgba(255,255,255,.04);
  }
}
