/* The colour palette — EVERY colour token, light and dark, in one place
   (UI rulebook §1.0). Change a colour here and the whole app follows.
   Loaded first by templates/v2/base.html, before Bootstrap and the app CSS.
   Light values under :root, dark values under [data-theme="dark"]. */

/* ── Grey ramp and base colours (was in statics/v2/css/main.css) ── */
:root {
  /* Color Palette */
  --primary-color: #1565c0;
  --primary-hover: #1565c0;
  /* Brand action blue — primary buttons, active toggles and the current
     breadcrumb. Defined here so the value lives in one place. */
  --brand-blue: #0d00df;
  --brand-blue-hover: #0a00b3;
  --secondary-color: #ffb800;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  /* Neutral Colors */
  /* Card surface. Pop-ups and cards use it as their background; without it
     they paint transparent. */
  --gray-0: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --blue-hover: #6497f9;
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  /* A floating panel (filter popover, row menu) and the edge of a pinned column. */
  --shadow-popover: 0 8px 24px rgba(15, 23, 42, 0.14);
  /* The grey page a form's cards sit on (rulebook §1.6). */
  --page-bg: #f5f5f5;
  /* The app frame: topbar and sidebar, and the line along their edge. */
  --chrome-bg: #f7f8fa;
  --chrome-border: #d8d8d8;
  --shadow-pinned-edge: -6px 0 8px -6px rgba(15, 23, 42, 0.12);
  /* Behind a pop-up; and the dark surround of a document (PDF) viewer. */
  --overlay-backdrop: rgba(15, 23, 42, 0.55);
  --doc-viewer-bg: #282828;
  /* Toast (rulebook §8.4, common/Toast.svelte): a dark surface on a light page. */
  --toast-bg: #111827;
  --toast-fg: #ffffff;
  --toast-border: #111827;
  --toast-action: #b8b4f7;
  --toast-close: #9ca3af;
  --toast-icon-done: #4ade80;
  --toast-icon-info: #60a5fa;
  --toast-icon-error: #f87171;
  --toast-shadow: 0 8px 24px rgba(17, 24, 39, 0.24);
  /* Fabric Production step pills (Knitting / Dyeing / Lamination). */
  --phase-knitting: #1565c0;
  --phase-dyeing: #7b1fa2;
  --phase-lamination: #00897b;
  --phase-other: #374151;
}
:root[data-theme="dark"] {
  /* Toast flips to a light surface so it still stands apart (§8.4). */
  --toast-bg: #f9fafb;
  --toast-fg: #111827;
  --toast-border: #e5e7eb;
  --toast-action: #0d00df;
  --toast-close: #6b7280;
  --toast-icon-done: #16a34a;
  --toast-icon-info: #2563eb;
  --toast-icon-error: #dc2626;
  --toast-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  --primary-color: #4f8ff7;
  --primary-hover: #397add;
  --secondary-color: #ffcf67;
  --success-color: #4ade80;
  --danger-color: #f87171;
  --warning-color: #fbbf24;
  --info-color: #38bdf8;
  /* The ramp only gets lighter from the card surface (--dt-surface), as light mode
     gets darker from white: grey 50 is a faint tint, 200 a hairline, 300 a
     stronger edge (rulebook §1.6). */
  --gray-0: #1b1f2c; /* same as --dt-surface */
  --gray-50: #22273a;
  --gray-100: #272d40;
  --gray-200: #30374c;
  --gray-300: #434b62;
  --gray-400: #6e768c;
  --gray-500: #9aa1b4;
  --gray-600: #b6bccb;
  --gray-700: #cdd2dd;
  --gray-800: #e2e5ec;
  --gray-900: #f3f4f6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 20px -5px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 20px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.5);
  --page-bg: #12141c;
  --chrome-bg: #1a2036;
  --chrome-border: #30374c;
  --shadow-pinned-edge: -6px 0 8px -6px rgba(0, 0, 0, 0.5);
  --overlay-backdrop: rgba(0, 0, 0, 0.6);
  --doc-viewer-bg: #1b1b1b;
  --phase-knitting: #42a5f5;
  --phase-dyeing: #ba68c8;
  --phase-lamination: #26a69a;
  --phase-other: #6b7280;
}

