/*
 * RepairSphere theme tokens: the one place a theme states its colours and type.
 *
 * Every other sheet reads these, directly or through the older names that alias them (--bs-paper, --bs-hi-vis,
 * --rag-green and the rest in app.css :root). A client theme that `extends: repairsphere` can rebrand most of the
 * app by redefining tokens in its own tokens sheet, without touching a component rule.
 *
 * Two kinds of token:
 *  - Brand tokens (--rs-accent, --rs-blue, --rs-red …) are the same in light and dark. They replaced colours that
 *    were written straight into rules, and they stay the same in both modes so the swap changed no pixel.
 *  - Surface and text tokens (--rs-paper, --rs-text, --rs-surface …) change with the mode. The dark values are in
 *    the block at the end.
 *
 * Each `-rgb` twin holds the same colour as bare channels, for translucent uses: rgba(var(--rs-accent-rgb), 0.18).
 * When you change a brand token, change its twin too.
 */

:root {
    /* ---- Brand (the same in both modes) ---- */
    --rs-accent: #00de91;               /* the signature hi-vis green: primary buttons, active nav, focus */
    --rs-accent-rgb: 0, 222, 145;
    --rs-accent-press: #00bd7b;         /* pressed/hover primary */
    /* --rs-accent-contrast: text on the accent (the primary button's label). Not set here, so it follows --bs-ink-2,
       which some scopes (the Workshop TV) change; a theme with a dark accent sets it, e.g. #fff. */
    --rs-accent-ink: #0a9d68;           /* a darker accent that still reads as text on white */
    --rs-blue: #02b3fe;                 /* the secondary-button blue */
    --rs-blue-rgb: 2, 179, 254;
    --rs-blue-action: #0071bc;          /* the action-button blue: white words on it are 5.1:1 (the brighter --rs-blue is 2.4:1) */
    --rs-blue-action-press: #005fa3;
    --rs-blue-action-rgb: 0, 113, 188;
    --rs-cyan: #00b3ff;                 /* the claim/hero cyan. Deliberately not --rs-blue: see the button-palette notes */
    --rs-cyan-rgb: 0, 179, 255;
    --rs-green: #1a7f3c;                /* good / done, as ink on a light surface */
    --rs-green-deep: #146c37;
    --rs-amber: #e8a400;                /* warning fill */
    --rs-amber-ink: #9a6700;            /* warning, as ink on a light surface */
    --rs-red: #b3261e;                  /* bad / overdue / destructive, as ink on a light surface */
    --rs-red-rgb: 179, 38, 30;

    /* ---- Workshop neutrals (the same in both modes) ---- */
    --rs-ink: #15171a;                  /* tyre black: backdrops, the always-dark hero card */
    --rs-ink-2: #0e0f11;                /* deepest */
    --rs-steel: #21252b;                /* raised panel on ink */
    --rs-steel-2: #2b3037;

    /* ---- Surfaces and text (change with the mode; light values here) ---- */
    --rs-paper: #fcfbf9;                /* cards and panels */
    --rs-table-scroll-cover: #fff;      /* the wide-table edge mask: must match the panel behind the table */
    --rs-line: #a9b1bc;                 /* hairlines */
    --rs-muted: #6b7280;
    --rs-text: #1d2126;
    --rs-hover-tint: #fafbfc;
    --rs-hover-lift: 0 6px 18px -10px rgba(16, 24, 40, 0.2);

    /* ---- Status (change with the mode) ---- */
    --rs-success: var(--rs-green);
    --rs-warning: var(--rs-amber);
    --rs-danger: var(--rs-red);
    --rs-due-amber: var(--rs-amber-ink); /* deadline 2-3 days out */
    --rs-due-red: var(--rs-red);         /* deadline today or overdue */
    --rs-success-subtle: #e9f6ee;        /* the success flash: wash, edge and ink (the same in both modes) */
    --rs-success-border: #b7e0c4;
    --rs-success-ink: var(--rs-green);

    /* ---- Sidebar (dark in both modes) ---- */
    --rs-sidebar-bg: #060a09;
    --rs-sidebar-accent: #1ee08f;
    --rs-sidebar-accent-rgb: 30, 224, 143;
    --rs-sidebar-cyan: #27e6e0;
    --rs-sidebar-text: #eef3f1;
    --rs-sidebar-faint: #7d8985;
    --rs-sidebar-line: rgba(255, 255, 255, 0.09);
    --rs-sidebar-gradient: linear-gradient(180deg, #040605, #070c0a);

    /* ---- Shape ----
       Every corner radius in the theme's sheets is calc(<its size> * var(--rs-radius-scale)): 0 gives square
       corners everywhere, 1.5 rounder ones. Pills (fully rounded ends) have their own token; circles (50%) stay round. */
    --rs-radius-scale: 1;
    --rs-radius-pill: 999px;
    /* Every pill, chip, badge and tag shares one shape (2026-11-14, public/mockups/pill-shapes.html option D):
       6px corners, and padding at 55% of each pill's own original amount (pill-padding.html option D).
       Fixed-height pills only lose it at the sides. --rs-radius-pill is now only for round controls
       (switch tracks, progress bars, search fields, segmented buttons), not labels. */
    --rs-pill-radius: calc(6px * var(--rs-radius-scale));
    --rs-pill-pad: 0.55;

    /* ---- Type ----
       DM Sans site-wide at a light weight. Display and mono go through the UI face, so sizes, case and spacing stay
       as designed. The number plate keeps its own face. */
    --rs-font-ui: 'DM Sans', 'Noto Sans Arabic', 'Noto Sans Devanagari', 'Noto Sans Malayalam', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --rs-font-display: var(--rs-font-ui);
    --rs-font-mono: var(--rs-font-ui);
    --rs-font-plate: 'Barlow Condensed';
    --rs-weight-body: 300;
    --rs-weight-heading: 400;

    /* ---- The pill family (badge-flag, status-pill, the ticker): one set of three per meaning: words, tint, edge. ---- */
    --pill-good: #146c37;    --pill-good-bg: #e3f4e9;    --pill-good-bd: #8ecaa1;     /* done, ok, authorised */
    --pill-wait: #8a5d00;    --pill-wait-bg: #fff4e0;    --pill-wait-bd: #efcf8c;     /* pending, due soon, credit, paused */
    --pill-bad: #b3261e;     --pill-bad-bg: #fdecec;     --pill-bad-bd: #f3b4b4;      /* overdue, declined, stopped */
    --pill-info: #064e73;    --pill-info-bg: #e1f1fc;    --pill-info-bd: #6fbde8;     /* in hand, ready */
    --pill-neutral: #4b5563; --pill-neutral-bg: #eef0f3; --pill-neutral-bd: #d7dbe0;  /* cancelled, plain */
    --pill-violet: #4a2f9e;  --pill-violet-bg: #ede7fb;  --pill-violet-bd: #c7b8ef;   /* a trade (rework) */
    --pill-pink: #8a1f5e;    --pill-pink-bg: #fde7f3;    --pill-pink-bd: #f0b3d6;     /* specialist repair */
    --pill-risk: #c2410c;    --pill-risk-bg: #fff0e5;    --pill-risk-bd: #fdba8c;     /* at risk: not late yet, but planned to be */
    --pill-risk-dot: #f97316;                                                            /* the same orange as a small solid mark */
}

/* Dark mode. The default theme's dark surfaces are true black (see the TRUE-BLACK block at the end of app.css). */
html[data-bs-theme="dark"] {
    --rs-paper: #000;
    --rs-table-scroll-cover: #000;
    --rs-line: #69737f;
    --rs-muted: #98a2b0;
    --rs-text: #e6e9ee;
    --rs-surface: #000;                 /* raised cards, panels, inputs (dark only: light rules use their own fallback) */
    --rs-surface-2: #000;               /* page background */
    --rs-surface-3: #23272e;            /* subtle fill: hovers, insets, chips */
    --rs-heading: #e9ecf1;              /* big figures that use --bs-ink as text in light mode */
    --rs-tile-hover: var(--rs-cyan);    /* clickable-tile hover edge */
    --rs-hover-tint: var(--rs-surface-3);
    --rs-hover-lift: 0 0 0 1px var(--rs-tile-hover);

    /* The light status inks are too dark to read here, so these are lifted. */
    --rs-success: #2ec77e;
    --rs-warning: #f0b429;
    --rs-danger: #f2685f;
    --rs-due-amber: #ffcf4d;
    --rs-due-red: #ff8a80;

    /* The pill tones on black: one bright hue each, the tint 14% of it on black, the edge 70% of it. */
    --pill-good: #3ddc97; --pill-wait: #ffb02e; --pill-bad: #ff6b63; --pill-info: #5fb4f0; --pill-neutral: #98a2b0; --pill-violet: #9b6dff; --pill-pink: #f27ac0;
    --pill-good-bg: color-mix(in srgb, var(--pill-good) 14%, #000);       --pill-good-bd: color-mix(in srgb, var(--pill-good) 70%, transparent);
    --pill-wait-bg: color-mix(in srgb, var(--pill-wait) 14%, #000);       --pill-wait-bd: color-mix(in srgb, var(--pill-wait) 70%, transparent);
    --pill-bad-bg: color-mix(in srgb, var(--pill-bad) 14%, #000);         --pill-bad-bd: color-mix(in srgb, var(--pill-bad) 70%, transparent);
    --pill-info-bg: color-mix(in srgb, var(--pill-info) 14%, #000);       --pill-info-bd: color-mix(in srgb, var(--pill-info) 70%, transparent);
    --pill-neutral-bg: color-mix(in srgb, var(--pill-neutral) 14%, #000); --pill-neutral-bd: color-mix(in srgb, var(--pill-neutral) 45%, transparent);
    --pill-violet-bg: color-mix(in srgb, var(--pill-violet) 14%, #000);   --pill-violet-bd: color-mix(in srgb, var(--pill-violet) 70%, transparent);
    --pill-pink-bg: color-mix(in srgb, var(--pill-pink) 14%, #000);       --pill-pink-bd: color-mix(in srgb, var(--pill-pink) 70%, transparent);
    --pill-risk: #ff8a3d; --pill-risk-dot: #ff8a3d;
    --pill-risk-bg: color-mix(in srgb, var(--pill-risk) 14%, #000);       --pill-risk-bd: color-mix(in srgb, var(--pill-risk) 70%, transparent);
}
