/* =====================================================================
   Ecom OS design tokens  v1.0  (Nov 2026)
   Source of truth for every color, size, radius, shadow and timing.
   Components must read these variables. Never hard-code a value that
   exists here. If you need a value that does not exist, add a token
   here first and note why in DESIGN.md.

   Theme model
   - Light is the default (bare :root).
   - Dark applies when the OS prefers dark and the app has not forced
     light, or when the app sets data-theme="dark" on <html>.
   - data-theme="light" forces light even on a dark OS.
   ===================================================================== */

:root {
  /* ---- Brand (fixed, never themed) ---- */
  --eo-brand-green: #07A55F;
  --eo-brand-gray: #F3F3F3;
  --eo-brand-ink: #1A1A1A;
  --eo-brand-grad-from: #2CBA54;   /* left / start of the green gradient */
  --eo-brand-grad-to: #00A360;     /* right / end */

  /* ---- Surfaces ---- */
  --eo-canvas: #F3F3F3;            /* app background, sidebar sits on it */
  --eo-sheet: #FFFFFF;             /* the one floating content sheet */
  --eo-glass: rgba(255, 255, 255, .76);  /* anything that floats ON TOP of the sheet */
  --eo-fill: rgba(26, 26, 26, .04);      /* hover tiles, fields, quiet plates */
  --eo-fill-2: rgba(26, 26, 26, .065);   /* secondary buttons, switch track off */
  --eo-line: rgba(26, 26, 26, .075);     /* hairlines between rows */
  --eo-lens: #FFFFFF;                    /* the selected plate in selectors */
  --eo-scrim: rgba(20, 20, 20, .18);     /* behind the welcome modal */

  /* ---- Text ---- */
  --eo-ink: #1A1A1A;      /* primary text, titles, values */
  --eo-ink-2: #5E5E5E;    /* lead sentences, secondary values */
  --eo-ink-3: #8F8F8F;    /* labels, help text, icons at rest, axis text */
  --eo-ink-4: #C4C4C4;    /* separators like "/", empty ring track, faint */

  /* ---- Signal ---- */
  --eo-green: #07A55F;            /* primary action, "good", done, selected icon */
  --eo-green-ink: #07864E;        /* green used AS TEXT (passes contrast on white) */
  --eo-on-green: #0A1F12;         /* text on a green button. White fails contrast here */
  --eo-green-tint: rgba(7, 165, 95, .09);
  --eo-red: #D9483F;              /* "down" numbers and destructive actions only */
  --eo-amber: #D2902A;            /* reserved. Not used for status dots */

  /* ---- Charts ---- */
  --eo-chart-now: var(--eo-green);
  --eo-chart-prev: #D4D4D4;

  /* ---- Shadows (elevation) ---- */
  --eo-shadow-sheet: 0 0 0 1px rgba(26,26,26,.03), 0 1px 2px rgba(26,26,26,.03), 0 20px 48px -28px rgba(26,26,26,.16);
  --eo-shadow-lens:  0 0 0 .5px rgba(26,26,26,.07), 0 1px 2px rgba(26,26,26,.06), 0 3px 10px -4px rgba(26,26,26,.08);
  --eo-shadow-pop:   0 0 0 .5px rgba(26,26,26,.09), 0 2px 6px rgba(26,26,26,.04), 0 28px 60px -18px rgba(26,26,26,.24);
  --eo-shadow-lift:  0 0 0 1px var(--eo-line), 0 18px 36px -20px rgba(0,0,0,.30);

  /* ---- Glass recipe ---- */
  --eo-blur: blur(24px) saturate(1.5);
  --eo-blur-header: blur(20px) saturate(1.4);

  /* ---- Type ---- */
  --eo-font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --eo-font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  /* No mono. Numbers use Geist with tabular figures. */

  --eo-text-11: 11px;   /* only inside tiny previews (phone mock, toasts never) */
  --eo-text-12: 12px;   /* group labels, axis labels, meta */
  --eo-text-13: 13px;   /* help text, labels, table headers, d-lines */
  --eo-text-135: 13.5px;/* buttons, menu items, row values, switches labels */
  --eo-text-14: 14px;   /* body */
  --eo-text-15: 15px;   /* section titles (h3), menu titles */
  --eo-text-17: 17px;   /* lead sentence */
  --eo-text-20: 20px;   /* page title (h1), secondary big values */
  --eo-text-22: 22px;   /* serif pill, email subject */
  --eo-text-36: 36px;   /* big numbers */
  --eo-text-44: 44px;   /* serif greeting */

  --eo-weight-light: 300;   /* big numbers, lead sentence */
  --eo-weight-regular: 400; /* everything by default */
  --eo-weight-medium: 500;  /* h3, buttons, emphasis inside text */
  --eo-weight-bold: 600;    /* page title only */

  /* ---- Space (4px grid) ---- */
  --eo-space-1: 4px;  --eo-space-2: 8px;  --eo-space-3: 12px; --eo-space-4: 16px;
  --eo-space-5: 20px; --eo-space-6: 24px; --eo-space-8: 32px; --eo-space-10: 40px;
  --eo-space-12: 48px; --eo-space-14: 56px; --eo-space-18: 72px;

  /* ---- Layout ---- */
  --eo-sidebar-w: 232px;
  --eo-sidebar-w-compact: 64px;
  --eo-content-max: 1080px;
  --eo-gutter: 40px;          /* 20px when the sheet is under 640px wide */
  --eo-section-gap: 56px;     /* 44px under 640px */
  --eo-bleed: 14px;           /* how far hover plates extend past the text column */

  /* ---- Sizes ---- */
  --eo-h-ctl: 36px;   /* default button */
  --eo-h-sm: 30px;    /* small button */
  --eo-h-xl: 44px;    /* sheet-level button (welcome) */
  --eo-h-field: 40px; /* inputs, selects */
  --eo-h-seg: 34px;   /* segmented control (28 inner + 3 + 3) */
  --eo-h-nav: 34px;   /* sidebar item */
  --eo-h-row: 56px;   /* list row minimum */
  --eo-h-td: 60px;    /* table row */
  --eo-h-mi: 36px;    /* menu item */

  /* ---- Radius: r_outer = r_inner + padding. Never edit the calc lines. ---- */
  --eo-r-ctl: 10px;                                        /* buttons, fields, rows, menu items, lens */
  --eo-p-seg: 3px;                                         /* segmented control padding */
  --eo-p-pop: 6px;                                         /* popover / menu padding */
  --eo-p-sheet: 8px;                                       /* sheet inset + modal padding */
  --eo-r-seg: calc(var(--eo-r-ctl) + var(--eo-p-seg));     /* 13 */
  --eo-r-pop: calc(var(--eo-r-ctl) + var(--eo-p-pop));     /* 16  popovers, hover tiles */
  --eo-r-sheet: calc(var(--eo-r-ctl) + var(--eo-p-sheet)); /* 18  sheet, plates, images */
  --eo-r-modal: calc(var(--eo-r-sheet) + var(--eo-p-sheet)); /* 26 welcome modal */
  --eo-r-pill: 999px;

  /* ---- Motion ---- */
  --eo-ease: cubic-bezier(.22, 1, .36, 1);      /* fades, color, hover, page rise */
  --eo-spring: cubic-bezier(.3, 1.14, .44, 1);  /* anything that grows or moves: morph, switch knob, drawer, arrows */
  --eo-out: cubic-bezier(.4, 0, .2, 1);         /* closing / collapsing */
  --eo-dur-press: 150ms;
  --eo-dur-hover: 250ms;
  --eo-dur-tile: 300ms;
  --eo-dur-close: 260ms;
  --eo-dur-grow: 440ms;
  --eo-dur-drawer: 550ms;
  --eo-dur-rise: 600ms;
  --eo-dur-modal: 650ms;
  --eo-dur-count: 900ms;
  --eo-dur-ring: 1100ms;
  --eo-dur-chart: 1300ms;
  --eo-dur-toast: 2400ms;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --eo-canvas: #111111;
    --eo-sheet: #1A1A1A;
    --eo-glass: rgba(36, 36, 36, .76);
    --eo-fill: rgba(255, 255, 255, .045);
    --eo-fill-2: rgba(255, 255, 255, .075);
    --eo-line: rgba(255, 255, 255, .07);
    --eo-lens: #262626;
    --eo-scrim: rgba(0, 0, 0, .35);
    --eo-ink: #F3F3F3;
    --eo-ink-2: #A9A9A9;
    --eo-ink-3: #777777;
    --eo-ink-4: #4A4A4A;
    --eo-green-ink: #3CC985;
    --eo-green-tint: rgba(7, 165, 95, .14);
    --eo-red: #EB5E55;
    --eo-amber: #E3A445;
    --eo-chart-prev: #3C3C3C;
    --eo-shadow-sheet: 0 0 0 1px rgba(255,255,255,.035), 0 20px 48px -24px rgba(0,0,0,.7);
    --eo-shadow-lens: inset 0 .5px 0 rgba(255,255,255,.09), 0 0 0 .5px rgba(255,255,255,.05), 0 2px 6px -1px rgba(0,0,0,.45);
    --eo-shadow-pop: 0 0 0 .5px rgba(255,255,255,.09), 0 28px 60px -14px rgba(0,0,0,.65);
    --eo-shadow-lift: 0 0 0 1px var(--eo-line), 0 18px 36px -18px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --eo-canvas: #111111;
  --eo-sheet: #1A1A1A;
  --eo-glass: rgba(36, 36, 36, .76);
  --eo-fill: rgba(255, 255, 255, .045);
  --eo-fill-2: rgba(255, 255, 255, .075);
  --eo-line: rgba(255, 255, 255, .07);
  --eo-lens: #262626;
  --eo-scrim: rgba(0, 0, 0, .35);
  --eo-ink: #F3F3F3;
  --eo-ink-2: #A9A9A9;
  --eo-ink-3: #777777;
  --eo-ink-4: #4A4A4A;
  --eo-green-ink: #3CC985;
  --eo-green-tint: rgba(7, 165, 95, .14);
  --eo-red: #EB5E55;
  --eo-amber: #E3A445;
  --eo-chart-prev: #3C3C3C;
  --eo-shadow-sheet: 0 0 0 1px rgba(255,255,255,.035), 0 20px 48px -24px rgba(0,0,0,.7);
  --eo-shadow-lens: inset 0 .5px 0 rgba(255,255,255,.09), 0 0 0 .5px rgba(255,255,255,.05), 0 2px 6px -1px rgba(0,0,0,.45);
  --eo-shadow-pop: 0 0 0 .5px rgba(255,255,255,.09), 0 28px 60px -14px rgba(0,0,0,.65);
  --eo-shadow-lift: 0 0 0 1px var(--eo-line), 0 18px 36px -18px rgba(0,0,0,.7);
  color-scheme: dark;
}

/* ---- Base ---- */
html, body { background: var(--eo-canvas); color: var(--eo-ink); }
body {
  font: var(--eo-weight-regular) var(--eo-text-14)/22px var(--eo-font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:focus-visible { outline: 2px solid var(--eo-green); outline-offset: 2px; border-radius: var(--eo-r-ctl); }
::selection { background: var(--eo-green-tint); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}