/* ── Components (was in statics/v2/css/components.css) ── */
:root {
  --dt-skel-bar: var(--gray-200);
  --dt-skel-shine: rgba(255, 255, 255, 0.95);
 --dt-surface: #ffffff; 
}
[data-theme="dark"] {
  --dt-skel-bar: var(--gray-300);
  --dt-skel-shine: rgba(255, 255, 255, 0.1);
 --dt-surface: #1b1f2c; 
}

/* ── Badges and status (was in statics/v2/css/badges.css) ── */
:root {
  /* Blue (light) — New */
  --status-info-text: #0056d0;
  --status-info-bg: #eaf2fd;
  --status-info-border: #b6d1f6;
  /* Slate (light) — Pending, Not Started */
  --status-neutral-text: #506185;
  --status-neutral-bg: #f0f2f7;
  --status-neutral-border: #ccd3e0;
  /* Outline (light) — Draft */
  --status-draft-text: #506185;
  --status-draft-bg: #ffffff;
  --status-draft-border: #ccd3e0;
  /* Dark slate (light) — Cancelled */
  --status-cancelled-text: #2e384c;
  --status-cancelled-bg: #dfe3ec;
  --status-cancelled-border: #a3adc2;
  /* Amber (medium) — Awaiting Approval, Resubmitted */
  --status-warning-text: #8d5900;
  --status-warning-bg: #fcedd4;
  --status-warning-border: #f1cb88;
  /* Teal (medium) — Approved, Passed */
  --status-success-text: #00745d;
  --status-success-bg: #d4fcf4;
  --status-success-border: #88f1dc;
  /* Green (medium) — Completed, Paid, Dispatched */
  --status-completed-text: #007430;
  --status-completed-bg: #d4fce5;
  --status-completed-border: #88f1b4;
  /* Red (light) — Rejected, Failed */
  --status-danger-text: #c0000d;
  --status-danger-bg: #fdeaeb;
  --status-danger-border: #f6b6ba;
  /* Orange (light) — Overdue */
  --status-alert-text: #a73d00;
  --status-alert-bg: #fdf1ea;
  --status-alert-border: #f6ceb6;
  /* Cyan (light) — Partially Delivered / Paid / Completed, In Progress */
  --status-partial-text: #006d83;
  --status-partial-bg: #eafafd;
  --status-partial-border: #b6ecf6;
  /* Violet (light) — Converted */
  --status-converted-text: #6800df;
  --status-converted-bg: #f3eafd;
  --status-converted-border: #d4b6f6;
  /* "Projection" tag beside a PRJ number (rulebook §1.4), .projection-tag below. */
  --tag-projection-text: #6d28d9;
  --tag-projection-bg: #f5f3ff;
}
:root[data-theme="dark"] {
  --status-info-text: #8fb8f5;      --status-info-bg: rgba(0, 86, 208, 0.18);     --status-info-border: rgba(143, 184, 245, 0.35);
  --status-neutral-text: #b4bfd6;   --status-neutral-bg: rgba(80, 97, 133, 0.18);  --status-neutral-border: rgba(180, 191, 214, 0.3);
  --status-draft-text: #b4bfd6;     --status-draft-bg: transparent;                --status-draft-border: rgba(180, 191, 214, 0.4);
  --status-cancelled-text: #c5ccdb; --status-cancelled-bg: rgba(163, 173, 194, 0.18); --status-cancelled-border: rgba(197, 204, 219, 0.3);
  --status-warning-text: #f3c06b;   --status-warning-bg: rgba(141, 89, 0, 0.18);   --status-warning-border: rgba(243, 192, 107, 0.35);
  --status-success-text: #5fe0c4;   --status-success-bg: rgba(0, 116, 93, 0.18);   --status-success-border: rgba(95, 224, 196, 0.32);
  --status-completed-text: #5cd68f; --status-completed-bg: rgba(0, 116, 48, 0.18); --status-completed-border: rgba(110, 227, 159, 0.32);
  --status-danger-text: #ff8a8f;    --status-danger-bg: rgba(192, 0, 13, 0.18);    --status-danger-border: rgba(255, 143, 150, 0.32);
  --status-alert-text: #ffa36b;     --status-alert-bg: rgba(167, 61, 0, 0.18);     --status-alert-border: rgba(255, 171, 120, 0.32);
  --status-partial-text: #6fd3e8;   --status-partial-bg: rgba(0, 109, 131, 0.18);  --status-partial-border: rgba(111, 211, 232, 0.32);
  --status-converted-text: #c39bff; --status-converted-bg: rgba(104, 0, 223, 0.18); --status-converted-border: rgba(195, 155, 255, 0.32);
  --tag-projection-text: #c4b5fd;   --tag-projection-bg: rgba(109, 40, 217, 0.22);
}

