/* ClientPanel design tokens — single app-owned facade over DevExpress Fluent (--dxds-* on 25.2+, --DS-* on 25.1).
   App CSS references ONLY --cp-* (never raw DevExpress --DS-* / --dxds-* prefixes, nor hex). See docs/decisions/0008-design-system-cp-facade.md.
   Colour tokens verified against DevExpress.Blazor.Themes.Fluent 25.1 (modes/light.min.css). */

/* Project font: Inter, loaded via a Google Fonts <link> in App.razor. We override the DevExpress sans
   token below (this file loads after the theme, so :root wins), which flows the face to DevExpress
   controls, --cp-font-family-base and the Bootstrap bridge from one place. The system stack stays the
   fallback while the web font loads / if it fails. */

:root {
    /* Light unless the customer chose dark (the dark block below sets `dark`, ADR-0032). Never left
       undeclared: Chrome's Auto Dark Mode (force-dark) algorithmically inverts pages that do not declare
       a color-scheme, which mangled the app under OS/browser dark (dark-on-dark, unreadable text). */
    color-scheme: light;

    /* Project font override — feeds --cp-font-family-base (below) AND DevExpress controls, which read
       the DevExpress sans token directly. Change this one line to change the app-wide sans face. */
    --dxds-font-family-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --cp-font-family-base: var(--dxds-font-family-sans-serif, var(--DS-font-family-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif));
    --cp-font-family-mono:  var(--dxds-font-family-mono,       var(--DS-font-family-mono,       ui-monospace, SFMono-Regular, Menlo, monospace));

    /* colour — dual fallback: 25.2+ (--dxds-*) -> 25.1 (--DS-*) -> literal. Names verified present in Fluent 25.1. */
    --cp-color-primary:       var(--dxds-color-content-primary-default-rest, var(--DS-color-content-primary-default-rest, #1a5fb4));
    /* Alpha 09/255 matches the subtle primary tint used on the page background. */
    --cp-color-page-bg:       color-mix(in srgb, var(--cp-color-primary) 3%, transparent);
    /* The same tint pre-composited onto the surface, for anything that must look like the page AND
       hide what scrolls beneath it (pinned bars). page-bg itself is translucent and would let the
       content show through. */
    --cp-color-page-bg-solid: color-mix(in srgb, var(--cp-color-primary) 3%, var(--cp-color-surface));
    --cp-color-content:       var(--dxds-color-content-neutral-default-rest, var(--DS-color-content-neutral-default-rest, #1d1d1d));
    /* The text colour of the page surface, kept apart from --cp-color-content, which a filled panel
       (EmphasisPanel) re-points at its own on-colour. Anything that floats ON the page surface from
       inside such a panel - a hint, a popover - reads this one, so it is never white on white. */
    --cp-color-content-on-surface: var(--dxds-color-content-neutral-default-rest, var(--DS-color-content-neutral-default-rest, #1d1d1d));
    /* '-subdued-rest' (opaque, mode-aware) is the secondary-text colour. NOT '-muted-rest', which is a
       transparent blend token (rgb(... / 0)) and would render text invisible. */
    --cp-color-content-muted: var(--dxds-color-content-neutral-subdued-rest, var(--DS-color-content-neutral-subdued-rest, #5f5f5f));
    --cp-color-surface:       var(--dxds-color-surface-neutral-default-rest, var(--DS-color-surface-neutral-default-rest, #ffffff));
    --cp-color-border:        var(--dxds-color-border-neutral-default-rest,  var(--DS-color-border-neutral-default-rest,  #d7d7d7));
    --cp-color-danger:        var(--dxds-color-content-danger-default-rest,  var(--DS-color-content-danger-default-rest,  #b3261e));
    --cp-color-success:       var(--dxds-color-content-success-default-rest, var(--DS-color-content-success-default-rest, #1e7d34));
    /* Warning TEXT and icons. Not the theme's content-warning token: with the ramp below remapped to
       yellow, that resolves to the yellow itself (#eab308, ~1.9:1 on white) — unreadable. Step 120 of
       the same ramp is the yellow darkened to #8c6b05: ~5:1 on white, ~4.6:1 on the warning tint, so it
       passes WCAG AA on both surfaces it is written on. A yellow FILL (a bar, a dot, an accent border)
       uses --cp-warning-base instead. */
    --cp-color-warning:       var(--dxds-warning-120, #8c6b05);
    --cp-color-info:          var(--dxds-color-content-info-default-rest,    var(--DS-color-content-info-default-rest,    #185fa5));
    /* text/icon on a primary-filled surface (e.g. the step-dot number); white in the Fluent light theme. */
    --cp-color-on-primary:    #ffffff;
    /* a muted panel surface — a hair off the base surface (part-preview bands, hover fills, subtle panels). */
    --cp-color-surface-muted: var(--dxds-color-surface-neutral-subdued-rest, var(--DS-color-surface-neutral-subdued-rest, #f1f3f5));
    /* the same surface one step down — the fill DevExpress paints on its own subdued surfaces when the
       pointer is over them. For an app-built panel that behaves like a control (the delivery option
       tiles): it darkens the way a DevExpress button does, rather than growing a border or a shadow. */
    --cp-color-surface-muted-hover: var(--dxds-color-surface-neutral-subdued-hover, var(--DS-color-surface-neutral-subdued-hover, #e2e6ea));
    /* the veil behind a sheet or popup — translucent black in both modes, as DevExpress's own popups
       dim the page; never a content colour, which turns pale in dark mode. */
    --cp-color-backdrop: var(--dxds-color-surface-backdrop-default-rest, var(--DS-color-surface-backdrop-default-rest, rgba(0, 0, 0, 0.4)));
    /* the same veil, frosted: thinned, with the page blurred behind it (--cp-backdrop-blur) — plainly not
       usable while a popup or the loading overlay is up, plainly still there. Every modal popup and the
       loading overlay use this pair, so they read as one layer. */
    --cp-color-backdrop-frosted: color-mix(in srgb, var(--cp-color-backdrop) 45%, transparent);
    --cp-backdrop-blur: 3px;

    /* semantic surface backgrounds (role) */
    /* each role: the ramp's '-10' tint, and its '-subtle' twin — the same tint at 40% opacity. A var()
       cannot take a hex alpha suffix, so color-mix applies it. */
    --cp-color-surface-primary:        var(--dxds-primary-10, var(--DS-primary-10, #cfe2ff));
    --cp-color-surface-primary-subtle: color-mix(in srgb, var(--cp-color-surface-primary) 35%, transparent);
    --cp-color-surface-danger:         var(--dxds-danger-10,  var(--DS-danger-10,  #f8d7da));
    --cp-color-surface-danger-subtle:  color-mix(in srgb, var(--cp-color-surface-danger) 35%, transparent);
    --cp-color-surface-warning:        var(--dxds-warning-10, var(--DS-warning-10, #fff3cd));
    --cp-color-surface-warning-subtle: color-mix(in srgb, var(--cp-color-surface-warning) 35%, transparent);
    --cp-color-surface-info:           var(--dxds-info-10,    var(--DS-info-10,    #cff4fc));
    --cp-color-surface-info-subtle:    color-mix(in srgb, var(--cp-color-surface-info) 35%, transparent);
    --cp-color-surface-success:        var(--dxds-success-10, var(--DS-success-10, #d1e7dd));
    --cp-color-surface-success-subtle: color-mix(in srgb, var(--cp-color-surface-success) 35%, transparent);

    /* the steps between warning and danger for an ageing scale (SegmentedMeter tones Caution1 / Caution2).
       --cp-warning-base lives in the second :root block below; custom properties resolve at use time. */
    --cp-color-meter-caution-1: color-mix(in srgb, var(--cp-warning-base) 62%, var(--cp-color-danger));
    --cp-color-meter-caution-2: color-mix(in srgb, var(--cp-warning-base) 30%, var(--cp-color-danger));

    /* Role subtle/emphasis palette for chips / pills / badges: a light tint background (the DevExpress
       '-10' shade), a readable role text colour and a light border. Sourced from DevExpress (--dxds-*)
       with a literal fallback — no --bs-* here — so components consume only these --cp-* names (see Pill).
       fg reuses --cp-color-{role}, which is itself a --dxds- content colour. */
    --cp-role-neutral-bg: var(--dxds-neutral-10, #e9ecef); --cp-role-neutral-fg: var(--cp-color-content-muted); --cp-role-neutral-border: var(--cp-color-border);
    --cp-role-primary-bg: var(--dxds-primary-10, #cfe2ff); --cp-role-primary-fg: var(--cp-color-primary);        --cp-role-primary-border: var(--dxds-primary-30, #9ec5fe);
    --cp-role-success-bg: var(--dxds-success-10, #d1e7dd); --cp-role-success-fg: var(--cp-color-success);        --cp-role-success-border: var(--dxds-success-30, #a3cfbb);
    --cp-role-warning-bg: var(--dxds-warning-10, #fff3cd); --cp-role-warning-fg: var(--cp-color-warning);        --cp-role-warning-border: var(--dxds-warning-30, #ffe69c);
    --cp-role-danger-bg:  var(--dxds-danger-10, #f8d7da);  --cp-role-danger-fg:  var(--cp-color-danger);         --cp-role-danger-border:  var(--dxds-danger-30, #f1aeb5);
    --cp-role-info-bg:    var(--dxds-info-10, #cff4fc);    --cp-role-info-fg:    var(--cp-color-info);           --cp-role-info-border:    var(--dxds-info-30, #9eeaf9);

    /* spacing — literals: DevExpress 25.1 exposes no --DS-spacing-* scale, and spacing is not mode-dependent. */
    --cp-space-1: 0.25rem;
    --cp-space-2: 0.5rem;
    --cp-space-3: 0.75rem;
    --cp-space-4: 1rem;
    --cp-space-5: var(--dxds-sizing-200, var(--DS-sizing-200, 1.25rem));
    --cp-space-6: 1.5rem;
    /* Section-scale steps. The rungs above 1.5rem are what separate whole sections of a page rather
       than elements within one, and the jumps widen accordingly — a scale that kept climbing in
       quarter-rems would be a list of every value anyone ever typed, which is the thing it exists to
       stop. A measurement that falls between two rungs belongs on the nearer one. */
    --cp-space-7: 2rem;
    --cp-space-8: 2.5rem;
    --cp-space-9: 3rem;
    --cp-space-10: 4rem;
    --cp-space-11: 5rem;
    --cp-space-12: 6rem;

    /* page shell — the one place the app's content width lives. Every page-level container (MainLayout
       .app-content, the page heading) reads these, so pages carry no width of their own and every
       screen lines up. The window itself scrolls, so the scrollbar sits at its edge. Literals: this is
       app layout, not a DevExpress concern. */
    --cp-content-max: 1640px;
    --cp-content-gutter: 1.5rem;

    /* radius — track DevExpress control radius where available. */
    --cp-radius-xsm: var(--dxds-border-radius-60,  var(--DS-border-radius-60,  0.25rem));
    --cp-radius-sm: var(--dxds-border-radius-80,  var(--DS-border-radius-80,  0.375rem));
    --cp-radius:    var(--dxds-border-radius-120,  var(--DS-border-radius-120,  0.5rem));
    --cp-radius-lg: var(--dxds-border-radius-160, var(--DS-border-radius-160, var(--bs-border-radius-lg, 0.75rem)));

    /* Shared control geometry for editors, buttons and navigation. Component tokens consume
       this scale; control tokens never depend on a component-specific token. */
    --cp-control-radius:       var(--cp-radius-sm);
    --cp-control-border-width: var(--dxds-border-width-10,  var(--DS-border-width-10,  0.0625rem));
    --cp-control-border:       color-mix(in srgb, var(--cp-color-border) 75%, var(--cp-control-bg));
    /* Shared Small / Medium / Large scale: 28/32/36px, with matching text metrics.
       Derive padding from the target height so borders never add an extra pixel to the scale. */
    --cp-control-height-sm:    1.75rem;
    --cp-control-height:       2rem;
    --cp-control-height-lg:    2.25rem;
    --cp-control-font-size-sm: 0.75rem;
    --cp-control-font-size:    0.8125rem;
    --cp-control-font-size-lg: 0.875rem;
    --cp-control-line-height-sm: 1rem;
    --cp-control-line-height:    1.125rem;
    --cp-control-line-height-lg: 1.25rem;
    --cp-control-padding-y-sm: calc((var(--cp-control-height-sm) - var(--cp-control-line-height-sm)) / 2 - var(--cp-control-border-width));
    --cp-control-padding-y:    calc((var(--cp-control-height) - var(--cp-control-line-height)) / 2 - var(--cp-control-border-width));
    --cp-control-padding-y-lg: calc((var(--cp-control-height-lg) - var(--cp-control-line-height-lg)) / 2 - var(--cp-control-border-width));
    --cp-control-padding-x-sm: var(--cp-space-3);
    --cp-control-padding-x:    0.875rem;
    --cp-control-padding-x-lg: var(--cp-space-4);
    --cp-control-touch-target: 2.75rem;
    --cp-control-focus-color:  var(--cp-color-primary);
    --cp-control-focus-bg:     color-mix(in srgb, var(--cp-color-surface-primary) 45%, var(--cp-control-bg));
    --cp-control-focus-border: color-mix(in srgb, var(--cp-control-focus-color) 65%, var(--cp-control-border));
    /* Total focused edge = the resting border plus an inset line; no outer halo or layout shift. */
    --cp-control-focus-size:   calc(var(--cp-control-border-width) * 2);
    --cp-control-focus-shadow: inset 0 0 0 calc(var(--cp-control-focus-size) - var(--cp-control-border-width)) var(--cp-control-focus-border);
    --cp-control-selection-bg: var(--cp-color-surface-primary);
    --cp-control-selection-color: var(--cp-color-primary);
    --cp-control-selection-hover-bg: color-mix(in srgb, var(--cp-color-primary) 8%, var(--cp-control-selection-bg));
    /* every dropdown window - an editor's list or calendar, the bar's menus, the quote panels - one shell:
       a lifted sheet (radius-lg, shadow-3) with no edge of its own - the shadow lifts it, as it lifts the phone's
       menu and the dialogs - and a tight inset (cp-devexpress.css). The edge's colour stays for what draws one. */
    --cp-dropdown-radius:      var(--cp-radius-lg);
    --cp-dropdown-border-width: 0;
    --cp-dropdown-border:      var(--cp-color-border);
    --cp-dropdown-bg:          var(--cp-color-surface);
    --cp-dropdown-shadow:      var(--cp-shadow-3);
    --cp-dropdown-padding:     var(--cp-space-1);
    --cp-control-transition:   140ms ease;
    --cp-control-bg:           var(--dxds-color-surface-neutral-default-rest, var(--DS-color-surface-neutral-default-rest, #ffffff));
    --cp-control-placeholder:  var(--dxds-color-content-neutral-deep-rest, var(--DS-color-content-neutral-deep-rest, #616161));
    /* Retain the underline API for consumers, but make the resting border uniform on all sides. */
    --cp-control-underline:            var(--cp-control-border);
    --cp-control-underline-hover:      var(--cp-control-border-hover);
    --cp-control-underline-focus:      var(--cp-control-focus-color);
    --cp-control-underline-focus-size: var(--cp-control-border-width);
    --cp-control-border-hover:         var(--dxds-color-border-neutral-default-hovered,  var(--DS-color-border-neutral-default-hovered,  #c7c7c7));
    --cp-control-border-disabled:      var(--dxds-color-border-neutral-default-disabled, var(--DS-color-border-neutral-default-disabled, #ebebeb));
    --cp-control-content-disabled:     var(--dxds-color-content-neutral-default-disabled, var(--DS-color-content-neutral-default-disabled, #bdbdbd));

    /* Balanced button scale: 28/32/36px at the default root size, shared with one-line editors above.
       Filled primary uses the theme's surface colour, not its content colour: dark mode
       deliberately gives those different lightness. */
    --cp-button-radius:           var(--cp-control-radius);
    --cp-button-height-sm:        var(--cp-control-height-sm);
    --cp-button-height:           var(--cp-control-height);
    --cp-button-height-lg:        var(--cp-control-height-lg);
    --cp-button-font-size-sm:     var(--cp-control-font-size-sm);
    --cp-button-font-size:        var(--cp-control-font-size);
    --cp-button-font-size-lg:     var(--cp-control-font-size-lg);
    --cp-button-line-height-sm:   var(--cp-control-line-height-sm);
    --cp-button-line-height:      var(--cp-control-line-height);
    --cp-button-line-height-lg:   var(--cp-control-line-height-lg);
    --cp-button-font-weight:      var(--cp-text-button-weight);
    --cp-button-padding-x-sm:     var(--cp-control-padding-x-sm);
    --cp-button-padding-x:        var(--cp-control-padding-x);
    --cp-button-padding-x-lg:     var(--cp-control-padding-x-lg);
    --cp-button-padding-y-sm:     var(--cp-control-padding-y-sm);
    --cp-button-padding-y:        var(--cp-control-padding-y);
    --cp-button-padding-y-lg:     var(--cp-control-padding-y-lg);
    --cp-button-caption-padding:  0;
    --cp-button-primary-bg:       var(--dxds-color-surface-primary-default-rest, var(--DS-color-surface-primary-default-rest, #0f6cbd));
    --cp-button-primary-fg:       var(--cp-color-on-primary);
    --cp-button-primary-hover-bg: color-mix(in srgb, var(--cp-button-primary-bg) 88%, black);
    --cp-button-primary-active-bg:color-mix(in srgb, var(--cp-button-primary-bg) 80%, black);
    --cp-button-secondary-bg:     var(--cp-color-surface);
    --cp-button-secondary-fg:     var(--cp-color-content);
    --cp-button-secondary-hover-bg: var(--cp-color-surface-muted);
    --cp-button-secondary-active-bg: var(--cp-color-surface-muted-hover);

    /* Passive pills have their own geometry. Text blends towards content for a calmer, darker
       label in light mode and a lighter label in dark mode; icons keep the original role tone. */
    --cp-pill-radius: 999px;
    --cp-pill-border-width: 1px;
    --cp-pill-gap: var(--cp-space-2);
    --cp-pill-line-height: 1rem;
    --cp-pill-font-weight: var(--cp-text-button-weight);
    --cp-pill-icon-size: .9em;
    --cp-pill-text-tone: 60%;
    --cp-pill-border-tone: 28%;
    --cp-pill-neutral-bg: var(--cp-color-surface-muted);
    --cp-pill-font-size-xs: var(--cp-text-caption-size);
    --cp-pill-font-size-sm: var(--cp-text-body2-size);
    --cp-pill-font-size-md: var(--cp-text-body2-size);
    --cp-pill-font-size-lg: var(--cp-text-body1-size);
    --cp-pill-font-size-xl: 1rem;
    --cp-pill-padding-y-xs: .125rem;
    --cp-pill-padding-y-sm: var(--cp-space-1);
    --cp-pill-padding-y-md: .375rem;
    --cp-pill-padding-y-lg: var(--cp-space-2);
    --cp-pill-padding-y-xl: .625rem;
    --cp-pill-padding-x-xs: var(--cp-space-2);
    --cp-pill-padding-x-sm: var(--cp-space-3);
    --cp-pill-padding-x-md: var(--cp-space-3);
    --cp-pill-padding-x-lg: var(--cp-space-4);
    --cp-pill-padding-x-xl: var(--cp-space-4);

    /* App-owned elevation: a contact shadow plus a softer ambient shadow (ADR-0029).
       1: subtle lift; 2: floating controls and navigation; 3: elevated panels and sheets.
       Negative spread keeps the larger shadows from forming a grey rim. */
    --cp-shadow-1: 0 1px 2px rgb(0 0 0 / 4%), 0 2px 6px rgb(0 0 0 / 3%);
    --cp-shadow-2: 0 2px 4px rgb(0 0 0 / 4%), 0 6px 16px -4px rgb(0 0 0 / 10%);
    --cp-shadow-3: 0 4px 8px rgb(0 0 0 / 5%), 0 16px 36px -8px rgb(0 0 0 / 16%);

    /* typography scale (rem; confirmed 2026-07-24). */
    --cp-text-h1-size: 3rem;      --cp-text-h1-weight: 700;  --cp-text-h1-line: 1.05;  --cp-text-h1-tracking: -0.02em;
    --cp-text-h2-size: 2.25rem;   --cp-text-h2-weight: 700;  --cp-text-h2-line: 1.1;   --cp-text-h2-tracking: -0.015em;
    --cp-text-h3-size: 1.875rem;  --cp-text-h3-weight: 600;  --cp-text-h3-line: 1.1;  --cp-text-h3-tracking: -0.01em;
    --cp-text-h4-size: 1.5rem;    --cp-text-h4-weight: 600;  --cp-text-h4-line: 1.15;   --cp-text-h4-tracking: -0.005em;
    --cp-text-h5-size: 1.25rem;   --cp-text-h5-weight: 600;  --cp-text-h5-line: 1.15;   --cp-text-h5-tracking: 0;
    --cp-text-h6-size: 1.125rem;  --cp-text-h6-weight: 600;  --cp-text-h6-line: 1.15;  --cp-text-h6-tracking: 0;
    --cp-text-subtitle1-size: 0.9rem;     --cp-text-subtitle1-weight: 600; --cp-text-subtitle1-line: 1.2;  --cp-text-subtitle1-tracking: 0.009em;
    --cp-text-subtitle2-size: 0.825rem; --cp-text-subtitle2-weight: 600; --cp-text-subtitle2-line: 1.2;  --cp-text-subtitle2-tracking: 0.007em;
    --cp-text-body1-size: .9rem;     --cp-text-body1-weight: 500; --cp-text-body1-line: 1.3;   --cp-text-body1-tracking: 0.009em;
    --cp-text-body2-size: 0.825rem; --cp-text-body2-weight: 400; --cp-text-body2-line: 1.3;  --cp-text-body2-tracking: 0.011em;
    --cp-text-button-size: 0.825rem;  --cp-text-button-weight: 500;  --cp-text-button-line: 1.4; --cp-text-button-tracking: 0.02em;
    --cp-text-caption-size: 0.75rem;  --cp-text-caption-weight: 400;  --cp-text-caption-line: 1.3; --cp-text-caption-tracking: 0.03em;
    --cp-text-overline-size: 0.75rem; --cp-text-overline-weight: 600; --cp-text-overline-line: 1.5; --cp-text-overline-tracking: 0.08em;

}

/* Dark mode (ADR-0032), chosen by the customer (ThemeSwitch) and set on <html> by App.razor / theme.js — the same
   explicit attributes, never the operating system preference.

   Elevation: none. On a dark page a shadow reads as a muddy halo rather than a lift, so surfaces are told
   apart by their fill and their border instead. DevExpress derives every popup, dropdown, flyout, toast
   and loading-panel shadow from its --dxds-box-shadow-* scale, so zeroing that scale here takes theirs
   out with ours.

   Tints: the '-10' ramp steps the light tints come from are absolute colours — DevExpress does not move
   them for dark mode — so a light pastel would sit on the dark surface. In dark every tint is instead the
   role colour mixed into the surface: a deep wash the role's (lighter, in dark) text reads well on. */
:root[data-bs-theme="dark"],
:root[data-fluent-darkmode] {
    color-scheme: dark;

    --cp-shadow-1: none;
    --cp-shadow-2: none;
    --cp-shadow-3: none;
    --dxds-box-shadow-xs: none;
    --dxds-box-shadow-sm: none;
    --dxds-box-shadow-md: none;
    --dxds-box-shadow-lg: none;
    --dxds-box-shadow-xl: none;
    --dxds-box-shadow-2xl: none;

    /* DevExpress names its hover step '-hovered'; the light value above asks for '-hover', which does
       not exist, and falls through to its light-grey literal — a pale band across every dark list. */
    --cp-color-surface-muted-hover: var(--dxds-color-surface-neutral-subdued-hovered, var(--DS-color-surface-neutral-subdued-hovered, #3d3d3d));

    /* Warning text: the darkened ramp step 120 that light mode needs is too dim on dark; the yellow
       itself reads well here. */
    --cp-color-warning: var(--cp-warning-base);

    --cp-color-surface-primary: color-mix(in srgb, var(--cp-color-primary) 22%, var(--cp-color-surface));
    --cp-color-surface-danger:  color-mix(in srgb, var(--cp-color-danger) 22%, var(--cp-color-surface));
    --cp-color-surface-warning: color-mix(in srgb, var(--cp-warning-base) 18%, var(--cp-color-surface));
    --cp-color-surface-info:    color-mix(in srgb, var(--cp-color-info) 22%, var(--cp-color-surface));
    --cp-color-surface-success: color-mix(in srgb, var(--cp-color-success) 22%, var(--cp-color-surface));

    --cp-role-neutral-bg: var(--cp-color-surface-muted);
    --cp-role-primary-bg: color-mix(in srgb, var(--cp-color-primary) 18%, var(--cp-color-surface));
    --cp-role-success-bg: color-mix(in srgb, var(--cp-color-success) 18%, var(--cp-color-surface));
    --cp-role-warning-bg: color-mix(in srgb, var(--cp-warning-base) 16%, var(--cp-color-surface));
    --cp-role-danger-bg:  color-mix(in srgb, var(--cp-color-danger) 18%, var(--cp-color-surface));
    --cp-role-info-bg:    color-mix(in srgb, var(--cp-color-info) 18%, var(--cp-color-surface));

    --cp-role-primary-border: color-mix(in srgb, var(--cp-color-primary) 45%, var(--cp-color-surface));
    --cp-role-success-border: color-mix(in srgb, var(--cp-color-success) 45%, var(--cp-color-surface));
    --cp-role-warning-border: color-mix(in srgb, var(--cp-warning-base) 45%, var(--cp-color-surface));
    --cp-role-danger-border:  color-mix(in srgb, var(--cp-color-danger) 45%, var(--cp-color-surface));
    --cp-role-info-border:    color-mix(in srgb, var(--cp-color-info) 45%, var(--cp-color-surface));
}

/* No colour on the base: Color=Inherit (default) must inherit the parent colour; .cp-text--default sets content colour explicitly. */
.cp-text { margin: 0; font-family: var(--cp-font-family-base); }

.cp-text-h1 { font-size: var(--cp-text-h1-size); font-weight: var(--cp-text-h1-weight); line-height: var(--cp-text-h1-line); letter-spacing: var(--cp-text-h1-tracking); }
.cp-text-h2 { font-size: var(--cp-text-h2-size); font-weight: var(--cp-text-h2-weight); line-height: var(--cp-text-h2-line); letter-spacing: var(--cp-text-h2-tracking); }
.cp-text-h3 { font-size: var(--cp-text-h3-size); font-weight: var(--cp-text-h3-weight); line-height: var(--cp-text-h3-line); letter-spacing: var(--cp-text-h3-tracking); }
.cp-text-h4 { font-size: var(--cp-text-h4-size); font-weight: var(--cp-text-h4-weight); line-height: var(--cp-text-h4-line); letter-spacing: var(--cp-text-h4-tracking); }
.cp-text-h5 { font-size: var(--cp-text-h5-size); font-weight: var(--cp-text-h5-weight); line-height: var(--cp-text-h5-line); letter-spacing: var(--cp-text-h5-tracking); }
.cp-text-h6 { font-size: var(--cp-text-h6-size); font-weight: var(--cp-text-h6-weight); line-height: var(--cp-text-h6-line); letter-spacing: var(--cp-text-h6-tracking); }
.cp-text-subtitle1 { font-size: var(--cp-text-subtitle1-size); font-weight: var(--cp-text-subtitle1-weight); line-height: var(--cp-text-subtitle1-line); letter-spacing: var(--cp-text-subtitle1-tracking); }
.cp-text-subtitle2 { font-size: var(--cp-text-subtitle2-size); font-weight: var(--cp-text-subtitle2-weight); line-height: var(--cp-text-subtitle2-line); letter-spacing: var(--cp-text-subtitle2-tracking); }
.cp-text-body1 { font-size: var(--cp-text-body1-size); font-weight: var(--cp-text-body1-weight); line-height: var(--cp-text-body1-line); letter-spacing: var(--cp-text-body1-tracking); }
.cp-text-body2 { font-size: var(--cp-text-body2-size); font-weight: var(--cp-text-body2-weight); line-height: var(--cp-text-body2-line); letter-spacing: var(--cp-text-body2-tracking); }
.cp-text-button { font-size: var(--cp-text-button-size); font-weight: var(--cp-text-button-weight); line-height: var(--cp-text-button-line); letter-spacing: var(--cp-text-button-tracking); }
.cp-text-caption { font-size: var(--cp-text-caption-size); font-weight: var(--cp-text-caption-weight); line-height: var(--cp-text-caption-line); letter-spacing: var(--cp-text-caption-tracking); }
.cp-text-overline { font-size: var(--cp-text-overline-size); font-weight: var(--cp-text-overline-weight); line-height: var(--cp-text-overline-line); letter-spacing: var(--cp-text-overline-tracking); text-transform: uppercase; }

.cp-text--default { color: var(--cp-color-content); }
.cp-text--muted   { color: var(--cp-color-content-muted); }
.cp-text--primary { color: var(--cp-color-primary); }
.cp-text--danger  { color: var(--cp-color-danger); }
.cp-text--success { color: var(--cp-color-success); }
.cp-text--warning { color: var(--cp-color-warning); }

/* Meter fills (MeterTone) — global, because SegmentedMeter and MeterLegendRow both paint them and
   scoped CSS cannot be shared between components. Warning is the yellow fill, not the warning text colour. */
.cp-meter-tone--success   { background-color: var(--cp-color-success); }
.cp-meter-tone--warning   { background-color: var(--cp-warning-base); }
.cp-meter-tone--primary   { background-color: var(--cp-color-primary); }
.cp-meter-tone--danger    { background-color: var(--cp-color-danger); }
.cp-meter-tone--caution-1 { background-color: var(--cp-color-meter-caution-1); }
.cp-meter-tone--caution-2 { background-color: var(--cp-color-meter-caution-2); }
.cp-meter-tone--neutral   { background-color: var(--cp-color-border); }

.cp-text--align-start   { text-align: start; }
.cp-text--align-center  { text-align: center; }
.cp-text--align-end     { text-align: end; }
.cp-text--align-justify { text-align: justify; }

.cp-text--gutter { margin-bottom: var(--cp-space-3); }

/* Bootstrap bridge — Bootstrap's colour / type / radius variables read from the --cp-* facade so
   utilities and components match the design system. Loaded after bootstrap.css, so these :root
   overrides win. rgb-triplet utilities (.bg-primary, .btn-primary) keep Bootstrap defaults —
   var() cannot emit an rgb triplet, and the app uses DevExpress controls for those. The role
   subtle/emphasis variants are surfaced as --cp-role-* tokens above (sourced from DevExpress shades)
   so components like Pill consume the --cp-* facade too. */
:root {
    --bs-body-bg: var(--cp-color-surface);
    --bs-body-color: var(--cp-color-content);
    --bs-secondary-color: var(--cp-color-content-muted);
    --bs-border-color: var(--cp-color-border);
    --bs-link-color: var(--cp-color-primary);
    --bs-link-hover-color: var(--cp-color-primary);
    --bs-primary: var(--cp-color-primary);
    --bs-danger: var(--cp-color-danger);
    --bs-success: var(--cp-color-success);
    --bs-warning: var(--cp-color-warning);
    --bs-info: var(--cp-color-info);
    --bs-border-radius: var(--cp-radius);
    --bs-border-radius-sm: var(--cp-radius-sm);
    --bs-body-font-family: var(--cp-font-family-base);
    --bs-body-font-size: 1rem;
}

/* 100% (not a fixed px) so rem honours the user's browser font-size / zoom preference. */
/*html { font-size: 87.5%; }*/
html { font-size: 100%; }

/* ── Warning hue remap: orange -> yellow ─────────────────────────────────────────
   DevExpress derives EVERY warning token from the --dxds-warning-{10..170} ramp: the semantic
   surface/content/border-warning tokens are var(--dxds-warning-N) (themes.fluent modes/light.min.css),
   and our --cp-color-warning / --cp-role-warning-* / --bs-warning chain off those. So redefining the
   ramp here — cp-tokens.css loads AFTER the theme, so this :root wins — retints warning EVERYWHERE
   (DevExpress controls included) from one base. The 17 stops are generated from a single base via
   color-mix, matching the stock ramp's light->dark shape (10 = lightest tint, 90 = the main colour
   used by *-default-rest, 170 = darkest). Change --cp-warning-base alone to shift the whole hue.
   NOTE: applies to both colour modes; the theme maps dark to different ramp stops, so revisit
   per-mode when real dark support lands. */
:root {
    --cp-warning-base: #eab308;   /* the single knob — warning yellow (was DevExpress orange #f7630c) */

    --dxds-warning-10:  color-mix(in srgb, var(--cp-warning-base) 12%, white);
    --dxds-warning-20:  color-mix(in srgb, var(--cp-warning-base) 22%, white);
    --dxds-warning-30:  color-mix(in srgb, var(--cp-warning-base) 33%, white);
    --dxds-warning-40:  color-mix(in srgb, var(--cp-warning-base) 46%, white);
    --dxds-warning-50:  color-mix(in srgb, var(--cp-warning-base) 56%, white);
    --dxds-warning-60:  color-mix(in srgb, var(--cp-warning-base) 64%, white);
    --dxds-warning-70:  color-mix(in srgb, var(--cp-warning-base) 74%, white);
    --dxds-warning-80:  color-mix(in srgb, var(--cp-warning-base) 87%, white);
    --dxds-warning-90:  var(--cp-warning-base);
    --dxds-warning-100: color-mix(in srgb, var(--cp-warning-base) 86%, black);
    --dxds-warning-110: color-mix(in srgb, var(--cp-warning-base) 72%, black);
    --dxds-warning-120: color-mix(in srgb, var(--cp-warning-base) 60%, black);
    --dxds-warning-130: color-mix(in srgb, var(--cp-warning-base) 47%, black);
    --dxds-warning-140: color-mix(in srgb, var(--cp-warning-base) 34%, black);
    --dxds-warning-150: color-mix(in srgb, var(--cp-warning-base) 26%, black);
    --dxds-warning-160: color-mix(in srgb, var(--cp-warning-base) 18%, black);
    --dxds-warning-170: color-mix(in srgb, var(--cp-warning-base) 11%, black);
}

/* ── Order stage scale ───────────────────────────────────────────────────────
   One colour per order stage, in pipeline order, on one smooth scale: received (a pale blue-grey —
   "not started"), in production (the brand primary), packing (cyan), finished for collection
   (a soft sage-mint, kept low in chroma so it does not shout beside its neighbours), on its way
   (green), completed (deep green). Hue turns steadily from blue to green and the
   lightness falls from production on, so a row of stages reads as one progression. Completed closes
   the scale on the order page's status bar and on pills; the pipeline bar ends at on its way. Red is
   not on the scale: it stays the overdue colour. A status we do not recognise uses the neutral role,
   outside the scale.

   Validated, not eyeballed (dataviz validate_palette.js), on the three sequences that actually stand
   side by side — the status bar of a delivery (received, production, packing, transit, completed)
   and of a collection (… packing, collection, completed), and the pipeline bar (… collection, transit):
     light, surface #ffffff: worst adjacent ΔE 15.0 deuteranopia, 15.5 normal — all pass.
     dark,  surface #252525: CVD passes everywhere (worst 13.0 deuteranopia); transit ↔ completed is
                             13.6 normal, a step under the 15 floor - read with the stage's label.
   Received, packing and collection sit under 3:1 against the light surface, so they are never the
   only carrier of a stage: bars come with a legend or a label, and pills carry their own text.

   Fill = bar segments and accents. Pill companions (bg / fg / border) have the shape of the
   --cp-role-* triplets above; every fg is ≥ 6.4:1 on its bg in light and ≥ 9.0:1 in dark.

   Production is the primary itself (lifted in dark, from its own hue where relative colour syntax
   is supported); the other stages are literals, so the scale stays smooth whatever the theme. */
:root {
    --cp-color-stage-received:   #b7c5db;
    --cp-color-stage-production: var(--cp-color-primary);
    --cp-color-stage-packing:    #16adcc;
    --cp-color-stage-collection: #92d3a3;
    --cp-color-stage-transit:    #229944;
    --cp-color-stage-completed:  #2b650e;

    --cp-color-stage-received-bg:   #eef2f8; --cp-color-stage-received-fg:   #3f4a5c; --cp-color-stage-received-border:   #cdd6e4;
    --cp-color-stage-production-bg: #e5f0fe; --cp-color-stage-production-fg: #1253a1; --cp-color-stage-production-border: #b5d0f5;
    --cp-color-stage-packing-bg:    #e0f6fa; --cp-color-stage-packing-fg:    #05606f; --cp-color-stage-packing-border:    #a3dfea;
    --cp-color-stage-collection-bg: #e3f6e8; --cp-color-stage-collection-fg: #1f5a36; --cp-color-stage-collection-border: #b2e0c0;
    --cp-color-stage-transit-bg:    #e2f5e6; --cp-color-stage-transit-fg:    #145c2a; --cp-color-stage-transit-border:    #ade0b9;
    --cp-color-stage-completed-bg:  #e6f0dc; --cp-color-stage-completed-fg:  #2b4f12; --cp-color-stage-completed-border:  #bfd6a8;
}

/* Dark: the same scale lifted into the dark band so the fills stay apart on the dark surface, and
   the pills inverted (deep tint, light text). Selectors are the two App.razor sets for dark. */
:root[data-bs-theme="dark"],
:root[data-fluent-darkmode] {
    --cp-color-stage-received:   #979fab;
    --cp-color-stage-production: #3072d0;
    --cp-color-stage-packing:    #2abbd6;
    --cp-color-stage-collection: #9edcaa;
    --cp-color-stage-transit:    #3db355;
    --cp-color-stage-completed:  #4a8312;

    --cp-color-stage-received-bg:   #2c3038; --cp-color-stage-received-fg:   #d3d9e3; --cp-color-stage-received-border:   #4d5562;
    --cp-color-stage-production-bg: #182e4b; --cp-color-stage-production-fg: #a9cdff; --cp-color-stage-production-border: #2d568c;
    --cp-color-stage-packing-bg:    #10343c; --cp-color-stage-packing-fg:    #9fe3f0; --cp-color-stage-packing-border:    #1d6170;
    --cp-color-stage-collection-bg: #173628; --cp-color-stage-collection-fg: #b4ecc4; --cp-color-stage-collection-border: #2a6a46;
    --cp-color-stage-transit-bg:    #17361f; --cp-color-stage-transit-fg:    #a4e3b2; --cp-color-stage-transit-border:    #2c6a3c;
    --cp-color-stage-completed-bg:  #233314; --cp-color-stage-completed-fg:  #c4df9f; --cp-color-stage-completed-border:  #46632a;
}

/* Where relative colour syntax is supported, dark production follows the theme's own primary hue
   (lightness and chroma stay the validated ones), so a re-accented theme carries it along. */
@supports (color: oklch(from red l c h)) {
    :root[data-bs-theme="dark"],
    :root[data-fluent-darkmode] {
        --cp-color-stage-production: oklch(from var(--cp-color-primary) 0.56 0.16 h);
    }
}

/* Stage fills as meter tones (MeterTone.Stage*) — global for the reason the tones above are. */
.cp-meter-tone--stage-received   { background-color: var(--cp-color-stage-received); }
.cp-meter-tone--stage-production { background-color: var(--cp-color-stage-production); }
.cp-meter-tone--stage-packing    { background-color: var(--cp-color-stage-packing); }
.cp-meter-tone--stage-collection { background-color: var(--cp-color-stage-collection); }
.cp-meter-tone--stage-transit    { background-color: var(--cp-color-stage-transit); }
.cp-meter-tone--stage-completed  { background-color: var(--cp-color-stage-completed); }

/* ── Category scale ───────────────────────────────────────────────────────────
   Identity colours for things that have a name and no meaning: a permission group on the team page.
   Not a status — none of the five is the success green, the warning yellow or the danger red, so a
   group never reads as good or bad news — and never on its own: the name always sits beside it.

   Fixed order, assigned by position (CategoryTone); a sixth thing takes the first colour again, its
   name telling the two apart. The order is the safety mechanism, not taste — validated with dataviz
   validate_palette.js in this order:
     light, surface #ffffff: worst adjacent CVD ΔE 9.2 (deutan), normal-vision 27.6. Aqua and magenta
                             sit under 3:1 on the surface, relieved by the name beside every swatch.
     dark,  surface #292929: worst adjacent CVD ΔE 9.4 (deutan), normal-vision 19.7, all ≥ 3:1.

   Fill = swatches and meter segments. Pill companions are mixed from the fill against the surface, so
   they follow the mode: a light tint behind, the fill darkened (lightened in dark) for the words. */
:root {
    --cp-color-category-1: #2a78d6;
    --cp-color-category-2: #eb6834;
    --cp-color-category-3: #1baf7a;
    --cp-color-category-4: #6250d6;
    --cp-color-category-5: #e87ba4;

    --cp-category-bg-mix: 13%;
    --cp-category-fg-mix: black;
    --cp-category-fg-share: 58%;
}

:root[data-bs-theme="dark"],
:root[data-fluent-darkmode] {
    --cp-color-category-1: #3987e5;
    --cp-color-category-2: #d95926;
    --cp-color-category-3: #199e70;
    --cp-color-category-4: #9085e9;
    --cp-color-category-5: #d55181;

    --cp-category-bg-mix: 24%;
    --cp-category-fg-mix: white;
    --cp-category-fg-share: 45%;
}

:root {
    --cp-color-category-1-bg: color-mix(in srgb, var(--cp-color-category-1) var(--cp-category-bg-mix), var(--cp-color-surface));
    --cp-color-category-2-bg: color-mix(in srgb, var(--cp-color-category-2) var(--cp-category-bg-mix), var(--cp-color-surface));
    --cp-color-category-3-bg: color-mix(in srgb, var(--cp-color-category-3) var(--cp-category-bg-mix), var(--cp-color-surface));
    --cp-color-category-4-bg: color-mix(in srgb, var(--cp-color-category-4) var(--cp-category-bg-mix), var(--cp-color-surface));
    --cp-color-category-5-bg: color-mix(in srgb, var(--cp-color-category-5) var(--cp-category-bg-mix), var(--cp-color-surface));

    --cp-color-category-1-fg: color-mix(in oklab, var(--cp-color-category-1) var(--cp-category-fg-share), var(--cp-category-fg-mix));
    --cp-color-category-2-fg: color-mix(in oklab, var(--cp-color-category-2) var(--cp-category-fg-share), var(--cp-category-fg-mix));
    --cp-color-category-3-fg: color-mix(in oklab, var(--cp-color-category-3) var(--cp-category-fg-share), var(--cp-category-fg-mix));
    --cp-color-category-4-fg: color-mix(in oklab, var(--cp-color-category-4) var(--cp-category-fg-share), var(--cp-category-fg-mix));
    --cp-color-category-5-fg: color-mix(in oklab, var(--cp-color-category-5) var(--cp-category-fg-share), var(--cp-category-fg-mix));
}

/* Category fills as meter tones (MeterTone.Category*) and swatches — global for the reason the tones
   above are. */
.cp-meter-tone--category-1 { background-color: var(--cp-color-category-1); }
.cp-meter-tone--category-2 { background-color: var(--cp-color-category-2); }
.cp-meter-tone--category-3 { background-color: var(--cp-color-category-3); }
.cp-meter-tone--category-4 { background-color: var(--cp-color-category-4); }
.cp-meter-tone--category-5 { background-color: var(--cp-color-category-5); }

/* ── Validity scale ───────────────────────────────────────────────────────────
   How long a ready quote's price has left, past the warning week: one hue (the ready lime family),
   palest for the shortest wait and strongest for the longest — the greener, the better, the more
   time to order. Sits after the warning yellow (MeterTone.Warning) and before the neutral grey (no
   expiry); the pale first step is what keeps it apart from the yellow beside it.

   Validated with dataviz validate_palette.js, in bar order with the warning yellow first:
     light, surface #ffffff: worst adjacent ΔE 16.0 normal, 14.6 deuteranopia.
     dark,  surface #252525: worst adjacent ΔE 16.0 normal, 15.2 protanopia, ≥3:1 contrast for every step.
   Expected fails, by design: the lightness band (the warning yellow is the shared status token; a
   sequential scale has a pale end), and in light the palest step's chroma sits under the floor.
   Contrast under 3:1 in light is relieved by the legend, which names every window and its figures. */
:root {
    --cp-color-meter-validity-short:  #cfeab4;
    --cp-color-meter-validity-medium: #86bb47;
    --cp-color-meter-validity-long:   #3f6a17;
}

/* Dark: the strongest step is the brightest on the dark surface, so "more time" still reads strongest. */
:root[data-bs-theme="dark"],
:root[data-fluent-darkmode] {
    --cp-color-meter-validity-short:  #557f2c;
    --cp-color-meter-validity-medium: #86bb47;
    --cp-color-meter-validity-long:   #c2e79a;
}

.cp-meter-tone--validity-short  { background-color: var(--cp-color-meter-validity-short); }
.cp-meter-tone--validity-medium { background-color: var(--cp-color-meter-validity-medium); }
.cp-meter-tone--validity-long   { background-color: var(--cp-color-meter-validity-long); }

/* ── Front page (Index on LandingLayout) ──────────────────────────────────────
   The public front page is a marketing surface in the Lasered brand, not the portal's theme: near-black
   ink, the brand red and white type over both, the same in light and dark mode, because photography and
   a brand red do not invert. Only the FAQ band follows the theme, through the ordinary surface and
   content tokens. Draft values, picked off the design mock-up. */
:root {
    --cp-landing-ink:           #0e0f11;
    --cp-landing-ink-raised:    #26272b;
    --cp-landing-brand:         #b8141b;
    --cp-landing-brand-deep:    #5c070b;
    --cp-landing-live:          #43c35e;
    --cp-landing-on-dark:       #ffffff;
    --cp-landing-on-dark-muted: color-mix(in srgb, var(--cp-landing-on-dark) 78%, transparent);
    --cp-landing-rule:          color-mix(in srgb, var(--cp-landing-on-dark) 40%, transparent);
    --cp-landing-veil:          color-mix(in srgb, var(--cp-landing-on-dark) 9%, transparent);
    /* The page's bands run as wide as the hero, with a side gutter that grows with the window. */
    --cp-landing-content-max:   100rem;
    --cp-landing-gutter:        clamp(var(--cp-space-6), 5vw, var(--cp-space-12));
    /* The red band behind the phone (LandingOnTheGo): its ground, red deepening to the right, and the large
       disc over it, lighter and greyer at the left. Sampled from the mock-up. */
    --cp-landing-red:             #a61819;
    --cp-landing-red-deep:        #7e0101;
    --cp-landing-red-disc-light:  #ad2b2e;
    --cp-landing-red-disc:        #851314;
    /* The "need more parts" panel (LandingMoreParts): maroon deepening to the left, the muted crescent and
       the two red rims along its edge. Sampled from the mock-up. */
    --cp-landing-maroon-deep:     #3c1112;
    --cp-landing-maroon:          #712528;
    --cp-landing-maroon-muted:    #822c2f;
    --cp-landing-rim:             #b13033;
    --cp-landing-rim-bright:      #cb373b;
    /* The date chip in the phone illustration (LandingPhone), light in either mode like the screen it is on. */
    --cp-landing-phone-chip:    #dfe5fb;
    --cp-landing-phone-chip-fg: #24306e;
}
