/* SEMIX colour tokens, v1 (2026-11-05).
   One :root, plain CSS custom properties, no build step.
   Load this file BEFORE styles.css on every page. Nothing in the repo uses these names yet,
   so adding the file changes nothing on screen. Old names (--color-primary, --primary,
   --color-gray-*) stay in styles.css and are pointed at these tokens later, one PR at a time.
   Ratios are WCAG 2.x contrast; checked by scratchpad/colors/final/measure_final.js (0 failures).
   Rules: red = money only on the board and in status badges; grey = closed visit;
   orange = late; dark navy = now-line; teal = SEMIX brand, never a technician colour.
   Every status also shows an icon and a word, never colour alone (WCAG 1.4.1). */
:root {
  /* ---------- Brand ---------- */
  --brand: #00685F;                 /* buttons, links, header. White text 6.68:1; text on white 6.68:1 */
  --brand-hover: #00564F;           /* darker on hover. White 8.59:1 (old #008378 was lighter, 4.65:1) */
  --brand-pressed: #134E4A;         /* pressed state, toast. White 9.48:1 */
  --brand-soft: #E0F2F1;            /* selected chip, drop-target fill, Installation badge bg */
  --brand-soft-fg: #134E4A;         /* text on --brand-soft 8.18:1 */
  --on-brand: #FFFFFF;              /* text/icons on --brand */
  --brand-mark: #00BBAF;            /* logo, favicon, splash art ONLY. Never text or a fill under text (2.41:1 on white) */
  --focus-ring: #00685F;            /* 2px keyboard focus ring on controls, 6.68:1 on white */

  /* ---------- Header ---------- */
  --header-bg: #00685F;             /* same on every page, warehouse and app included */
  --header-fg: #FFFFFF;             /* 6.68:1 */
  --header-fg-muted: #D1E4E2;       /* replaces rgba(255,255,255,.75); 5.06:1 */
  --header-control: #1A776F;        /* replaces the rgba(255,255,255,.25) glass; white text 5.37:1 */
  --header-control-hover: #267F77;  /* white text 4.79:1 */

  /* ---------- Surfaces (today's values, no visible change) ---------- */
  --bg-page: #F9F9FF;               /* body background */
  --bg-card: #FFFFFF;               /* cards, modals, board rows */
  --bg-subtle: #FAFAFA;             /* table header, row hover */
  --bg-sunken: #F5F5F5;             /* wells, disabled inputs */
  --bg-tint: #F0F3FF;               /* light panels */
  --bg-selected: #E7EEFE;           /* selected row (today's --color-primary-light value) */

  /* ---------- QR code (ONL-FE3b): a camera reads it — never themed, dark on light ---------- */
  --qr-dark: #000000;
  --qr-light: #FFFFFF;

  /* ---------- Text ---------- */
  --sign-ink: #151C27;              /* the customer's signature on the bill screen: always dark, it goes on paper */
  --fg-default: #151C27;            /* main text. 17.1:1 on white */
  --fg-secondary: #3D4947;          /* secondary text. 8.05:1 even on --bg-selected */
  --fg-muted: #666666;              /* desktop hints/metadata. >=4.56:1 on every surface above (was #737373: 4.08 on selected rows) */
  --fg-muted-field: #525252;        /* technician phone, outdoor: lightest text allowed. 7.81:1 on white */
  --fg-disabled: #A3A3A3;           /* disabled controls only, never content */
  --fg-on-fill: #FFFFFF;            /* text on any dark fill */

  /* ---------- Borders ---------- */
  --border-subtle: #E5E5E5;         /* dividers, hour lines (decorative) */
  --border-default: #D4D4D4;        /* card and table outlines (decorative) */
  --border-control: #6D7A77;        /* inputs, checkboxes, toggles. >=3.5:1 on all surfaces */
  --border-strong: #737373;         /* badge and dashed borders that carry meaning. 4.74:1 on white */

  /* ---------- Semantic groups ----------
     -fg = text on -bg (>=7:1), -bg = tint, -border = 1px, ALWAYS drawn on badges,
     -solid = filled button/toast, -on-solid = text on the solid. */
  --success-fg: #064E3B;            /* 8.57:1 on bg */
  --success-bg: #D1FAE5;
  --success-border: #047857;        /* 4.84:1 on bg, 5.48:1 on white */
  --success-solid: #047857;         /* replaces #10B981 (white text was 2.54:1) */
  --success-on-solid: #FFFFFF;      /* 5.48:1 */

  --warning-fg: #78350F;            /* 8.15:1 on bg */
  --warning-bg: #FEF3C7;
  --warning-border: #B45309;        /* 4.51:1 on bg, 5.02:1 on white */
  --warning-solid: #F59E0B;         /* amber fill kept; light, so it never looks like danger */
  --warning-on-solid: #431407;      /* dark text on amber 7.29:1 (white was 2.15:1). Add --warning-border on white */
  --accent: var(--warning-solid);   /* the one main action of the day: Log in, On my way, Finish (SEMIX_STYLE §2) */
  --on-accent: var(--warning-on-solid); /* text on --accent */

  --danger-fg: #7F1D1D;             /* 8.20:1 on bg */
  --danger-bg: #FEE2E2;
  --danger-border: #B91C1C;         /* 5.30:1 on bg, 6.47:1 on white */
  --danger-solid: #B91C1C;          /* replaces #EF4444 (3.76:1) and #DC2626 */
  --danger-on-solid: #FFFFFF;       /* 6.47:1 */

  --info-fg: #1E40AF;               /* 7.15:1 on bg */
  --info-bg: #DBEAFE;
  --info-border: #1D4ED8;           /* 5.49:1 on bg */
  --info-solid: #1D4ED8;
  --info-on-solid: #FFFFFF;         /* 6.70:1 */

  --neutral-fg: #404040;            /* 9.51:1 on bg */
  --neutral-bg: #F5F5F5;
  --neutral-border: #737373;        /* 4.35:1 on bg */
  --neutral-solid: #525252;
  --neutral-on-solid: #FFFFFF;      /* 7.81:1 */

  --indigo-fg: #3730A3;             /* 8.06:1 on bg */
  --indigo-bg: #E0E7FF;
  --indigo-border: #4F46E5;         /* 5.10:1 on bg */

  --violet-fg: #5B21B6;             /* 7.57:1 on bg (existing 2nd-tech badge colours) */
  --violet-bg: #EDE9FE;
  --violet-border: #7C3AED;         /* 4.80:1 on bg */

  /* ---------- Primary Data statuses (fixes P-9; map = js/admin/shared/constants.js:82-92) ----------
     Badge = bg + 1px border + icon + word. */
  --pd-diagnostics-fg: var(--warning-fg);    /* icon: search */
  --pd-diagnostics-bg: var(--warning-bg);
  --pd-diagnostics-border: var(--warning-border);
  --pd-done-fg: var(--success-fg);           /* icon: check_circle */
  --pd-done-bg: var(--success-bg);
  --pd-done-border: var(--success-border);
  --pd-recall-fg: var(--info-fg);            /* icon: replay. Not red: red = money */
  --pd-recall-bg: var(--info-bg);
  --pd-recall-border: var(--info-border);
  --pd-installation-fg: var(--brand-soft-fg);/* icon: build */
  --pd-installation-bg: var(--brand-soft);
  --pd-installation-border: var(--brand);
  --pd-deposit-fg: var(--indigo-fg);         /* icon: savings (piggy bank) */
  --pd-deposit-bg: var(--indigo-bg);
  --pd-deposit-border: var(--indigo-border);
  --pd-not-paid-fg: var(--danger-fg);        /* icon: money_off. Filled tint */
  --pd-not-paid-bg: var(--danger-bg);
  --pd-not-paid-border: var(--danger-border);
  --pd-refund-fg: var(--danger-fg);          /* icon: undo. Outline only, so it differs from Not paid */
  --pd-refund-bg: #FFFFFF;
  --pd-refund-border: var(--danger-border);
  --pd-paid-fg: var(--success-fg);           /* icon: paid */
  --pd-paid-bg: var(--success-bg);
  --pd-paid-border: var(--success-border);
  --pd-second-tech-fg: var(--violet-fg);     /* icon: group (2nd tech payout row) */
  --pd-second-tech-bg: var(--violet-bg);
  --pd-second-tech-border: var(--violet-border);

  /* ---------- Visit statuses in lists, side panel, technician phone ---------- */
  --visit-scheduled-fg: var(--neutral-fg);   /* icon: event */
  --visit-scheduled-bg: var(--neutral-bg);
  --visit-scheduled-border: var(--neutral-border);
  --visit-onway-fg: var(--info-fg);          /* icon: directions_car, "since 1:41" */
  --visit-onway-bg: var(--info-bg);
  --visit-onway-border: var(--info-border);
  --visit-done-fg: var(--success-fg);        /* icon: check_circle */
  --visit-done-bg: var(--success-bg);
  --visit-done-border: var(--success-border);
  --visit-unpaid-fg: var(--danger-fg);       /* icon: money_off + "$240 due" */
  --visit-unpaid-bg: var(--danger-bg);
  --visit-unpaid-border: var(--danger-border);
  --visit-late-fg: #7C2D12;                  /* icon: schedule + "late 20 min". 8.83:1 on bg */
  --visit-late-bg: #FFF7ED;
  --visit-late-border: #EA580C;              /* 3.35:1 on bg, 3.56:1 on white */
  --visit-closed-fg: var(--neutral-fg);      /* no access (door_front), client moved (event_repeat), cancelled (block) */
  --visit-closed-bg: var(--neutral-bg);
  --visit-closed-border: var(--neutral-border);

  /* ---------- Day board (SCHEDULE_UI_DESIGN 2.1): colour = technician, state = fill style + icon ---------- */
  --board-bg: #FFFFFF;
  --board-line: #E5E5E5;            /* hour lines (decorative) */
  --board-offhours-a: #F5F5F5;      /* 135deg hatch stripe 1 */
  --board-offhours-b: #E5E5E5;      /* hatch stripe 2; tech fills stay >=3.69:1 against it */
  --board-offhours-fg: #404040;     /* reason text, >=8.2:1 on both stripes */
  --board-selected: #151C27;        /* 2px outline, 2px offset, on top of any state */
  --drop-target-bg: #E0F2F1;
  --drop-target-border: #00685F;    /* dashed, 5.77:1 on its bg */

  --state-onway-bg: #FFFFFF;        /* on the way / on site: white body + 2px tech border + 6px tech band on the left */
  --state-onway-fg: #151C27;        /* car icon + "since 1:41" */
  --state-done: #E5E5E5;            /* closed visit fill (paid, nothing to pay, no access, client moved, deposit) */
  --state-done-border: #737373;     /* 1px; 3.76:1 vs the grey, 4.74:1 vs the row */
  --state-done-fg: #404040;         /* text and outcome icon, 8.23:1 */
  --state-money: #B91C1C;           /* closed but NOT paid: 2px border (5.14:1 on grey) + money_off chip with white icon (6.47:1) */
  --state-money-fg: #991B1B;        /* "$240 due" on the grey block, 6.60:1 */
  --state-late: #EA580C;            /* late: 3px ring outside a 2px white gap (3.56:1); the block keeps its own look */
  --state-late-fg: #7C2D12;         /* late pill text "late 20 min" on --state-late-bg, 8.83:1 */
  --state-late-bg: #FFF7ED;
  --state-cancelled-border: #737373;/* shown only with "show cancelled": white body, 1px dashed, struck-through text */
  --state-cancelled-fg: #666666;    /* 5.74:1; no opacity */
  --state-unassigned-border: #525252; /* "No technician" row: white body, 2px dashed (7.81:1), icon person_add */
  --now-line: #1E3A8A;              /* 2px; MUST have the halo: alone it is only 1.03-2.23:1 on tech fills */
  --now-line-halo: #FFFFFF;         /* 1px each side (box-shadow); >=4.65:1 against every tech fill */

  /* ---------- Technician colours ----------
     All fills are dark and carry white text (>=4.65:1), so lightness alone tells the state
     for every viewer: dark = scheduled, white = on the way, light grey = closed.
     Hand out in this order. 1-8 are the main set; 9-12 only past 8 technicians.
     Initials are always on the block. -tint = window band, helper hatch, PD row background.
     Smallest CIEDE2000 gap (normal / protan / deutan / tritan):
     first 3: 35.5 / 28.9 / 24.1 / 21.0; first 8: 12.8 / 10.0 / 8.5 / 10.2; all 12: 8.9 / 6.1 / 6.0 / 7.3 */
  --tech-1: #236DF0;  --tech-1-text: #FFFFFF;  --tech-1-tint: #E9F1FE;   /* Blue    4.65:1 */
  --tech-2: #781D59;  --tech-2-text: #FFFFFF;  --tech-2-tint: #FEEAF4;   /* Plum    9.91:1 */
  --tech-3: #416335;  --tech-3-text: #FFFFFF;  --tech-3-tint: #E5F6E0;   /* Moss    6.86:1 */
  --tech-4: #5501B9;  --tech-4-text: #FFFFFF;  --tech-4-tint: #F0EEFF;   /* Violet 10.04:1 */
  --tech-5: #A0617E;  --tech-5-text: #FFFFFF;  --tech-5-tint: #FFE9F2;   /* Rose    4.66:1 */
  --tech-6: #644F80;  --tech-6-text: #FFFFFF;  --tech-6-tint: #F3ECFF;   /* Dusk    7.07:1 */
  --tech-7: #C928B8;  --tech-7-text: #FFFFFF;  --tech-7-tint: #FEE9F9;   /* Orchid  4.69:1 */
  --tech-8: #1D8350;  --tech-8-text: #FFFFFF;  --tech-8-tint: #DEF8E6;   /* Green   4.76:1 */
  --tech-9: #343CF8;  --tech-9-text: #FFFFFF;  --tech-9-tint: #EBF0FE;   /* Ultramarine 6.67:1, overflow */
  --tech-10: #0D71A6; --tech-10-text: #FFFFFF; --tech-10-tint: #E3F3FE;  /* Ocean   5.34:1, overflow */
  --tech-11: #8F00D3; --tech-11-text: #FFFFFF; --tech-11-tint: #F5ECFE;  /* Purple  6.76:1, overflow */
  --tech-12: #875D8A; --tech-12-text: #FFFFFF; --tech-12-tint: #FDE9FE;  /* Mauve   5.30:1, overflow */
  --tech-none-border: #525252;      /* = --state-unassigned-border */
}