/* ── Primary, surfaces, status families, charts (was in svelte-frontend/src/styles/variables.css) ── */
:root {
  --color-primary: #0d00df;
  --color-primary-hover: #0a00b8;
  --color-primary-active: #080091;
  --color-primary-50: #eeedfd;
  --color-primary-100: #dcdafb;
  --color-primary-200: #b8b4f7;
  --color-on-primary: #ffffff;
  /* Primary split for dark mode (rulebook §1.6): TEXT for links, selected text,
     titles, active tabs and primary borders; FILL for filled buttons, ticked
     boxes, on switches and the active side of a segmented control. */
  --color-primary-text: #0d00df;
  --color-primary-fill: #0d00df;
  --focus-ring: rgba(13, 0, 223, 0.12);
  /* The hairline round every colour swatch, so White shows on light and Navy on dark. */
  --swatch-ring: rgba(17, 24, 39, 0.18);
  /* Initials avatars: none in light; a light ring in dark keeps navy visible. */
  --avatar-ring: none;
  /* Quiet tag (Mixed carton). */
  --tag-bg: #f0f2f7;
  --tag-fg: #506185;
  /* Tooltips: the +N more names, hover hints. */
  --tooltip-bg: #111827;
  --tooltip-fg: #ffffff;
  /* Chart colours (rulebook §1.4 "Chart colours"). Categories, never status.
     Indigo by default; warm only for money that is late or being lost.
     Within a ramp, darker = look here first. */
  --chart-indigo-1: #2d23e3;
  --chart-indigo-2: #6f69ec;
  --chart-indigo-3: #a8a4f4;
  --chart-indigo-4: #dcdafb;
  --chart-warm-1: #9a3412;
  --chart-warm-2: #c2410c;
  --chart-warm-3: #ea8a4f;
  --chart-warm-4: #f6c3a0;
  /* Legend % chips: dark text, the tint on the border only. */
  --chart-chip-text: #334155;
  /* Colours used from JavaScript (charts, avatars, SVG). Same value as before;
     neutral greys take their grey-ramp step's dark value. */
  --chart-amber-100: #fef3c7;
  --chart-amber-100-2: #fef4c7;
  --chart-amber-250: #fef08a;
  --chart-amber-500: #ff9900;
  --chart-amber-500-2: #f59e0b;
  --chart-amber-500-3: #ff9800;
  --chart-amber-550: #eda100;
  --chart-blue-100: #c7d3f8;
  --chart-blue-200: #a3b7f4;
  --chart-blue-200-2: #a5b4fc;
  --chart-blue-200-3: #93b4fb;
  --chart-blue-250: #818cf8;
  --chart-blue-300: #7796ee;
  --chart-blue-300-2: #7ba6f0;
  --chart-blue-300-3: #9d7bea;
  --chart-blue-350: #9359ff;
  --chart-blue-350-2: #6366f1;
  --chart-blue-350-3: #5b7ce6;
  --chart-blue-350-4: #7c93d6;
  --chart-blue-400: #4f46e5;
  --chart-blue-400-2: #4b73e6;
  --chart-blue-400-3: #3b82f6;
  --chart-blue-450: #2563eb;
  --chart-blue-450-2: #3987e5;
  --chart-blue-450-3: #2196f3;
  --chart-blue-50: #e1e8fc;
  --chart-blue-50-2: #dbeafe;
  --chart-blue-50-3: #ede9fe;
  --chart-blue-50-4: #e0e7ff;
  --chart-blue-50-5: #e3f2fd;
  --chart-blue-50-6: #eaf1fd;
  --chart-blue-500: #1a73e8;
  --chart-blue-500-2: #0885fe;
  --chart-blue-500-3: #0ea5e9;
  --chart-blue-500-4: #1e4ed8;
  --chart-blue-500-5: #1d4ed8;
  --chart-blue-500-6: #4338ca;
  --chart-blue-500-7: #4472c4;
  --chart-blue-500-8: #2a78d6;
  --chart-blue-500-9: #1e4dd9;
  --chart-blue-500-a14: rgba(30,78,216,.14);
  --chart-blue-500-a50: rgba(30,78,216,.5);
  --chart-blue-550: #4a3aa7;
  --chart-blue-550-2: #0d00df;
  --chart-blue-600: #1565c0;
  --chart-blue-600-a10: rgba(21,101,192,0.10);
  --chart-blue-700: #26386f;
  --chart-blue-750: #1b3a6b;
  --chart-blue-850: #211b3e;
  --chart-cyan-100: #cffafe;
  --chart-cyan-550: #06b6d4;
  --chart-cyan-650: #0891b2;
  --chart-cyan-700: #0e7490;
  --chart-green-100: #d1fae5;
  --chart-green-50: #dcfce7;
  --chart-green-500: #4caf50;
  --chart-green-550: #84cc16;
  --chart-green-550-2: #22c55e;
  --chart-green-600: #1baf7a;
  --chart-green-600-2: #2e9b5c;
  --chart-green-650: #00bc7c;
  --chart-green-650-2: #16a34a;
  --chart-green-650-3: #199e70;
  --chart-green-650-4: #2e7d32;
  --chart-green-650-a14: rgba(22,163,74,.14);
  --chart-green-650-a50: rgba(22,163,74,.5);
  --chart-green-700: #15803d;
  --chart-green-750: #166534;
  --chart-green-750-2: #008300;
  --chart-grey-0: #ffffff;
  --chart-grey-100: #e2e8f0;
  --chart-grey-1000: #000000;
  --chart-grey-1000-a7: rgba(0,0,0,0.07);
  --chart-grey-150: #cbd5e1;
  --chart-grey-250: #b2c9ad;
  --chart-grey-350: #94a3b8;
  --chart-grey-350-2: #a3a3a3;
  --chart-grey-350-3: #9ca3af;
  --chart-grey-350-a15: rgba(148,163,184,0.15);
  --chart-grey-450: #8b9099;
  --chart-grey-50: #f1f5f9;
  --chart-grey-50-2: #e8f5e9;
  --chart-grey-50-3: #f3f4f6;
  --chart-grey-50-4: #eef2f7;
  --chart-grey-550: #64748b;
  --chart-grey-550-2: #6b7280;
  --chart-grey-600: #5f6368;
  --chart-grey-650: #475569;
  --chart-grey-750: #334155;
  --chart-grey-800: #21273e;
  --chart-grey-800-2: #2a2f45;
  --chart-grey-850: #1e293b;
  --chart-grey-850-2: #1b1e28;
  --chart-grey-900: #1c1c1c;
  --chart-grey-900-a15: rgba(15,23,42,0.15);
  --chart-grey-900-a6: rgba(15,23,42,0.06);
  --chart-orange-100: #ffedd5;
  --chart-orange-450: #f97316;
  --chart-orange-450-2: #eb6834;
  --chart-orange-450-3: #e0912c;
  --chart-orange-450-4: #c0714f;
  --chart-orange-50: #fff4e5;
  --chart-orange-500: #d95926;
  --chart-orange-500-2: #e08a1e;
  --chart-orange-500-3: #ea580c;
  --chart-orange-550: #e65100;
  --chart-orange-550-2: #d97706;
  --chart-orange-550-a14: rgba(217,119,6,.14);
  --chart-orange-550-a50: rgba(217,119,6,.5);
  --chart-orange-600: #c2410c;
  --chart-orange-650: #b45309;
  --chart-orange-650-2: #9a3412;
  --chart-orange-650-3: #b4540a;
  --chart-orange-700: #92400e;
  --chart-orange-700-2: #854d0e;
  --chart-red-200: #fca5a5;
  --chart-red-300: #e87ba4;
  --chart-red-350: #ef5350;
  --chart-red-400: #ef4444;
  --chart-red-400-2: #e34948;
  --chart-red-400-3: #f44336;
  --chart-red-50: #ffe4e6;
  --chart-red-50-2: #fee2e2;
  --chart-red-50-3: #fff1f2;
  --chart-red-50-4: #ffebee;
  --chart-red-500: #e11d48;
  --chart-red-500-2: #dc2626;
  --chart-red-500-3: #db2777;
  --chart-red-500-4: #d32f2f;
  --chart-red-500-a14: rgba(220,38,38,.14);
  --chart-red-500-a50: rgba(220,38,38,.5);
  --chart-red-550: #c5221f;
  --chart-red-550-2: #c62828;
  --chart-red-600: #b42318;
  --chart-red-600-2: #b91c1c;
  --chart-red-600-3: #be123c;
  --chart-red-650: #9f1239;
  --chart-red-650-2: #991b1b;
  --chart-teal-600: #14b8a6;
  --chart-teal-650: #1f8a8a;
  --chart-teal-700: #059669;
  --chart-teal-700-2: #0d9488;
  --chart-teal-750: #00897b;
  --chart-teal-750-2: #047857;
  --chart-violet-350: #a855f7;
  --chart-violet-350-2: #db7ab0;
  --chart-violet-400: #7c3aed;
  --chart-violet-500: #6d28d9;
  --chart-violet-550: #7e22ce;
  --chart-violet-600: #5b21b6;
  --chart-violet-600-2: #7b1fa2;
  --chart-violet-600-3: #a21caf;
}
:root[data-theme="dark"] {
  --chart-chip-text: #cbd5e1;
  /* Rulebook §1.6: the brand primary cannot be read on a dark surface. */
  --color-primary-text: #a49dff;
  --color-primary-fill: #3b30ff;
  --color-primary-hover: #5249ff;
  --color-primary-50: rgba(164, 157, 255, 0.14);
  --color-primary-100: rgba(164, 157, 255, 0.26);
  /* The quiet primary border (row next-step buttons): a soft lavender, not a glow. */
  --color-primary-200: rgba(164, 157, 255, 0.45);
  --focus-ring: rgba(164, 157, 255, 0.3);
  --swatch-ring: rgba(255, 255, 255, 0.28);
  --avatar-ring: 0 0 0 1px rgba(255, 255, 255, 0.22);
  --tag-bg: rgba(148, 163, 184, 0.16);
  --tag-fg: #b8c2d6;
  --tooltip-bg: #f3f4f6;
  --tooltip-fg: #111827;
  /* JavaScript colours: series keep their value, greys follow the ramp. */
  --chart-grey-100: #30374c;
  --chart-grey-1000: #f3f4f6;
  --chart-grey-1000-a7: rgba(255, 255, 255, 0.07);
  --chart-grey-150: #434b62;
  --chart-grey-250: #434b62;
  --chart-grey-350: #6e768c;
  --chart-grey-350-2: #6e768c;
  --chart-grey-350-3: #6e768c;
  --chart-grey-450: #6e768c;
  --chart-grey-50: #272d40;
  --chart-grey-50-2: #272d40;
  --chart-grey-50-3: #272d40;
  --chart-grey-50-4: #272d40;
  --chart-grey-550: #9aa1b4;
  --chart-grey-550-2: #9aa1b4;
  --chart-grey-600: #b6bccb;
  --chart-grey-650: #b6bccb;
  --chart-grey-750: #cdd2dd;
  --chart-grey-800: #e2e5ec;
  --chart-grey-800-2: #e2e5ec;
  --chart-grey-850: #e2e5ec;
  --chart-grey-850-2: #f3f4f6;
  --chart-grey-900: #f3f4f6;
  --chart-grey-900-a15: rgba(255, 255, 255, 0.15);
  --chart-grey-900-a6: rgba(255, 255, 255, 0.06);
}

/* Colour picker spectrum (Master Admin → Colour, form/Colour/ColourHexField.svelte).
   A spectrum is absolute — the same colours in light and dark — so both themes
   hold the same values. The saturation / brightness square is the hue fill with
   --picker-white (left → right) and --picker-black (bottom → top) laid over it. */
:root {
  --picker-white: #FFFFFF;
  --picker-black: #000000;
  --picker-hue: linear-gradient(to right, #FF0000 0%, #FFFF00 17%, #00FF00 33%, #00FFFF 50%, #0000FF 67%, #FF00FF 83%, #FF0000 100%);
}
:root[data-theme="dark"] {
  --picker-white: #FFFFFF;
  --picker-black: #000000;
  --picker-hue: linear-gradient(to right, #FF0000 0%, #FFFF00 17%, #00FF00 33%, #00FFFF 50%, #0000FF 67%, #FF00FF 83%, #FF0000 100%);
}
