/* Theme: light (Warm Ivory) is the default. Dark applies with data-theme="dark", or data-theme="system" on a dark device.
   Brand on Cue design tokens — v3 (Oct 23 2026: premium pass on the approved product palette; docs/DESIGN-SYSTEM.md)
   Product chrome: Warm Ivory background, Midnight Navy text + navigation, Deep Teal primary actions and links,
   amber for attention, emerald for success / live, an accessible red for errors, and a hatched neutral for test data.
   Every text pair below is >= 4.5:1 and every UI edge >= 3:1 (tests/test_accessibility.py computes them).
   A business's own brand colors are used only in its previews (--biz-brand / --biz-accent, set at runtime). */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/shared/fonts/inter-latin-var.woff2") format("woff2"); }

:root {
  /* ---- Palette (named; screens use the semantic tokens further down) ---- */
  --ivory-0: #ffffff; --ivory-25: #fdfcf9; --ivory-50: #fbf9f5; --ivory-100: #f4f0e8; --ivory-150: #ebe5da; --ivory-200: #ddd5c7; --ivory-300: #c8bfae;
  --navy-950: #00122a; --navy-900: #001c3c; --navy-800: #0a2a50; --navy-700: #1b3a63; --navy-600: #3b4f6b; --navy-500: #56657a;
  --teal-900: #00393d; --teal-800: #00454a; --teal-700: #005a60; --teal-600: #0f766e; --teal-500: #00908c; --teal-200: #a9dcd8; --teal-100: #d7eeec; --teal-50: #edf7f6;
  --amber-800: #92400e; --amber-700: #b45309; --amber-500: #f49c00; --amber-200: #f8d58c; --amber-50: #fff8eb;
  --emerald-700: #047857; --emerald-600: #059669; --emerald-200: #a7f3d0; --emerald-50: #ecfdf5;
  --red-700: #b91c1c; --red-200: #fecaca; --red-50: #fef2f2;

  /* Command Intelligence Center palette (Nov 21 2026) — one action colour, navy surfaces, blue for links/Approved, red only for the
     brand mark and Blocked. Status colours below are for dots, bars, edges and fills (>= 3:1 as UI parts); status TEXT keeps the darker
     AA tokens (--success / --warning / --danger), so every text pair stays >= 4.5:1 (tests/test_accessibility.py). */
  --cic-primary: #0f766e; --cic-navy: #0b1b36; --cic-blue: #1e40af; --cic-red: #d7262e;
  --status-working: #16a34a; --status-needs: #f59e0b; --status-blocked: #dc2626; --status-fixing: #9ca3af;
  --fs-display: 1.875rem; --fs-heading: 1rem; --fs-body: .875rem; --fs-label: .75rem;
  --fw-display: 700; --fw-heading: 600; --fw-body: 400; --fw-label: 600;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 16px; --sp-4: 24px; --sp-5: 32px;
  --rad-sm: 8px; --rad-md: 12px; --rad-lg: 16px;
  --card-border: #e3e7ed;

  /* Product brand (fixed) */
  --brand: var(--cic-primary);       /* Teal #0F766E: the single action colour (5.5:1 with white text) */
  --brand-accent: var(--teal-600);
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, transparent);
  --brand-softer: color-mix(in srgb, var(--brand) 5%, transparent);
  --brand-strong: var(--teal-800);
  --navy: #0b1b36;                   /* Navy #0B1B36: text, sidebar and hero cards (Nov 21 2026 palette) */
  /* The approved logo's own colours (web/shared/brand/source/derived.json). For brand moments (logo-adjacent accents), not for
     text: logo teal on white is 3.6:1, so buttons and links keep the darker Deep Teal --brand (7.6:1 with white text). */
  --logo-navy: #001c3c; --logo-teal: #00908c; --logo-amber: #f49c00;
  --ivory: #fbf9f5;                  /* Warm Ivory: page background */
  /* A business's own colors (previews only; default to the product colors) */
  --biz-brand: var(--brand); --biz-accent: var(--brand-accent); --biz-ink: #ffffff;

  /* Neutrals (warm, navy-tinted) — kept for older screens */
  --n-0: #ffffff; --n-25: #fdfcfa; --n-50: #fbf9f5; --n-100: #f3efe7; --n-150: #e8e2d7; --n-200: #dcd5c8;
  --n-300: #c5bfb3; --n-400: #94a3b8; --n-500: #64748b; --n-600: #475569; --n-700: #334155; --n-800: #1e293b; --n-900: #0f172a; --n-950: #0b1120;

  /* Semantic surfaces and text */
  --bg: var(--ivory);
  --bg-elev: #ffffff;
  --bg-sunken: var(--ivory-100);
  --bg-raised: var(--ivory-25);      /* a card inside a card */
  --bg-hover: color-mix(in srgb, var(--navy) 4%, transparent);
  --bg-active: color-mix(in srgb, var(--navy) 7%, transparent);
  --text: var(--navy);               /* 16.3:1 on ivory */
  --text-2: #3d4c63;                 /* 9.0:1 on ivory, 8.2:1 on sunken */
  --text-3: #56657a;                 /* 5.6:1 on ivory, 5.2:1 on sunken, 4.6:1 on n-150 (WCAG AA small text) */
  --text-inverse: #ffffff;
  --border: var(--ivory-150);
  --border-strong: var(--ivory-200);
  --border-input: #8e8576;           /* form field edges: 3.6:1 on white (WCAG 1.4.11) */
  --divider: #efeae1;
  --focus: var(--teal-700);          /* focus ring: 7.1:1 on ivory, 7.6:1 on white */
  --focus-on-dark: #5eead4;          /* on the navy navigation: 11.6:1 */

  /* Status (text on its own -bg is >= 4.5:1; the base colour on white is >= 3:1 as a UI part) */
  --success: var(--emerald-700); --success-bg: var(--emerald-50); --success-border: var(--emerald-200);   /* emerald: approved / connected / live (5.5:1) */
  --warning: var(--amber-700);   --warning-bg: var(--amber-50);   --warning-border: var(--amber-200);     /* amber: needs attention / pending (4.8:1) */
  --danger: var(--red-700);      --danger-bg: var(--red-50);      --danger-border: var(--red-200);        /* red: error / failed (5.9:1) */
  --on-status: #ffffff;          /* text on a SOLID status fill (badge counts, dots with numbers); near-black in dark mode where fills are light */
  --info: #0e5f8a;               --info-bg: #eef7fb;              --info-border: #bfe0ef;
  --live: var(--emerald-600);    /* live dot (3.8:1 on white, next to words) */
  --test: #4a5568; --test-bg: #f2f1ee; --test-stripe: #e6e3dc; --test-border: #8e8576;   /* test / demo data: hatched neutral, dashed edge, "Test" word */
  --draft: var(--text-2); --draft-bg: var(--bg-sunken);
  --blocked: var(--amber-800); --blocked-bg: var(--amber-50);   /* disconnected / blocked: amber with an icon (7.0:1) */
  --hot: #c2410c; --hot-bg: #fff3eb;
  --warm: #a16207; --warm-bg: #fefae8;
  --cold: #3f5f8f; --cold-bg: #eef3fa;

  /* Chart palette (color-blind friendly order) */
  --c1: var(--brand); --c2: #b45309; --c3: #0e5f8a; --c4: #7c3aed; --c5: #be185d; --c6: #4d7c0f;

  /* Typography (Inter, self-hosted; system fallback). Scale: 12 / 13 / 14 (app body) / 16 / 18 / 22 / 28 / 36 / 48 */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 0.75rem;   /* 12 */
  --fs-sm: 0.8125rem; /* 13 */
  --fs-md: 0.875rem;  /* 14 — app body */
  --fs-lg: 1rem;      /* 16 */
  --fs-xl: 1.125rem;  /* 18 */
  --fs-2xl: 1.375rem; /* 22 */
  --fs-3xl: 1.75rem;  /* 28 */
  --fs-4xl: 2.25rem;  /* 36 */
  --fs-5xl: 3rem;     /* 48 */
  --lh-tight: 1.2; --lh: 1.5; --lh-loose: 1.65;
  --fw-regular: 400; --fw-medium: 520; --fw-semibold: 620; --fw-bold: 720;
  --tracking-tight: -0.015em; --tracking-display: -0.025em; --tracking-caps: 0.06em;

  /* Spacing (4px scale) */
  --s-0: 0; --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 28px; --s-8: 32px;
  --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;

  /* Radii */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;

  /* Elevation (navy-tinted, soft) */
  --shadow-xs: 0 1px 1px rgba(0, 28, 60, .04);
  --shadow-sm: 0 1px 2px rgba(0, 28, 60, .05), 0 1px 3px rgba(0, 28, 60, .04);
  --shadow-md: 0 6px 16px -4px rgba(0, 28, 60, .09), 0 2px 5px -2px rgba(0, 28, 60, .05);
  --shadow-lg: 0 22px 48px -14px rgba(0, 28, 60, .22), 0 8px 16px -8px rgba(0, 28, 60, .08);
  --shadow-focus: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent);
  --ring: 0 0 0 1px var(--border);

  /* Motion (all 0 when the person prefers reduced motion) */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-1: 120ms; --dur-2: 180ms; --dur-3: 260ms;

  /* Layout */
  --sidebar-w: 248px;                /* narrow navigation, broad working area */
  --tabbar-h: 62px;
  --topbar-h: 60px;
  --content-max: 1240px;
  --target: 44px;                    /* touch target on phones / coarse pointers */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {                /* only when someone chose "Match my device"; the default is light */
    --brand: #2bb3ab; --brand-accent: #5eead4; --brand-ink: #04211f; --brand-strong: #5eead4;
    --bg: #0b1120; --bg-elev: #111a2e; --bg-sunken: #070c18; --bg-raised: #152038;
    --bg-hover: rgba(255, 255, 255, .045); --bg-active: rgba(255, 255, 255, .08);
    --text: #f1f5f9; --text-2: #b6c2d3; --text-3: #8d9bb0; --text-inverse: #0b1120;
    --border: #1f2a40; --border-strong: #2b3954; --border-input: #617190;  /* 3.5:1 on dark surfaces (was 2.8:1) */ --divider: #18223a; --card-border: #2b3954;
    --focus: #5eead4;
    --success: #3ccf8e; --success-bg: rgba(60, 207, 142, .12); --success-border: rgba(60, 207, 142, .3);
    --warning: #f0b45a; --warning-bg: rgba(240, 180, 90, .12); --warning-border: rgba(240, 180, 90, .3);
    --danger: #ff6b7a; --danger-bg: rgba(255, 107, 122, .12); --danger-border: rgba(255, 107, 122, .3); --on-status: #10141f;
    --info: #7aa7ff; --info-bg: rgba(122, 167, 255, .12); --info-border: rgba(122, 167, 255, .3);
    --live: #3ccf8e; --test: #c3cbd8; --test-bg: #1a2338; --test-stripe: #222d45; --test-border: #617190;
    --draft: #b6c2d3; --draft-bg: #070c18; --blocked: #f0b45a; --blocked-bg: rgba(240, 180, 90, .12);
    --hot: #ff8a4c; --hot-bg: rgba(255, 138, 76, .13); --warm: #f2c062; --warm-bg: rgba(242, 192, 98, .12); --cold: #8fb2e6; --cold-bg: rgba(143, 178, 230, .12);
    --brand-soft: color-mix(in srgb, var(--brand) 22%, transparent);
    --brand-softer: color-mix(in srgb, var(--brand) 11%, transparent);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .5); --shadow-lg: 0 20px 44px -12px rgba(0, 0, 0, .65);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #2bb3ab; --brand-accent: #5eead4; --brand-ink: #04211f; --brand-strong: #5eead4;
  --bg: #0b1120; --bg-elev: #111a2e; --bg-sunken: #070c18; --bg-raised: #152038;
  --bg-hover: rgba(255, 255, 255, .045); --bg-active: rgba(255, 255, 255, .08);
  --text: #f1f5f9; --text-2: #b6c2d3; --text-3: #8d9bb0; --text-inverse: #0b1120;
  --border: #1f2a40; --border-strong: #2b3954; --border-input: #617190;  /* 3.5:1 on dark surfaces (was 2.8:1) */ --divider: #18223a; --card-border: #2b3954;
  --focus: #5eead4;
  --success: #3ccf8e; --success-bg: rgba(60, 207, 142, .12); --success-border: rgba(60, 207, 142, .3);
  --warning: #f0b45a; --warning-bg: rgba(240, 180, 90, .12); --warning-border: rgba(240, 180, 90, .3);
  --danger: #ff6b7a; --danger-bg: rgba(255, 107, 122, .12); --danger-border: rgba(255, 107, 122, .3); --on-status: #10141f;
  --info: #7aa7ff; --info-bg: rgba(122, 167, 255, .12); --info-border: rgba(122, 167, 255, .3);
  --live: #3ccf8e; --test: #c3cbd8; --test-bg: #1a2338; --test-stripe: #222d45; --test-border: #617190;
  --draft: #b6c2d3; --draft-bg: #070c18; --blocked: #f0b45a; --blocked-bg: rgba(240, 180, 90, .12);
  --hot: #ff8a4c; --hot-bg: rgba(255, 138, 76, .13); --warm: #f2c062; --warm-bg: rgba(242, 192, 98, .12); --cold: #8fb2e6; --cold-bg: rgba(143, 178, 230, .12);
  --brand-soft: color-mix(in srgb, var(--brand) 22%, transparent);
  --brand-softer: color-mix(in srgb, var(--brand) 11%, transparent);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .5); --shadow-lg: 0 20px 44px -12px rgba(0, 0, 0, .65);
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; }
}
