/*
 * HOMEi design tokens — the one place a colour is decided.
 * ─────────────────────────────────────────────────────────────────────
 * WHY THIS FILE EXISTS (audit 2026-09-10, on origin/main at def18022f)
 *
 *   586 colour declarations across the 13 panel stylesheets
 *   279 distinct values
 *   165 of them (59%) used exactly ONCE
 *   105 distinct low-saturation greys
 *    39 values shared by three sheets or more
 *
 * A hundred and five greys is not a palette, it is an accident. Three
 * sheets carry their own local variable layer WITH a dark mirror
 * (construction-tracking, sales-projects, project-360) — done properly,
 * but each with its own names and its own values, so the same role is
 * three different colours. Three others carry no dark handling at all
 * (contract-delivery-terms, sales-inventory, unit-details), and screen-
 * local <style> blocks carry none either: on the Collections screen the
 * headline figure resolved to slate-700 on a near-black ground — 1.71:1,
 * where 3:1 is the minimum — which is why dark mode is currently
 * switched off (HO-3101).
 *
 * A token here is a ROLE, never a colour name: `--ho-danger-ink`, not
 * `--ho-red-700`. The role is what a reader can choose correctly; the
 * colour is what they guess at. That is the whole point.
 *
 * ─────────────────────────────────────────────────────────────────────
 * HOW TO USE IT
 *
 *   .my-card      { background: var(--ho-surface); color: var(--ho-ink); }
 *   .my-card-late { color: var(--ho-danger-ink); background: var(--ho-danger-soft); }
 *
 * Consume tokens; do not write a hex. A sheet built entirely on these
 * gets dark mode for free — that is the condition HO-3101 records for
 * turning dark mode back on. tests/Feature/Design/StylesheetHexRatchet
 * Test.php holds each sheet's current hex count and lets it go DOWN
 * only, so the count falls sheet by sheet instead of a big-bang rewrite.
 *
 * MIGRATION ORDER
 *   First, the three sheets with NO dark handling — they gain it for
 *   free the moment they read from here:
 *     unit-details.css (13 KB) · sales-inventory.css (12 KB)
 *     contract-delivery-terms.css (9 KB)
 *   Then the sheets that already carry a local variable layer: re-point
 *   their definitions at these tokens (a small diff at the top of each
 *   file, not a rewrite) so one role is one colour everywhere:
 *     sales-projects.css · construction-tracking.css · project-360.css
 *     workforce.css · payroll.css · navigation.css · assistant.css
 *
 * ─────────────────────────────────────────────────────────────────────
 * THE CONTRAST GUARANTEE
 *
 * Every pairing below is measured, in BOTH themes, by
 * tests/Feature/Design/DesignTokenContrastTest.php — which parses THIS
 * file, so the numbers cannot drift away from the values. Text pairings
 * meet WCAG 2.1 AA (4.5:1); control boundaries meet 1.4.11 (3:1).
 *
 * There is deliberately NO "faint ink" token. The greys the sheets used
 * for de-emphasised text — #9ca3af at 2.5:1, #7c8c9c at 3.4:1 — cannot
 * pass as text at any size. De-emphasis is `--ho-ink-muted`; anything
 * lighter is a LINE, not a word.
 */

