/* =============================================================================================
   TimeView design tokens — the single source of truth for --brand-*, --palette-* and --tv-*.

   Served from TSO.TimeView.Shared.Components as _content/TSO.TimeView.Shared.Components/tv-tokens.css
   and loaded FIRST by every host (BFF, Admin). Custom properties are resolved at computed-value
   time, so this file has no ordering dependency on the Syncfusion theme; it only declares names.
   Rules that must beat the theme live in tv-theme.css. See docs/design-system/README.md.
   ============================================================================================= */

:root {
    --tv-default-border-radius: 0.5rem;

    /* Width of the docked AI chat panel. Shared by the panel itself and by the
       margin-right that shifts .main-content out from under it — they must match. */
    --ai-chat-docked-width: min(400px, 35 * var(--tv-vw));

    /* ── Tier 1: typography ──
       The app used to inherit the stock `dotnet new blazor` stack
       ('Helvetica Neue', Helvetica, Arial). Neither Helvetica face exists on Windows, so
       app-authored text fell through to Arial while every Syncfusion control rendered in the
       theme's own stack — two typefaces with different x-heights and metrics on every screen.
       This mirrors Bootstrap 5.3's native stack so app text and component text match.

       Font *family* is set globally; the size/weight tokens below are applied deliberately by
       components. Setting a global font-size would reflow every existing screen, and TimeView is
       a dense power-user tool where that density is a feature. */
    --tv-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
                    "Noto Sans", "Liberation Sans", Arial, sans-serif,
                    "Apple Color Emoji", "Segoe UI Emoji";

    /* Machine output — trace ids, request ids, stack traces. Mirrors Bootstrap 5.3's own
       monospace stack for the same reason as the sans stack above. */
    --tv-font-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
                    "Courier New", monospace;

    /* Type scale. Five steps, because five is what the screens actually need:
       page title, section heading, body, supporting metadata, and the large numerals
       on KPI/summary cards. Resist adding a sixth without a screen that needs it. */
    --tv-text-page-title: 1.375rem;
    --tv-text-section:    1rem;
    --tv-text-body:       0.875rem;
    --tv-text-meta:       0.75rem;
    --tv-text-metric:     1.75rem;

    --tv-weight-regular: 400;
    --tv-weight-medium:  500;
    --tv-weight-strong:  600;

    --tv-leading-tight:  1.25;
    --tv-leading-normal: 1.5;

    /* ── Tier 1: spacing ──
       A 4px base step. Kept short on purpose: page gutter and section gap are the two values
       that were missing everywhere (grids ran edge-to-edge with no gutter), the numbered steps
       cover component-internal spacing. */
    --tv-space-1: 0.25rem;
    --tv-space-2: 0.5rem;
    --tv-space-3: 0.75rem;
    --tv-space-4: 1rem;
    --tv-space-5: 1.5rem;
    --tv-space-6: 2rem;

    --tv-page-gutter: var(--tv-space-4);
    /* Gap between the app bar and page content. Shared with .top-bar's sticky `top` so the bar
       rests and sticks at the same offset instead of jumping up when scrolling starts. */
    --tv-content-top-gap: 0.2rem;
    --tv-section-gap: var(--tv-space-5);
    /* Narrowest cell of a TvSection split row before the cells stack (.tv-section__split, #2559). */
    --tv-section-split-min: 32rem;

    /* Height of the app bar. MainLayout sets the bar's height from it, and floating panels that
       open at the top (the timer, #1559) start below it instead of covering its buttons and
       hiding keyboard focus behind themselves. 3rem is Syncfusion's own bar height (48px). */
    --tv-app-bar-height: 3rem;

    /* Where the app bar starts, below the banners above it (impersonation, staff broadcasts). Those
       wrap to any height, so the value is measured at runtime: timerPopup.js's trackAppBarTop sets it
       on :root. 0 until then, which is right when no banner is shown. */
    --tv-app-bar-top: 0px;

    /* Smallest comfortable touch target (44px). The timer's phone bar sizes its controls with it, and
       the page reserves room for the bar from the same value, so the two cannot drift apart. */
    --tv-touch-target: 2.75rem;

    /* Height of the support-impersonation banner. MainLayout's
       flex `.layout-shell` gives the main container the remaining height, so nothing subtracts it.
       Fixed rather than intrinsic so a wrapped line cannot push the shell down and give the document
       a second scrollbar. */
    --tv-impersonation-banner-height: 2.5rem;

    /* The user's chosen UI size (the "Size" setting in the user menu), as a CSS zoom factor. 1 unless
       the BFF's pre-boot script sets html[data-ui-size]; theme-overrides.css maps each level to a
       value and applies it. Zoom, not a root font-size: the Syncfusion theme is sized in px almost
       throughout, so only zoom scales its grids and inputs along with our rem-based tokens.
       A length in vh/dvh/vw no longer fills the window once zoomed, so use the viewport-unit tokens
       below instead of raw units. */
    --tv-ui-zoom: 1;

    /* Viewport units, corrected for --tv-ui-zoom. CSS zoom multiplies every length inside the page,
       so 100vh renders at 100vh x zoom: a gap below the content at zoom < 1, an overflow at zoom > 1.
       Dividing the unit by the zoom cancels that. Write calc(100 * var(--tv-vh)), calc(100 * var(--tv-vh) - 3.5rem),
       min(30rem, 90 * var(--tv-vw)). Raw vh/dvh/vw are not allowed in the UI projects;
       ViewportUnitRatchetTests fails on them. */
    --tv-vh: calc(1vh / var(--tv-ui-zoom));
    --tv-dvh: calc(1dvh / var(--tv-ui-zoom));
    --tv-vw: calc(1vw / var(--tv-ui-zoom));

    /* ── Tier 2: focus ──
       Two-tone ring: a thin separating ring against the element, then the accent.
       The separator uses the theme's own background so it reads on light and dark
       alike (the stock template hardcoded `white`, which vanished on dark panels). */
    --tv-focus-ring: var(--tv-accent);
    --tv-focus-ring-inner: var(--color-sf-content-bg-color, #ffffff);

    /* ── Tier 1: primitive palette ─────────────────────────────────────────
       Interface hues, named by hue. Every semantic token below points here, so a hue is changed
       in exactly one place. Do not reference these directly from component styles — use a
       semantic token instead.

       These are *not* the TimeSolutions brand colours, despite an earlier version of this comment
       claiming they were. They are the theme's semantic hues — what "info", "success", "warning"
       and "danger" look like in the active Syncfusion theme, with a Material/Bootstrap hex as the
       fallback. That is the right basis for status meaning: a status colour has to track the theme
       and hold contrast as a small glyph, which a brand colour chosen for a logo does not.
       The brand palette is defined separately below and is not interchangeable with these.

       Where a hue has a natural match in Syncfusion's semantic theme variables,
       it inherits from the active theme (var(--color-sf-*, <brand fallback>)) so
       status colors track theme switches (light/dark/high-contrast/Fluent/etc.).
       The brand hex is the fallback for themes that don't define the variable
       (e.g. bootstrap5, highcontrast). Hues with no semantic Syncfusion match
       (grey/orange/black) stay explicit.
       Caveat: some Syncfusion themes define --color-sf-* as raw RGB triplets
       ("r, g, b") rather than full colors, so on those the token resolves to an
       invalid value and the element falls back to its inherited color. The
       supported family (bootstrap5.3) defines them normally. */
    --palette-grey:   #757575;
    --palette-blue:   var(--color-sf-info,    #4dadff);
    --palette-green:  var(--color-sf-success, #2e7d32);
    --palette-amber:  var(--color-sf-warning, #f9a825);
    /* Text *on* a green or amber fill (#1641): the theme's own button text for that fill (white on
       green, black on amber in bootstrap5.3). The fallbacks are for themes that define neither, such
       as highcontrast, where they read 5.1:1 and 10.7:1 on the fallback fills above. */
    --palette-on-green: var(--color-sf-success-text, #ffffff);
    --palette-on-amber: var(--color-sf-warning-text, #000000);
    /* Amber for *text* (#1174). --palette-amber is a fill: as text it is 1.55:1 on the light theme's
       white. The theme's own warning-message text colour is tuned per theme for exactly this - a deep
       amber on light (#664d03), a light one on dark (#ffda6a) - so it is inherited, not mixed. */
    --palette-amber-text: var(--color-sf-msg-warning-color, #664d03);
    --palette-red:    var(--color-sf-danger,  #c62828);
    /* Red for *text*, on the same terms as --palette-amber-text: --palette-red as 12px text was
       3.41:1 on the dark theme's dialog surface. The theme's danger-message text colour is #ea868f
       on dark (6.10:1 there) and #842029 on light. */
    --palette-red-text: var(--color-sf-msg-danger-color, #842029);
    --palette-accent: var(--color-sf-primary, #0d6efd);
    --palette-orange: #ff814c;
    --palette-black:  #000000;

    /* Categorical hues. No semantic Syncfusion match, and none is wanted: these exist to tell
       taxonomy entries apart at a glance, so they must stay mutually distinct rather than track a
       theme's notion of "info" or "success". */
    --palette-purple: #6a1b9a;
    --palette-teal:   #00695c;

    /* Deep variants, for use as a solid *fill* behind white text. The theme-derived hues above are
       tuned for glyphs and borders on the page background; as a background they leave white text at
       roughly 2:1, so they cannot simply be reused. Explicit hex on purpose — a theme-inherited
       value gives no guarantee of the contrast a filled chip needs. */
    --palette-green-deep: #1b5e20;
    --palette-amber-deep: #a35200;
    --palette-orange-deep: #c94f1a; /* white on it: 4.54:1; on --palette-orange it is 2.48:1 */

    /* ── Tier 1: TimeSolutions brand palette ───────────────────────────────
       The canonical corporate identity, from the 2022 design guide (ImageConsult,
       "TimeSolutions _ designguide 13_01_22.pdf", p. 8 — the RGB set, which the guide
       specifies for on-screen use; the CMYK and Pantone sets on pp. 7 and 9 are for print).

       These are fixed corporate values. Unlike --palette-* above they deliberately do NOT
       inherit from the Syncfusion theme: the brand green is the brand green in light, dark and
       high contrast alike. That is also why they must be used sparingly — a fixed colour cannot
       guarantee contrast against a surface it does not control.

       Use for: identity surfaces — sign-in, the app shell's brand mark, marketing/empty states,
       print and export headers, illustration and chart accents where the palette is decorative,
       and structural chrome that divides a screen (the EntityDetail section bands).

       Do NOT use for: status, validation or any colour that carries meaning. Those belong to the
       --palette-* hues above and their Tier-2 semantic tokens. Brand blue reading as "info" or
       brand green as "success" is a coincidence of hue, not a decision, and it breaks the moment
       the identity is refreshed. (One documented exception: --approval-employee-closed, below.)

       Contrast, computed (not eyeballed) against white and against the dark theme's #212529:

                     on white   on #212529
         GREEN         2.78        5.55
         COOLGREEN     3.26        4.73
         TURQUOISE     2.95        5.24
         BLUE          5.74        2.69
         DARKBLUE     11.98        1.29

       So there is no brand hue that is legible as text on both themes — BLUE and DARKBLUE work
       on light only, the three greens on dark only. Worse, GREEN (2.78) and TURQUOISE (2.95) sit
       under even the 3:1 floor for icons and borders on white. Treat every one of these as a
       *fill* colour with a deliberately chosen foreground on top, and check the pairing in the
       browser; do not reuse these numbers for a surface other than the two above. */
    --brand-green:     #50af43;
    --brand-coolgreen: #00a278;
    --brand-turquoise: #00a6b6;
    --brand-blue:      #1768b2;
    --brand-darkblue:  #19375f;
    --brand-black:     #000000;

    /* Neutral ramp. The guide specifies black at 100/75/50/25% plus white; these are those
       percentages flattened against white, so they stay usable as opaque fills. On a dark
       surface prefer the --tv-* neutral chrome tokens below, which track the theme. */
    --brand-black-75: #404040;
    --brand-black-50: #808080;
    --brand-black-25: #bfbfbf;
    --brand-white:    #ffffff;

    /* The guide encourages gradients between brand hues ("forløb kan bruges", p. 8) for
       identity surfaces and line icons. Named here so the pairing is decided once rather than
       improvised per screen. Not for use behind body text. */
    --brand-gradient-cool: linear-gradient(135deg, var(--brand-green), var(--brand-turquoise));
    --brand-gradient-deep: linear-gradient(135deg, var(--brand-turquoise), var(--brand-darkblue));

    /* ── Tier 2: chart series ──
       Fills for data series that carry NO meaning — external vs internal hours, posted vs pipeline
       revenue, a top-N breakdown. Those were painted with status hues (--palette-blue/-orange, the
       invoice status tokens), so every chart read as an alert and none of the brand appeared below
       the page header. The design guide lists chart accents as a legitimate decorative use of the
       identity, so the series ramp is the brand palette, in a fixed order.

       Order is by legibility as a fill, not by the guide's listing: BLUE first (already the app's
       primary — 5.74:1 light, 2.69 dark, the trade the primary override in theme-overrides.css
       already accepts), then COOLGREEN, the one brand hue that clears the 3:1 graphics floor on
       both themes (3.26 / 4.73). Series 3–5 dip under 3:1 on one theme each and are meant for
       charts that also carry a legend and data labels, not for a lone bar.

       A series that DOES mean something — a credit note, an overdue bucket, the norm line, an
       approval state — keeps its semantic token. Don't put one of those beside a brand series in
       the same chart unless it is neutral (the grey norm line is fine): a brand hue next to a red
       or amber makes the brand hue look like a status too. */
    --chart-series-1: var(--brand-blue);
    --chart-series-2: var(--brand-coolgreen);
    --chart-series-3: var(--brand-turquoise);
    --chart-series-4: var(--brand-green);
    --chart-series-5: var(--brand-darkblue);

    /* ── Tier 2: AI instruction categories ──
       A filled chip per instruction category in the AI admin list. Deep variants throughout,
       because the category label is white text on the fill. Chosen for mutual distinctness, not
       for meaning — none of these categories is "good" or "bad". */
    --ai-category-persona:         var(--palette-accent);
    --ai-category-workflow:        var(--palette-green-deep);
    --ai-category-domain-skill:    var(--palette-amber-deep);
    --ai-category-conditional:     var(--palette-purple);
    --ai-category-prompt-template: var(--palette-teal);

    /* ── Tier 2: entity identity ──
       The colour of an entity's glyph wherever the entity is drawn — the navigation menu today.

       Every entity currently resolves to the brand primary: a menu in thirty hues reads as
       decoration rather than as structure, and the glyph shape already says which entity it is.
       The per-entity indirection is kept anyway, so singling one out later is a one-line change
       here — repoint --entity-invoice at a --palette-* primitive and nothing else moves.

       Referenced from EntityConfiguration.IconColor; see the "Entity-List Status Icons" section of
       docs/design-system/README.md. */
    --tv-nav-icon: var(--palette-accent);

    /* The selected menu row is filled with the brand primary, so a glyph in --tv-nav-icon would be
       invisible against it. This is the foreground the theme already pairs with that fill, so the
       glyph tracks the row's own text rather than needing a second colour decision. */
    --tv-nav-icon-selected: var(--color-sf-primary-text-color, var(--brand-white));

    /* Customers and the taxonomies that classify them. */
    --entity-customer:              var(--tv-nav-icon);
    --entity-customertype:          var(--tv-nav-icon);
    --entity-companytype:           var(--tv-nav-icon);
    --entity-contact:               var(--tv-nav-icon);
    --entity-contactgroup:          var(--tv-nav-icon);
    --entity-referencerole:         var(--tv-nav-icon);

    /* Work: what is done, and how it is classified and registered. */
    --entity-tvtask:                var(--tv-nav-icon);
    --entity-tvtaskdeadline:        var(--tv-nav-icon);
    --entity-tvtasktemplate:        var(--tv-nav-icon);
    --entity-tvtasktemplatecollection: var(--tv-nav-icon);
    --entity-tasktype:              var(--tv-nav-icon);
    --entity-tasktypesworktype:     var(--tv-nav-icon);
    --entity-worktype:              var(--tv-nav-icon);
    --entity-timeregistration:      var(--tv-nav-icon);

    /* Money. */
    --entity-invoice:               var(--tv-nav-icon);
    --entity-invoiceline:           var(--tv-nav-icon);
    --entity-invoicerule:           var(--tv-nav-icon);
    --entity-currencyexchangerate:  var(--tv-nav-icon);
    --entity-accountingsystem:      var(--tv-nav-icon);

    /* People, and the contracts and calendars that govern their time. */
    --entity-tvuser:                var(--tv-nav-icon);
    --entity-tvgroup:               var(--tv-nav-icon);
    --entity-tvusersgroup:          var(--tv-nav-icon);
    --entity-tvuserrateinterval:    var(--tv-nav-icon);
    --entity-tvcompetence:          var(--tv-nav-icon);
    --entity-tvusercompetence:      var(--tv-nav-icon);
    --entity-usercontract:          var(--tv-nav-icon);
    --entity-usercontracttemplate:  var(--tv-nav-icon);
    --entity-usertype:              var(--tv-nav-icon);
    --entity-usertypeentitylayout:  var(--tv-nav-icon);
    --entity-workday:               var(--tv-nav-icon);
    --entity-workdaystemplate:      var(--tv-nav-icon);
    --entity-holiday:               var(--tv-nav-icon);
    --entity-flexvacationinfo:      var(--tv-nav-icon);

    /* Documents and things that are sent. */
    --entity-correspondence:        var(--tv-nav-icon);
    --entity-correspondencecategory: var(--tv-nav-icon);
    --entity-standardtext:          var(--tv-nav-icon);
    --entity-reportdefinition:      var(--tv-nav-icon);
    --entity-emaillog:              var(--tv-nav-icon);
    --entity-emailtemplate:         var(--tv-nav-icon);
    --entity-webhooksubscription:   var(--tv-nav-icon);
    --entity-webhookevent:          var(--tv-nav-icon);
    --entity-webhooksendattempt:    var(--tv-nav-icon);

    /* Configuration of the product itself, rather than of the business it records. */
    --entity-customfielddefinition: var(--tv-nav-icon);
    --entity-auditlog:              var(--tv-nav-icon);
    --entity-securityrole:          var(--tv-nav-icon);

    /* ── Tier 2: navigation entries with no entity behind them ──
       A menu item that is a *place* (a calendar, an administration section) rather than a list of
       one entity. Kept beside the entity tokens so the menu has one palette, not two, and pointing
       at the same --tv-nav-icon for the same reason.
       Referenced from NavMenuIcons. */
    --nav-home:             var(--tv-nav-icon);
    --nav-planning:         var(--tv-nav-icon);
    --nav-documenttemplate: var(--tv-nav-icon);
    --nav-hr:               var(--tv-nav-icon);
    --nav-administration:   var(--tv-nav-icon);
    --nav-system:           var(--tv-nav-icon);
    --nav-debug:            var(--tv-nav-icon);

    /* ── Tier 2: neutral chrome ──
       Derived from the element's own foreground rather than a fixed light grey, so
       surfaces and separators stay legible on light, dark and high-contrast themes.
       (currentColor is resolved where the token is used, not here.) */
    --tv-border-color: color-mix(in srgb, currentColor 25%, transparent);
    --tv-surface-alt: color-mix(in srgb, currentColor 8%, transparent);

    /* Same idea, under the names components already reference. Both were used across the UI with
       hardcoded light-theme hex fallbacks (#555 / #d0d0d0 / #595959) and defined nowhere, so every
       use silently fell back — including on dark themes, where a mid-grey on a dark panel fails
       contrast. Deriving from currentColor makes them track the active theme. */
    --tv-color-text-secondary: color-mix(in srgb, currentColor 70%, transparent);
    --tv-color-border: var(--tv-border-color);

    /* Hover wash for list rows, menu items and icon buttons. Previously referenced as
       --tv-color-hover with a hardcoded #f5f5f5 fallback and defined nowhere, so every hover
       painted light grey — invisible on light themes, wrong on dark ones. */
    --tv-color-hover: var(--color-sf-hover-bg-color, color-mix(in srgb, currentColor 10%, transparent));

    /* Opaque panel surface for anything that floats above page content (flyouts, cards,
       popups). Components previously reached for the undefined --e-bg-color with a #ffffff
       fallback, which pinned them to white on every theme. */
    --tv-surface: var(--color-sf-content-bg-color, #ffffff);

    /* Page canvas. Deliberately a step darker than --tv-surface rather than equal to it: the
       layout relies on cards/panels reading as raised against the canvas, and painting both from
       --color-sf-content-bg-color erases that distinction. Mixing toward black (not toward the
       text colour) keeps the canvas darker than the surface on light *and* dark themes.
       Overridden for dark in theme-overrides.css — see the note there. */
    --tv-body-bg: color-mix(in srgb, var(--color-sf-content-bg-color, #ffffff) 96%, #000000);
    --tv-body-fg: var(--color-sf-content-text-color, #333333);

    /* Elevation for those same floating panels. A shadow, not a colour, so it has no palette
       entry — but it was being duplicated inline per component via an undefined --e-shadow. */
    --tv-shadow-flyout: 0 0.5rem 2rem rgba(0, 0, 0, 0.1);

    /* Raised variant of the above, for hover on a floating card. Same story: it was inlined per
       component as an undefined --e-shadow-hover. */
    --tv-shadow-flyout-hover: 0 1rem 3rem rgba(0, 0, 0, 0.15);

    /* ── Tier 2: accent fill and its foreground ──
       Syncfusion themes expose --color-sf-primary but no matching "on primary"
       variable, so a component that fills itself with the accent has nothing to
       read for its foreground. Declared once here rather than hardcoded per
       component. White holds up against the accent on every bundled theme; a
       theme with a light primary would override this token, not the components. */
    --tv-accent: var(--palette-accent);
    --tv-on-accent: #ffffff;

    /* ── Tier 2: accent as text or a glyph on the surface ──
       The accent itself is 2.69:1 on the dark canvas, under the 3:1 floor for an icon. The theme's
       primary text tint (-darker) is the accent darkened in light (7.91:1 on white) and lightened in
       dark (7.68:1 on #212529, tv-theme.css), so text and a marked glyph read in both. Used for
       every plain link (the a, .btn-link default in tv-theme.css) and the entity list's filter
       icon on a filtered column. */
    --tv-accent-text: var(--color-sf-primary-darker, var(--palette-accent));

    /* ── Tier 2: in-place search ──
       Marks the rows a client-side search matched (e.g. the batch-edit field list).
       Amber rather than the primary colour so a hit never reads as a selection. */
    --tv-search-match: var(--palette-amber);

    /* ── Tier 2: global search ──
       The app-bar search box and its results panel. The panel floats above page content, so it
       needs a surface of its own rather than inheriting whatever it happens to overlap. Values
       come from the Syncfusion theme so the panel follows a theme switch; the hexes are only
       fallbacks for themes that define neither. */
    --tv-search-surface: var(--color-sf-flyout-bg-color, var(--color-sf-content-bg-color, #ffffff));
    /* The bar's own border variable is too faint against the app-bar background to register as an
       edge, so the field's outline is drawn from the text colour like every other input border in
       the app (`--tv-border-color`); the results panel keeps the theme's lighter border. */
    --tv-search-border: var(--color-sf-border, rgba(128, 128, 128, .35));
    --tv-search-field-border: var(--tv-border-color);
    --tv-search-hover: var(--color-sf-hover-bg-color, rgba(128, 128, 128, .12));
    /* Demoted rows: ended employees, inactive/blocked customers, archived tasks. Dimmed rather
       than hidden — they are still results, just not the ones you probably meant. */
    --tv-search-muted: var(--palette-grey);

    /* ── Tier 2: entity detail form ──
       The generic edit form (EntityDetail) used to inherit Bootstrap 5.3's accordion styling
       verbatim, which paints an expanded section header as a full-bleed tinted bar — a solid
       blue band on light, navy on dark, and the theme's own link blue at that. These tokens
       repaint the form as a stack of cards, each headed by a solid band in the TimeSolutions
       BLUE. The band is deliberately loud — it is the only chrome in the form, so it is what
       divides the page into sections; everything below it (fields, labels, borders) stays
       neutral and derived from the Syncfusion theme, so light, dark and high contrast follow.

       This is a *branded* fill, not a status colour, so it is exempt from the "never use
       --brand-* for meaning" rule above: the band says "section", not "approved" or "error".
       It is also why the foreground is pinned to --brand-white rather than left to the theme —
       a fixed fill has to carry its own contrast (5.74:1 in both themes; see the brand table).

       Every neutral here is mixed from --tv-body-fg rather than reusing --tv-surface-alt /
       --tv-color-text-secondary / --tv-color-hover: those dilute *currentColor*, and every
       surface in this form (the tab strip, the float label, and now the header itself) sits
       inside an element the theme has already tinted its own blue — so a currentColor-derived
       "neutral" renders as a translucent blue wash. */
    --tv-form-surface: var(--tv-surface);
    --tv-form-section-header-surface: var(--brand-blue);
    --tv-form-section-header-fg: var(--brand-white);
    /* Hover/expanded darken the band rather than lighten it: lightening BLUE drops the white
       label below AA, darkening only raises it. */
    --tv-form-section-header-hover: color-mix(in srgb, var(--brand-blue) 85%, var(--brand-black));
    --tv-form-hover: color-mix(in srgb, var(--tv-body-fg) 10%, transparent);
    /* Filled well behind read-only fields. Was the same token as the section header until the
       header became a brand fill — which silently painted every disabled input solid blue. */
    --tv-form-well: color-mix(in srgb, var(--tv-body-fg) 6%, transparent);
    --tv-form-field-label: color-mix(in srgb, var(--tv-body-fg) 72%, transparent);
    --tv-form-field-border: var(--tv-border-color);

    /* ── Tier 2: generic indicators (value-vs-target cards) ── */
    --indicator-neutral: currentColor;
    --indicator-good: var(--palette-green);
    --indicator-warning: var(--palette-amber);
    --indicator-bad: var(--palette-red);
    /* The warning colour for *text* (#1174); --indicator-warning is its fill. A colour-mix of the deep
       amber toward the body text was tried first and failed on the dark theme's KPI cards (3.45:1),
       which is why this inherits the theme's own value. Measured in both themes; see the
       design-system README, "Colour contrast". */
    --indicator-warning-text: var(--palette-amber-text);
    /* The bad/error colour for *text*; --indicator-bad is its fill. */
    --indicator-bad-text: var(--palette-red-text);

    /* ── Tier 2: time-registration approval domain ──
       Distinct from task/invoice status on purpose — the approved green (#4CA44C)
       is intentionally lighter than the generic --palette-green.

       "Employee closed" / "done" is the deliberate exception to the "no brand hues for status"
       rule. It used to sit on --palette-blue, i.e. the theme's *info* cyan (#0dcaf0 in Bootstrap
       5.3) — white text on it measures ~1.7:1 and it read as a stray Bootstrap colour next to the
       brand-blue primary. Done is also the one status painted as a solid button fill (the
       "Færdig" action in the time-registration editor), so it needs a fill that carries white
       text on both themes: --brand-blue does (5.74:1). The row token below follows it so a row
       and its period agree. */
    --approval-draft: var(--palette-amber);
    --approval-employee-closed: var(--brand-blue);
    --approval-management-approved: #4CA44C;
    --approval-management-denied: var(--palette-black);

    /* ── Tier 2: time-registration row status (individual entries) ──
       The per-row counterpart to the --approval-* period states above. These lived in C# as
       System.Drawing.Color.FromArgb triplets in TimeRegStatusColors.cs — a third copy of the
       brand hexes, alongside app.css and the (now deleted) scheduler appointment template, which
       had already drifted to #50AD50/#51B6FF/#FF8850. Done and approved reuse the approval tokens
       so a row and its period agree. Draft is the *deep* orange: these are solid fills carrying
       white text (count badge, popup items), and white on --palette-orange is 2.48:1. */
    --timereg-row-draft: var(--palette-orange-deep);
    --timereg-row-done: var(--approval-employee-closed);
    --timereg-row-approved: var(--approval-management-approved);
    --timereg-row-denied: var(--palette-black);
    /* ManagementStatus.None on the entity list: closed by the employee, not yet seen by management. */
    --timereg-row-pending: var(--palette-grey);

    /* ── Tier 2: day norm status (fill-remaining-hours day strip) ──
       Solid chips with white text rather than coloured glyphs, so these point at the deep palette
       variants. This is the one place a status colour is used as a fill; everywhere else it is text. */
    --day-norm-met: var(--palette-green-deep);
    --day-norm-short: var(--palette-amber-deep);

    /* ── Tier 2: task status domain (TvTask.Status) ── */
    --task-status-notstarted:  var(--palette-grey);
    --task-status-inprogress:  var(--palette-blue);
    --task-status-completed:   var(--palette-green);
    --task-status-approved:    var(--palette-green);
    --task-status-disapproved: var(--palette-red);

    /* ── Tier 2: deadline status domain (TvTaskDeadline.Status) ── */
    --deadline-status-created:  var(--palette-grey);
    --deadline-status-done:     var(--palette-green);
    --deadline-status-declined: var(--palette-red);

    /* ── Tier 2: email delivery status domain (EmailLog.Status) ──
       Amber (not red) for a spam complaint: the message was delivered, so it is a reputation
       warning rather than a failure to deliver. Grey covers both "not yet known" (Queued) and
       "will never be known" — a Flowmailer row, which no webhook ever updates. */
    --email-status-queued:        var(--palette-grey);
    --email-status-sent:          var(--palette-blue);
    --email-status-delivered:     var(--palette-green);
    --email-status-bounced:       var(--palette-red);
    --email-status-spamcomplaint: var(--palette-amber);
    --email-status-failed:        var(--palette-red);
    --email-status-unknown:       var(--palette-grey);

    /* ── Tier 2: webhook delivery status domain ── */
    --webhook-delivery-ok:     var(--palette-green);
    --webhook-delivery-failed: var(--palette-red);
    --webhook-delivery-none:   var(--palette-grey);

    /* ── Tier 2: invoice status domain (Invoice.Status) ──
       Draft is orange (work in progress) rather than grey, matching the legacy client's
       orange draft overlay; the rest follow the blue → green progression. */
    --invoice-status-draft:      var(--palette-orange);
    --invoice-status-done:       var(--palette-blue);
    --invoice-status-approved:   var(--palette-green);
    --invoice-status-posted:     var(--palette-blue);
    --invoice-status-dispatched: var(--palette-blue);
    --invoice-status-paid:       var(--palette-green);
    --invoice-status-cancelled:  var(--palette-red);

    /* ── Tier 2: scheduled job results (SchedulableExecutionResultEnum) ──
       "Nothing to do" is grey rather than green: it is a non-event, and colouring it as success
       makes an idle job look as reassuring as one that actually did work. */
    --job-result-ok:            var(--palette-green);
    --job-result-witherrors:    var(--palette-amber);
    --job-result-failed:        var(--palette-red);
    --job-result-stopped:       var(--palette-red);
    --job-result-nowork:        var(--palette-grey);
    --job-result-unknown:       var(--palette-grey);
    --job-result-info:          var(--palette-blue);

    /* ── Tier 2: receivables aging bands (invoicing dashboard) ──
       A severity ramp, not a status: green while nothing is due, then progressively hotter the
       longer a receivable has been outstanding, ending on the system's strongest severity colour.
       The last band used to be --palette-black, which vanished on the dark theme (a black bar on
       #212529); every step now clears 3:1 as a graphical mark on white and on #212529 alike. */
    --invoice-aging-not-due:    var(--palette-green);
    --invoice-aging-1-30:       var(--palette-amber);
    --invoice-aging-31-60:      var(--palette-orange);
    --invoice-aging-61-90:      color-mix(in srgb, var(--palette-orange) 50%, var(--palette-red));
    --invoice-aging-over-90:    var(--palette-red);

    /* ── Tier 2: invoice line shortfall/profit (InvoiceDraftLine.Shortfall) ──
       Billed below the calculated price is a loss, above it a profit; zero stays unstyled. */
    --invoice-shortfall-negative: var(--palette-red);
    --invoice-shortfall-positive: var(--palette-green);

    /* ── Tier 2: invoice key figure trend (InvoiceDetail trend chart) ──
       Series identity, not status: the same metric keeps one colour across every invoice on the
       chart. The margin line takes the theme accent so it reads as a different *kind* of quantity
       (a percentage, on its own axis) rather than as a fourth amount. The current invoice reuses
       the draft colour because that is exactly what it is - a figure still being edited. */
    --invoice-trend-price:        var(--palette-blue);
    --invoice-trend-contribution: var(--palette-green);
    --invoice-trend-shortfall:    var(--palette-amber);
    --invoice-trend-margin:       var(--palette-accent);
    --invoice-trend-current:      var(--palette-orange);

    /* ── Tier 2: operation queue domain (QueuedOperation.Status) ──
       Terminal states reuse the indicator tokens; the two non-terminal states get their own
       so "waiting for a worker" reads differently from "neutral". */
    --operation-queue-waiting: var(--palette-grey);
    --operation-queue-running: var(--palette-blue);

    /* ── Tier 2: activity centre badge ──
       A solid accent fill behind white text. It must not use --indicator-neutral: that token is
       currentColor, which in the app bar is the white icon colour, giving a white pill with white
       text. The failed variant is handled by --indicator-bad in the component's own stylesheet. */
    --activity-center-badge-bg: var(--palette-accent);
    --activity-center-badge-fg: var(--tv-on-accent);

    /* ── Tier 2: what's-new badge ── Same accent fill as the activity centre badge: an app-bar
       badge has to read against the bar itself, so --indicator-neutral (currentColor) is not an
       option here either. */
    --whats-new-badge-bg: var(--palette-accent);
    --whats-new-badge-fg: var(--tv-on-accent);

    /* ── Tier 2: DMS document status domain (CorrespondenceListItem.ApprovalStatus) ── */    --doc-status-draft:    var(--palette-orange);
    --doc-status-finished: var(--palette-blue);
    --doc-status-denied:   var(--palette-black);
    --doc-status-approved: var(--palette-green);

    /* ══ Tier 2: enum columns rendered as glyphs on the generic entity lists ══
       Each enum column in EntityConfiguration.ColumnIcons pairs an MDI glyph with one of these
       tokens. Two kinds of group live below and they are coloured on different principles:

       • A *status* has a direction — grey/blue "in progress", green "good", red "bad". Colour
         carries meaning and should be read before the glyph.
       • A *taxonomy* (VAT zone, group type, custom-field type) has no direction. Its colours exist
         only to tell members apart, so they are drawn from the categorical hues and must stay
         mutually distinct rather than imply that one member is better than another.

       Domains are kept separate even when two currently resolve to the same primitive: that is what
       lets one diverge later without silently repainting the other. */

    /* ── Audit trail action (AuditLog.Action) ──
       Read is grey, not blue: it is the only member that changed nothing, and colouring it like an
       edit makes a read-heavy log look far busier than it is. */
    --audit-action-none:          var(--palette-grey);
    --audit-action-created:       var(--palette-green);
    --audit-action-updated:       var(--palette-blue);
    --audit-action-deleted:       var(--palette-red);
    --audit-action-statuschanged: var(--palette-amber);
    --audit-action-read:          var(--palette-grey);

    /* ── Company legal form (CompanyType.TypeCode) — taxonomy ── */
    --company-type-none: var(--palette-grey);
    --company-type-as:   var(--palette-blue);
    --company-type-aps:  var(--palette-teal);
    --company-type-amba: var(--palette-purple);

    /* ── Customer lifecycle (Customer.State) ──
       Lead is amber rather than green: it is a prospect, not yet revenue. Blocked takes red and
       Inactive grey, so "we stopped them" reads differently from "they went quiet". */
    --customer-state-active:   var(--palette-green);
    --customer-state-lead:     var(--palette-amber);
    --customer-state-inactive: var(--palette-grey);
    --customer-state-blocked:  var(--palette-red);

    /* ── Automatic invoice dispatch (Customer + Invoice.AutomaticInvoiceDispatch) ──
       Shared by two entities on purpose: it is one setting, shown in two lists. */
    --invoice-dispatch-none:  var(--palette-grey);
    --invoice-dispatch-email: var(--palette-blue);
    --invoice-dispatch-gln:   var(--palette-teal);

    /* ── Invoice dispatch outcome (InvoiceDispatch.Status, Invoice.LatestDispatchStatus) ──
       In flight (pending, sent, in transit) is blue, delivered green, and a dispatch that did not
       arrive (rejected, failed) red. Not tracked is grey: the provider never reports back, so it is
       an absence of information, not a problem. */
    --invoice-dispatch-status-pending:    var(--palette-blue);
    --invoice-dispatch-status-nottracked: var(--palette-grey);
    --invoice-dispatch-status-sent:       var(--palette-blue);
    --invoice-dispatch-status-intransit:  var(--palette-blue);
    --invoice-dispatch-status-delivered:  var(--palette-green);
    --invoice-dispatch-status-rejected:   var(--palette-red);
    --invoice-dispatch-status-failed:     var(--palette-red);

    /* ── VAT zone (Customer.VatZone) — taxonomy ── */
    --vat-zone-domestic:      var(--palette-blue);
    --vat-zone-eu:            var(--palette-purple);
    --vat-zone-international: var(--palette-teal);

    /* ── VAT interval (Customer.Vatinterval) — taxonomy ── */
    --vat-interval-none:       var(--palette-grey);
    --vat-interval-monthly:    var(--palette-blue);
    --vat-interval-quarterly:  var(--palette-purple);
    --vat-interval-halfyearly: var(--palette-teal);

    /* ── Custom field data type (CustomFieldDefinition.Type) — taxonomy ──
       Int and Double share the numeric teal: they differ in precision, not in kind, and the glyph
       already says which. */
    --custom-field-type-string:   var(--palette-blue);
    --custom-field-type-int:      var(--palette-teal);
    --custom-field-type-double:   var(--palette-teal);
    --custom-field-type-datetime: var(--palette-purple);
    --custom-field-type-guid:     var(--palette-grey);
    --custom-field-type-picklist: var(--palette-amber);

    /* ── Email provider (EmailLog.Provider) ──
       Unknown is grey and is the honest default: only Postmark reports events back, so provider and
       delivery status have to disagree gracefully. */
    --email-provider-unknown:    var(--palette-grey);
    --email-provider-postmark:   var(--palette-blue);
    --email-provider-flowmailer: var(--palette-teal);

    /* ── Email template state (EmailTemplate.IsActive) ──
       A layout has no state of its own — the resolver only reads children — so it is grey rather
       than pretending to be inactive. Inactive is amber, not red: it is a draft, not a failure. */
    --email-template-layout:   var(--palette-grey);
    --email-template-active:   var(--palette-green);
    --email-template-inactive: var(--palette-amber);
    /* Built-in fallback: neither the tenant's own work (green) nor missing (grey) — it is TimeView
       filling the gap, so it borrows the info hue. */
    --email-template-builtin:  var(--palette-blue);

    /* ── Absence type (FlexVacationInfo.Type, TvTask.SpecialTypeDesignator) ──
       One domain, two entities: a task's special-type designator and a flex/vacation row name the
       same six kinds of absence, so they must not drift apart. The "…Sum" members are aggregates of
       the type above them and deliberately reuse its colour — the glyph (sigma) is what says
       "total", the colour says "of what". */
    --absence-type-none:           var(--palette-grey);
    --absence-type-vacation:       var(--palette-blue);
    --absence-type-vacation2:      var(--palette-teal);
    --absence-type-maternityleave: var(--palette-purple);
    --absence-type-lieudays:       var(--palette-amber);
    --absence-type-sickness:       var(--palette-red);

    /* ── Task CAP type (TvTask.CAPType) ──
       An audit-independence classification, so it reads as a permission: green allowed, red
       prohibited. None renders no glyph at all and therefore needs no token. */
    --task-captype-auditing:    var(--palette-green);
    --task-captype-nonauditing: var(--palette-blue);
    --task-captype-prohibited:  var(--palette-red);

    /* ── Sales opportunity rating (TvTask.OpRating) ──
       A funnel, not a status: the ramp runs grey → blue → green as the deal advances, with the two
       terminal states breaking out (accepted green, denied red). InProduction is the accent — it has
       left the funnel entirely and is work now. */
    --task-oprating-contact:        var(--palette-grey);
    --task-oprating-meetingplanned: var(--palette-blue);
    --task-oprating-meetingdone:    var(--palette-blue);
    --task-oprating-agreedonquote:  var(--palette-amber);
    --task-oprating-quotesent:      var(--palette-amber);
    --task-oprating-homestretch:    var(--palette-orange);
    --task-oprating-quoteaccepted:  var(--palette-green);
    --task-oprating-quotedenied:    var(--palette-red);
    --task-oprating-inproduction:   var(--palette-accent);

    /* ── Invoice type (Invoice.InvoiceType) ──
       Two axes in one enum: what is billed (aconto = amber, time registrations = blue) and how the
       invoice came about (the glyph). Colour therefore groups the aconto family together and the
       time-registration family together, which is the distinction that matters when scanning. */
    --invoice-type-normal:                     var(--palette-blue);
    --invoice-type-aconto:                     var(--palette-amber);
    --invoice-type-recurring-template-aconto:  var(--palette-amber);
    --invoice-type-recurring-template-timereg: var(--palette-blue);
    --invoice-type-from-recurring-aconto:      var(--palette-amber);
    --invoice-type-from-recurring-timereg:     var(--palette-blue);
    --invoice-type-from-automatic-timereg:     var(--palette-teal);

    /* ── Invoice line type (InvoiceLine.InvoiceLineType) — taxonomy ──
       Aconto keeps the amber it has on the invoice itself, so a line and its invoice agree. */
    --invoice-line-type-normal:                var(--palette-blue);
    --invoice-line-type-aconto:                var(--palette-amber);
    --invoice-line-type-recurring:             var(--palette-teal);
    --invoice-line-type-recurring-from-task:   var(--palette-purple);

    /* ── Invoice rule granularity (InvoiceRule.Type) — taxonomy ── */
    --invoice-rule-type-per-line:    var(--palette-blue);
    --invoice-rule-type-per-task:    var(--palette-teal);
    --invoice-rule-type-per-invoice: var(--palette-purple);

    /* ── Report kind (ReportDefinition.Type) — taxonomy ── */
    --report-type-none:          var(--palette-grey);
    --report-type-invoice:       var(--palette-blue);
    --report-type-specification: var(--palette-teal);

    /* ── Standard text kind (StandardText.Type) — taxonomy ── */
    --standard-text-type-invoiceline:  var(--palette-blue);
    --standard-text-type-invoiceemail: var(--palette-teal);

    /* ── Organisational unit kind (TvGroup.GroupType) — taxonomy ──
       Deliberately not a hierarchy ramp: a division is not "better" than a team, and colouring it
       as one invites reading rank into what is only a shape of grouping. */
    --group-type-usergroup:  var(--palette-blue);
    --group-type-department: var(--palette-teal);
    --group-type-team:       var(--palette-green);
    --group-type-division:   var(--palette-purple);
    --group-type-office:     var(--palette-amber);

    /* ── Flex settlement interval (UserContract/UserContractTemplate.FlexInterval) ──
       A duration ramp, not a status: the longer the interval, the further along the hue runs. */
    --flex-interval-weekly:      var(--palette-blue);
    --flex-interval-monthly:     var(--palette-teal);
    --flex-interval-threemonths: var(--palette-green);
    --flex-interval-sixmonths:   var(--palette-amber);
    --flex-interval-twelvemonths: var(--palette-purple);

    /* ── Competence (TvCompetence.CompetenceType, TvUserCompetence.Status) ──
       The type says what kind of qualification it is; the status is a progress ramp that ends in green
       (completed) or red (cancelled). Two separate domains, so one can be re-hued without the other. */
    --competence-type-all:        var(--palette-grey);
    --competence-type-education:  var(--palette-blue);
    --competence-type-course:     var(--palette-teal);
    --competence-type-job:        var(--palette-purple);
    --competence-status-notstarted: var(--palette-grey);
    --competence-status-inprogress: var(--palette-blue);
    --competence-status-completed:  var(--palette-green);
    --competence-status-canceled:   var(--palette-red);

    /* ── Tier 2: time-reg schema pin affordances (TimeRegSchema) ──
       Not a status domain: these are chrome. --pin-toggle stays a neutral, because it also draws the
       ring on the topbar's *primary-blue* quick-add toggle, where a coloured ring would be
       accent-on-accent and vanish.
       The row glyphs get their own pair. Unpinned is the info blue on the outline glyph: coloured
       enough to read at 18px, but the outline keeps its visual weight below the pinned state.
       Pinned is orange — a warm hue no other schema affordance uses, so a pinned row is spotted
       without reading the icon and never confused with today's blue column or a primary button.
       Orange is an explicit hex rather than --palette-amber because amber inherits the theme's
       warning colour, which on light themes is a pale yellow that all but disappears on white. */
    --pin-toggle: var(--color-sf-content-text-color, #e0e0e0);
    --pin-toggle-pinned: var(--palette-accent);
    --pin-glyph: var(--palette-blue);
    --pin-glyph-pinned: var(--palette-orange);

    /* ── Tier 2: planning grid domain (PlanningGrid) ──
       Restricted-row label/glyph is a muted neutral, not a status color - it signals "hidden by
       design", not good/bad/pending. Rejected/pending/receipt cell accents reuse the generic
       indicator tokens above rather than inventing a parallel red/blue/green. */
    --planning-restricted: var(--palette-grey);
    --planning-inactive-customer: var(--indicator-warning);
    /* The same signal on the customer's name. A separate token because the one above is a fill and
       border colour; as text it was pale yellow on white (#1174). */
    --planning-inactive-customer-text: var(--indicator-warning-text);
    /* Hours planned onto zero capacity (#752). Bad rather than warning, and deliberately not the same
       token as the peak's amber: the peak is a gradient worth a look, this is work nobody can do. */
    --planning-uncovered: var(--indicator-bad);
    /* Planned hours left on an employee who has already left (#759). Bad rather than warning, and for
       the same reason as --planning-uncovered above: an inactive customer is work that may be
       misdirected, this is work nobody is going to do. Shares the token with the row badge so the
       banner and the rows it points at read as one signal. */
    --planning-departed-employee: var(--indicator-bad);
    --planning-cell-pending: var(--indicator-neutral);
    --planning-cell-rejected: var(--indicator-bad);
    --planning-cell-receipt: var(--indicator-good);
    /* Another planner changed this cell (#900). Warning rather than bad: the change is legitimate and
       may well be the better figure - what needs attention is that it was not this user who made it.
       Kept distinct from --planning-cell-rejected, which means the server refused a write. */
    --planning-cell-remote-changed: var(--indicator-warning);

    /* -- Tier 2: planning capacity scale (PlanningCapacityCell, #575/#576/#577) --
       Five bands diverging around 100 %: below is spare capacity, around 100 % is balance, above is
       overbooked. Both ends are problems and the middle is the healthy one, which is why this is a
       diverging scale and not the sequential --indicator-* good-to-bad set.

       The outer bands reuse the primitives so they track the theme, matching the mockup's own blue
       and red. The two inboard tints are explicit rgba rather than a color-mix() of those primitives,
       for the reason documented on --timereg-today-tint below: color-mix() over var(--color-sf-*)
       resolves to an invalid colour on themes that expose those as bare RGB triplets (Material 3),
       which drops the fill entirely instead of degrading. The channels are the mockup's #d03b3b and
       #256abf at the alpha its light tints imply.

       The balance band is deliberately NOT one of the mockup's near-white/near-black pair. Freezing
       #f0efec here would paint a near-white fill on the dark theme - the exact failure the
       --tv-color-text-secondary comment above records having fixed. Deriving it from currentColor
       tracks every theme, and currentColor-based color-mix() is safe on Material 3 because it reads
       no --color-sf-* variable. */
    --planning-load-over: var(--palette-red);
    --planning-load-over-soft: rgba(208, 59, 59, 0.28);
    --planning-load-mid: var(--tv-surface-alt);
    --planning-load-spare-soft: rgba(38, 106, 191, 0.28);
    --planning-load-spare: var(--palette-blue);

    /* The same five bands as a graphical mark: the load bar in PlanningCapacityCell (#1175). A set of
       its own because the tints above are backgrounds behind text (CustomerReadingCell, NormPanel)
       and must stay pale, while a bar is the mark itself and needs 3:1 against the surface it sits
       on. The tints failed that as bars on light: 1.16 (mid), 1.46-1.49 (soft), 1.80 (the theme's
       info cyan), measured 25-09-2026.

       Every band is mixed with currentColor, which is dark text on light and light text on dark, so
       one declaration pushes each hue away from the background in both themes - no dark branch.
       Mid is the text colour itself at 60 %, i.e. a neutral grey. The soft bands sit halfway between
       their hue and that grey: less saturated rather than paler, because paler is exactly what lost
       the contrast. The hues are the mockup's #d03b3b / #256abf, written out rather than read from
       --palette-red/-blue, for the Material 3 color-mix() reason given above.

       Sized for the page as well as for a table: the Team overview table has its own surface, but
       the Cross card's heatmap and the Totals / Find-quickly chevrons sit on the tinted page. 85 %
       hue (the first cut) left spare at 2.98 on the dark page; 75 % clears every surface.
       Measured in the running app (28-09-2026), painted colour against the composited background:
                     light table  light page  dark table  dark page
         over           6.65         5.26        4.30        3.55
         over-soft      5.63         4.81        4.55        3.89
         mid            4.18         3.84        5.23        4.63
         spare-soft     5.56         4.76        4.64        3.97
         spare          7.07         5.60        4.21        3.48
       (tables #fff / #212529, pages #e5e5e5 / #2f3336.) */
    --planning-load-bar-over: color-mix(in srgb, #d03b3b 75%, currentColor);
    --planning-load-bar-mid: color-mix(in srgb, currentColor 60%, transparent);
    --planning-load-bar-spare: color-mix(in srgb, #256abf 75%, currentColor);
    --planning-load-bar-over-soft: color-mix(in srgb, var(--planning-load-bar-over) 50%, var(--planning-load-bar-mid));
    --planning-load-bar-spare-soft: color-mix(in srgb, var(--planning-load-bar-spare) 50%, var(--planning-load-bar-mid));

    /* -- Tier 2: Mit dashboard's "Luft/mangler" figures (#2010) --
       Text, unlike the bar tones above (4.21 / 4.30 on the dark table, under the 4.5:1 text floor), so
       they point at the text-grade tokens: the theme's primary text tint for luft (~12:1 light, 7.68:1
       dark) and the danger-message text colour for mangler (#842029 light, #ea868f dark). */
    --planning-slack-spare-text: var(--tv-accent-text);
    --planning-slack-short-text: var(--indicator-bad-text);

    /* -- Tier 2: planning charts (MyDashboard, Totals; #1179) --
       Chart lines are graphical marks and need 3:1 against the panel on both themes. The raw
       --chart-series-* ramp cannot give that: brand blue is 2.69 on dark and dark blue 1.29, and the
       Syncfusion default palette drew the second division in a grey that all but vanished on dark.
       The same currentColor trick as the load bars above: mixing each hue with the text colour pushes
       it away from the background in both themes from one declaration. 65 % is the most hue that
       still clears every surface for all five (worst case: blue 3.91 on the dark page #2f3336, orange-
       deep's lightest 3.8 on light). Every hue is a literal primitive (brand-* / palette-orange*),
       never a --color-sf-* triplet, for the Material 3 color-mix() reason given above.

       Totaler's divisions carry no meaning, so they take the brand ramp in legibility order, with
       orange-deep in third place because turquoise beside coolgreen is two teals. MyDashboard keeps
       the module's orange (planned) / blue (realised) identity; its dash pattern still carries the
       plan-versus-fact distinction for colour-blind readers. */
    --planning-chart-series-1: color-mix(in srgb, var(--brand-blue) 65%, currentColor);
    --planning-chart-series-2: color-mix(in srgb, var(--brand-coolgreen) 65%, currentColor);
    --planning-chart-series-3: color-mix(in srgb, var(--palette-orange-deep) 65%, currentColor);
    --planning-chart-series-4: color-mix(in srgb, var(--brand-turquoise) 65%, currentColor);
    --planning-chart-series-5: color-mix(in srgb, var(--brand-green) 65%, currentColor);
    --planning-chart-planned: color-mix(in srgb, var(--palette-orange) 65%, currentColor);
    --planning-chart-realised: var(--planning-chart-series-1);
    /* "Planlagt overarbejde", stacked on the neutral norm in MyDashboard's remaining-window bars
       (#1813): a hue of its own, apart from both the neutral norm below it and the orange plan beside it. */
    --planning-chart-overtime: var(--planning-chart-series-2);
    /* MyDashboard's "I dag" and "Deadline" markers (#1582): reference lines, not data, so they stay
       neutral and leave the hues to the two series. */
    --planning-chart-marker: var(--tv-color-text-secondary);

    /* ── Tier 2: time registration schema — today's column ──
       Today is a navigational cue, not a status, so it must not collide with the approval
       colours the schema already paints onto day headers.
       The tint is written as an explicit rgba rather than derived from --palette-blue with
       color-mix()/relative-colour syntax: those resolve to an invalid colour on themes that
       define --color-sf-* as bare RGB triplets (Material 3), which would silently drop the
       highlight entirely rather than degrade. */
    --timereg-today-accent: var(--palette-blue);
    --timereg-today-tint: rgba(77, 173, 255, 0.12);

    /* Drag & drop of hours between days in the schema. The "over" tint is written as an explicit
       rgba rather than a colour-mix of the primitive: it sits behind the cell's textbox, so it has
       to stay translucent no matter which theme resolves --palette-blue. */
    --timereg-drop-valid: var(--palette-blue);
    --timereg-drop-over: rgba(77, 173, 255, 0.22);

    /* ── Tier 2: notifications (toasts + error dialog) ──
       Toasts sit in the bottom-left corner, flush to the edge: they deliberately overlay the
       navigation when it is open, which the stacking scale below permits (toast 1300 > sidebar 1001).
       Colours point at the Tier-1 primitives, which inherit from the active Syncfusion theme, so the
       accent of a toast matches the rest of the app instead of a second hardcoded palette. */
    --tv-toast-offset-block: 1.25rem;
    --tv-toast-offset-inline: 0;

    /* Toast surfaces are mixed from the accent into the *theme's* own toast background, so light,
       dark and high contrast all work from one declaration — no parallel [data-theme] block.
       The mix stays opaque: a translucent toast would show the page through it and wreck contrast. */
    --notification-info-accent: var(--palette-blue);
    --notification-info-surface: color-mix(in srgb, var(--notification-info-accent) 14%, var(--color-sf-content-bg-color, #fff));
    --notification-success-accent: var(--palette-green);
    --notification-success-surface: color-mix(in srgb, var(--notification-success-accent) 14%, var(--color-sf-content-bg-color, #fff));
    --notification-warning-accent: var(--palette-amber);
    --notification-warning-surface: color-mix(in srgb, var(--notification-warning-accent) 16%, var(--color-sf-content-bg-color, #fff));
    --notification-error-accent: var(--palette-red);
    --notification-error-surface: color-mix(in srgb, var(--notification-error-accent) 14%, var(--color-sf-content-bg-color, #fff));

    /* Fremdriftsringen on "Mangler at blive planlagt" (#573). Both are set explicitly because
       Syncfusion writes the circular ring's colours as SVG *presentation attributes*
       (stroke="#E9ECEF" / "#007bff") rather than taking them from the theme stylesheet - so an
       unstyled ring renders a near-white track on the dark theme's #1e1e1e panel, where the empty
       portion is the loudest thing on the row and a 0% ring reads as a full one. */
    --planning-progress-ring: var(--palette-accent);
    --planning-progress-track: var(--color-sf-border, #495057);

    /* ── Tier 2: file-type glyphs (DMS document list) ──
       Vendor brand hues (Word/Excel/PDF) plus generic image/archive accents;
       no Tier-1 semantic match exists for these, so they stay explicit hex. */
    --filetype-word:    #2b579a;
    --filetype-excel:   #217346;
    --filetype-powerpoint: #d24726;
    --filetype-pdf:     #d93025;
    --filetype-email:   #0072c6;
    --filetype-image:   #8e44ad;
    --filetype-archive: #f39c12;

    /* ── Tier 2: inline code and code blocks (AI chat, markdown output) ──
       A code block keeps a dark surface on light themes too — that is the near-universal
       convention for syntax-highlighted output and is deliberate, like the file-type brand hues
       above. Inline code, by contrast, is a wash over the surrounding text and does follow the
       theme. Both were previously hardcoded in theme-overrides.css with a duplicate dark branch. */
    --tv-code-surface: var(--tv-surface-alt);
    --tv-code-block-surface: #1e1e1e;
    --tv-code-block-text: #d4d4d4;

    /* Form validation / error accents. Carried the Blazor template default (#e50000) as a third
       competing red; theme-overrides.css redefined the same name at :root and, loading later,
       always won — so this value never rendered. Single definition, on the palette. */
    --color-danger: var(--palette-red);
    --color-danger-light: color-mix(in srgb, var(--color-danger) 12%, transparent);

    /* ── Stacking order for app chrome ──
       The sticky TopBar sits at 1000 and the main-layout sidebar is lifted to
       1001 (see theme-overrides.css) so it covers the TopBar on mobile. The AI
       chat slide-over must clear the sidebar — expanded, it spans the full
       viewport width. A modal dialog must clear everything, so it is
       deliberately defined one band above both.
       Toasts sit *above* ordinary dialogs, not below: several screens (the mobile time-tracking
       timer, for one) are themselves modal dialogs, and a toast they raise would otherwise render
       behind their own overlay. The error dialog then has to clear the toasts too, so an exception
       is never hidden behind the notification reporting it. */
    --tv-z-topbar: 1000;
    /* The layout sidebar must cover the sticky TopBar on mobile, where its type is Over. */
    --tv-z-sidebar: 1001;
    --tv-z-chat-panel: 1050;
    --tv-z-dialog: 1100;
    /* Full-screen app overlays (mobile global search, planning grid busy shade). */
    --tv-z-overlay: 1200;
    --tv-z-toast: 1300;
    --tv-z-error-dialog: 1400;

    /* ── Dialog widths ──
       Every dialog picks one of these instead of a px width: fixed px widths overflow phones,
       and each dialog drifted to its own number. The min() keeps a gutter on small screens. */
    /* Confirms and small pickers. */
    --tv-dialog-sm: min(26rem, 92 * var(--tv-vw));
    /* Forms (e.g. the DMS upload dialog). */
    --tv-dialog-md: min(44rem, 92 * var(--tv-vw));
    /* Wizards and previews. */
    --tv-dialog-lg: min(64rem, 95 * var(--tv-vw));
    /* Previews/editors that need the whole screen (DMS merge preview step). */
    --tv-dialog-full: calc(92 * var(--tv-vw));
    /* The tallest a scrolling list in a dialog body gets (the group and multi pickers), so the
       footer stays in view however many options there are. */
    --tv-dialog-list-max-height: min(24rem, 50 * var(--tv-vh));
}