:root {
    --ho-handover-action-fill: #f5c400;
    --ho-handover-action-ink: #1a1d24;
    /* Shared unit-map roles: occupancy remains separate from handover readiness. */
    --ho-unit-reserved-fill: #f5c400;
    --ho-unit-reserved-ink:  #3d2f00;
    --ho-unit-verify-fill:   #eeebfd;
    --ho-unit-verify-ink:    #5546c9;
    --ho-unit-verify-line:   #cfc8f7;
    --ho-unit-unready-fill:  #d9dce2;
    /* ── Surfaces ──────────────────────────────────────────────────
       sunken = the page behind everything · surface = a card sitting
       on it · raised = a modal, popover or drawer above both. */
    --ho-surface:            #ffffff;
    --ho-surface-sunken:     #f9fafb;
    --ho-surface-raised:     #ffffff;
    /* inset = a tint ON a surface: a toggle's track, a segment control's
       well, a table's hover row. Screens were already painting gray-100 for
       this, and muted ink sat at 4.39:1 on it — so the token exists, and
       muted ink is measured against it. */
    --ho-surface-inset:      #f3f4f6;

    /* ── Ink ───────────────────────────────────────────────────────
       Two text inks, and only two. `ink` for anything a decision is
       made from — a figure, a name, a status. `ink-muted` for the
       supporting line beneath it — gray-500 nudged three units darker so
       it clears 4.5:1 on the inset tint too. Nothing lighter is a text
       colour. */
    --ho-ink:                #111827;   /* 17.74:1 on surface */
    --ho-ink-muted:          #68707d;   /*  5.00:1 on surface · 4.78 on sunken · 4.54 on inset */

    /* ── Lines ─────────────────────────────────────────────────────
       `line` separates content and carries no contrast duty. `line-
       strong` is the EDGE OF A CONTROL — an input, a checkbox, a
       button outline — and therefore must stay ≥3:1 (WCAG 1.4.11).
       The old #d1d5db sat at 1.47:1: an input nobody could find. */
    --ho-line:               #e5e7eb;
    --ho-line-strong:        #868e9c;   /*  3.30:1 on surface · 3.16 on sunken */

    /* ── Focus ─────────────────────────────────────────────────────
       Never remove the ring; recolour it with this. */
    --ho-focus:              #2563eb;   /*  5.17:1 on surface */

    /* ── Semantic: danger ──────────────────────────────────────────
       Overdue, breached, refused, failed. `ink` on a plain surface,
       `ink` on `soft` for a badge, `line` for the bar or border. */
    --ho-danger-ink:         #b91c1c;   /*  6.47:1 on surface · 5.91 on soft */
    --ho-danger-soft:        #fef2f2;
    --ho-danger-line:        #dc2626;

    /* ── Semantic: warning — due today, at risk, needs attention ── */
    --ho-warning-ink:        #92400e;   /*  7.09:1 on surface · 6.84 on soft */
    --ho-warning-soft:       #fffbeb;
    --ho-warning-line:       #d97706;

    /* ── Semantic: success — paid, delivered, on time, approved ─── */
    --ho-success-ink:        #15803d;   /*  5.02:1 on surface · 4.79 on soft */
    --ho-handover-final-ready-fill: #ccfbf1;
    --ho-handover-final-ready-ink: #115e59;
    --ho-success-soft:       #f0fdf4;
    --ho-success-line:       #16a34a;

    /* ── Semantic: info — scheduled, informational, in progress ─── */
    --ho-info-ink:           #1d4ed8;   /*  6.70:1 on surface · 6.16 on soft */
    --ho-info-soft:          #eff6ff;
    --ho-info-line:          #2563eb;

    /* ── Accent (brand) ────────────────────────────────────────────
       The HOMEi orange is #e97524. As TEXT it is 2.7:1 and fails, so
       the readable form of the brand colour is orange-700; keep the
       brand hex for logos and large fills only, never for words. */
    --ho-accent-ink:         #c2410c;   /*  5.18:1 on surface · 4.88 on soft */
    --ho-accent-soft:        #fff7ed;
    --ho-accent-line:        #ea580c;
}

/*
 * Dark theme. Values are CHOSEN, not inverted: inverting #b91c1c gives
 * an unreadable red on a near-black ground. Each one is measured
 * against the dark surfaces by the same test that measures the light
 * ones, so a sheet built on tokens flips correctly with no work.
 *
 * The surfaces are Filament's own dark greys — zinc-950 for the page,
 * zinc-900 for a card, zinc-800 for what floats above — because that is
 * the chrome every screen sits inside. A token layer whose "sunken" was
 * lighter than the body Filament paints would have inverted the very
 * hierarchy it names.
 */
.dark {
    --ho-unit-reserved-fill: #f5c400;
    --ho-unit-reserved-ink:  #3d2f00;
    --ho-unit-verify-fill:   #262046;
    --ho-unit-verify-ink:    #b3a8f7;
    --ho-unit-verify-line:   #463c74;
    --ho-unit-unready-fill:  #3f3f47;
    --ho-surface:            #18181b;   /* zinc-900 */
    --ho-surface-sunken:     #09090b;   /* zinc-950 — Filament's body */
    --ho-surface-raised:     #27272a;   /* zinc-800 */
    --ho-surface-inset:      #202023;

    --ho-ink:                #f4f4f5;   /* 16.12:1 on surface */
    --ho-ink-muted:          #a1a1aa;   /*  6.91:1 on surface · 7.76 on sunken · 6.34 on inset */

    --ho-line:               #34343a;
    --ho-line-strong:        #71717a;   /*  3.67:1 on surface · 4.12 on sunken */

    --ho-focus:              #60a5fa;   /*  6.97:1 on surface */

    --ho-danger-ink:         #f87171;   /*  6.40:1 on surface · 5.57 on soft */
    --ho-danger-soft:        #3a1c1c;
    --ho-danger-line:        #f87171;

    --ho-warning-ink:        #fbbf24;   /* 10.61:1 on surface · 7.96 on soft */
    --ho-warning-soft:       #3a2e14;
    --ho-warning-line:       #fbbf24;

    --ho-success-ink:        #4ade80;   /* 10.17:1 on surface · 8.19 on soft */
    --ho-handover-final-ready-fill: #134e4a;
    --ho-handover-final-ready-ink: #99f6e4;
    --ho-success-soft:       #14301f;
    --ho-success-line:       #4ade80;

    --ho-info-ink:           #93c5fd;   /*  9.82:1 on surface · 8.21 on soft */
    --ho-info-soft:          #1c2742;
    --ho-info-line:          #60a5fa;

    --ho-accent-ink:         #fb923c;   /*  7.83:1 on surface · 6.61 on soft */
    --ho-accent-soft:        #38220f;
    --ho-accent-line:        #fb923c;
}
