/* ==========================================================================
   asap — application design system
   --------------------------------------------------------------------------
   One source of truth for colour, type, spacing, elevation and the app shell.

   Load order matters: this file comes AFTER the Telerik theme, so the
   `--kendo-*` bridge below wins the cascade. Telerik derives every hover,
   active, subtle and "on" colour from a handful of base tokens with relative
   OKLCH, so re-branding the whole component library means changing
   `--asap-brand` once.

   Theme: js/theme.js stamps `data-theme="light|dark"` on <html> before first
   paint. Dark mode redefines the `--asap-*` tokens only; everything else
   references them.

   Mixing a tone with an opaque neutral (a tinted banner, a status edge) goes
   `in oklab`: `in oklch` takes the shorter hue arc to the neutral's own hue, so
   amber on graphite turns blue-grey and a tint towards white turns pink. Mixes
   with `transparent` keep the tone's hue either way.
   ========================================================================== */


/* 0. Type face ------------------------------------------------------------- */

/* Mona Sans (github.com/github/mona-sans, v2.0.27, SIL Open Font License: fonts/mona-sans/OFL.txt),
   self-hosted: one variable file with the weight (200..900), width (75..125 %) and optical size
   axes, and its italic. The host pages preload the upright one, so the first paint already has
   it. The URL is relative to this file, which the host pages serve from
   _content/asapWebApplication.Shared/. */
@font-face {
    font-family: "Mona Sans";
    src: url("fonts/mona-sans/MonaSansVF[wdth,opsz,wght].woff2") format("woff2-variations"),
         url("fonts/mona-sans/MonaSansVF[wdth,opsz,wght].woff2") format("woff2");
    font-weight: 200 900;
    font-stretch: 75% 125%;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Mona Sans";
    src: url("fonts/mona-sans/MonaSansVF-Italic[wdth,opsz,wght].woff2") format("woff2-variations"),
         url("fonts/mona-sans/MonaSansVF-Italic[wdth,opsz,wght].woff2") format("woff2");
    font-weight: 200 900;
    font-stretch: 75% 125%;
    font-style: italic;
    font-display: swap;
}

/* Material Symbols Outlined (fonts.google.com/icons, v382 as Google Fonts served it, Apache License
   2.0: fonts/material-symbols/LICENSE.txt), self-hosted: the whole set with its fill, weight, grade
   and optical size axes. The icons are named by the host and the data (a footer button's glyph),
   so no subset would hold them all. Served from the app, not from Google: a page load sends no
   address to a third party, and the icons draw without the internet. "block": until the face is
   there an icon is blank, never its name spelled out. The class is what Google's stylesheet gave
   with it; the size and the axes are below (.material-symbols-outlined). */
@font-face {
    font-family: "Material Symbols Outlined";
    src: url("fonts/material-symbols/MaterialSymbolsOutlined.woff2") format("woff2");
    font-weight: 100 700;
    font-style: normal;
    font-display: block;
}

.material-symbols-outlined {
    font-family: "Material Symbols Outlined";
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
}


/* 1. Tokens ---------------------------------------------------------------- */

:root {
    color-scheme: light;

    /* Signal (DARK-THEME-SIGNAL.md): true-neutral greys and one accent, kept rare in both themes:
       the primary key, the current place, selection, focus and links; whatever is merely "on"
       lifts in grey. Light's accent is the logo's cobalt, dark's the logo's signal orange (dark
       block). --asap-brand and --asap-brand-strong are the INK; the -fill tokens sit behind ink
       (--asap-on-brand). */
    --asap-brand: oklch(50% 0.21 263);
    --asap-brand-strong: oklch(43% 0.2 263);
    --asap-brand-soft: color-mix(in oklch, var(--asap-brand) 10%, transparent);
    /* In light the fill is the ink itself, deeper under the pointer and pressed; white on it
       holds 6:1 or more. */
    --asap-brand-fill: var(--asap-brand);
    --asap-brand-fill-hover: var(--asap-brand-strong);
    --asap-brand-fill-active: var(--asap-brand-strong);
    --asap-on-brand: #ffffff;
    /* signal orange in light: the "speed" cues (logo chevron, favourites, the loading bar) */
    --asap-accent: oklch(69% 0.19 45);

    /* The logo is artwork: the same cobalt square and orange chevron in both themes. */
    --asap-logo-fill: oklch(50% 0.21 263);
    --asap-logo-chevron: oklch(69% 0.19 45);

    /* surfaces: canvas < surface (cards) ; surface-2 (headers) ; surface-3 (hover) */
    --asap-canvas: oklch(97.2% 0 0);
    --asap-surface: oklch(100% 0 0);
    --asap-surface-2: oklch(98.4% 0 0);
    --asap-surface-3: oklch(95.2% 0 0);
    --asap-field-bg: oklch(100% 0 0);
    --asap-border: oklch(90% 0 0);
    --asap-border-strong: oklch(82.5% 0 0);

    /* The sidebar, its brand row and footer: the chassis the workspace is set into (section 6).
       A step below the canvas, so the workspace is the lighter, raised sheet in both themes. */
    --asap-chassis: oklch(94.4% 0 0);
    /* a row under the pointer on the chassis: darker than it in light, lighter in dark */
    --asap-chassis-hover: oklch(90.8% 0 0);
    /* the quiet ink a notch deeper, to keep 4.5:1 on the grey chassis and its hover */
    --asap-chassis-text-3: oklch(49.5% 0 0);
    /* The workspace frame's edge and shadow. */
    --asap-frame-edge: var(--asap-border);
    --asap-frame-shadow: 0 1px 2px oklch(20% 0 0 / 0.05), 0 12px 32px -16px oklch(20% 0 0 / 0.14);
    /* The highlight a lit surface carries on its top edge. Light is lit by its white and a
       shadow; only dark draws it. */
    --asap-lit: transparent;
    --asap-lit-raised: transparent;

    /* Kendo's base buttons (the grid's row buttons, dialog buttons) */
    --asap-control: var(--asap-surface-3);
    /* the hover of a secondary button resting on surface-2 (action bar, grid toolbar) */
    --asap-action-hover: var(--asap-surface);
    /* an editor's edge */
    --asap-field-border: var(--asap-border-strong);
    --asap-field-border-hover: var(--asap-border-strong);
    /* the edge of a control drawn by its edge alone (an unchecked checkbox): 3:1 on white
       and on the hover grey */
    --asap-control-border: oklch(60% 0 0);

    /* ink */
    --asap-text: oklch(22% 0 0);
    --asap-text-2: oklch(45% 0 0);
    /* still the quietest step, but readable: 4.6:1 on the hover grey */
    --asap-text-3: oklch(53% 0 0);

    /* semantic */
    --asap-success: oklch(58% 0.15 155);
    --asap-warning: oklch(76% 0.16 75);
    --asap-danger: oklch(58% 0.2 25);
    --asap-info: oklch(60% 0.13 235);
    /* danger as a fill behind white type (below); the steps repeat Kendo's own light
       error-hover/-active */
    --asap-danger-fill-hover: oklch(from var(--asap-danger) calc(l - 0.0662) calc(c - 0.0245) h);
    --asap-danger-fill-active: oklch(from var(--asap-danger) calc(l - 0.0892) calc(c - 0.0325) h);

    /* the focus ring: 70% of the brand holds 3:1 on white and on the hover grey */
    --asap-ring: color-mix(in oklab, var(--asap-brand) 70%, transparent);
    --asap-shadow-1: 0 1px 2px oklch(20% 0 0 / 0.05), 0 1px 3px oklch(20% 0 0 / 0.07);
    --asap-shadow-2: 0 4px 14px oklch(20% 0 0 / 0.08), 0 1px 3px oklch(20% 0 0 / 0.06);
    --asap-shadow-3: 0 20px 50px oklch(20% 0 0 / 0.18), 0 4px 10px oklch(20% 0 0 / 0.08);
    /* Roles the two themes fill differently. Each defaults to what light uses, so
       the dark block below only has to say where dark departs, and a rule that reads one of
       these needs no theme check of its own.

       fill   a solid behind ink (primary buttons, a checked box, the calendar's day).
              Brand text and links stay on --asap-brand: ink and fill are different jobs.
       mark   a danger colour used as a shape (rail, meter, disc) rather than behind white ink.
       raised the tone of what floats over the page: popups, windows, menus, the sheet.
       control the boundary of an input, which has to be seen, unlike a card's hairline. */
    --asap-danger-fill: oklch(53% 0.2 25);
    --asap-danger-mark: oklch(53% 0.2 25);
    /* tint  how much of a status colour a soft face mixes into the surface: an urgent row or the
             head of an acknowledged urgent message (danger), the head of an urgent message still
             waiting, the offline line (warning). Shares, not colours, so each use names its own
             surface: color-mix(in srgb, var(--asap-danger) var(--asap-tint-danger), var(--asap-surface)).
             Dark mixes more red into its darker surfaces and less of its brighter yellow. */
    --asap-tint-danger: 13%;
    --asap-tint-warning: 20%;

    --asap-border-control: var(--asap-border-strong);
    --asap-border-control-hover: var(--asap-border-strong);

    --asap-surface-raised: var(--asap-surface);
    --asap-surface-raised-2: var(--asap-surface-2);
    --asap-surface-raised-3: var(--asap-surface-3);
    --asap-border-raised: var(--asap-border);

    /* What a control becomes under the pointer and under a press: lighter than at rest in both
       themes (light's surface is the lightest step, dark's the darkest, so they differ). */
    --asap-surface-hover: var(--asap-surface);
    --asap-surface-active: var(--asap-surface-3);

    /* Whatever depends on the surface tones has a raised counterpart. A custom property is
       resolved where it is declared and inherited as that value, so the raised scope (section 2)
       cannot get these from the rebound tones; it points the names at these instead. Light has
       no raised tone, so each is the base token. */
    --asap-surface-raised-hover: var(--asap-surface-hover);
    --asap-surface-raised-active: var(--asap-surface-active);
    --asap-row-alt-raised: var(--asap-row-alt);
    --asap-brand-raised: var(--asap-brand);
    --asap-text-3-raised: var(--asap-text-3);
    --asap-border-control-raised: var(--asap-border-control);
    --asap-border-control-hover-raised: var(--asap-border-control-hover);

    /* behind modal layers: the drawer, the sheet, Telerik windows */
    --asap-scrim: oklch(15% 0 0 / 0.5);
    --asap-scrim-veil: oklch(from var(--asap-scrim) l c h / 0.5);
    /* Under the centred program search: the page stays readable, calmed (lighter than a scrim). */
    --asap-veil: color-mix(in oklch, var(--asap-canvas) 55%, transparent);
    --asap-row-alt: color-mix(in oklch, var(--asap-surface-2) 60%, transparent);
    --asap-row-selected: color-mix(in srgb, var(--asap-brand) 25%, transparent);
    /* selected text */
    --asap-selection: color-mix(in oklab, var(--asap-brand) 20%, transparent);
    --asap-scrollbar: var(--asap-border-strong);
    /* the key hint inside a solid key: a dark inset under white ink (light), a light wash under
       dark ink (dark) */
    --asap-onfill-chip: oklch(0% 0 0 / 0.22);
    --asap-onfill-chip-edge: oklch(100% 0 0 / 0.12);

    /* The rare accent's stand-ins (DARK-THEME-SIGNAL.md D3, D4): what is merely "on" is drawn in
       these greys, not in the brand.
       calm      the brand inside a cockpit: meters, in-progress marks, pressed tiles, drawn choices
       key       a list row's default button, a chosen yes/no: a key a step off its siblings
       chip      the wash behind a monogram, a code, the language in use
       meter     a progress bar's fill
       list      a chosen entry in a drop-down: a tint of the accent and its bar */
    --asap-calm: oklch(42% 0 0);
    --asap-calm-strong: oklch(30% 0 0);
    --asap-calm-soft: oklch(0% 0 0 / 0.06);
    --asap-key-default: oklch(87% 0 0);
    --asap-key-default-hover: oklch(83.5% 0 0);
    --asap-key-default-active: oklch(80% 0 0);
    --asap-chip-neutral: oklch(0% 0 0 / 0.06);
    --asap-meter: oklch(45% 0 0);
    --asap-list-selected: color-mix(in oklab, var(--asap-brand) 12%, transparent);
    --asap-list-selected-hover: color-mix(in oklab, var(--asap-brand) 17%, transparent);

    /* The cockpits (Features/Dashboards): a plate's shadow at rest and lifted, and a hover that
       moves a drawn shape one step (darker here, lighter in dark). */
    --asap-plate-shadow: oklch(20% 0 0 / 0.14);
    --asap-plate-lift: oklch(20% 0 0 / 0.24);
    --asap-hover-filter: brightness(0.97);
    /* the chosen one of a segmented choice (the header's form view, the theme, a yes/no field):
       a brand tint with a brand edge and the brand ink in light, a lit grey key in dark */
    --asap-seg-thumb: var(--asap-brand-soft);
    --asap-seg-edge: inset 0 0 0 1px color-mix(in oklch, var(--asap-brand) 28%, transparent);
    --asap-seg-ink: var(--asap-brand);

    /* A floor plan is a drawing, and the host's drawings are light. In the dark theme it stays a
       sheet of paper (--plan-sheet) rather than a grey slab; the veil only calms the drawing so
       the plates win against it. Plates keep a dark edge (--plan-halo) and the ring is deep
       enough to be seen on paper. */
    --plan-sheet: transparent;
    --plan-veil: color-mix(in oklch, var(--asap-canvas) 45%, transparent);
    --plan-rule: color-mix(in srgb, var(--asap-border) 62%, transparent);
    --plan-ring: var(--asap-ring);
    --plan-halo: transparent;
    --asap-radius-xs: 4px;
    --asap-radius-sm: 6px;
    --asap-radius: 8px;
    --asap-radius-lg: 12px;
    --asap-radius-xl: 16px;
    --asap-radius-full: 999px;

    /* One family for everything (section 0). The grid sizes its columns from this face's glyph
       widths (GridFontMetrics.cs): a change of face or of the grid's type means measuring again. */
    --asap-font-ui: "Mona Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --asap-font-display: var(--asap-font-ui);
    --asap-font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

    /* Material Symbols grade: light glyphs on dark render heavier than dark on white; a
       negative grade thins them without changing their width (dark block). */
    --asap-icon-grad: 0;

    /* the logo's deep chevron on the always-dark sign-in panel: artwork, the same in both themes */
    --asap-logo-deep: oklch(43% 0.2 263);

    /* The sidebar has one width, so opening a folder never reflows the page next to it.
       Program names wrap to two lines instead of widening it; dragging its edge sets a
       different width (theme.js keeps it as an inline value of this token on <html>). */
    --asap-sidebar-w: 296px;
    /* The folded sidebar on a desktop (the rail). */
    --asap-rail-w: 56px;
    --asap-header-h: 56px;

    /* The program tree's grid. Sticky folder heads stack in multiples of the row height,
       and the skeleton draws on the same grid, so density changes go through these only. */
    --asap-tree-row-h: 30px;
    --asap-tree-indent: 20px;
    --asap-edge-shadow: 0 8px 12px -10px oklch(20% 0 0 / 0.45);

    --asap-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --asap-dur-fast: 120ms;
    --asap-dur: 220ms;
    --asap-dur-slow: 360ms;
}

/* Signal (DARK-THEME-SIGNAL.md): true-neutral greys and one accent, the logo's signal orange.
   The accent is rare: the primary key, the current place, selection, focus and links; everything
   that is merely "on" lifts in grey. Orange carries dark ink, not white. --asap-brand and
   --asap-brand-strong are the INK (text, icons, focus, the current item, tints); the -fill tokens
   sit behind ink. Caution is yellow here, so orange never reads as "attention". */
:root[data-theme="dark"] {
    color-scheme: dark;

    --asap-brand: oklch(75% 0.16 54);
    --asap-brand-strong: oklch(83% 0.115 60);
    --asap-brand-soft: color-mix(in oklab, var(--asap-brand) 12%, transparent);
    /* Dark ink on the fill holds 7.7:1 at rest, 8.6:1 under the pointer, 6.2:1 pressed. Hover is
       lighter and press deeper, as on every key in this theme. */
    --asap-brand-fill: oklch(72% 0.17 50);
    --asap-brand-fill-hover: oklch(76.5% 0.16 53);
    --asap-brand-fill-active: oklch(67% 0.17 47);
    --asap-on-brand: oklch(17% 0.02 50);
    --asap-accent: oklch(75% 0.16 54);
    --asap-icon-grad: -25;

    /* chassis (sidebar, brand row, footer) < field (a recessed well) < canvas (the workspace) <
       surface (cards) < surface-2 (header strips) < raised (popups, menus, windows, the sheet) <
       surface-3 (hover) < control (Kendo's base buttons). Every step is at least 6 sRGB levels, so
       it survives a 16-bit Remote Desktop session. Inside floating layers the surface tokens move
       up to the raised ones (section 2). */
    --asap-chassis: oklch(11.8% 0 0);
    --asap-chassis-hover: oklch(25.4% 0 0);
    --asap-chassis-text-3: var(--asap-text-3);
    --asap-field-bg: oklch(13.2% 0 0);
    --asap-canvas: oklch(15% 0 0);
    --asap-surface: oklch(19% 0 0);
    --asap-surface-2: oklch(21.6% 0 0);
    --asap-surface-3: oklch(25.4% 0 0);
    --asap-control: oklch(28.5% 0 0);
    /* secondary keys rest on surface-2; hover must lift, not sink to the bar colour */
    --asap-action-hover: oklch(from var(--asap-surface-2) calc(l + 0.05) c h);
    --asap-border: oklch(100% 0 0 / 0.075);
    --asap-border-strong: oklch(100% 0 0 / 0.14);

    /* Light from above: a lit surface carries this on its top edge (section 2). A floating layer
       is nearer the light, so its edge catches more. */
    --asap-lit: oklch(100% 0 0 / 0.06);
    --asap-lit-raised: oklch(100% 0 0 / 0.09);
    --asap-frame-edge: oklch(100% 0 0 / 0.07);
    --asap-frame-shadow: 0 30px 60px -30px oklch(0% 0 0 / 0.8);

    /* A sunken well with a soft edge (2.3:1 on a card); focus carries the strong orange ring, so
       dense forms stay calm. */
    --asap-field-border: oklch(43% 0 0);
    --asap-field-border-hover: oklch(52% 0 0);
    --asap-control-border: oklch(56% 0 0);
    /* A cockpit control's edge at 3:1 or more on every surface step. */
    --asap-border-control: oklch(100% 0 0 / 0.36);
    --asap-border-control-hover: oklch(100% 0 0 / 0.55);

    /* off-white, so a full shift on a dark screen does not halate; text-3 holds 4.6:1 on the
       hover grey */
    --asap-text: oklch(95% 0 0);
    --asap-text-2: oklch(75% 0 0);
    --asap-text-3: oklch(63.5% 0 0);

    /* semantic inks for text, icons and edges; danger also comes as a fill for white type */
    --asap-success: oklch(72% 0.15 155);
    /* yellow, not amber: hue 85 keeps its dark tints gold rather than olive */
    --asap-warning: oklch(86% 0.15 85);
    --asap-danger: oklch(68% 0.18 25);
    --asap-info: oklch(74% 0.09 240);
    /* White on it is 5.8:1. As a shape on a card it would be 3.0:1, so marks use the text red. */
    --asap-danger-fill: oklch(53% 0.18 25);
    --asap-danger-fill-hover: oklch(57% 0.18 25);
    --asap-danger-fill-active: oklch(49% 0.18 25);
    --asap-danger-mark: var(--asap-danger);
    --asap-tint-danger: 24%;
    --asap-tint-warning: 16%;

    /* The ring is the accent itself: 7:1 on the workspace, 5:1 on the lightest raised step. */
    --asap-ring: oklch(75% 0.16 54 / 0.95);
    --asap-edge-shadow: 0 8px 12px -10px oklch(0% 0 0 / 0.8);
    /* Each elevation carries the lit top edge, so whatever is raised (cards, keys, popups,
       windows) catches the light the same way. */
    --asap-shadow-1: inset 0 1px 0 var(--asap-lit), 0 1px 2px oklch(0% 0 0 / 0.4), 0 1px 3px oklch(0% 0 0 / 0.3);
    --asap-shadow-2: inset 0 1px 0 var(--asap-lit), 0 4px 14px oklch(0% 0 0 / 0.45), 0 1px 3px oklch(0% 0 0 / 0.3);
    --asap-shadow-3: inset 0 1px 0 var(--asap-lit-raised), 0 24px 56px -12px oklch(0% 0 0 / 0.75), 0 4px 10px oklch(0% 0 0 / 0.35);

    /* Tone is what lifts a surface on a dark canvas, since a black shadow cannot show on it. */
    --asap-surface-raised: oklch(23.4% 0 0);
    --asap-surface-raised-2: oklch(26.2% 0 0);
    --asap-surface-raised-3: oklch(29.6% 0 0);
    --asap-border-raised: oklch(100% 0 0 / 0.12);

    --asap-surface-hover: var(--asap-surface-3);
    --asap-surface-active: oklch(28% 0 0);
    --asap-surface-raised-hover: var(--asap-surface-raised-3);
    --asap-surface-raised-active: oklch(33% 0 0);
    --asap-row-alt-raised: var(--asap-surface-raised-2);
    /* On the lighter step the brand text, the quiet ink and a field's edge each need a notch more
       to keep their contrast. */
    --asap-brand-raised: var(--asap-brand-strong);
    --asap-text-3-raised: var(--asap-text-2);
    --asap-border-control-raised: oklch(100% 0 0 / 0.42);
    --asap-border-control-hover-raised: oklch(100% 0 0 / 0.6);

    /* A scrim cannot make a dark canvas visibly darker, so a window stands off by its own tone and
       edge; the scrim is what dims the page behind it. */
    --asap-scrim: oklch(5% 0 0 / 0.74);
    --asap-scrim-veil: oklch(from var(--asap-scrim) l c h / 0.62);
    --asap-veil: oklch(8% 0.004 250 / 0.5);
    --asap-row-alt: var(--asap-surface-2);
    --asap-row-selected: color-mix(in srgb, var(--asap-brand) 16%, transparent);
    --asap-selection: color-mix(in oklab, var(--asap-brand) 35%, transparent);
    --asap-scrollbar: oklch(100% 0 0 / 0.26);
    --asap-onfill-chip: oklch(100% 0 0 / 0.3);
    --asap-onfill-chip-edge: oklch(0% 0 0 / 0.12);

    /* The rare accent's stand-ins (light block): lit greys here, a step above their surround. */
    --asap-calm: oklch(88% 0 0);
    --asap-calm-strong: oklch(95% 0 0);
    --asap-calm-soft: oklch(100% 0 0 / 0.08);
    --asap-key-default: oklch(38.5% 0 0);
    --asap-key-default-hover: oklch(43.5% 0 0);
    --asap-key-default-active: oklch(34.5% 0 0);
    --asap-chip-neutral: oklch(100% 0 0 / 0.09);
    --asap-meter: oklch(82% 0 0);
    --asap-list-selected: color-mix(in oklab, var(--asap-brand) 20%, transparent);
    --asap-list-selected-hover: color-mix(in oklab, var(--asap-brand) 26%, transparent);

    --asap-plate-shadow: oklch(0% 0 0 / 0.5);
    --asap-plate-lift: oklch(0% 0 0 / 0.6);
    --asap-hover-filter: brightness(1.14);
    /* A choice that is merely "on" lifts in grey and takes the full ink, not the accent. */
    --asap-seg-thumb: oklch(29% 0 0);
    --asap-seg-edge: var(--asap-shadow-1), 0 0 0 1px var(--asap-border);
    --asap-seg-ink: var(--asap-text);

    --plan-sheet: oklch(100% 0 0);
    --plan-veil: color-mix(in srgb, oklch(74% 0 0) 55%, transparent);
    --plan-rule: color-mix(in srgb, oklch(40% 0 0) 22%, transparent);
    --plan-ring: oklch(43% 0.2 263);
    --plan-halo: oklch(8% 0 0 / 0.9);
}


/* 2. Telerik bridge ----------------------------------------------------------
   Map the Kendo token set onto ours. Only base tokens are set; Kendo derives
   the rest. The font-size step (16px -> 14px) gives the density an ERP needs. */

:root {
    --kendo-font-family: var(--asap-font-ui);
    --kendo-font-size: 0.875rem;
    --kendo-font-size-md: 0.875rem;
    --kendo-font-size-sm: 0.8125rem;
    --kendo-font-size-xs: 0.75rem;
    --kendo-font-size-lg: 1rem;
    --kendo-font-size-xl: 1.25rem;

    --kendo-border-radius-base: 0.5rem;

    /* Kendo paints --kendo-color-primary as a FILL under on-primary (solid buttons, checked boxes,
       the calendar's day) and reads -on-surface and -emphasis as INK, so each role gets its own
       token: the fill under its ink (white on cobalt, dark on orange), the brand ink for text and
       lines. -emphasis is the
       focus edge of inputs, pickers and checkboxes: the ink, not Kendo's 40 % wash of the fill. */
    --kendo-color-primary: var(--asap-brand-fill);
    --kendo-color-primary-hover: var(--asap-brand-fill-hover);
    --kendo-color-primary-active: var(--asap-brand-fill-active);
    --kendo-color-on-primary: var(--asap-on-brand);
    --kendo-color-primary-on-surface: var(--asap-brand);
    --kendo-color-primary-emphasis: var(--asap-brand);
    --kendo-color-app-surface: var(--asap-surface);
    --kendo-color-on-app-surface: var(--asap-text);
    --kendo-color-surface: var(--asap-surface-2);
    --kendo-color-surface-alt: var(--asap-surface);
    --kendo-color-subtle: var(--asap-text-2);
    --kendo-color-border: var(--asap-border);
    --kendo-color-border-alt: var(--asap-field-border);
    --kendo-color-base: var(--asap-control);

    --kendo-color-success: var(--asap-success);
    --kendo-color-warning: var(--asap-warning);
    --kendo-color-error: var(--asap-danger);
    --kendo-color-info: var(--asap-info);

    --kendo-elevation-1: var(--asap-shadow-1);
    --kendo-elevation-2: var(--asap-shadow-2);
    --kendo-elevation-3: var(--asap-shadow-2);
    --kendo-elevation-4: var(--asap-shadow-3);
    --kendo-elevation-5: var(--asap-shadow-3);

    --kendo-disabled-opacity: 0.55;
}

/* Kendo derives its tones for a light base: hover darkens, "subtle" tints go towards white,
   inverse steps past white and the on-colours clamp to black. In dark they come from our
   tokens. -error is a FILL under on-error and -on-surface its INK, as for the primary. */
:root[data-theme="dark"] {
    /* Danger as a fill behind white ink: Kendo's own pick of ink flips to white below L 70 %,
       which the text red (L 68 %) just misses at 3.1:1, so the fill is the deeper red; on-error
       stays derived (white). -on-surface keeps text and lines on the text red. */
    --kendo-color-error: var(--asap-danger-fill);
    --kendo-color-error-hover: var(--asap-danger-fill-hover);
    --kendo-color-error-active: var(--asap-danger-fill-active);
    --kendo-color-error-on-surface: var(--asap-danger);
    --kendo-color-error-emphasis: oklch(from var(--asap-danger) l c h / 0.4);

    /* the derived clamp puts pure black on the light semantic inks */
    --kendo-color-on-success: var(--asap-canvas);
    --kendo-color-on-warning: var(--asap-canvas);
    --kendo-color-on-info: var(--asap-canvas);

    /* Base controls (grid row buttons, dialog buttons, list hover = base) sit one step above
       every row state, and hover and press step lighter. Derived on-base is a bluish L 0.95. */
    --kendo-color-base-hover: oklch(from var(--asap-control) calc(l + 0.04) c h);
    --kendo-color-base-active: oklch(from var(--asap-control) calc(l + 0.08) c h);
    --kendo-color-base-subtle: var(--asap-surface-2);
    --kendo-color-base-subtle-active: oklch(from var(--asap-control) calc(l + 0.04) c h);
    --kendo-color-on-base: var(--asap-text);
    --kendo-color-base-on-surface: var(--asap-text);
    --kendo-color-base-on-subtle: var(--asap-text);

    --kendo-color-primary-subtle: oklch(from var(--asap-brand) 0.30 calc(c * 0.35) h);
    --kendo-color-primary-subtle-hover: oklch(from var(--asap-brand) 0.34 calc(c * 0.40) h);
    --kendo-color-primary-subtle-active: oklch(from var(--asap-brand) 0.38 calc(c * 0.45) h);
    --kendo-color-primary-on-subtle: oklch(from var(--asap-brand) 0.88 calc(c * 0.45) h);

    --kendo-color-info-subtle: oklch(from var(--asap-info) 0.30 calc(c * 0.35) h);
    --kendo-color-info-subtle-hover: oklch(from var(--asap-info) 0.34 calc(c * 0.40) h);
    --kendo-color-info-subtle-active: oklch(from var(--asap-info) 0.38 calc(c * 0.45) h);
    --kendo-color-info-on-subtle: oklch(from var(--asap-info) 0.88 calc(c * 0.45) h);

    --kendo-color-success-subtle: oklch(from var(--asap-success) 0.30 calc(c * 0.35) h);
    --kendo-color-success-subtle-hover: oklch(from var(--asap-success) 0.34 calc(c * 0.40) h);
    --kendo-color-success-subtle-active: oklch(from var(--asap-success) 0.38 calc(c * 0.45) h);
    --kendo-color-success-on-subtle: oklch(from var(--asap-success) 0.88 calc(c * 0.45) h);

    --kendo-color-warning-subtle: oklch(from var(--asap-warning) 0.32 calc(c * 0.35) h);
    --kendo-color-warning-subtle-hover: oklch(from var(--asap-warning) 0.36 calc(c * 0.40) h);
    --kendo-color-warning-subtle-active: oklch(from var(--asap-warning) 0.40 calc(c * 0.45) h);
    --kendo-color-warning-on-subtle: oklch(from var(--asap-warning) 0.90 calc(c * 0.45) h);

    --kendo-color-error-subtle: oklch(from var(--asap-danger) 0.30 calc(c * 0.35) h);
    --kendo-color-error-subtle-hover: oklch(from var(--asap-danger) 0.34 calc(c * 0.40) h);
    --kendo-color-error-subtle-active: oklch(from var(--asap-danger) 0.38 calc(c * 0.45) h);
    --kendo-color-error-on-subtle: oklch(from var(--asap-danger) 0.88 calc(c * 0.45) h);

    /* A tooltip is a dark chip with an edge, not a pale one that glares on a dark page. Kendo
       derives the ink from this (white, 12:1), so -on-inverse is not set here. */
    --kendo-color-inverse: oklch(30% 0 0);
    /* Where inverse is a line or text on the page (the inverse button variants) it stays pale. */
    --kendo-color-inverse-on-surface: oklch(92% 0 0);
}

/* What floats over the page (popups, windows, dialogs, toasts, the sheet, the account menu, the
   error bar) is lifted by tone: a black shadow does not show on a dark canvas, so a surface is
   told apart by being lighter than what is behind it. The scope rebinds the surface and border
   tokens to the raised family, which in light is the base one (nothing moves there). What is
   derived from them has to be declared again: a custom property is resolved where it is declared
   and inherited as that value, so Kendo's tokens (it paints the popup, list, calendar, window and
   notification from them), the hover and press tones and the zebra stripe would all stay on the
   tone of the page. */
.k-popup,
.ps-panel,
.pm-menu,
.k-window,
.k-dialog,
.k-notification,
.k-popover,
.app-sheet__panel,
.user-menu__panel,
.pic-card,
.shell-notice,
#blazor-error-ui {
    --asap-surface: var(--asap-surface-raised);
    --asap-surface-2: var(--asap-surface-raised-2);
    --asap-surface-3: var(--asap-surface-raised-3);
    --asap-border: var(--asap-border-raised);
    --asap-surface-hover: var(--asap-surface-raised-hover);
    --asap-surface-active: var(--asap-surface-raised-active);
    --asap-row-alt: var(--asap-row-alt-raised);
    --asap-brand: var(--asap-brand-raised);
    --asap-text-3: var(--asap-text-3-raised);
    --asap-border-control: var(--asap-border-control-raised);
    --asap-border-control-hover: var(--asap-border-control-hover-raised);

    --kendo-color-app-surface: var(--asap-surface);
    --kendo-color-surface-alt: var(--asap-surface);
    --kendo-color-surface: var(--asap-surface-2);
    --kendo-color-base-subtle: var(--asap-surface-2);
}

/* Editors are a recessed well. Telerik 15 renders the default fill without k-input-solid /
   k-picker-solid, so a class rule never matched; the tokens Kendo's own input rules read
   are re-pointed on the field instead: no specificity fight with Kendo's :focus-within and
   invalid states, and it holds inside popups and windows. */
/* --kendo-color-surface too: Kendo lifts a hovered picker and paints input prefix/suffix
   bands with it, which would pop a drop-down out of the well under the pointer. */
:root[data-theme="dark"] :is(.k-input, .k-picker) {
    --kendo-color-surface-alt: var(--asap-field-bg);
    --kendo-color-surface: var(--asap-field-bg);
}

/* The cockpits (Features/Dashboards) draw their meters, in-progress marks, occupied docks, racks,
   pressed tiles and drawn selections in the brand. The brand is the one accent and all of these
   are the normal state, so inside a cockpit it is a calm neutral: the screen stays quiet until
   caution (yellow) or alarm (red) shows. Focus keeps the accent (--asap-ring), and so does a
   primary key (the -fill tokens). Re-scoped here once rather than in each cockpit's stylesheet. */
.cockpit {
    /* figures stand in columns and tick in place */
    font-variant-numeric: tabular-nums;
    --asap-brand: var(--asap-calm);
    --asap-brand-strong: var(--asap-calm-strong);
    --asap-brand-soft: var(--asap-calm-soft);
}

/* Both themes: a drop-down's edge is the editor edge, not Kendo's divider, so a column of
   text boxes and drop-downs reads as one set of fields. Hover firms it up. */
.k-picker {
    --kendo-color-border: var(--asap-field-border);
}

:is(.k-input, .k-picker):hover {
    --kendo-color-border-alt: var(--asap-field-border-hover);
    --kendo-color-border: var(--asap-field-border-hover);
}


/* 3. Base ------------------------------------------------------------------- */

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: var(--asap-font-ui);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--asap-text);
    background-color: var(--asap-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern";
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--asap-font-display);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--asap-text);
}

h1:focus {
    outline: none;
}

a {
    color: var(--asap-brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Without this, links, the account button and the tiles show the browser's own focus ring,
   which no other control shares. A real outline in the brand: 6:1 on white and 5:1 on a dark
   card, and it is what a Windows contrast theme redraws in its own colour. (The soft ring the
   buttons use is 1.9:1 in light, too weak to be the only sign for a control that has no border.) */
a:focus-visible,
.form-link:focus-visible {
    outline: 2px solid var(--asap-brand);
    outline-offset: 2px;
    border-radius: var(--asap-radius-xs);
}

/* Bootstrap's pink (#d63384) is 4.3:1 on the dark canvas. */
code {
    color: inherit;
}

/* Selected text takes a wash of the accent (stronger in dark, where the ink is light). */
::selection {
    background: var(--asap-selection);
}

 

* {
    scrollbar-width: thin;
    scrollbar-color: var(--asap-scrollbar) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    background: var(--asap-scrollbar);
    border-radius: var(--asap-radius-full);
    border: 3px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

.material-symbols-outlined {
    font-size: 20px;
    line-height: 1;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" var(--asap-icon-grad), "opsz" 20;
    vertical-align: middle;
    user-select: none;
    flex: 0 0 auto;
}

.material-symbols-outlined.is-filled {
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" var(--asap-icon-grad), "opsz" 20;
}

.mono {
    font-family: var(--asap-font-mono);
    font-variant-numeric: tabular-nums;
}

.muted {
    color: var(--asap-text-2);
}

.muted-2 {
    color: var(--asap-text-3);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* 4. Splash (shown by the host page until the circuit renders) ------------- */

#app-splash {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: grid;
    place-items: center;
    background: var(--asap-canvas);
}

body:has(.app-shell, .auth, .app-content, .error-page) #app-splash {
    display: none;
}

.splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: fade-in var(--asap-dur-slow) var(--asap-ease) both;
}

.splash__bar {
    width: 120px;
    height: 3px;
    border-radius: var(--asap-radius-full);
    background: var(--asap-border);
    overflow: hidden;
    position: relative;
}

.splash__bar::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    border-radius: inherit;
    background: var(--asap-brand);
    animation: bar-slide 1.1s var(--asap-ease) infinite;
}


/* 5. Brand ------------------------------------------------------------------ */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--asap-text);
    text-decoration: none;
}

.brand-link {
    display: inline-flex;
    color: inherit;
    text-decoration: none;
}

.brand-link:hover {
    text-decoration: none;
}

.brand__mark {
    flex: 0 0 auto;
    display: block;
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand__name {
    font-family: var(--asap-font-display);
    font-weight: 800;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
}

.brand__sub {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--asap-text-3);
    margin-top: 3px;
}

.brand--inverse {
    color: #fff;
}

.brand--inverse .brand__sub {
    color: rgba(255, 255, 255, 0.6);
}

.brand--inverse .brand__mark rect {
    fill: #fff;
}

.brand--inverse .brand__mark path:first-of-type {
    stroke: var(--asap-logo-deep);
}


/* 6. App shell -------------------------------------------------------------- */

.app-shell {
    display: flex;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background: var(--asap-canvas);
}

.app-sidebar {
    /* A length, not max-content: the width does not follow the widest open row, so
       expanding a folder cannot push the grid next to it sideways. It animates to 0 when
       collapsed, which needs no interpolate-size. Do not set that property on anything that
       holds the grid: it is inherited, and inherited into a Kendo grid it freezes
       AutoFitAllColumns. */
    flex: 0 0 auto;
    width: var(--asap-sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--asap-chassis);
    border-right: 1px solid var(--asap-border);
    overflow: hidden;
    transition: width var(--asap-dur) var(--asap-ease),
                transform var(--asap-dur) var(--asap-ease),
                border-color var(--asap-dur) var(--asap-ease);
}

.app-shell[data-sidebar="collapsed"] .app-sidebar {
    width: 0;
    border-right-color: transparent;
}

/* While the edge is dragged the width follows the pointer, not a transition. */
.app-shell.is-resizing {
    cursor: col-resize;
    user-select: none;
}

.app-shell.is-resizing .app-sidebar {
    transition: none;
}

.app-sidebar__inner {
    /* min-width keeps the panel intact while the aside animates to 0 on collapse,
       so the content clips out of view instead of reflowing on the way. */
    width: 100%;
    min-width: min(var(--asap-sidebar-w), calc(100vw - 56px));
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Lets the tree bar react to the nav's scroll position (section 7). */
    timeline-scope: --asap-nav;
}

.app-sidebar__brand {
    height: var(--asap-header-h);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px 0 18px;
    border-bottom: 1px solid var(--asap-border);
}

/* Only a drawer has a close button; a desktop sidebar collapses from its footer. */
.app-sidebar__close.k-button {
    display: none;
}

.app-sidebar__search {
    padding: 4px 8px;
}

/* The drag handle on the sidebar's right edge. It takes no space: the hit area straddles
   the border, and a brand line shows where it is once the pointer rests on it. */
.app-sidebar__resizer {
    position: relative;
    z-index: 5;
    flex: 0 0 auto;
    width: 0;
    outline: none;
    /* Without this a finger drag becomes a pan and the browser cancels the pointer. */
    touch-action: none;
}

.app-sidebar__resizer::before {
    content: "";
    position: absolute;
    inset-block: 0;
    left: -4px;
    width: 8px;
    cursor: col-resize;
}

@media (pointer: coarse) {
    .app-sidebar__resizer::before {
        left: -12px;
        width: 24px;
    }
}

.app-sidebar__resizer::after {
    content: "";
    position: absolute;
    inset-block: 0;
    left: -2px;
    width: 3px;
    border-radius: var(--asap-radius-full);
    background: var(--asap-brand);
    opacity: 0;
    transition: opacity var(--asap-dur-fast) var(--asap-ease);
    pointer-events: none;
}

.app-sidebar__resizer:hover::after {
    opacity: 0.55;
    transition-delay: 250ms;
}

.app-sidebar__resizer:focus-visible::after,
.app-shell.is-resizing .app-sidebar__resizer::after {
    opacity: 1;
    transition-delay: 0s;
}

.app-shell[data-sidebar="collapsed"] .app-sidebar__resizer {
    display: none;
}

/* Footer: which company and client this job works in, and the way to fold the sidebar. */
.app-sidebar__footer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 8px 10px 14px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--asap-border);
}

.app-sidebar__monogram {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--asap-radius-sm);
    background: var(--asap-brand-soft);
    color: var(--asap-brand-strong);
    font-family: var(--asap-font-display);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-sidebar__context {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.app-sidebar__company,
.app-sidebar__client {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar__company {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--asap-text);
}

.app-sidebar__client {
    font-size: 0.71875rem;
    color: var(--asap-text-3);
    font-variant-numeric: tabular-nums;
}

/* Beats the later `.app-iconbtn.k-button` 36px. */
.app-sidebar__footer .app-sidebar__collapse.k-button {
    width: 30px;
    height: 30px;
}

.app-sidebar__inner > .empty {
    flex: 1 1 auto;
}

/* Skip link: off-screen until a keyboard user tabs to it as the page's first stop. Parked,
   its shadow would still reach into the top-left corner, so it only casts one on show. */
.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 30001;
    padding: 8px 14px;
    border: 0;
    border-radius: var(--asap-radius-full);
    background: var(--asap-surface);
    color: var(--asap-brand);
    font: 600 0.8125rem/1.2 var(--asap-font-ui);
    transform: translateY(-160%);
    transition: transform var(--asap-dur-fast) var(--asap-ease);
    cursor: pointer;
}

/* A transparent outline draws nothing, except in forced colours, which ignore box-shadow. */
.skip-link:focus-visible {
    transform: none;
    outline: 2px solid transparent;
    box-shadow: var(--asap-shadow-2), 0 0 0 3px var(--asap-ring);
}

.app-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* The framed workspace (desktop widths): the sidebar, its brand row and footer are the chassis,
   and the header, the page and its key bar sit in a panel set into it, lighter than the chassis
   (lit in dark, a sheet with a shadow in light). What is pinned in the sidebar (folder heads, the
   tree bar) paints the chassis too. The drawer layout and phones stay full-bleed: there every
   pixel belongs to the page, and the sidebar is a drawer that floats over it in the card tone
   (compact layouts, below). Prefixed with .app-shell to outrank the base rules that follow. */
@media (min-width: 992px) {
    .app-shell {
        background: var(--asap-chassis);
    }

    .app-shell .app-sidebar {
        --asap-surface: var(--asap-chassis);
        --asap-surface-3: var(--asap-chassis-hover);
        --asap-text-3: var(--asap-chassis-text-3);
        border-color: transparent;
    }

    .app-shell .app-sidebar__brand {
        border-color: transparent;
    }

    .app-shell .app-body {
        margin: 8px 8px 8px 0;
        border-radius: 14px;
        background: var(--asap-canvas);
        box-shadow: inset 0 1px 0 var(--asap-lit), 0 0 0 1px var(--asap-frame-edge), var(--asap-frame-shadow);
        overflow: hidden;
    }

    /* Inside the panel the header and the key bar are the page's own tone, set off by a hairline. */
    .app-shell .app-header {
        background: transparent;
    }

    .app-shell .app-actionbar {
        background: transparent;
        box-shadow: none;
    }
}

.app-header {
    height: var(--asap-header-h);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 0 10px;
    background: var(--asap-surface);
    border-bottom: 1px solid var(--asap-border);
}

.app-header__lead {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header__title {
    margin: 0;
    font-size: 1.0625rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: -0.015em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.app-header__tools {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

.app-header__divider {
    width: 1px;
    height: 22px;
    background: var(--asap-border);
    margin: 0 6px;
}

.app-header__dev {
    display: flex;
    align-items: center;
    gap: 2px;
}

.app-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 16px 20px 24px;
    animation: page-in var(--asap-dur-slow) var(--asap-ease) both;
}

.app-content--fill {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 16px;
}

/* Function-key bar: the screen's actions, left-aligned in the server's F-key order.
   Soft elevated buttons; Enter is the one solid primary. Telerik 15 marks it
   k-button-solid + k-button-primary (the older combined k-button-solid-primary is gone). */
.app-actionbar {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
    background: var(--asap-surface);
    border-top: 1px solid var(--asap-border);
    box-shadow: 0 -8px 24px oklch(20% 0.02 258 / 0.04);
}

.app-actionbar .app-actionbar__btn.k-button {
    height: 38px;
    padding: 0 14px 0 10px;
    border-radius: var(--asap-radius);
    border: 1px solid var(--asap-border);
    background: var(--asap-surface-2);
    color: var(--asap-text);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.005em;
    box-shadow: var(--asap-shadow-1);
    transition: background var(--asap-dur-fast), border-color var(--asap-dur-fast),
                box-shadow var(--asap-dur-fast), transform var(--asap-dur-fast);
}

.app-actionbar .app-actionbar__btn.k-button .k-button-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.app-actionbar .app-actionbar__btn.k-button .material-symbols-outlined {
    font-size: 19px;
    margin: 0;
    color: var(--asap-text-2);
    transition: color var(--asap-dur-fast);
}

.app-actionbar .app-actionbar__btn.k-button:hover,
.app-actionbar .app-actionbar__btn.k-button.k-hover {
    background: var(--asap-action-hover);
    border-color: var(--asap-border-strong);
    box-shadow: var(--asap-shadow-2);
    transform: translateY(-1px);
}

.app-actionbar .app-actionbar__btn.k-button:hover .material-symbols-outlined {
    color: var(--asap-brand);
}

.app-actionbar .app-actionbar__btn.k-button:active,
.app-actionbar .app-actionbar__btn.k-button.k-active {
    background: var(--asap-surface-3);
    box-shadow: none;
    transform: translateY(0);
}

.app-actionbar .app-actionbar__btn.k-button:focus-visible,
.app-actionbar .app-actionbar__btn.k-button.k-focus {
    box-shadow: 0 0 0 3px var(--asap-ring);
}

.app-actionbar .app-actionbar__btn.k-button-primary {
    background: var(--asap-brand-fill);
    border-color: transparent;
    color: var(--asap-on-brand);
    box-shadow: 0 1px 2px color-mix(in oklab, var(--asap-brand-fill) 40%, transparent),
                inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.app-actionbar .app-actionbar__btn.k-button-primary .material-symbols-outlined,
.app-actionbar .app-actionbar__btn.k-button-primary:hover .material-symbols-outlined {
    color: color-mix(in srgb, var(--asap-on-brand) 92%, transparent);
}

.app-actionbar .app-actionbar__btn.k-button-primary:hover,
.app-actionbar .app-actionbar__btn.k-button-primary.k-hover {
    background: var(--asap-brand-fill-hover);
    border-color: transparent;
    box-shadow: 0 4px 12px color-mix(in oklab, var(--asap-brand-fill) 40%, transparent),
                inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.app-actionbar .app-actionbar__btn.k-button-primary:active,
.app-actionbar .app-actionbar__btn.k-button-primary.k-active {
    background: var(--asap-brand-fill-active);
    box-shadow: none;
}

/* A click leaves focus on the key, and Kendo's :focus halo (0,4,0) outranks the rest rules
   above (0,3,0): pointer focus restores the rest elevation; keyboard focus keeps the ring. */
.app-actionbar .app-actionbar__btn.k-button:focus:not(:focus-visible, :hover, .k-hover, :active, .k-active) {
    box-shadow: var(--asap-shadow-1);
}

.app-actionbar .app-actionbar__btn.k-button-primary:focus:not(:focus-visible, :hover, .k-hover, :active, .k-active) {
    box-shadow: 0 1px 2px color-mix(in oklab, var(--asap-brand-fill) 40%, transparent),
                inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* Graphite: the hover lift lands on the same grey as the press (surface-3), so a press would
   not show; it settles between rest and hover instead. A passing pointer leaves the icon
   neutral: the accent marks the actions themselves (Enter), not the hover. */
:root[data-theme="dark"] .app-actionbar .app-actionbar__btn.k-button:not(.k-button-primary):is(:active, .k-active) {
    background: oklch(from var(--asap-action-hover) calc(l - 0.025) c h);
}

:root[data-theme="dark"] .app-actionbar .app-actionbar__btn.k-button:not(.k-button-primary):hover .material-symbols-outlined {
    color: var(--asap-text);
}

/* Phones: one thumb-scrollable row instead of a stack of wrapped rows. */
@media (max-width: 640px) {
    .app-actionbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    }

    .app-actionbar::-webkit-scrollbar {
        display: none;
    }

    .app-actionbar .app-actionbar__btn.k-button {
        flex: 0 0 auto;
    }
}

.app-backdrop {
    display: none;
}

/* Icon buttons in the chrome. They are flat, and Kendo forbids a flat button any background
   (!important): the hover tint is its own overlay, 8% of the text colour, a neutral grey in
   both themes. */
.app-iconbtn.k-button {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--asap-radius-sm);
    color: var(--asap-text-2);
}

.app-iconbtn.k-button:hover,
.app-iconbtn.k-button.k-hover {
    color: var(--asap-text);
}

.app-iconbtn.k-button .k-svg-icon {
    width: 18px;
    height: 18px;
}

.app-iconbtn.k-button .k-svg-icon svg {
    width: 18px;
    height: 18px;
}

/* Compact layouts: the sidebar becomes a drawer over the content */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1040;
        /* A drawer floats over the content, keeping a strip of backdrop beside it so it
           stays dismissable by tapping. The !important beats the collapsed rule: a
           drawer keeps its width and leaves by sliding out, not by shrinking to zero. */
        width: min(var(--asap-sidebar-w), calc(100vw - 56px)) !important;
        transform: translateX(-100%);
        border-right-color: var(--asap-border) !important;
    }

    .app-shell[data-sidebar="expanded"] .app-sidebar {
        transform: none;
        box-shadow: var(--asap-shadow-3);
    }

    /* Over the page, not set into a chassis: the drawer takes the card tone. */
    .app-sidebar {
        background: var(--asap-surface);
    }

    /* A flat tint: a backdrop blur repaints the whole viewport every frame, which is
       slow over Remote Desktop without a GPU. */
    .app-shell[data-sidebar="expanded"] .app-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: var(--asap-scrim-veil);
        animation: fade-in var(--asap-dur) var(--asap-ease) both;
    }

    .app-sidebar__close.k-button {
        display: inline-flex;
    }

    .app-sidebar__collapse.k-button,
    .app-sidebar__resizer {
        display: none;
    }

    .app-header {
        padding: 0 10px 0 6px;
    }

    .app-content {
        padding: 12px;
    }

    .app-content--fill {
        padding-bottom: 12px;
    }

    .app-actionbar {
        padding-left: 12px;
        padding-right: 12px;
    }
}



/* The folded sidebar on a desktop: a rail of the brand mark, the navigation's way in (the
   program search, the menu's top-level entries; ShellSlots.SidebarRail) and the unfold button
   (Sidebar.razor). The sidebar narrows to it and its own contents fade out underneath; a drawer
   (compact layouts) has no rail. Buttons: 40 px, the tree's hover tone, the open program's
   entry in its current-place tint. */
.app-rail {
    display: none;
}

@media (min-width: 992px) {
    .app-shell .app-sidebar {
        position: relative;
    }

    .app-shell[data-sidebar="collapsed"] .app-sidebar {
        width: var(--asap-rail-w);
    }

    .app-sidebar__inner {
        transition: opacity var(--asap-dur-fast) var(--asap-ease), visibility 0s;
    }

    .app-shell[data-sidebar="collapsed"] .app-sidebar__inner {
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--asap-dur-fast) var(--asap-ease), visibility 0s linear var(--asap-dur-fast);
    }

    .app-rail {
        position: absolute;
        inset: 0 auto 0 0;
        width: var(--asap-rail-w);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 12px 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--asap-dur-fast) var(--asap-ease), visibility 0s linear var(--asap-dur-fast);
    }

    .app-shell[data-sidebar="collapsed"] .app-rail {
        opacity: 1;
        visibility: visible;
        transition: opacity var(--asap-dur) var(--asap-ease) var(--asap-dur-fast), visibility 0s;
    }
}

.app-rail__brand {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    border-radius: var(--asap-radius);
}

.app-rail__brand:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--asap-ring);
}

/* The Programs slice's part: the search, a divider, the entries, which scroll on their own. */
.app-rail__nav {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.app-rail__divider {
    flex: 0 0 auto;
    width: 24px;
    height: 1px;
    margin: 8px 0;
    background: var(--asap-border);
}

/* Padded so a focus ring at either end is not cut by the scroll box. */
.app-rail__entries {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    margin: 0;
    padding: 3px 8px;
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: none;
}

.app-rail__btn {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: var(--asap-radius);
    background: transparent;
    color: var(--asap-text-2);
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--asap-dur-fast) var(--asap-ease), color var(--asap-dur-fast) var(--asap-ease);
}

.app-rail__btn:hover {
    background: var(--asap-surface-3);
    color: var(--asap-text);
}

.app-rail__btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--asap-ring);
}

.app-rail__btn .k-svg-icon,
.app-rail__btn .k-svg-icon svg {
    width: 20px;
    height: 20px;
}

.app-rail__btn.is-current {
    background: var(--asap-brand-soft);
    color: var(--asap-brand);
}

/* The search looks like the field it stands for. */
.app-rail__search {
    border: 1px solid var(--asap-border-control);
    background: var(--asap-field-bg);
}

.app-rail__search:hover {
    background: var(--asap-field-bg);
}

.app-rail__expand {
    margin-top: 4px;
}

/* 7. Sidebar: search + program tree ------------------------------------------ */

/* Program search (ProgramSearchField, ProgramSearchPanel, program-search.js): the sidebar's
   field and the quick-open panel, under the field or centred over the page (design hand-off,
   turn 2). The panel is a raised surface (section 2's scope); rows are 48 px, the active one in
   the brand's soft tint with a hairline of it, matched text in bold brand ink. */
.ps-field {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 6px 0 8px;
    border: 1px solid var(--asap-border-control);
    border-radius: var(--asap-radius);
    background: var(--asap-field-bg);
    transition: border-color var(--asap-dur-fast) var(--asap-ease), box-shadow var(--asap-dur-fast) var(--asap-ease);
}

.ps-field:focus-within {
    border-color: var(--asap-brand);
    box-shadow: 0 0 0 3px var(--asap-ring);
}

.ps-field__icon {
    flex: 0 0 auto;
    color: var(--asap-text-3);
    transition: color var(--asap-dur-fast) var(--asap-ease);
}

.ps-field:focus-within .ps-field__icon {
    color: var(--asap-brand);
}

.ps-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--asap-text);
    font: inherit;
    font-size: 0.8125rem;
    text-overflow: ellipsis;
}

.ps-input::placeholder {
    color: var(--asap-text-3);
    opacity: 1;
}

/* A key cap. The field's "Strg K" is a size up and shows only at rest. */
.ps-kbd {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    height: 18px;
    min-width: 18px;
    padding: 0 4px;
    border: 1px solid var(--asap-border-strong);
    border-bottom-width: 2px;
    border-radius: var(--asap-radius-xs);
    background: var(--asap-surface);
    color: var(--asap-text-2);
    font: 600 10.5px/1 var(--asap-font-ui);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.ps-field__hint {
    flex: 0 0 auto;
    background: var(--asap-surface-raised);
    height: 20px;
    min-width: 20px;
    margin-left: -2px;
    font-size: 10px;
}

.ps-field:focus-within .ps-field__hint {
    display: none;
}

/* A finger has no Strg K. */
@media (pointer: coarse) {
    .ps-field__hint {
        display: none;
    }
}

.ps-clear {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: var(--asap-radius-full);
    background: transparent;
    color: var(--asap-text-2);
    cursor: pointer;
    transition: background-color var(--asap-dur-fast) var(--asap-ease), color var(--asap-dur-fast) var(--asap-ease);
}

.ps-clear:hover {
    background: var(--asap-surface-3);
    color: var(--asap-text);
}

.ps-clear:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--asap-ring);
}

/* Over the drawer (1040) and its backdrop, under Kendo's popups. */
.ps-veil {
    position: fixed;
    inset: 0;
    z-index: 1045;
    background: var(--asap-veil);
}

.ps-panel {
    position: fixed;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - 24px);
    max-height: min(480px, calc(100dvh - var(--ps-top, 64px) - 12px));
    overflow: hidden;
    border: 1px solid var(--asap-border-raised);
    border-radius: var(--asap-radius-lg);
    background: var(--asap-surface-raised);
    box-shadow: var(--asap-shadow-3);
    color: var(--asap-text);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Under the sidebar's field: program-search.js measures the field and sets these. */
.ps-panel--sidebar {
    top: var(--ps-top, 104px);
    left: var(--ps-left, 8px);
    width: var(--ps-width, 440px);
}

/* Centred over the page, which on a desktop starts after the rail. */
.ps-panel--centre {
    --ps-top: 64px;
    --ps-room: 0px;
    --ps-w: min(560px, 100vw - 24px);
    top: var(--ps-top);
    left: calc(var(--ps-room) + (100vw - var(--ps-room) - var(--ps-w)) / 2);
    width: var(--ps-w);
}

@media (min-width: 992px) {
    .app-shell[data-sidebar="collapsed"] .ps-panel--centre {
        --ps-room: var(--asap-rail-w);
    }
}

.ps-panel__field {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid var(--asap-border-raised);
}

.ps-panel__icon {
    flex: 0 0 auto;
    color: var(--asap-brand-raised);
}

.ps-panel__input {
    font-size: 0.9375rem;
}

.ps-panel__clear {
    width: 28px;
    height: 28px;
}

.ps-panel__clear:hover {
    background: var(--asap-surface-raised-3);
}

.ps-panel__notice {
    flex: 0 0 auto;
    margin: 12px 16px 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--asap-text-2);
}

.ps-panel__suggest {
    padding: 0;
    border: 0;
    background: none;
    color: var(--asap-brand-raised);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.ps-list.is-empty {
    display: none;
}

.ps-list {
    flex: 1 1 auto;
    min-height: 0;
    padding: 2px 0 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ps-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ps-group__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px 4px;
}

.ps-group__label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--asap-text-2);
}

.ps-group__count {
    font-size: 0.75rem;
    color: var(--asap-text-2);
}

.ps-option {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    height: 48px;
    margin: 0 6px;
    padding: 7px 10px;
    border-radius: var(--asap-radius);
    cursor: pointer;
}

.ps-option.is-active {
    background: var(--asap-brand-soft);
    box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--asap-brand) 32%, transparent);
}

/* On --asap-surface-raised-3, not the hand-off's surface-3, which in dark is the panel's own tone. */
.ps-option__chip {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--asap-radius-sm);
    background: var(--asap-surface-raised-3);
    color: var(--asap-text-2);
}

.ps-option__chip .k-svg-icon,
.ps-option__chip .k-svg-icon svg {
    width: 18px;
    height: 18px;
}

.ps-option.is-active .ps-option__chip {
    background: var(--asap-surface);
    color: var(--asap-brand);
}

.ps-option__text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 18px;
}

.ps-option__name,
.ps-option__path {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ps-option__name {
    font-weight: 600;
}

.ps-option__path {
    font-size: 0.75rem;
    line-height: 16px;
    color: var(--asap-text-2);
}

.ps-option__via {
    margin-left: 4px;
}

.ps-option__via::before {
    content: "·";
    margin-right: 4px;
}

.ps-option__star {
    flex: 0 0 auto;
    display: grid;
    color: var(--asap-accent);
}

.ps-option__code {
    flex: 0 0 auto;
    font-family: var(--asap-font-mono);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--asap-text-3-raised);
}

.ps-option__enter {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    width: 20px;
    visibility: hidden;
}

.ps-option.is-active .ps-option__enter {
    visibility: visible;
}

.ps-hit {
    padding: 0;
    background: none;
    color: var(--asap-brand-strong);
    font-weight: 700;
}

.ps-panel__hint {
    margin: 0;
    padding: 14px 16px;
    font-size: 0.8125rem;
    color: var(--asap-text-2);
}

.ps-list__more {
    margin: 8px 16px 0;
    font-size: 0.75rem;
    color: var(--asap-text-2);
}

.ps-panel__empty {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
}

.ps-panel__empty-mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--asap-radius-full);
    background: var(--asap-surface-raised-3);
    color: var(--asap-text-2);
}

.ps-panel__empty-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ps-panel__empty-title {
    font-weight: 600;
}

.ps-panel__empty-text {
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--asap-text-2);
}

.ps-panel__keys {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 9px 14px;
    border-top: 1px solid var(--asap-border-raised);
    background: var(--asap-surface-raised-2);
    font-size: 0.6875rem;
    color: var(--asap-text-2);
}

.ps-panel__keys > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ps-panel__keys-end {
    margin-left: auto;
}

@media (forced-colors: active) {
    .app-rail__brand:focus-visible,
    .app-rail__btn:focus-visible,
    .ps-clear:focus-visible,
    .ps-field:focus-within {
        outline: 2px solid Highlight;
        outline-offset: 2px;
    }

    .ps-option.is-active,
    .app-rail__btn.is-current {
        outline: 2px solid Highlight;
        outline-offset: -2px;
    }
}

/* A finger has no Strg ↵; on a phone the keys' footer is only in the way. A scanner held
   sideways keeps it: its hardware keys walk and open the list. */
@media (pointer: coarse) {
    .ps-panel__keys-tab {
        display: none;
    }
}

@media (pointer: coarse) and (max-width: 640px) {
    .ps-panel__keys {
        display: none;
    }
}

/* The program menu (ProgramMenu, program-menu.js): a right click on a program in the tree, the
   search or on the start page. A raised surface over everything, the search's panel included; drawn
   where the pointer was once the script has measured it (is-placed), so it never flashes at 0,0. */
.pm-menu {
    position: fixed;
    z-index: 1060;
    top: 0;
    left: 0;
    min-width: 248px;
    padding: 4px;
    border: 1px solid var(--asap-border-raised);
    border-radius: var(--asap-radius);
    background: var(--asap-surface-raised);
    box-shadow: var(--asap-shadow-3);
    color: var(--asap-text);
    font-size: 0.8125rem;
    visibility: hidden;
}

.pm-menu.is-placed {
    visibility: visible;
}

.pm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--asap-radius-sm);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.pm-item:hover,
.pm-item:focus-visible,
.pm-item:focus {
    outline: none;
    background: var(--asap-surface-raised-3);
}

/* The plain open is the menu's default, as on a browser's link menu. */
.pm-item--default {
    font-weight: 600;
}

.pm-item__icon {
    flex: 0 0 auto;
    width: 18px;
    overflow: hidden;
    color: var(--asap-text-2);
}

.pm-item__icon--star {
    color: var(--asap-accent);
}

.pm-item__text {
    flex: 1 1 auto;
    white-space: nowrap;
}

/* A <kbd>: Bootstrap's dark key box is taken off; the hint is quiet text at the end. */
.pm-item__key {
    margin-left: 24px;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--asap-text-3-raised);
    font: 500 0.75rem/1 var(--asap-font-ui);
    white-space: nowrap;
}

/* While the menu is open, no row's card comes up under the pointer and over it. */
:root:has(.pm-menu) .k-tooltip {
    visibility: hidden;
}

.pm-separator {
    height: 1px;
    margin: 4px 6px;
    background: var(--asap-border-raised);
}

@media (forced-colors: active) {
    .pm-item:is(:hover, :focus) {
        outline: 2px solid Highlight;
        outline-offset: -2px;
    }
}

/* A finger opens the menu with a long press and has no keys: the hints go, the rows grow. */
@media (pointer: coarse) {
    .pm-item {
        height: 44px;
    }

    .pm-item__key {
        display: none;
    }
}

/* WEB025's menu pickers (MenuPicker.razor). Portaled to the root, so out of the component's
   scoped styles. The list leaves out the drop-down's default line ("Menü wählen …"), which only
   names a target not yet chosen: nobody picks "none" once a menu is open. */
.me-picker-popup {
    max-width: calc(100vw - 24px);
}

.me-picker-popup .k-list-optionlabel {
    display: none;
}

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--asap-radius-xs);
    border: 1px solid var(--asap-border-strong);
    border-bottom-width: 2px;
    background: var(--asap-surface);
    color: var(--asap-text-3);
    font-family: var(--asap-font-mono);
    font-size: 11px;
    line-height: 1;
}

/* Tree bar: the list's name, "show the open program" and "collapse all". Once the list
   scrolls, a hairline and a soft shadow separate it from the rows passing underneath. */
.app-sidebar__treebar {
    position: relative;
    z-index: 50;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px 4px 20px;
    border-bottom: 1px solid transparent;
}

@supports (animation-timeline: scroll()) {
    .app-sidebar__treebar {
        animation: tree-edge linear both;
        animation-timeline: --asap-nav;
        animation-range: 0 24px;
    }
}

.app-sidebar__overline {
    flex: 1 1 auto;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--asap-text-3);
}

.app-treebar__btn.k-button {
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: var(--asap-radius-sm);
    color: var(--asap-text-3);
}

/* Flat, like .app-iconbtn: the hover tint is Kendo's own overlay. */
.app-treebar__btn.k-button:hover,
.app-treebar__btn.k-button.k-hover {
    color: var(--asap-text);
}

.app-treebar__btn.k-button .k-svg-icon,
.app-treebar__btn.k-button .k-svg-icon svg {
    width: 16px;
    height: 16px;
}

.app-treebar__btn.k-button.k-disabled {
    opacity: 0.35;
}

/* Idle, not disabled: it keeps focus after collapsing (see ProgramTree.razor). Only the glyph
   fades, so that focus ring keeps its full strength, and it answers no hover. */
.app-treebar__btn.k-button.is-idle .k-svg-icon {
    opacity: 0.35;
}

.app-treebar__btn.k-button.is-idle:hover {
    color: var(--asap-text-3);
    cursor: default;
}

.app-treebar__btn.k-button.is-idle::before {
    opacity: 0;
}

.app-sidebar__nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* Reserve the scrollbar gutter so expanding a node cannot make the tree
       jitter sideways as the vertical scrollbar appears. */
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
    /* No top padding: rows would show above the pinned folder heads. Scrolling is
       instant on purpose; a smooth scroll per arrow key lags over Remote Desktop. */
    padding: 0 4px 16px 8px;
    scroll-timeline: --asap-nav block;
}

/* The program tree, built on Telerik 15.0.1's DOM (check these after a Telerik upgrade):
     li.k-treeview-item[aria-level][aria-expanded if folder][style="--kendo-treeview-level: n"]
       > span.k-treeview-item-content.{is-current | is-trail | is-favourites | is-hint}   ← the row
           > span.k-treeview-toggle (folders only) + span.k-treeview-leaf > .menu-item + .menu-item-star
       > div.k-animation-container > div.k-child-animation-container > div > ul.k-treeview-group[role=group]
   A row is drawn in layers: the row itself is transparent (open folders are opaque, since
   they can be pinned), its ::before is the rounded tint (hover, press, open program) and its
   ::after the open program's bar. The tint starts at the row's own indent, so nesting reads
   at a glance. */
.app-sidebar .k-treeview {
    --tree-guide: var(--asap-border-strong);
    /* the open program's share of brand at rest and on hover, a pressed row's, and a hovered row's icon */
    --tree-current-tint: 11%;
    --tree-current-tint-hover: 16%;
    --tree-press-tint: 14%;
    --tree-icon-hover: var(--asap-brand);
    padding-top: 4px;
    background: transparent;
    color: inherit;
    font-size: 0.8125rem;
    line-height: 1.35;
    /* The nav scrolls, not the tree. Left as its own scroll container (Kendo's overflow:auto)
       the tree is what pinned heads would stick to, and it never moves. */
    overflow: visible;
    white-space: normal;
    animation: fade-in var(--asap-dur) var(--asap-ease) backwards;
}

/* Graphite: the open program takes a larger share of the light ink to rank above the grey
   hover, and the press a larger one still, so it is lighter than the hover it starts from
   and the open row it leads to. A passing hover leaves icons neutral; the accent marks
   the current item only. */
:root[data-theme="dark"] .app-sidebar .k-treeview {
    --tree-current-tint: 20%;
    --tree-current-tint-hover: 24%;
    --tree-press-tint: 28%;
    --tree-icon-hover: var(--asap-text);
}

.app-sidebar .k-treeview-group {
    gap: 0;
    min-width: 0;
}

.app-sidebar .k-treeview-group .k-treeview-group {
    margin-top: 0;
}

/* Every nested group sits in an animation container that clips (for Telerik's 150ms reveal)
   and stacks at z-index 600. clip still clips the reveal but is not a scroll container, and
   without the z-index pinned heads at different depths layer by their own z-index. */
.app-sidebar .k-treeview .k-animation-container {
    overflow: clip;
    z-index: auto;
}

.app-sidebar .k-treeview-lines > .k-treeview-item[aria-expanded="true"] {
    padding-bottom: 6px;
}

/* Indent guide: a hairline under each open folder's chevron. Inside a nested group the level
   variable still holds the parent's level, which is exactly the chevron's column. The group
   holding the open program draws it in brand. */
.app-sidebar .k-treeview-group[role="group"] {
    /* Reset per group, so the brand guide below does not leak into nested groups. */
    --tree-guide: var(--asap-border-strong);
    background: linear-gradient(var(--tree-guide), var(--tree-guide)) no-repeat
        calc((var(--kendo-treeview-level, 1) - 0.5) * var(--asap-tree-indent) - 0.5px) 0 / 1px 100%;
}

.app-sidebar .k-treeview-group[role="group"]:has(> .k-treeview-item > .is-current) {
    --tree-guide: color-mix(in oklch, var(--asap-brand) 55%, transparent);
}

.app-sidebar .k-treeview-item {
    /* Keyboard focus scrolls a row into view below the pinned heads, not under them. */
    scroll-margin-top: calc((var(--kendo-treeview-level, 1) - 1) * var(--asap-tree-row-h));
}

.app-sidebar .k-treeview-item-content {
    position: relative;
    min-height: var(--asap-tree-row-h);
    padding-inline-start: calc(var(--kendo-treeview-level, 1) * var(--asap-tree-indent));
    padding-inline-end: 2px;
    border: 0;
    color: var(--asap-text-2);
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    transition: color var(--asap-dur-fast) var(--asap-ease);
}

.app-sidebar .k-treeview-item-content::before {
    content: "";
    position: absolute;
    inset-block: 1px;
    inset-inline: calc((var(--kendo-treeview-level, 1) - 1) * var(--asap-tree-indent)) 0;
    border-radius: var(--asap-radius-sm);
    background: var(--row-tint, transparent);
    transition: background-color var(--asap-dur-fast) var(--asap-ease), box-shadow var(--asap-dur-fast) var(--asap-ease);
    pointer-events: none;
}

/* Positioned, so they paint above the tint layer. */
.app-sidebar .k-treeview-item-content > .k-treeview-toggle {
    position: relative;
}

/* Pinned folder heads: an open folder's row stays at the top while its programs scroll,
   stacked one row per level, until its last program has passed. Folder names stay on one
   line, which is what keeps every pinned row exactly one row high. The row is opaque (CSS
   cannot tell whether it is stuck), so it paints the guides of the folders above it itself,
   one hairline per indent column; stuck or not, it always sits inside those folders. */
.app-sidebar .k-treeview-item[aria-expanded="true"] > .k-treeview-item-content {
    position: sticky;
    top: calc((var(--kendo-treeview-level, 1) - 1) * var(--asap-tree-row-h));
    z-index: calc(40 - var(--kendo-treeview-level, 1));
    height: var(--asap-tree-row-h);
    background:
        repeating-linear-gradient(to right,
            transparent 0 calc(var(--asap-tree-indent) / 2 - 0.5px),
            var(--tree-guide) calc(var(--asap-tree-indent) / 2 - 0.5px) calc(var(--asap-tree-indent) / 2 + 0.5px),
            transparent calc(var(--asap-tree-indent) / 2 + 0.5px) var(--asap-tree-indent))
            0 0 / calc((var(--kendo-treeview-level, 1) - 1) * var(--asap-tree-indent)) 100% no-repeat,
        var(--asap-surface);
}

.app-sidebar .k-treeview-item-content:hover,
.app-sidebar .k-treeview-item-content.k-hover {
    --row-tint: var(--asap-surface-3);
    color: var(--asap-text);
    background-color: transparent;
}


/* Pressed shows at once, before the server has answered the click. */
.app-sidebar .k-treeview-item-content:active {
    --row-tint: color-mix(in oklch, var(--asap-brand) var(--tree-press-tint), transparent);
}

.app-sidebar .k-treeview-item-content:active::before {
    transition-duration: 0s;
}

/* Telerik's own focus ring arrives a round trip late (k-focus is set by the server) and
   also shows for mouse clicks; the browser's :focus-visible is immediate. Telerik focuses a
   clicked row from script, though, which the browser can count as keyboard focus, so
   theme.js marks the nav [data-pointer] from a pointer press until the next key. */
.app-sidebar .k-treeview-item-content:focus,
.app-sidebar .k-treeview-item-content.k-focus {
    box-shadow: none;
}

.app-sidebar__nav:not([data-pointer]) .k-treeview-item:focus-visible > .k-treeview-item-content::before {
    box-shadow: inset 0 0 0 2px var(--asap-ring);
}

.app-sidebar .k-treeview-toggle {
    align-self: stretch;
    width: var(--asap-tree-indent);
    margin-inline-start: calc(-1 * var(--asap-tree-indent));
    justify-content: center;
    color: var(--asap-text-3);
    transition: color var(--asap-dur-fast) var(--asap-ease);
}

.app-sidebar .k-treeview-toggle .k-icon {
    padding: 0;
}

.app-sidebar .k-treeview-item-content:hover > .k-treeview-toggle {
    color: var(--asap-text);
}

.app-sidebar .k-treeview .k-treeview-leaf {
    flex: 1 1 auto;
    min-width: 0;
    align-self: stretch;
    gap: 4px;
    padding: 0 2px 0 6px;
    border-radius: 0;
    background: none;
    color: inherit;
}

.k-treeview-leaf .k-icon {
    margin-inline-end: 0;
}

/* Hierarchy by weight: sections 600, sub-folders 500, programs regular and a step lighter. */
.app-sidebar .k-treeview-item[aria-expanded] > .k-treeview-item-content {
    color: var(--asap-text);
    font-weight: 500;
}

.app-sidebar .k-treeview-item[aria-level="1"][aria-expanded] > .k-treeview-item-content {
    font-weight: 600;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    padding-block: 5px;
}

.menu-item__icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--asap-text-3);
    transition: color var(--asap-dur-fast);
}

.k-treeview-item-content:hover .menu-item__icon {
    color: var(--tree-icon-hover, var(--asap-brand));
}

.menu-item__text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Program names get two lines before they are cut, and long German compounds hyphenate
   (the labels carry lang="de" whatever the UI language). */
.app-sidebar .k-treeview-item:not([aria-expanded]) .menu-item__text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
    overflow-wrap: anywhere;
    hyphens: auto;
    line-height: 1.3;
}

/* The way to the open program: its folders' icons in brand, and a closed one gets a dot. */
.app-sidebar .k-treeview-item-content.is-trail {
    color: var(--asap-text);
}

.app-sidebar .k-treeview-item-content.is-trail .menu-item__icon {
    color: var(--asap-brand);
}

.app-sidebar .k-treeview-item[aria-expanded="false"] > .is-trail .menu-item::after {
    content: "";
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin-inline-end: 3px;
    border-radius: 50%;
    background: var(--asap-brand);
}

/* The open program: brand tint, brand ink, and a bar that grows in when it becomes current. */
.app-sidebar .k-treeview-item-content.is-current {
    --row-tint: color-mix(in oklch, var(--asap-brand) var(--tree-current-tint), transparent);
    color: var(--asap-brand-strong);
    font-weight: 600;
}

.app-sidebar .k-treeview-item-content.is-current:hover {
    --row-tint: color-mix(in oklch, var(--asap-brand) var(--tree-current-tint-hover), transparent);
    color: var(--asap-brand-strong);
}

.app-sidebar .k-treeview-item-content.is-current .menu-item__icon {
    color: var(--asap-brand);
}

.app-sidebar .k-treeview-item-content.is-current::after {
    content: "";
    position: absolute;
    inset-block: 7px;
    inset-inline-start: calc((var(--kendo-treeview-level, 1) - 1) * var(--asap-tree-indent) + 1px);
    width: 3px;
    border-radius: var(--asap-radius-full);
    background: var(--asap-brand);
    animation: tree-mark-in var(--asap-dur-slow) var(--asap-ease) backwards;
    pointer-events: none;
}

/* Favourites: always the first group, set off from the menu below it. */
.app-sidebar .k-treeview-lines > .k-treeview-item:has(> .is-favourites) {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--asap-border);
}

/* Orange even when the open program is a favourite (the trail colours icons brand). */
.app-sidebar .k-treeview-item-content.is-favourites .menu-item__icon {
    color: var(--asap-accent);
}

.app-sidebar .k-treeview-item-content.is-hint {
    cursor: default;
}

.app-sidebar .k-treeview-item-content.is-hint:hover,
.app-sidebar .k-treeview-item-content.is-hint:active {
    --row-tint: transparent;
    color: inherit;
}

.menu-hint {
    display: block;
    padding: 4px 0 6px;
    font-size: 0.75rem;
    font-style: italic;
    line-height: 1.35;
    white-space: normal;
    color: var(--asap-text-3);
}

.menu-item-star {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--asap-radius-xs);
    color: var(--asap-text-3);
    opacity: 0;
    cursor: pointer;
    transition: opacity var(--asap-dur-fast), color var(--asap-dur-fast), background-color var(--asap-dur-fast);
}

.menu-item-star:hover {
    color: var(--asap-accent);
    background: color-mix(in oklch, var(--asap-accent) 12%, transparent);
}

/* A starred program always shows its star; the others on hover or keyboard focus. */
.menu-item-star.is-active {
    opacity: 1;
    color: var(--asap-accent);
}

.k-treeview-item-content:hover .menu-item-star,
.app-sidebar__nav:not([data-pointer]) .k-treeview-item:focus-visible > .k-treeview-item-content .menu-item-star {
    opacity: 1;
}

/* With a hovering pointer, an unstarred star takes no room while hidden (the name gets the
   full width, and wraps less); when it shows it sits over the end of the row, and the name
   fades out beneath it. Touch keeps it in the row (below), always visible and unmasked. */
@media (hover: hover) {
    .app-sidebar .menu-item-star:not(.is-active) {
        position: absolute;
        top: 50%;
        inset-inline-end: 2px;
        margin-top: -12px;
    }

    .app-sidebar .k-treeview-item-content:hover .menu-item:has(+ .menu-item-star:not(.is-active)) .menu-item__text,
    .app-sidebar__nav:not([data-pointer]) .k-treeview-item:focus-visible > .k-treeview-item-content .menu-item:has(+ .menu-item-star:not(.is-active)) .menu-item__text {
        mask-image: linear-gradient(to left, transparent 24px, #000 40px);
    }
}

.menu-item-star.is-popping .k-svg-icon {
    animation: star-pop var(--asap-dur-slow) cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.menu-item-star.is-popping::after {
    content: "";
    position: absolute;
    inset: 2px;
    border: 2px solid var(--asap-accent);
    border-radius: 50%;
    opacity: 0;
    animation: star-ring 560ms var(--asap-ease);
    pointer-events: none;
}

/* Touch has no hover: the star is always there, dimmed, with a finger-sized target. */
@media (hover: none) {
    .menu-item-star {
        opacity: 0.5;
    }

    .menu-item-star.is-active {
        opacity: 1;
    }

    .menu-item-star::before {
        content: "";
        position: absolute;
        inset: -8px;
    }
}

/* Phones (Size=Large) and coarse pointers get finger-sized rows. */
.app-sidebar .k-treeview-lg {
    --asap-tree-row-h: 40px;
    font-size: 0.875rem;
}

@media (pointer: coarse) {
    .app-sidebar {
        --asap-tree-row-h: 40px;
    }

    .app-treebar__btn.k-button {
        width: 40px;
        height: 40px;
    }
}

@media (forced-colors: active) {
    .app-sidebar__nav:not([data-pointer]) .k-treeview-item:focus-visible > .k-treeview-item-content::before {
        outline: 3px solid Highlight;
        outline-offset: -3px;
    }

    .app-sidebar .k-treeview-item-content.is-current::before {
        outline: 2px solid Highlight;
    }

    /* Background-only marks turn Canvas-on-Canvas in forced colours. */
    .app-sidebar__resizer:focus-visible::after,
    .app-sidebar .k-treeview-item[aria-expanded="false"] > .is-trail .menu-item::after {
        background: Highlight;
        opacity: 1;
        forced-color-adjust: none;
    }
}

/* The navigation's loading shape (SidebarSkeleton.razor), on the tree's own grid. */
.sidebar-skeleton {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 4px 12px 0 8px;
    overflow: hidden;
}

.sidebar-skeleton--full {
    padding-top: 4px;
}

.sidebar-skeleton__search,
.sidebar-skeleton__bar,
.sidebar-skeleton__row::before {
    background: linear-gradient(90deg,
            var(--asap-surface-3) 0%,
            color-mix(in oklab, var(--asap-surface-3) 35%, var(--asap-surface)) 50%,
            var(--asap-surface-3) 100%) 0 0 / 300% 100%;
    animation: skeleton-shimmer 1.6s linear infinite;
}

.sidebar-skeleton__search {
    height: 36px;
    margin: 0 -4px 12px 0;
    border-radius: var(--asap-radius);
}

.sidebar-skeleton__bar {
    width: 34%;
    height: 9px;
    margin: 6px 0 10px 12px;
    border-radius: var(--asap-radius-full);
}

.sidebar-skeleton__row {
    position: relative;
    flex: 0 0 auto;
    height: var(--asap-tree-row-h);
}

.sidebar-skeleton__row::before {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(var(--level) * var(--asap-tree-indent));
    width: max(40px, calc(var(--w) - var(--level) * var(--asap-tree-indent)));
    height: 10px;
    margin-top: -5px;
    border-radius: var(--asap-radius-full);
}

/* The tree rows' tooltip card (ProgramTreeTooltip.razor): the name, then the code and where it
   lives. It sits on Kendo's inverse tooltip, so everything takes the tooltip's own ink. */
.tree-tip {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 300px;
    padding-block: 2px;
}

.tree-tip__label {
    font-weight: 600;
    line-height: 1.3;
}

.tree-tip__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.tree-tip__path {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.6875rem;
    opacity: 0.72;
}

.tree-tip .chip {
    height: 18px;
    padding: 0 6px;
    background: color-mix(in oklch, currentColor 16%, transparent);
    color: inherit;
}


/* 8. Header: culture, user menu, chips ---------------------------------------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 8px;
    border-radius: var(--asap-radius-sm);
    background: var(--asap-surface-3);
    color: var(--asap-text-2);
    font-size: 0.71875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.chip--mono {
    font-family: var(--asap-font-mono);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: uppercase;
}

.chip--brand {
    background: var(--asap-brand-soft);
    color: var(--asap-brand);
}

.chip--accent {
    background: color-mix(in oklch, var(--asap-accent) 16%, transparent);
    color: color-mix(in oklab, var(--asap-accent) 75%, var(--asap-text));
}

.user-menu {
    position: relative;
}

.user-menu__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 8px 0 4px;
    border-radius: var(--asap-radius-full);
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background var(--asap-dur-fast), border-color var(--asap-dur-fast);
}

.user-menu__trigger:hover,
.user-menu__trigger[aria-expanded="true"] {
    background: var(--asap-surface-3);
}

/* A plain button among Kendo ones: the same ring, not the browser's own. */
.user-menu__trigger:focus-visible {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 3px var(--asap-ring);
}

.user-menu__name {
    font-weight: 600;
    font-size: 0.8125rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu__caret {
    color: var(--asap-text-3);
    font-size: 18px;
}

.avatar {
    position: relative;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--asap-brand-soft);
    color: var(--asap-brand);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.avatar--lg {
    width: 44px;
    height: 44px;
    font-size: 0.9375rem;
}

/* The box around the user menu's avatar: positioned and not clipping, so a mark on its lower right
   (ShellSlots.AccountAvatarBadge) is whole where the avatar itself clips its circle. */
.user-menu__avatar {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

/* The accent is kept for acting and the current place: a monogram or a code is a grey chip with
   the full ink, on the page, the hovered trigger, the menu's head band and a tinted search row
   alike. */
:is(.avatar, .chip--brand, .app-sidebar__monogram) {
    background: var(--asap-chip-neutral);
    color: var(--asap-text);
}

.avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1049;
}

.user-menu__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-width: calc(100vw - 24px);
    z-index: 1050;
    max-height: calc(100dvh - var(--asap-header-h) - 12px);
    overflow: hidden auto;
    overscroll-behavior: contain;
    background: var(--asap-surface);
    border: 1px solid var(--asap-border);
    border-radius: var(--asap-radius-lg);
    box-shadow: var(--asap-shadow-3);
    animation: pop-in var(--asap-dur-fast) var(--asap-ease) both;
    transform-origin: top right;
}

.user-menu__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--asap-surface-2);
    border-bottom: 1px solid var(--asap-border);
}

.user-menu__head-text {
    min-width: 0;
}

.user-menu__head-name {
    font-weight: 600;
    font-family: var(--asap-font-display);
    font-size: 0.9375rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu__head-sub {
    font-size: 0.75rem;
    color: var(--asap-text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu__list {
    margin: 0;
    padding: 10px 16px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 7px 16px;
    font-size: 0.8125rem;
}

.user-menu__list dt {
    margin: 0;
    font-weight: 500;
    color: var(--asap-text-3);
}

.user-menu__list dd {
    margin: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--asap-text);
}

/* Theme and language (ShellSlots.AccountPreferences): one labelled row each, the control at
   the right edge like the values of the list above. The icons stand in one column, and the
   language list keeps to it: its checks under the translate glyph, its names under the word. */
.user-menu__prefs {
    display: grid;
    padding: 6px 16px 8px;
    border-top: 1px solid var(--asap-border);
}

.user-menu__pref {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
}

.user-menu__pref-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--asap-text-2);
    white-space: nowrap;
}

.user-menu__pref-label .material-symbols-outlined {
    color: var(--asap-text-3);
}

/* A choice of a few, all in view. One highlight slides to the chosen one (--index, set by
   ThemeToggle.razor, FormViewChoice.razor and FlagChoice.razor): a brand tint in light, a lit
   grey key in dark (--asap-seg-*). */
.segmented {
    --seg-w: 36px;
    --seg-gap: 2px;
    position: relative;
    display: inline-flex;
    gap: var(--seg-gap);
    padding: 2px;
    border: 1px solid var(--asap-border);
    border-radius: var(--asap-radius-sm);
}

.segmented::before {
    content: "";
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: var(--seg-w);
    border-radius: calc(var(--asap-radius-sm) - 2px);
    background: var(--asap-seg-thumb);
    box-shadow: var(--asap-seg-edge);
    transform: translateX(calc(var(--index, 0) * (var(--seg-w) + var(--seg-gap))));
    opacity: 0;
}

.segmented.is-placed::before {
    opacity: 1;
}

.segmented.is-ready::before {
    transition: transform var(--asap-dur) var(--asap-ease);
}

.segmented__item {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--seg-w);
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: calc(var(--asap-radius-sm) - 2px);
    background: transparent;
    color: var(--asap-text-3);
    cursor: pointer;
    transition: background var(--asap-dur-fast), color var(--asap-dur-fast);
}

.segmented__item:hover {
    background: color-mix(in oklch, var(--asap-text) 6%, transparent);
    color: var(--asap-text);
}

/* Its ink sets the choice apart from the others' quiet grey. */
.segmented__item.is-selected,
.segmented__item.is-selected:hover {
    background: transparent;
    color: var(--asap-seg-ink);
}

/* The transparent outlines here and below show in forced colours, which drop box-shadow. */
.segmented__item:focus-visible {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 2px var(--asap-ring);
}

/* The language: a row that names the one in use and unfolds the others below it. */
.culture-chooser__toggle.user-menu__pref {
    width: calc(100% + 16px);
    margin-inline: -8px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--asap-radius-sm);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: background var(--asap-dur-fast);
}

.culture-chooser__toggle:hover {
    background: var(--asap-surface-3);
}

.culture-chooser__toggle:focus-visible {
    outline: 2px solid transparent;
    outline-offset: -2px;
    box-shadow: inset 0 0 0 2px var(--asap-ring);
}

.culture-chooser__value {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--asap-text);
}

.culture-chooser__current {
    transition: opacity var(--asap-dur-fast);
}

.culture-chooser.is-open .culture-chooser__current {
    opacity: 0;
}

.culture-chooser__caret {
    margin-inline-end: -3px;
    color: var(--asap-text-3);
    transition: transform var(--asap-dur) var(--asap-ease);
}

.culture-chooser.is-open .culture-chooser__caret {
    transform: rotate(180deg);
}

/* Grows open from nothing: a grid row from 0fr to 1fr, nothing measured. */
.culture-chooser__drawer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--asap-dur) var(--asap-ease);
}

.culture-chooser.is-open .culture-chooser__drawer {
    grid-template-rows: 1fr;
}

/* Clips while it grows; as wide as the row's hover, so the options' highlight is not cut. */
.culture-chooser__clip {
    min-height: 0;
    overflow: hidden;
    margin-inline: -8px;
}

.culture-chooser__list {
    display: grid;
    gap: 1px;
    padding: 2px 0 4px;
}

.culture-chooser__option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--asap-radius-sm);
    background: transparent;
    color: var(--asap-text-2);
    font: inherit;
    font-size: 0.8125rem;
    text-align: start;
    cursor: pointer;
    transition: background var(--asap-dur-fast), color var(--asap-dur-fast);
}

.culture-chooser__option:hover:not(:disabled) {
    background: var(--asap-surface-3);
    color: var(--asap-text);
}

.culture-chooser__option:focus-visible {
    outline: 2px solid transparent;
    outline-offset: -2px;
    box-shadow: inset 0 0 0 2px var(--asap-ring);
}

.culture-chooser__option.is-selected {
    color: var(--asap-text);
}

.culture-chooser__option.is-selected .culture-chooser__name {
    font-weight: 600;
}

.culture-chooser__mark {
    display: grid;
    place-items: center;
    color: var(--asap-brand);
}

.culture-chooser__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.culture-chooser__code {
    font-family: var(--asap-font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    color: var(--asap-text-3);
}

/* The tertiary grey drops under 4.5:1 on the hover grey; the code steps up with the name. */
.culture-chooser__option:hover:not(:disabled) .culture-chooser__code {
    color: var(--asap-text-2);
}

/* While the page reloads in the chosen language: the others wait, the chosen one spins. */
.culture-chooser__option:disabled {
    cursor: default;
    opacity: 0.5;
}

.culture-chooser__option.is-pending:disabled {
    opacity: 1;
    color: var(--asap-text);
}

.is-spinning {
    animation: spin 0.9s linear infinite;
}

.user-menu__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--asap-border);
}

.user-menu__client {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
}


/* 9. Content surfaces ----------------------------------------------------------- */

.surface {
    background: var(--asap-surface);
    border: 1px solid var(--asap-border);
    border-radius: var(--asap-radius-lg);
    box-shadow: var(--asap-shadow-1);
}

.surface--fill {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.surface--fill > .k-grid {
    flex: 1 1 auto;
    min-height: 0;
    border: 0;
    border-radius: inherit;
}

.surface--scroll {
    overflow: auto;
}

.form-surface {
    padding: 20px 24px 12px;
}

.page-skeleton {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 48px 24px;
    color: var(--asap-text-2);
}

.empty__icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    border-radius: var(--asap-radius-lg);
    background: var(--asap-surface-3);
    color: var(--asap-text-3);
}

.empty__icon .k-svg-icon,
.empty__icon .k-svg-icon svg {
    width: 24px;
    height: 24px;
}

.empty__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.empty__text {
    margin: 0;
    max-width: 44ch;
    font-size: 0.8125rem;
}

.empty__actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.empty--compact {
    padding: 24px;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
}

.status-dot--on {
    background: var(--asap-success);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--asap-success) 18%, transparent);
}

.status-dot--off {
    background: var(--asap-danger);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--asap-danger) 18%, transparent);
}

.code-area.k-textarea,
.code-area .k-input-inner {
    font-family: var(--asap-font-mono);
    font-size: 0.8125rem;
    line-height: 1.55;
}

/* Never wider than the screen: a dialog of 440px on a phone of 390 reflows rather than hang over the edge. */
.k-window.app-window {
    max-width: min(1100px, calc(100vw - 16px));
}

/* WG0075's Gasse window (GasseWindow.razor): its content is a column (the status row, then the rack, the one
   part that scrolls) with bands that pad themselves. Scoped CSS cannot reach Telerik's content element, which the
   window renders at the page's root. And the lists' picture card (z-index 10000, under the windows' 10001) comes
   over it, as the cards' thumbnails open it there. */
.k-window.ko-gasse-window > .k-window-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

body:has(.k-window.ko-gasse-window) .pic-card {
    z-index: 15000;
}

/* XML with its syntax coloured (XmlEditor.razor, js/xml-editor.js): a textarea whose own text
   is transparent, over a layer drawn in colour. Both must lay the text out identically, to
   the pixel: same font, size, line height, padding and tab width, and no wrapping, so a
   scrollbar on the one cannot move a line on the other. The palette is shared with WEB015's
   document viewer (doc-code), which colours its structure and source the same way. */
.xml-editor,
.doc-code {
    --xml-tag: light-dark(oklch(47% 0.17 258), oklch(77% 0.12 250));
    --xml-attr: light-dark(oklch(47% 0.18 305), oklch(78% 0.12 305));
    --xml-value: light-dark(oklch(47% 0.13 150), oklch(80% 0.13 150));
    --xml-cdata: light-dark(oklch(44% 0.1 55), oklch(84% 0.09 75));
    --xml-entity: light-dark(oklch(52% 0.17 28), oklch(77% 0.13 35));
    --xml-quiet: var(--asap-text-3);
}

.xml-editor {
    position: relative;
    height: min(60vh, 560px);
    min-height: 240px;
    overflow: hidden;
    /* the edge, hover and focus of every other editor (section 2 and 13) */
    border: 1px solid var(--asap-field-border);
    border-radius: var(--asap-radius-sm);
    background: var(--asap-field-bg, var(--asap-surface));
    transition: border-color var(--asap-dur-fast), box-shadow var(--asap-dur-fast);
}

.xml-editor:hover {
    border-color: var(--asap-field-border-hover);
}

.xml-editor:focus-within {
    border-color: var(--asap-brand);
    box-shadow: 0 0 0 3px var(--asap-ring);
}

.xml-editor.is-readonly {
    background: var(--asap-surface-2);
}

/* The envelope viewer's window (EnvelopeViewer.razor): resized freely, by any edge or corner, past the
   dialogs' cap, and maximized; its content is a column in which the editor takes all the room the foot
   leaves, so the text fills the window at any size. */
.k-window.envelope-window {
    max-width: none;
    max-height: none;
}

.k-window.envelope-window > .k-window-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.envelope-window .xml-editor {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}

.envelope-window .envelope-editor__bar {
    flex: 0 0 auto;
}

/* Kendo's grips are 5-6 px, and in the rounded corners the window's clipping cuts the corner ones
   away: they could not be caught at all. Wider edges, and corners large enough to reach past the curve. */
.k-window.envelope-window > .k-resize-n,
.k-window.envelope-window > .k-resize-s {
    height: 8px;
}

.k-window.envelope-window > .k-resize-e,
.k-window.envelope-window > .k-resize-w {
    width: 8px;
}

.k-window.envelope-window > :is(.k-resize-ne, .k-resize-nw, .k-resize-se, .k-resize-sw) {
    z-index: 201;
    width: 18px;
    height: 18px;
}

.xml-editor__layer,
.xml-editor__input {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 10px 14px;
    border: 0;
    font-family: var(--asap-font-mono);
    font-size: 0.8125rem;
    /* Cascadia Code joins "--" and "->" (its contextual alternates): not in XML. */
    font-variant-ligatures: none;
    font-feature-settings: "calt" 0, "liga" 0;
    line-height: 1.55;
    letter-spacing: 0;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    text-align: start;
}

.xml-editor__layer {
    overflow: hidden;
    color: var(--asap-text);
    pointer-events: none;
}

/* Room past the text, so the layer can always scroll as far as the textarea, whose scrollbars
   take some of its box away. */
.xml-editor__layer code {
    display: block;
    width: max-content;
    min-width: 100%;
    padding: 0 32px 32px 0;
    font: inherit;
    background: none;
    color: inherit;
}

.xml-editor__input {
    width: 100%;
    height: 100%;
    overflow: auto;
    resize: none;
    outline: none;
    background: transparent;
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: var(--asap-text);
}

.xml-editor__input::selection {
    background: color-mix(in oklch, var(--asap-brand) 24%, transparent);
    -webkit-text-fill-color: transparent;
}

.xml-editor .x-tag { color: var(--xml-tag); }
.xml-editor .x-attr { color: var(--xml-attr); }
.xml-editor .x-value { color: var(--xml-value); }
.xml-editor .x-cdata { color: var(--xml-cdata); }
.xml-editor .x-entity { color: var(--xml-entity); }
.xml-editor .x-punct,
.xml-editor .x-decl { color: var(--xml-quiet); }
.xml-editor .x-comment { color: var(--xml-quiet); }

/* The envelope editor's foot: what the text is (as sent, edited, refused) and what to do with it. */
.envelope-editor__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
}

.envelope-editor__status {
    flex: 1 1 18rem;
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    font-size: 0.8125rem;
    color: var(--asap-text-2);
}

.envelope-editor__status.is-error {
    color: var(--asap-danger);
    font-family: var(--asap-font-mono);
    font-size: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* 10. Home ----------------------------------------------------------------------- */

.home {
    max-width: 1160px;
    margin: 0 auto;
    padding: 8px 4px 32px;
}

.home__hero {
    padding: 24px 0 8px;
}

/* text-2: on the canvas text-3 falls just short of 4.5:1 */
.eyebrow {
    margin: 0 0 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--asap-text-2);
}

.display {
    margin: 0 0 10px;
    font-family: var(--asap-font-display);
    font-size: clamp(1.625rem, 2.6vw, 2.25rem);
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.12;
}

/* Bootstrap's own .lead is weight 300, too thin for body copy */
.lead {
    margin: 0;
    max-width: 62ch;
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--asap-text-2);
}

.message-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 20px;
    padding: 12px 14px;
    border-radius: var(--asap-radius);
    border: 1px solid color-mix(in oklch, var(--asap-info) 30%, transparent);
    background: color-mix(in oklch, var(--asap-info) 9%, transparent);
    color: var(--asap-text);
    font-size: 0.84375rem;
}

.message-banner .k-svg-icon {
    flex: 0 0 auto;
    color: var(--asap-info);
    margin-top: 1px;
}

.message-banner--warning {
    border-color: color-mix(in oklch, var(--asap-warning) 40%, transparent);
    background: color-mix(in oklch, var(--asap-warning) 12%, transparent);
}

.message-banner--warning .k-svg-icon {
    color: color-mix(in oklab, var(--asap-warning) 70%, var(--asap-text));
}

.message-banner--error {
    border-color: color-mix(in oklch, var(--asap-danger) 35%, transparent);
    background: color-mix(in oklch, var(--asap-danger) 9%, transparent);
}

.message-banner--error .k-svg-icon {
    color: var(--asap-danger);
}

.home__section {
    margin-top: 28px;
}

.home__section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.005em;
}

.home__section-title .k-svg-icon {
    color: var(--asap-text-3);
}

.home__section-title .chip {
    margin-left: 2px;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    background: var(--asap-surface);
    border: 1px solid var(--asap-border);
    border-radius: var(--asap-radius-lg);
    box-shadow: var(--asap-shadow-1);
    transition: transform var(--asap-dur-fast) var(--asap-ease),
                box-shadow var(--asap-dur-fast) var(--asap-ease),
                border-color var(--asap-dur-fast) var(--asap-ease),
                background-color var(--asap-dur-fast) var(--asap-ease);
}

.tile:hover {
    transform: translateY(-1px);
    box-shadow: var(--asap-shadow-2);
    border-color: var(--asap-border-strong);
}

/* A shadow does not lift a card off a near-black canvas; a lighter grey does. */
:root[data-theme="dark"] .tile:hover {
    background: var(--asap-surface-2);
}

.tile:active {
    transform: translateY(0);
}

/* The transparent outline turns into a system-colour ring in Windows contrast themes,
   which drop box-shadow. */
.tile:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: var(--asap-brand);
    box-shadow: 0 0 0 3px var(--asap-ring), var(--asap-shadow-1);
}

.tile__icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--asap-brand-soft);
    color: var(--asap-brand);
}

.tile__body {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
}

.tile__title {
    display: block;
    font-weight: 600;
    font-size: 0.84375rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile__meta {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--asap-text-3);
}

.tile__arrow {
    flex: 0 0 auto;
    color: var(--asap-text-3);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity var(--asap-dur-fast), transform var(--asap-dur-fast);
}

.tile:is(:hover, :focus-visible) .tile__arrow {
    opacity: 1;
    transform: none;
}

.tile--star .tile__icon {
    background: color-mix(in oklch, var(--asap-accent) 14%, transparent);
    color: color-mix(in oklab, var(--asap-accent) 80%, var(--asap-text));
}

/* A recent program's icon is a grey chip until the pointer or focus is on it, so the favourites
   keep the only orange icons on the page and the accent marks where you act. */
.tile:not(.tile--star) .tile__icon {
    background: var(--asap-chip-neutral);
    color: var(--asap-text-2);
    transition: color var(--asap-dur-fast), background-color var(--asap-dur-fast);
}

.tile:not(.tile--star):is(:hover, :focus-visible) .tile__icon {
    background: var(--asap-brand-soft);
    color: var(--asap-brand);
}


/* 11. Grid ----------------------------------------------------------------------- */

.k-grid {
    border-color: var(--asap-border);
    font-variant-numeric: tabular-nums;
    /* The stripe and Kendo's row hover (8% in srgb, as it composites) as opaque tones, so a
       pinned cell, which has to cover what scrolls under it, repeats its row exactly. */
    --grid-row-alt: color-mix(in oklab, var(--asap-surface-2) 60%, var(--asap-surface));
    --grid-row-hover: color-mix(in srgb, var(--asap-text) 8%, var(--asap-surface));
}

/* On graphite a 60% stripe is a 1.04 step, too faint to follow a row across; the full
   header grey is the smallest step that survives a 16-bit Remote Desktop. */
:root[data-theme="dark"] .k-grid {
    --grid-row-alt: var(--asap-surface-2);
}

/* AutoFitColumns: Telerik toggles `k-autofitting` on the header/content table (which
   sets `width: auto; table-layout: auto`), clears the column's <col> width, measures
   one cell with getBoundingClientRect() and toggles everything back — all in one
   synchronous step. Any transition on those widths would freeze the previous layout
   for that measurement and autofit would hand back the current widths. Keep the
   measurement instant and keyword interpolation off, whatever the rest of the
   cascade does. */
.k-grid .k-autofitting,
.k-grid .k-autofitting * {
    transition: none !important;
    interpolate-size: numeric-only;
}

.k-grid .k-grid-toolbar {
    gap: 6px;
    padding: 8px 10px;
    border-color: var(--asap-border);
    background: var(--asap-surface);
}

.k-grid .k-grid-toolbar .k-button {
    border-radius: var(--asap-radius-sm);
}

/* Side by side the bar holds the host's actions for the selected rows (SubfileGrid.razor):
   labelled buttons drawn like the function keys, the default one solid, deleting red on
   approach; then how many rows they act on; the list's own tools as icons at the end. */
.grid-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.k-grid .k-grid-toolbar .grid-action.k-button {
    height: 32px;
    padding: 0 12px 0 9px;
    border-radius: var(--asap-radius-sm);
    border: 1px solid var(--asap-border);
    background: var(--asap-surface-2);
    color: var(--asap-text);
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: var(--asap-shadow-1);
    transition: background var(--asap-dur-fast), border-color var(--asap-dur-fast),
                color var(--asap-dur-fast), box-shadow var(--asap-dur-fast);
}

.grid-action.k-button .k-button-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.grid-action.k-button .material-symbols-outlined {
    font-size: 18px;
    color: var(--asap-text-2);
    transition: color var(--asap-dur-fast);
}

.k-grid .k-grid-toolbar .grid-action.k-button:not(.k-disabled):hover {
    background: var(--asap-action-hover);
    border-color: var(--asap-border-strong);
    box-shadow: var(--asap-shadow-2);
}

.grid-action.k-button:not(.k-disabled):hover .material-symbols-outlined {
    color: var(--asap-brand);
}

/* Graphite, as on the function keys: a passing pointer leaves the icon neutral; the accent
   marks the actions themselves (the default), not the hover. */
:root[data-theme="dark"] .grid-action.k-button:not(.k-disabled, .k-button-primary, .is-danger):hover .material-symbols-outlined {
    color: var(--asap-text);
}

.k-grid .k-grid-toolbar .grid-action.k-button:focus-visible,
.k-grid .k-grid-toolbar .grid-action.k-button.k-focus {
    box-shadow: 0 0 0 3px var(--asap-ring);
}

/* The ring outlasts the hover lift and the press, as on the function keys. The default
   action's ring is the offset outline every solid button takes (section 13). */
.k-grid .k-grid-toolbar .grid-action.k-button:not(.k-disabled, .k-button-primary):is(:hover, :active):focus-visible {
    box-shadow: 0 0 0 3px var(--asap-ring);
}

.k-grid .k-grid-toolbar .grid-action.k-button-primary {
    background: var(--asap-brand-fill);
    border-color: transparent;
    color: var(--asap-on-brand);
}

.grid-action.k-button-primary .material-symbols-outlined,
.grid-action.k-button-primary:not(.k-disabled):hover .material-symbols-outlined {
    color: color-mix(in srgb, var(--asap-on-brand) 92%, transparent);
}

.k-grid .k-grid-toolbar .grid-action.k-button-primary:not(.k-disabled):hover {
    background: var(--asap-brand-fill-hover);
    border-color: transparent;
}

/* Pressed, as on the function keys: a step below rest and flat. On graphite the hover lift
   lands on the press grey (surface-3), so there the press settles between rest and hover. */
.k-grid .k-grid-toolbar .grid-action.k-button:not(.k-disabled, .k-button-primary, .is-danger):active {
    background: var(--asap-surface-3);
    box-shadow: none;
}

:root[data-theme="dark"] .k-grid .k-grid-toolbar .grid-action.k-button:not(.k-disabled, .k-button-primary, .is-danger):active {
    background: oklch(from var(--asap-action-hover) calc(l - 0.025) c h);
}

.k-grid .k-grid-toolbar .grid-action.k-button-primary:not(.k-disabled):active {
    background: var(--asap-brand-fill-active);
    box-shadow: none;
}

.k-grid .k-grid-toolbar .grid-action.is-danger:not(.k-disabled):hover {
    background: color-mix(in oklab, var(--asap-danger) 8%, var(--asap-surface));
    border-color: color-mix(in oklch, var(--asap-danger) 45%, transparent);
    /* the deeper red: the ink alone is 4.3:1 on the light tint */
    color: var(--asap-danger-fill-active);
}

/* Pressed, the tint deepens; in light the label deepens with it, or it drops under 4.5:1.
   The dark ink already holds 5:1 on the deeper tint. */
.k-grid .k-grid-toolbar .grid-action.is-danger:not(.k-disabled):active {
    background: color-mix(in oklab, var(--asap-danger) 14%, var(--asap-surface));
    color: var(--asap-danger-fill-active);
    box-shadow: none;
}

:root[data-theme="dark"] .k-grid .k-grid-toolbar .grid-action.is-danger:not(.k-disabled):is(:hover, :active) {
    color: var(--asap-danger);
}

.grid-action.is-danger.k-button:not(.k-disabled):hover .material-symbols-outlined {
    color: inherit;
}

.grid-action.is-danger.k-button:not(.k-disabled):active .material-symbols-outlined {
    color: inherit;
}

/* Nothing selected: the actions wait, flat, and the count says why. */
.k-grid .k-grid-toolbar .grid-action.k-button.k-disabled {
    opacity: 1;
    background: transparent;
    border-color: var(--asap-border);
    box-shadow: none;
    color: var(--asap-text-3);
}

.grid-action.k-button.k-disabled .material-symbols-outlined {
    color: var(--asap-text-3);
}

/* How many rows the actions will act on: nothing at all until there are some. */
.grid-selection {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 24px;
    font-size: 0.78125rem;
    color: var(--asap-text);
    white-space: nowrap;
}

.grid-selection.has-selection {
    margin-inline-start: 6px;
    padding-inline-start: 12px;
    border-inline-start: 1px solid var(--asap-border);
}

.grid-selection__count {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.k-grid .k-grid-toolbar .grid-selection__clear.k-button {
    width: 24px;
    height: 24px;
    border-radius: var(--asap-radius-full);
}

.grid-selection__clear.k-button .k-svg-icon,
.grid-selection__clear.k-button .k-svg-icon svg {
    width: 14px;
    height: 14px;
}

.grid-tools {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.k-grid .k-grid-toolbar .grid-tools .app-iconbtn.k-button {
    width: 32px;
    height: 32px;
}

.grid-tools .app-iconbtn.k-button.k-disabled {
    opacity: 0.35;
}

.grid-tools__sep {
    width: 1px;
    height: 18px;
    margin-inline: 4px;
    background: var(--asap-border);
}

.k-grid .k-grid-header {
    border-color: var(--asap-border);
    background: var(--asap-surface-2);
}

/* 500 on a narrower cut (Mona Sans's width axis at 90 %): more of a title fits at the same size.
   GridFontMetrics.HeaderAdvances is measured in exactly this type. */
.k-grid .k-grid-header .k-table-th {
    font-size: 0.75rem;
    font-weight: 500;
    font-stretch: 90%;
    letter-spacing: 0.02em;
    color: var(--asap-text-2);
    border-color: var(--asap-border);
    padding-block: 8px;
}

.k-grid .k-grid-header .k-column-title {
    font-weight: 500;
}

/* GridFontMetrics measured the cells at 14px and the headers at 12px, and Mona Sans changes its
   glyphs with the optical size: from 17px on it switches to a wider display cut. Pinned to the
   sizes measured, a larger root font scales the text, and the columns computed for it, alike. */
.k-grid .k-table-td {
    font-variation-settings: "opsz" 14;
}

.k-grid .k-grid-header .k-table-th {
    font-variation-settings: "opsz" 12;
}

/* The sort arrow sits 4px after the title, not the theme's 15px: every column keeps room
   for it (SubfileColumnWidths.SortIconReserve), and 15px on each would add up. The theme
   sets it with `.k-grid .k-grid-header .k-cell-inner > .k-link > .k-sort-icon`. */
.k-grid .k-grid-header .k-table-th .k-cell-inner > .k-link > .k-sort-icon {
    margin-inline-start: 4px;
}

/* Kendo paints the sort arrow, its order digit and the column-menu marks with the primary
   fill; on dark that is too deep to read on the header or the raised popup, so they take
   the ink. The menu's marks live in its items, which Kendo renders at the document root. */
.k-grid .k-grid-header :is(.k-sort-icon, .k-sort-order),
.k-grid-header .k-columnmenu-indicators,
:is(.k-column-menu, .k-columnmenu-item) .k-columnmenu-indicators {
    color: var(--asap-brand);
}

/* On graphite the menu marks in full text colour outshine the column titles beside them:
   they rest a step below the titles and come up on hover. A filtered column (.k-active)
   keeps its solid mark. */
:root[data-theme="dark"] .k-grid .k-grid-header :is(.k-grid-header-menu, .k-grid-filter, .k-header-column-menu):not(.k-active) {
    color: var(--asap-text-3);
}

:root[data-theme="dark"] .k-grid .k-grid-header :is(.k-grid-header-menu, .k-grid-filter, .k-header-column-menu):not(.k-active):hover {
    color: var(--asap-text);
}

/* The grouping hint is an instruction, not data: on graphite it takes the titles' tone. */
:root[data-theme="dark"] .k-grid .k-grouping-header {
    color: var(--asap-text-2);
}

.k-grid .k-table-td {
    border-color: var(--asap-border);
    padding-block: 5px;
}

/* A value wider than its column ends in an ellipsis. The cell's own text-overflow never
   reaches the block the templates wrap a value in, so without this a too-narrow column cuts
   a number mid-digit and leaves a plausible, wrong one. Columns are sized from the data on
   the server (SubfileColumnWidths); this is for the width the user drags them to. */
.k-grid .k-table-td > .text-nowrap,
.k-grid .k-table-td .d-flex > .text-nowrap {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* A picture column's thumbnail (SubfileGrid), before its value: a fixed box, so a thumbnail that
   comes late, or never, moves nothing; SubfileColumnWidths counts its 24px. 24px in a 20px line,
   so it overhangs the line by 2px each way and the row keeps its height. The tile shows while it
   loads, and covers the broken-image icon of a missing one: a broken <img> draws ::after, a loaded
   one does not (Chromium, Firefox). The pointer resting on it opens its card (picture-card.js). */
.cell-pic {
    position: relative;
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    margin-block: -2px;
    border-radius: var(--asap-radius-xs);
    object-fit: cover;
    background: var(--asap-surface-3);
    box-shadow: inset 0 0 0 1px var(--asap-border);
}

.cell-pic::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--asap-surface-3);
    box-shadow: inset 0 0 0 1px var(--asap-border);
}

.cell-pic.is-round {
    border-radius: 50%;
}

/* The same on a phone card, where the value sits one level deeper and no column can be
   widened. Not the traffic light: flush left there, the clip would cut its halo. */
.k-grid .k-grid-stack-content > .text-nowrap:not(:has(> .status-dot)) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.k-grid .k-table-alt-row {
    background: var(--grid-row-alt);
}

/* Stacked cards (phones) have no row lines, and a faint stripe alone does not show where a
   record ends: every card after the first opens with the grid's hairline. */
.k-grid .k-table-row + .k-table-row > .k-table-td:has(> .k-grid-stack-row) {
    border-block-start-width: 1px;
}

/* Selected rows: Kendo's own selectors (a :not(.k-group-cell) less would lose), its own
   formula in light; in dark the tint comes from the ink, so selection stays a step above
   the hover tint instead of level with it. Pinned cells draw it on a ::before. */
.k-grid .k-table-row.k-selected > .k-table-td:not(.k-group-cell),
.k-grid .k-table-td.k-selected:not(.k-group-cell),
.k-grid .k-grid-stack-cell.k-selected {
    background-color: var(--asap-row-selected);
}

.k-grid .k-master-row.k-table-row.k-selected.k-grid-row-sticky > .k-table-td::before,
.k-grid .k-master-row.k-table-row.k-selected .k-table-td.k-grid-row-sticky::before,
.k-grid .k-master-row.k-table-row.k-selected .k-grid-content-sticky::before,
.k-grid .k-master-row.k-table-row .k-selected.k-table-td.k-grid-content-sticky::before {
    background-color: var(--asap-row-selected);
}

/* The current page is a grey chip (Kendo draws it from the primary ink), not orange. */
.k-pager {
    --kendo-color-primary-on-surface: var(--asap-text);
}

.k-grid .k-pager {
    padding: 6px 10px;
    font-variant-numeric: tabular-nums;
    font-size: 0.78125rem;
    border-color: var(--asap-border);
    background: var(--asap-surface);
    color: var(--asap-text-2);
}

/* Kendo's responsive pager stays on one line and clips what does not fit: on a phone that
   was the page-size picker. There it wraps to a second, centred line instead. */
@media (max-width: 480px) {
    .k-grid .k-pager {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 6px;
    }
}

.k-grid .k-command-cell {
    text-align: right;
    white-space: nowrap;
}

.k-grid .k-command-cell .k-button,
.k-grid-stack-content .k-button {
    margin-inline: 2px;
    border-radius: var(--asap-radius-sm);
}

/* Kendo's row hover lands on the grey of the row buttons, which then lose their tile on the
   row under the pointer: there rest, hover and press each move one rung of Kendo's ladder (a
   pointer press always lands on a hovered row). Both steps are literal: a hover written as
   var(--kendo-color-base-active) would take the press declared beside it. A selected row's
   tint already sets them apart. */
.k-grid .k-table-row:not(.k-selected):is(:hover, .k-hover) > .k-command-cell {
    --kendo-color-base: var(--kendo-color-base-hover);
}

.k-grid .k-table-row:not(.k-selected):is(:hover, .k-hover) > .k-command-cell .k-button {
    --kendo-color-base-hover: oklch(from var(--asap-control) calc(l - 0.094) c h);
    --kendo-color-base-active: oklch(from var(--asap-control) calc(l - 0.144) c h);
}

:root[data-theme="dark"] .k-grid .k-table-row:not(.k-selected):is(:hover, .k-hover) > .k-command-cell .k-button {
    --kendo-color-base-hover: oklch(from var(--asap-control) calc(l + 0.08) c h);
    --kendo-color-base-active: oklch(from var(--asap-control) calc(l + 0.12) c h);
}

/* The accent is kept for acting on a choice (the toolbar's default action, Enter): a row's
   default button is a grey key a step off its siblings, so a page of rows is not a column of
   orange squares. */
.k-grid :is(.k-command-cell, .k-grid-stack-content) {
    --kendo-color-primary: var(--asap-key-default);
    --kendo-color-primary-hover: var(--asap-key-default-hover);
    --kendo-color-primary-active: var(--asap-key-default-active);
    --kendo-color-on-primary: var(--asap-text);
}

.k-grid .selection-header,
.k-grid .k-table-td:has(.k-checkbox-wrap) {
    text-align: center !important;
}

.k-grid .k-grid-norecords,
.k-grid .k-grid-norecords-template {
    border: 0;
    background: transparent;
}

.k-grid .k-column-resizer:hover {
    background: var(--asap-brand);
}

/* Pinned columns: Kendo edges them with half the text colour, a hard line in both themes,
   and paints their stripe and hover with base greys the rows do not use. They repeat their
   row instead, and the pin edge stays one hairline step above the grid lines. Kendo's own
   selectors, so these tie and win on order. */
.k-grid .k-master-row .k-grid-content-sticky:not(.k-group-cell),
.k-grid .k-grouping-row .k-grid-content-sticky,
.k-grid .k-grid-header .k-table-th.k-grid-header-sticky {
    border-inline-color: var(--asap-border-strong);
}

.k-grid .k-master-row.k-table-alt-row .k-grid-content-sticky:not(.k-group-cell),
.k-grid .k-master-row.k-table-alt-row .k-table-td.k-grid-content-sticky:not(.k-group-cell) {
    background-color: var(--grid-row-alt);
}

.k-grid .k-master-row.k-table-row:is(:hover, .k-hover) .k-table-td.k-grid-content-sticky:not(.k-group-cell) {
    background-color: var(--grid-row-hover);
}

.k-grid td.cell-ellipsis,
.k-grid .k-table-td.cell-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Keyboard focus: the design-system ring, inset, where Kendo draws a 10-15% grey (header
   menus, column-menu items) that vanishes on both themes. The list is not Navigable, so
   Telerik leaves its cells and headers unfocusable and takes the header menus, checkboxes
   and row buttons out of the tab order (tabindex -1); inside the list the keyboard reaches
   only an open column menu's items, with the arrow keys. */
.k-grid .k-grid-header :is(.k-grid-header-menu, .k-grid-filter, .k-header-column-menu):focus-visible,
.k-column-menu :is(.k-columnmenu-item, .k-column-list-item):focus-visible,
.k-column-menu .k-menu:not(.k-context-menu) .k-item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--asap-ring);
}

/* A click also focuses the header menu and the first column-menu item. Kendo frames them
   for any focus, which reads as a stuck hover; pointer focus stays quiet. */
.k-grid .k-grid-header :is(.k-grid-header-menu, .k-grid-filter, .k-header-column-menu):focus:not(:focus-visible),
.k-column-menu :is(.k-columnmenu-item, .k-column-list-item):focus:not(:focus-visible),
.k-column-menu .k-menu:not(.k-context-menu) .k-item:focus:not(:focus-visible) {
    box-shadow: none;
}

.k-grid .k-checkbox:focus-visible,
.k-column-menu .k-checkbox:focus-visible {
    box-shadow: 0 0 0 3px var(--asap-ring);
}

/* Contrast themes force the dot's fill to the page colour, and on and off differ by hue
   alone: there on is filled and off is a ring. */
@media (forced-colors: active) {
    .k-grid .status-dot {
        forced-color-adjust: none;
        border: 2px solid CanvasText;
        box-shadow: none;
    }

    .k-grid .status-dot--on {
        background: CanvasText;
    }

    .k-grid .status-dot--off {
        background: Canvas;
    }
}


/* 12. Forms (detail screens) ----------------------------------------------------
   ScreenForm lays a host screen out on the host's own rows and columns (ScreenLayout).
   forms.js picks one of three arrangements from the space there is:
     wide     every field at its host row and column, as the green screen had it
     stacked  the side-by-side blocks below each other, on one shared set of columns
     compact  every host line wraps on its own (a phone, a very narrow sheet)
   The grid is always as wide as its content (max-content), so its width tells forms.js
   whether an arrangement fits without trying it out in the page.
   A box always means "you can type here"; a fixed value is plain, selectable text. */

.details-form {
    --form-pitch: 34px;
    --form-gap: 14px;
    --form-rule: 17px;
    --form-col-gap: 12px;
    --form-block-gap: 20px;
    min-width: 0;
    /* amounts, dates and numbers line up from row to row */
    font-variant-numeric: tabular-nums;
}

/* A display screen has nothing to type into: it reads as a data sheet, closer set. */
.details-form.is-readonly {
    --form-pitch: 28px;
}

.form-grid {
    display: grid;
    width: max-content;
    max-width: none;
    column-gap: var(--form-col-gap);
    align-items: center;
    grid-template-columns: repeat(var(--wide-cols, 1), max-content);
    grid-template-rows: var(--wide-rows, auto);
}

.details-form[data-arrangement="stacked"] .form-grid {
    grid-template-columns: repeat(var(--stack-cols, 1), max-content);
    grid-template-rows: var(--stack-rows, auto);
}

.form-block,
.form-line {
    display: contents;
}

.form-cell {
    grid-row: var(--wr);
    grid-column: var(--wc) / span var(--ws, 1);
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    min-height: var(--form-pitch);
}

/* A piece of a cell: one field, or a range's separator, or a unit. It carries the field's state.
   Its font is the editors' (13px): widths are counted in characters (ch), which are as wide as
   the font they are counted in, so a fixed value, an editor and a column head only line up when
   all three count in the same one. */
.form-part {
    --fw: var(--fw-w);
    font-size: var(--kendo-font-size-sm);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.details-form[data-arrangement="stacked"] .form-part {
    --fw: var(--fw-s);
}

.details-form[data-arrangement="stacked"] .form-cell {
    grid-row: var(--sr);
    grid-column: var(--sc) / span var(--ss, 1);
}

/* A block that stands next to another one on the green screen keeps some air on its left. */
.details-form[data-arrangement="wide"] .form-cell.is-block-start {
    padding-inline-start: var(--form-block-gap);
}


/* Stacked blocks share one set of columns: a long caption or description takes two lines
   rather than widening the column for every block (the measured width follows these caps). */
.details-form[data-arrangement="stacked"] .form-grid {
    column-gap: 10px;
}

.details-form[data-arrangement="stacked"] :is(.form-label, .form-header) {
    max-width: 10rem;
    white-space: normal;
    overflow-wrap: break-word;
}

.details-form[data-arrangement="stacked"] .form-desc {
    max-width: 12rem;
    white-space: normal;
}

/* The host's <L> lines and, when stacked, the rule between two blocks of one section. */
.form-divider,
.form-break {
    grid-column: 1 / -1;
    grid-row: var(--wr);
    align-self: center;
    height: 0;
    border-top: 1px solid var(--asap-border);
}

.details-form[data-arrangement="stacked"] .form-divider {
    grid-row: var(--sr);
}

.form-break {
    display: none;
    grid-row: var(--sr);
    border-top-style: dashed;
}

.details-form[data-arrangement="stacked"] .form-break {
    display: block;
}

/* A host <L> after other fields: on a grid row of its own across the whole form (ScreenLayout),
   drawn like the ruled rows above. The <hr> sits in a .form-part, which would otherwise shrink
   to nothing around it. */
.form-cell.is-rule {
    min-height: 0;
}

.form-cell.is-rule > .form-part {
    flex: 1 1 auto;
}

/* Bootstrap fills an <hr> with currentColor; under dark's translucent border it shows through
   as a light line, so only the border draws. */
.form-part > .form-rule {
    flex: 1 1 auto;
    height: 0;
    margin: 0;
    border: 0;
    border-top: 1px solid var(--asap-border);
    background: none;
    opacity: 1;
}

/* The focused host line, lit across every block like a 5250 rule line. forms.js moves it. */
.form-ruler {
    grid-column: 1 / -1;
    grid-row: var(--ruler-row, 1);
    align-self: stretch;
    margin-inline: -8px;
    border-radius: var(--asap-radius-sm);
    background: color-mix(in oklch, var(--asap-brand) 6%, transparent);
    visibility: hidden;
    pointer-events: none;
}

/* 6% of the ink barely lifts graphite; the band needs a little more to be found. */
:root[data-theme="dark"] .form-ruler {
    background: color-mix(in oklab, var(--asap-brand) 10%, transparent);
}

.form-grid:focus-within > .form-ruler {
    visibility: visible;
}

/* Compact: every host line wraps on its own; a label sits above its values. */
.details-form[data-arrangement="compact"] .form-grid {
    display: block;
    width: auto;
}

.details-form[data-arrangement="compact"] .form-block {
    display: block;
}

.details-form[data-arrangement="compact"] .form-block + .form-block {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--asap-border);
}

.details-form[data-arrangement="compact"] .form-block + .form-block.is-section-start {
    margin-top: var(--form-gap);
    border-top: 1px solid var(--asap-border);
}

.details-form[data-arrangement="compact"] .form-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    padding-block: 3px;
}

.details-form[data-arrangement="compact"] .form-cell.is-rule {
    flex-basis: 100%;
    padding-block: 6px;
}

.details-form[data-arrangement="compact"] .form-cell {
    min-height: 0;
    min-width: 0;
    max-width: 100%;
}

.details-form[data-arrangement="compact"] .form-cell.is-label {
    flex: 1 0 100%;
    padding-inline-start: 0;
}


/* Nothing is measured in compact: long values, captions and descriptions wrap in place. */
.details-form[data-arrangement="compact"] .form-cell > * {
    min-width: 0;
}

.details-form[data-arrangement="compact"] :is(.form-value, .form-code) {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.details-form[data-arrangement="compact"] :is(.form-label, .form-header, .form-unit, .form-desc, .form-link) {
    white-space: normal;
    overflow-wrap: anywhere;
}

.details-form[data-arrangement="compact"] :is(.form-ruler, .form-break) {
    display: none;
}

.details-form[data-arrangement="compact"] .form-divider {
    margin-block: 10px;
}

/* Text: labels, the host's column heads, units, separators and lookup descriptions. */
.form-label,
.form-header,
.form-unit,
.form-sep,
.form-desc {
    white-space: nowrap;
    line-height: 1.3;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--asap-text-2);
}

label.form-label {
    cursor: pointer;
}

.form-header {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--asap-text-2);
}

.form-unit,
.form-desc {
    font-size: 0.8125rem;
    color: var(--asap-text-2);
}

.form-sep {
    padding-inline: 2px;
    color: var(--asap-text-3);
}

/* "descriptionX / descriptionY" with nothing to describe yet: no lone "/" between two blanks. */
.form-part:has(> .form-desc:empty) {
    display: none;
}

.form-part:has(> .form-sep):has(+ .form-part > .form-desc:empty),
.form-part:has(> .form-desc:empty) + .form-part:has(> .form-sep) {
    display: none;
}

/* A fixed value: plain text people can select and copy, formatted the way they read it. */
.form-value {
    font-size: inherit;
    color: var(--asap-text);
    white-space: pre;
    font-variant-numeric: tabular-nums;
    user-select: text;
}

/* Zero reads quieter in colour, never faint: it is still data. A missing value is a dash. */
/* A fixed value sits where an editor's text would: the same inset as a box (its border and
   padding, 9px), so fixed and editable values in one column line up. A right-aligned value
   takes a box's width too: its column's widest number (--fw, FormColumns), else its own length. */
.form-part > :is(.form-value, .form-flagvalue, .form-link) {
    padding-inline-start: 9px;
}

.form-part > .form-code {
    margin-inline-start: 3px;
}

.form-value:is(.is-end, .is-center) {
    display: inline-block;
    box-sizing: border-box;
    width: var(--fw, calc(var(--len, 0) * 1ch + 18px));
    padding-inline: 9px;
}

.form-value.is-end {
    text-align: end;
}

.form-value.is-center {
    text-align: center;
}

/* A column head over numbers stands over their right edge: its piece is as wide as they are
   (counted in the values' font), the smaller caption right-aligned inside it. */
.form-part:has(> .form-header.is-end) {
    width: var(--fw);
}

.form-header.is-end {
    flex: 1 1 auto;
    padding-inline-end: 9px;
    text-align: end;
}

.form-value.is-muted {
    color: var(--asap-text-2);
}

.form-value.is-empty {
    color: var(--asap-text-3);
}

.form-value.is-mono,
.form-part.is-mono .k-input-inner {
    font-family: var(--asap-font-mono);
    font-size: 0.8125rem;
}

.form-code {
    padding: 1px 6px;
    border-radius: var(--asap-radius-xs);
    background: var(--asap-surface-3);
    font-family: var(--asap-font-mono);
    font-size: 0.8125rem;
    color: var(--asap-text);
    white-space: pre;
    user-select: text;
}

.form-flagvalue {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
}

.form-flagvalue .k-svg-icon {
    color: var(--asap-success);
}

.form-flagvalue.is-no,
.form-flagvalue.is-no .k-svg-icon,
.form-flagvalue.is-none {
    color: var(--asap-text-2);
}

.form-link {
    color: var(--asap-brand);
    text-decoration: none;
}

.form-link:hover {
    text-decoration: underline;
}

.form-meter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.form-meter__track {
    width: 120px;
    height: 6px;
    overflow: hidden;
    border-radius: var(--asap-radius-full);
    background: var(--asap-surface-3);
}

.form-meter__fill {
    display: block;
    width: var(--pct, 0%);
    height: 100%;
    border-radius: inherit;
    /* data, not an action: drawn in the ink, the accent stays rare */
    background: var(--asap-text-2);
}

/* Editors: as wide as the host allows characters (set per field), never wider than the cell. */
.form-cell :is(.k-input, .k-picker) {
    flex: 0 1 auto;
    max-width: 100%;
}

/* An empty date shows its format as a hint (DateEditor), in the quietest grey, like a missing
   fixed value: it must not read as data. */
.form-cell .k-input-inner::placeholder {
    color: var(--asap-text-3);
}

/* One end cap for every box: what sits at its end (a password's eye, a code's text and arrow)
   stays in the field's own fill, as a drop-down's arrow does; Kendo gives it a band of its own. */
.form-cell .k-input .k-input-suffix {
    background-color: transparent;
}

/* The date and time button is a solid control; in the dark well it stands out as a raised grey
   tab, so it becomes an icon behind a hairline, like the eye. */
:root[data-theme="dark"] .form-cell .k-input .k-input-button {
    border-inline-start-color: var(--asap-border);
    background: transparent;
}

:root[data-theme="dark"] .form-cell .k-input .k-input-button:hover {
    background: color-mix(in oklab, var(--asap-text) 8%, transparent);
}

:root[data-theme="dark"] .form-cell .k-input .k-input-button:active {
    background: color-mix(in oklab, var(--asap-text) 13%, transparent);
}

.form-cell .k-numerictextbox .k-input-inner {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.form-part.is-upper .k-input-inner {
    text-transform: uppercase;
}

.form-cell .k-textarea {
    min-height: calc(var(--form-pitch) * 2);
}

/* A code field shows its code's text inside itself ("A  ABC"), as the legacy combo box did: the
   code where it is typed (as wide as the host's code, --code characters), the text after it,
   muted. In a closed list the same two sit in the value. */
.k-input.lookup-combined .k-input-inner {
    flex: 0 0 calc(var(--code, 4) * 1ch + 16px);
    min-width: 0;
}

.lookup-desc {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--asap-text-2);
}

/* The text and the arrow sit in the widget's suffix, which is only as wide as its content:
   it takes the rest of the box, the text the room in it, so the arrow stays at the right edge. */
.k-input.lookup-combined .k-input-suffix {
    flex: 1 1 auto;
    min-width: 0;
}

.k-input.lookup-combined .lookup-desc {
    padding-inline-end: 2px;
}

.lookup-value {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.lookup-value__code {
    flex: 0 0 auto;
}

/* A fixed code and its text, one piece. */
.form-code + .form-desc {
    margin-inline-start: 4px;
}

/* A lookup's list (a popup, so not inside the form): the code, then what it stands for. */
.lookup-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

/* Translucent ink, not the hover grey: the chip stays a step above whatever the row shows. Every
   chip is as wide as the list's longest code (--code characters, LookupEditor), so the texts
   form one column. */
.lookup-item .form-code {
    flex: 0 0 auto;
    box-sizing: border-box;
    min-width: calc(var(--code, 0) * 1ch + 12px);
    background: color-mix(in oklab, var(--asap-text) 9%, transparent);
}

/* "keine Auswahl" has no code: no chip, but its place, so its text stays in the column. */
.lookup-item .form-code:empty {
    visibility: hidden;
}

.lookup-item__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--asap-text-2);
}

.k-list-item.k-selected .lookup-item__text,
.k-list-item.k-selected .lookup-item .form-code {
    color: inherit;
    background: transparent;
}

/* The row Enter will pick while typing: Kendo marks it k-focus with a faint inset line only;
   the program search's brand tint and bar make it obvious. The selected row keeps its fill. */
.lookup-popup {
    --lookup-target-tint: 10%;
    --lookup-target-tint-hover: 14%;
}

/* On graphite the light ink needs a larger share to rank the target above the grey hover. */
:root[data-theme="dark"] .lookup-popup {
    --lookup-target-tint: 16%;
    --lookup-target-tint-hover: 20%;
}

.lookup-popup .k-list .k-list-item.k-focus:not(.k-selected) {
    background: color-mix(in oklch, var(--asap-brand) var(--lookup-target-tint), transparent);
    box-shadow: inset 3px 0 0 var(--asap-brand);
}

.lookup-popup .k-list .k-list-item.k-focus:not(.k-selected):hover {
    background: color-mix(in oklch, var(--asap-brand) var(--lookup-target-tint-hover), transparent);
}

/* The selected row as the target: the same bar. Kendo's all-round frame would read as a bevel
   inside the tint. */
.lookup-popup .k-list .k-list-item.k-selected.k-focus {
    box-shadow: inset 3px 0 0 var(--asap-brand);
}

/* Yes / no: the segmented choice (section 8) as a field, one tab stop, three answers, J / N / K
   on the keyboard (forms.js). It sits in the field's well and edge, as tall as the editors beside
   it; its keys are text, so wider than the header's icons (the longest label is "Nein"). */
.form-flag.segmented {
    --seg-w: 40px;
    align-items: center;
    height: 28px;
    border-color: var(--asap-field-border);
    background: var(--asap-field-bg);
    transition: border-color var(--asap-dur-fast), box-shadow var(--asap-dur-fast);
}

.form-flag .segmented__item {
    height: 22px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 22px;
}

.form-flag .segmented__item.is-selected {
    font-weight: 600;
}

/* "k. A." picked is no answer: its highlight is grey in both themes, so the accent marks an
   answer only. */
.form-flag.is-blank::before {
    background: var(--asap-surface-3);
    box-shadow: inset 0 0 0 1px var(--asap-border-strong);
}

.form-flag.is-blank .segmented__item.is-selected {
    color: var(--asap-text);
}

.form-flag:focus-within {
    border-color: var(--asap-brand);
    box-shadow: 0 0 0 3px var(--asap-ring);
}

/* The well carries the field's focus ring, so a key shows keyboard focus by an outline of its own. */
.form-flag .segmented__item:focus-visible {
    outline: 2px solid var(--asap-brand);
    outline-offset: 1px;
    box-shadow: none;
}

/* The host flagged the field: red frame, the cursor already there (forms.js). */
.form-part.is-error :is(.k-input, .k-picker, .form-flag) {
    border-color: var(--asap-danger);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--asap-danger) 20%, transparent);
}

/* Focused, a flagged field keeps its red frame and gains the focus ring around it. */
.form-part.is-error :is(.k-input, .k-picker, .form-flag):is(:focus-within, .k-focus) {
    border-color: var(--asap-danger);
    box-shadow: 0 0 0 1px var(--asap-danger), 0 0 0 4px var(--asap-ring);
}

.form-part.is-error .form-value {
    color: var(--asap-danger);
}

.form-cell .form-error-icon {
    flex: 0 0 auto;
    color: var(--asap-danger);
}

/* Changed by the operator, not yet sent: a dot in the gutter; Esc puts the host's value back. */
.form-part.is-changed::before {
    content: "";
    position: absolute;
    inset-inline-start: -9px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 50%;
    background: var(--asap-brand);
}

/* Windows contrast themes: the answer picked and the changed mark keep their meaning. */
@media (forced-colors: active) {
    :root .form-flag .form-flag__opt[aria-checked="true"] {
        forced-color-adjust: none;
        background: Highlight;
        color: HighlightText;
        box-shadow: none;
    }

    .form-part.is-changed::before {
        forced-color-adjust: none;
        background: CanvasText;
    }

    .form-ruler {
        background: transparent;
        outline: 1px dotted CanvasText;
    }
}

/* The host's message for a form: above the card, where the eye starts, until the next screen. */
.screen-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid color-mix(in oklch, var(--tone) 32%, transparent);
    border-radius: var(--asap-radius);
    background: color-mix(in oklab, var(--tone) 9%, var(--asap-surface));
    color: var(--asap-text);
    font-size: 0.8125rem;
    line-height: 1.45;
    animation: pop-in var(--asap-dur) var(--asap-ease) both;
}

/* On graphite a 9% tint hardly tells error from info; a little more tone and a firmer edge. */
:root[data-theme="dark"] .screen-message {
    border-color: color-mix(in oklch, var(--tone) 40%, transparent);
    background: color-mix(in oklab, var(--tone) 12%, var(--asap-surface));
}

.screen-message .k-svg-icon {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--tone);
}

.screen-message--info { --tone: var(--asap-info); }
.screen-message--success { --tone: var(--asap-success); }
.screen-message--warning { --tone: var(--asap-warning); }
.screen-message--error { --tone: var(--asap-danger); }

/* What the screen is for (ANZEIGEN, ÄNDERN, NEUANLAGE ...), next to the program chip. */
.chip--mode {
    --tone: var(--asap-text-3);
    border: 1px solid color-mix(in oklch, var(--tone) 35%, transparent);
    background: color-mix(in oklch, var(--tone) 10%, transparent);
    color: var(--asap-text);
}

.chip--mode.is-change { --tone: var(--asap-warning); }
.chip--mode.is-new { --tone: var(--asap-success); }
.chip--mode.is-copy { --tone: var(--asap-info); }
.chip--mode.is-delete { --tone: var(--asap-danger); }

/* A thin warm tint on graphite turns brown and leaves the mode to the edge: in dark the tone
   also tints the label. The neutral mode keeps its plain label. */
:root[data-theme="dark"] .chip--mode {
    border-color: color-mix(in oklch, var(--tone) 45%, transparent);
    background: color-mix(in oklch, var(--tone) 14%, transparent);
}

:root[data-theme="dark"] .chip--mode:is(.is-change, .is-new, .is-copy, .is-delete) {
    color: color-mix(in oklab, var(--tone) 55%, var(--asap-text));
}

/* The screen on display was put in place of the host's in the developer tools. Dashed: a
   stand-in, not a state the host reported. */
.chip--edited {
    border: 1px dashed color-mix(in oklch, var(--asap-accent) 65%, transparent);
    background: color-mix(in oklch, var(--asap-accent) 12%, transparent);
    color: var(--asap-text);
    cursor: help;
}

/* The page's bar: the count sits at the far end; asking before leaving takes the whole bar. */
.app-actionbar__count {
    margin-inline-start: auto;
}

.app-actionbar__confirm {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 6px 6px 6px 12px;
    border: 1px solid color-mix(in oklab, var(--asap-warning) 35%, var(--asap-border));
    border-radius: var(--asap-radius);
    background: color-mix(in oklab, var(--asap-warning) 8%, var(--asap-surface));
    animation: fade-in var(--asap-dur-fast) var(--asap-ease) both;
}

/*.app-actionbar__confirm-text {
    flex: 1 1 16rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8125rem;
    color: var(--asap-text-2);
}*/

.app-actionbar__confirm-text strong {
    font-weight: 600;
    color: var(--asap-text);
}

/* Unsent changes, counted next to the key that sends them. */
.edit-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 26px;
    border-radius: var(--asap-radius-full);
    background: var(--asap-brand-soft);
    color: var(--asap-text);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.edit-count::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--asap-brand);
}


/* 12a. Phone rows (MobileForm): the legacy client's FormGroup ---------------------------------
   A form on a phone is one row per caption and its values, as the legacy client drew it on its
   scanners: the icon and caption on the left, the value on the right and large, what explains it (a
   code's text, the row's next value) smaller under it, a hairline between rows. A row that
   takes input gives its editor the rest of the row: centred, bold, framed in green.
   Sizes follow the legacy rows on a 360-430px phone, in rem with a ceiling, so a tablet in the
   phone view does not blow them up the way the legacy vh/vw sizes did. The editors keep the
   grid's .form-part (FormPart) and so its error, changed and length marks. */

.mobile-form {
    --mf-title: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --mf-value: clamp(1.125rem, 0.95rem + 0.8vw, 1.375rem);
    --mf-desc: clamp(0.8125rem, 0.76rem + 0.25vw, 0.9375rem);
    --mf-icon: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
    --mf-frame: color-mix(in oklch, var(--asap-success) 55%, var(--asap-field-border));
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

/* The screen's own heading: the caption the host put above every value. */
.mf-subtitle {
    padding-bottom: 0.5rem;
    font-size: var(--mf-title);
    font-weight: 600;
    color: var(--asap-text);
}

/* A third for the caption, two thirds for the value, on every row: the captions form one column
   and every editor is as wide as every other. */
.mf-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    column-gap: 0.75rem;
    min-height: 3rem;
    padding-block: 0.5rem;
    border-bottom: 1px solid var(--asap-border);
}

/* The hairline is between rows: none before a gap, a rule or the end. */
.mf-row:last-child {
    border-bottom: 0;
}

/* The caption's third: the legacy row's icon, then the caption. A row whose caption names
   nothing known keeps the icon's place empty, so the captions of a screen line up. */
.mf-head {
    grid-column: 1;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.mf-head .mf-icon {
    width: var(--mf-icon);
    font-size: var(--mf-icon);
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" var(--asap-icon-grad), "opsz" 24;
    color: var(--asap-text-2);
}

/* A long caption wraps in what is left of its third, hyphenated in the page's language. */
.mf-title {
    min-width: 0;
    font-size: var(--mf-title);
    line-height: 1.3;
    color: var(--asap-text-2);
    overflow-wrap: break-word;
    hyphens: auto;
}

.mf-values {
    grid-column: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: end;
}

/* One value: its caption inside the row ("VPE", "Datum"), its pieces, its text under it. */
.mf-value {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: baseline;
    column-gap: 0.5rem;
    max-width: 100%;
}

.mf-pieces {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: baseline;
    column-gap: 0.375rem;
    min-width: 0;
    max-width: 100%;
}

.mf-value.is-first .mf-pieces {
    font-size: var(--mf-value);
    font-weight: 600;
    line-height: 1.25;
    color: var(--asap-text);
}

.mf-value.is-more .mf-pieces,
.mf-desc {
    font-size: var(--mf-desc);
    line-height: 1.3;
    color: var(--asap-text-2);
}

.mf-desc {
    flex-basis: 100%;
    overflow-wrap: anywhere;
}

.mf-caption {
    font-size: var(--mf-desc);
    color: var(--asap-text-3);
}

.mf-sep,
.mf-unit {
    font-weight: 400;
    color: var(--asap-text-2);
}

/* A fixed value reads like the row's text, not like the grid's 13px data sheet. */
.mobile-form .form-part {
    font-size: var(--kendo-font-size-lg);
}

.mobile-form .form-part > :is(.form-value, .form-flagvalue, .form-link) {
    padding-inline-start: 0;
}

.mobile-form .form-value {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.mobile-form .form-value:is(.is-end, .is-center) {
    width: auto;
    padding-inline: 0;
}

.mobile-form .form-code {
    padding: 0;
    background: none;
    font: inherit;
}

.mobile-form .form-flagvalue {
    font-size: inherit;
}

.mobile-form .form-error-icon {
    flex: 0 0 auto;
    color: var(--asap-danger);
}

/* A row that takes input: every editor fills the value's two thirds, so all are one size; a
   range's two stand one under the other, which says "from / to" without the slash a phone has no
   room for. What would sit beside an editor and narrow it goes inside its frame instead: a unit
   at the end, the host's error mark at the start. */
.mf-row.is-input .mf-value,
.mf-row.is-input .mf-pieces {
    width: 100%;
}

.mf-row.is-input .mf-pieces {
    position: relative;
    row-gap: 0.375rem;
}

.mf-row.is-input .mf-pieces > .form-part {
    flex: 1 1 100%;
    justify-content: flex-end;
}

.mf-row.is-input .mf-sep {
    display: none;
}

.mf-row.is-input .mf-unit {
    position: absolute;
    inset-inline-end: 0.75rem;
    bottom: 0;
    line-height: 2.75rem;
    pointer-events: none;
}

.mf-row.is-input .form-part > .form-error-icon {
    visibility: hidden;
    position: absolute;
    inset-inline-start: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.mf-row.is-input :is(.k-input, .k-picker) {
    width: 100%;
    min-height: 2rem;
    border-width: 2px;
}

.mf-row.is-input .form-part:not(.is-error) :is(.k-input, .k-picker) {
    border-color: var(--asap-brand-fill);
}

.mf-row.is-input .form-part:not(.is-error) :is(.k-input, .k-picker):is(:focus-within, .k-focus) {
    border-color: var(--asap-success);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--asap-success) 22%, transparent);
}

.mf-row.is-input :is(.k-input, .k-picker) .k-input-inner {
    font-size: var(--kendo-font-size-lg);
    font-weight: 600;
    text-align: center;
    /*    color: var(--asap-brand);*/
}

.mf-row.is-input .k-input-inner::placeholder {
    color: color-mix(in oklch, var(--asap-brand) 50%, transparent);
}

.mf-row.is-input .k-input .k-input-suffix {
    background-color: transparent;
}

/* A code with its text inside the box ("GRLAGER  Lagerpersonal"): one line, the code whole and as
   wide as what is typed in it, the text in the rest, cut short before the arrow. The grid sizes
   the code in characters of its 13px font, which at this size would leave the text no room. */
.mf-row.is-input .k-input.lookup-combined .k-input-inner {
    flex: 0 0 auto;
    width: auto;
    field-sizing: content;
    min-width: 3ch;
    max-width: 70%;
    text-align: start;
}

.mf-row.is-input .k-input.lookup-combined .k-input-suffix {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
}

/* A screen with a single row that takes input: its editor takes a line of its own under its
   caption, the whole width of the form, and a code's text in it is shown whole, wrapping rather
   than cut short. */
.mobile-form:not(:has(.mf-row.is-input ~ .mf-row.is-input)) .mf-row.is-input {
    row-gap: 0.375rem;
}

.mobile-form:not(:has(.mf-row.is-input ~ .mf-row.is-input)) .mf-row.is-input > :is(.mf-head, .mf-values) {
    grid-column: 1 / -1;
}

.mobile-form:not(:has(.mf-row.is-input ~ .mf-row.is-input)) .mf-row.is-input .lookup-desc {
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
}

/* Yes / no: the same three answers across the editor's whole width, large enough for a thumb.
   The keys share the width, so the highlight is a third of the track (less its padding and the
   two gaps) and moves by its own width plus a gap. */
.mf-row.is-input .form-flag {
    flex: 1 1 auto;
    height: 2rem;
}

.mf-row.is-input .form-flag::before {
    width: calc((100% - 4px - 2 * var(--seg-gap)) / 3);
    transform: translateX(calc(var(--index, 0) * (100% + var(--seg-gap))));
}

.mf-row.is-input .form-flag__opt {
    flex: 1 1 0;
    min-width: 0;
    height: calc(2.75rem - 6px);
    font-size: 0.875rem;
    line-height: calc(2.75rem - 6px);
}

.mf-gap {
    height: 0.75rem;
}

.mf-rule {
    margin: 0.5rem 0;
    border: 0;
    border-top: 1px solid var(--asap-border-strong);
    background: none;
    opacity: 1;
}

/* A screen with nothing but text: the host's message, large, as the legacy scanners showed it. */
.mf-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 0.5rem;
    text-align: center;
}

.mf-message__icon {
    font-size: 8rem;
    color: #32364c;
}

.mf-message__line {
    margin: 0;
    font-size: var(--mf-value);
    font-weight: 600;
    color: var(--asap-text);
    overflow-wrap: anywhere;
}

.mf-message__line + .mf-message__line {
    font-weight: 400;
    color: var(--asap-text-2);
}


/* 13. Telerik chrome: inputs, buttons, popups, windows, notifications ----------- */

/* Telerik 15 renders the default fill as plain .k-input / .k-picker (no -solid class).
   Their fill and edge come from the tokens re-pointed in section 2. */
.k-input,
.k-picker {
    transition: border-color var(--asap-dur-fast), box-shadow var(--asap-dur-fast), background var(--asap-dur-fast);
}

/* Focus: the edge turns brand and the design-system ring replaces Kendo's faint 25% halo.
   (0,3,0) beats Kendo's :focus-within; an invalid field keeps Kendo's red ring, and a field
   the host flagged (.form-part.is-error, section 12) keeps its own. */
:is(.k-input, .k-picker):not(.k-invalid):is(.k-focus, :focus-within) {
    border-color: var(--asap-brand);
    box-shadow: 0 0 0 3px var(--asap-ring);
}

/* An unchecked box or radio is drawn by its edge alone, so the edge holds 3:1 on rows, hover
   tints and headers; the field edge is softer by design. Re-pointing Kendo's token keeps its
   focus, checked and invalid states. */
.k-checkbox,
.k-radio {
    --kendo-color-border-alt: var(--asap-control-border);
}

/* Kendo draws the validation mark with the error fill; the ink reads on the well. */
:is(.k-input, .k-picker).k-invalid .k-input-validation-icon {
    color: var(--asap-danger);
}

.k-button {
    font-weight: 500;
    transition: background var(--asap-dur-fast), border-color var(--asap-dur-fast), color var(--asap-dur-fast), box-shadow var(--asap-dur-fast);
}

/* Keyboard focus is the design-system ring on every button. Kendo's own halos sit at
   (0,4,0) and also show after a mouse click (a grey-white smudge on dark), so the ring is
   raised above them and the click halo is dropped. The action bar and the grid toolbar
   restore their own rest elevation on pointer focus (sections 6 and 11). Flat buttons forbid
   box-shadow (!important) and draw focus with an inset ::after instead. */
.k-button.k-button.k-button.k-button:focus-visible {
    box-shadow: 0 0 0 3px var(--asap-ring);
}

/* On a solid fill a flush ring reads as a pale rim of the button; an offset outline leaves a
   gap in whatever the button sits on. */
.k-button.k-button.k-button.k-button:is(.k-button-primary, .k-button-error):not(.k-button-flat, .k-button-outline, .k-button-link, .k-button-clear):focus-visible {
    box-shadow: none;
    outline: 2px solid var(--asap-ring);
    outline-offset: 2px;
}

.k-button.k-button:focus:not(:focus-visible, .app-actionbar__btn, .grid-action) {
    box-shadow: none;
}

/* The leave question's safe answer gets focus from script, which never matches
   :focus-visible; it is the dialog's Enter default, so it shows the ring anyway. */
.app-actionbar__confirm .is-leave-keep.k-button.k-button:focus {
    box-shadow: 0 0 0 3px var(--asap-ring);
}

.k-button.k-button-flat:focus-visible::after {
    opacity: 1;
    box-shadow: inset 0 0 0 2px var(--asap-ring);
}

.k-button.k-button-flat:focus:not(:focus-visible)::after {
    opacity: 0;
}

/* Outline (base) buttons: Kendo frames them in the text colour and fills them with it on hover,
   a near-white frame and a white slab on dark. A hairline and a lift instead. */
:root[data-theme="dark"] .k-button.k-button-outline:not(.k-button-primary, .k-button-error) {
    border-color: var(--asap-border-strong);
    color: var(--asap-text);
}

:root[data-theme="dark"] .k-button.k-button-outline:not(.k-button-primary, .k-button-error):is(:hover, .k-hover, :active, .k-active) {
    border-color: var(--asap-border-strong);
    color: var(--asap-text);
    background-color: var(--asap-action-hover);
}

/* A solid key is lit from above like the surfaces: a short sheen on its top half. Short-range
   only, so it costs nothing over Remote Desktop. */
:is(.k-button.k-button-solid:is(.k-button-primary, .k-button-error), .app-actionbar .app-actionbar__btn.k-button-primary):not(.k-disabled) {
    background-image: linear-gradient(180deg, oklch(100% 0 0 / 0.14), oklch(100% 0 0 / 0) 55%);
}

/* A disabled solid fill only fades with opacity; on dark a faded orange reads as a deeper,
   still-active one, so it also loses its colour. */
:root[data-theme="dark"] .k-button.k-disabled:is(.k-button-primary, .k-button-error) {
    --kendo-disabled-filter: grayscale(0.85);
}

/* The keys disable themselves while a press is on its way to the host; a quick reply should
   not flash them grey, so the dimming waits as long as the sheet's busy state does. */
:root[data-theme="dark"] .app-actionbar .app-actionbar__btn.k-button.k-disabled {
    transition: opacity 0s 120ms, filter 0s 120ms;
}

.k-popup {
    border-color: var(--asap-border);
    border-radius: var(--asap-radius);
    box-shadow: var(--asap-shadow-3);
}

/* The chosen entry is a tinted row with the full ink and the accent's bar, not an orange slab
   across the list. */
.k-list-item.k-selected {
    background: var(--asap-list-selected);
    color: var(--asap-text);
    box-shadow: inset 3px 0 0 var(--asap-brand);
}

.k-list-item.k-selected:is(:hover, .k-hover) {
    background: var(--asap-list-selected-hover);
    color: var(--asap-text);
}

.k-window {
    border-color: var(--asap-border);
    border-radius: var(--asap-radius-lg);
    box-shadow: var(--asap-shadow-3);
}

.k-window-titlebar {
    padding: 12px 16px;
    border-color: var(--asap-border);
    background: var(--asap-surface-2);
}

.k-window-title {
    font-family: var(--asap-font-display);
    font-weight: 600;
    font-size: 0.9375rem;
}

.k-window-content {
    padding: 16px;
}

/* A flat veil, like the drawer's and the sheet's: a blur repaints the viewport every
   frame over Remote Desktop. */
.k-overlay {
    background: var(--asap-scrim);
    opacity: 0.45;
}

:root[data-theme="dark"] .k-overlay {
    opacity: 0.62;
}

.k-notification-container {
    padding-top: 12px;
}

.k-notification {
    border-radius: var(--asap-radius);
    box-shadow: var(--asap-shadow-2);
    font-weight: 500;
}

.k-tooltip {
    border-radius: var(--asap-radius-sm);
    font-size: 0.75rem;
    padding: 6px 10px;
    box-shadow: var(--asap-shadow-2);
}

/* On dark a light tooltip is the brightest thing on screen, on every hover: a raised
   graphite card with a hairline instead, a step above raised-3 so it also stands off a
   popup. Scoped, because the global inverse stays light for Kendo's focus washes and the
   skeleton shimmer. The arrow goes: the hairline would cut it off the card, and the card
   already sits next to what it names. */
:root[data-theme="dark"] .k-tooltip {
    --kendo-color-inverse: oklch(33% 0.004 260);
    --kendo-color-on-inverse: var(--asap-text);
    box-shadow: inset 0 0 0 1px var(--asap-border-strong), var(--asap-shadow-2);
}

:root[data-theme="dark"] .k-tooltip .k-callout {
    display: none;
}

/* Picture card: the picture behind a list's thumbnail (picture-card.js), one for the page, beside
   the cell. Its frame has a fixed size, so a picture that arrives late never moves the card. The
   thumbnail shows at once, blurred (it is in memory), and the picture fades in over it; a picture
   that is missing leaves the thumbnail sharp. It floats like a popup (raised in dark, see the scope
   above), over the record sheet and under the loading veil, and never takes the pointer. */
.pic-card {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 17rem;
    padding: 8px;
    border-radius: var(--asap-radius);
    background: var(--asap-surface);
    color: var(--asap-text);
    box-shadow: inset 0 0 0 1px var(--asap-border), var(--asap-shadow-3);
    font-size: 0.75rem;
    line-height: 1.35;
    pointer-events: none;
    animation: pic-card-in var(--asap-dur-fast) var(--asap-ease);
}

.pic-card[hidden] {
    display: none;
}

@keyframes pic-card-in {
    from {
        opacity: 0;
        translate: -4px 0;
    }
}

.pic-card[data-side="left"] {
    animation-name: pic-card-in-left;
}

@keyframes pic-card-in-left {
    from {
        opacity: 0;
        translate: 4px 0;
    }
}

.pic-card__frame {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--asap-radius-sm);
    background: var(--asap-surface-2);
}

.pic-card.no-picture .pic-card__frame {
    display: none;
}

.pic-card__frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pic-card.is-round .pic-card__frame img {
    object-fit: cover;
}

/* A picture that fails after the card opened shows the frame's tone, not the broken-image icon. */
.pic-card__frame img::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--asap-surface-2);
}

.pic-card__thumb {
    filter: blur(6px);
    transform: scale(1.06);
}

/* Gone once the picture has faded in over it: it would show through a transparent picture. */
.pic-card.is-loaded .pic-card__thumb {
    visibility: hidden;
    transition: visibility 0s var(--asap-dur-fast);
}

.pic-card.is-missing .pic-card__thumb {
    filter: none;
    transform: none;
}

.pic-card__full {
    opacity: 0;
    transition: opacity var(--asap-dur-fast) var(--asap-ease);
}

.pic-card.is-loaded .pic-card__full {
    opacity: 1;
}

.pic-card.is-missing .pic-card__full {
    display: none;
}

.pic-card__caption {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.pic-card__value {
    font-weight: 600;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.pic-card__text {
    color: var(--asap-text-2);
}

.pic-card__tip {
    color: var(--asap-text-3);
}

.k-skeleton {
    background: var(--asap-surface-3);
}

.k-card {
    border-color: var(--asap-border);
    box-shadow: var(--asap-shadow-1);
}

.k-badge {
    font-weight: 600;
}

.k-progressbar {
    border-radius: var(--asap-radius-full);
    overflow: hidden;
}

/* A progress bar is data: it fills with a grey, and the accent stays rare. */
.k-progressbar {
    --kendo-color-primary: var(--asap-meter);
    --kendo-color-on-primary: var(--asap-surface);
}

/* Windows contrast themes ignore box-shadow, and Kendo sets outline: none on its controls:
   without this, keyboard focus would vanish there. */
@media (forced-colors: active) {
    :is(.k-button, .k-input, .k-picker):is(:focus-visible, :focus-within) {
        outline: 2px solid Highlight;
        outline-offset: 2px;
    }
}


/* 13a. Sheet: a record's screen over the list (Sheet.razor, RecordSheet.razor) --------
   Slides in from the right edge over the whole shell, modal. Above the drawer (1040) and
   below Kendo's popups, so drop-downs and date pickers opened inside it land on top. The
   width token is set on <html> by theme.js from the last drag. */

:root {
    --asap-sheet-w: 640px;
    --asap-sheet-ease-in: cubic-bezier(0.32, 0.72, 0, 1);
    --asap-sheet-ease-out: cubic-bezier(0.4, 0, 1, 1);
}

.app-sheet {
    position: fixed;
    inset: 0;
    z-index: 1045;
    display: flex;
    justify-content: flex-end;
}

.app-sheet[data-state="closed"] {
    pointer-events: none;
}

/* A flat tint, like the drawer's: a blur repaints the viewport every frame over RDP. */
.app-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: var(--asap-scrim-veil);
    animation: fade-in var(--asap-dur-slow) var(--asap-ease) both;
}

.app-sheet[data-state="closed"] .app-sheet__backdrop {
    animation: fade-out 220ms var(--asap-sheet-ease-out) both;
}

.app-sheet__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(var(--asap-sheet-w), calc(100vw - 48px));
    height: 100%;
    background: var(--asap-surface);
    border-left: 1px solid var(--asap-border);
    box-shadow: var(--asap-shadow-3);
    outline: none;
    animation: sheet-in-right 360ms var(--asap-sheet-ease-in) both;
}

.app-sheet[data-state="closed"] .app-sheet__panel {
    animation: sheet-out-right 220ms var(--asap-sheet-ease-out) both;
}

.app-sheet.is-resizing,
.app-sheet.is-resizing * {
    cursor: col-resize !important;
    user-select: none;
}

/* Header: context line, the record, and its tools. */
.app-sheet__header {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 16px 14px 24px;
    border-bottom: 1px solid var(--asap-border);
}

.app-sheet__heading {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 2px;
}

.app-sheet__eyebrow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 22px;
    margin-bottom: 6px;
    color: var(--asap-text-3);
    font-size: 0.75rem;
    font-weight: 500;
}

.app-sheet__context {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sheet__title {
    margin: 0;
    font-family: var(--asap-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--asap-text);
    overflow-wrap: anywhere;
}

.app-sheet__description {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--asap-text-2);
    overflow-wrap: anywhere;
}

.app-sheet__tools {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* The developer tools (ShellSlots.SheetDevTools); d-md-flex shows them on wide screens. */
.app-sheet__dev {
    align-items: center;
    gap: 2px;
}

.app-sheet__stepper {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 6px;
    padding-right: 8px;
    border-right: 1px solid var(--asap-border);
}

.app-sheet__position {
    min-width: 4.75em;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--asap-text-2);
    white-space: nowrap;
}

.app-sheet__tools .app-iconbtn.k-button.k-disabled {
    opacity: 0.35;
}

/* Runs while the panel is aria-busy; delayed so a quick reply does not flash it. */
.app-sheet__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    overflow: hidden;
    opacity: 0;
    transition: opacity var(--asap-dur-fast) var(--asap-ease);
}

.app-sheet__progress::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 38%;
    border-radius: var(--asap-radius-full);
    background: var(--asap-brand);
    animation: bar-slide 1.1s var(--asap-ease) infinite;
}

.app-sheet__panel[aria-busy="true"] .app-sheet__progress {
    opacity: 1;
    transition-delay: 120ms;
}

/* Body: the host's screen, scrolled on its own. */
/* A list in the sheet (a cockpit's drill-down) needs the width of a list, whatever the
   sheet was last dragged to for a record. It stays within the viewport and resizable. */
.app-sheet--wide .app-sheet__panel {
    width: min(max(var(--asap-sheet-w), 1040px), calc(100vw - 48px));
}

.app-sheet__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 20px 24px 24px;
}

.app-sheet__form {
    animation: fade-in var(--asap-dur) var(--asap-ease) both;
    transition: opacity var(--asap-dur-fast) var(--asap-ease);
}

/* The record being replaced stays in place, dimmed, until the next one arrives. */
.app-sheet__panel[aria-busy="true"] .app-sheet__form {
    opacity: 0.5;
    pointer-events: none;
    transition-delay: 120ms;
}

.app-sheet__skeleton {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.app-sheet__skeleton-row {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 2.25fr);
    gap: 14px;
    align-items: center;
}

.app-sheet__empty {
    padding-top: 56px;
}

/* The host's message for this record (ScreenMessage): a little more room in the sheet. */
.screen-message.app-sheet__message {
    margin-bottom: 18px;
}

/* Footer: the screen's keys, Enter at the far end. */
.app-sheet__footer {
    flex: 0 0 auto;
}

.app-sheet__actions.app-actionbar {
    padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
    box-shadow: none;
}

.app-sheet__actions-spacer {
    flex: 1 1 auto;
}

/* A chip of its own on the fill, set off in the direction away from the ink it carries, so the
   hint holds 4.5:1 at rest, hover and press. */
.app-sheet__kbd {
    margin-left: 2px;
    padding: 1px 5px;
    border-radius: var(--asap-radius-xs);
    background: var(--asap-onfill-chip);
    box-shadow: inset 0 0 0 1px var(--asap-onfill-chip-edge);
    color: var(--asap-on-brand);
    font-family: var(--asap-font-ui);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.4;
}

.app-sheet__confirm {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid color-mix(in oklab, var(--asap-warning) 35%, var(--asap-border));
    background: color-mix(in oklab, var(--asap-warning) 8%, var(--asap-surface));
    animation: fade-in var(--asap-dur-fast) var(--asap-ease) both;
}

.app-sheet__confirm-text {
    flex: 1 1 16rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8125rem;
}

.app-sheet__confirm-text strong {
    font-weight: 600;
    color: var(--asap-text);
}

.app-sheet__confirm-text span {
    color: var(--asap-text-2);
}

.app-sheet__confirm-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* The drag edge: wider than it looks, with a brand line on hover and focus. */
.app-sheet__resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -5px;
    width: 10px;
    z-index: 1;
    cursor: col-resize;
    outline: none;
    touch-action: none;
}

.app-sheet__resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 4px;
    width: 2px;
    background: var(--asap-brand);
    opacity: 0;
    transition: opacity var(--asap-dur-fast) var(--asap-ease);
}

.app-sheet__resizer:hover::after,
.app-sheet__resizer:focus-visible::after,
.app-sheet.is-resizing .app-sheet__resizer::after {
    opacity: 1;
}

/* Phones: the whole screen, no drag edge, no keyboard hint. */
@media (max-width: 640px) {
    .app-sheet__kbd {
        display: none;
    }

    .app-sheet__panel,
    .app-sheet--wide .app-sheet__panel {
        width: 100vw;
        border-left: 0;
    }

    .app-sheet__resizer {
        display: none;
    }

    .app-sheet__header {
        padding: 12px 8px 12px 16px;
    }

    .app-sheet__body {
        padding: 16px;
    }

    .app-sheet__actions.app-actionbar,
    .app-sheet__confirm {
        padding-left: 16px;
        padding-right: 16px;
    }
}


/* 13b. Chat: tokens and the parts every chat screen shares (Features/Chat) -------------
   The screens' own rules sit beside them (scoped .razor.css); what several of them draw alike
   lives here: the status glyph, the avatar, the eyebrow, the filter chips, the meter, the count
   badges, the icon buttons, the urgent halo and the typing dots. The handoff's values, in the
   app's tokens: Mona Sans only, and in the dark theme the orange accent stays rare (the user's
   own bubbles are a lit neutral there, not orange). */

:root {
    /* The user's own bubble and its edge; the others' bubble. */
    --chat-own: color-mix(in srgb, var(--asap-brand) 11%, var(--asap-surface));
    --chat-own-edge: color-mix(in srgb, var(--asap-brand) 20%, transparent);
    --chat-theirs: var(--asap-surface-3);

    /* A mention of someone else, and of the user (the one solid chip in a bubble). */
    --chat-mention: var(--asap-brand-soft);
    --chat-mention-ink: var(--asap-brand);
    --chat-mention-me: var(--asap-brand-fill);
    --chat-mention-me-ink: var(--asap-on-brand);

    /* The urgent and the waiting tints (rows, card heads, the offline line). */
    --chat-danger-tint: color-mix(in srgb, var(--asap-danger) var(--asap-tint-danger), var(--asap-surface));
    --chat-warning-tint: color-mix(in srgb, var(--asap-warning) var(--asap-tint-warning), var(--asap-surface));

    /* Urgent words as ink on those tints ("Dringend ·", a time): --asap-danger holds only about
       3.9:1 there; this holds 4.5:1 on the tint and on its hover tint, the page's and the Sheet's,
       in both themes. The conversation row still sets its own of the same values
       (--row-danger-ink, ConversationRow.razor.css). */
    --chat-danger-ink: oklch(50% 0.2 25);

    /* The ink on the amber break glyph and the caution marks. */
    --chat-amber-ink: oklch(27% 0.05 75);

    /* The ring an avatar's glyph is cut out of the surface with. */
    --chat-glyph-ring: var(--asap-surface);

    /* The urgent bar's height, and the workspace's top inset while it shows. */
    --chat-urgentbar-h: 52px;
}

:root[data-theme="dark"] {
    --chat-own: color-mix(in oklch, var(--asap-text) 12%, var(--asap-surface));
    --chat-own-edge: var(--asap-border-strong);
    --chat-danger-ink: oklch(76% 0.13 25);
}

/* The status glyph (PresenceGlyph.razor) ------------------------------------------- */

.chat-glyph {
    flex: 0 0 auto;
    display: inline-block;
    width: var(--chat-glyph-size, 12px);
    height: var(--chat-glyph-size, 12px);
    vertical-align: middle;
}

.chat-glyph svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.chat-glyph.has-ring {
    box-sizing: content-box;
    padding: 2px;
    border-radius: 50%;
    background: var(--chat-glyph-ring);
}

.chat-glyph__available { fill: var(--asap-success); }
.chat-glyph__break { fill: var(--asap-warning); }
.chat-glyph__break-mark { stroke: var(--chat-amber-ink); stroke-width: 1.5; stroke-linecap: round; fill: none; }
.chat-glyph__dnd { fill: var(--asap-danger-mark); }
.chat-glyph__dnd-mark { stroke: #fff; stroke-width: 1.8; stroke-linecap: round; fill: none; }
.chat-glyph__away { fill: var(--asap-text-3); }
.chat-glyph__away-mark { stroke: var(--asap-surface); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.chat-glyph__offline { fill: none; stroke: var(--asap-text-3); stroke-width: 2; }

/* The avatar (ChatAvatar.razor) ------------------------------------------------------ */

.chat-avatar {
    position: relative;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: var(--chat-avatar-size, 36px);
    height: var(--chat-avatar-size, 36px);
    border-radius: 50%;
    background: var(--asap-chip-neutral);
    color: var(--asap-text-2);
    font-size: calc(var(--chat-avatar-size, 36px) * 0.33);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    user-select: none;
}

.chat-avatar.is-self {
    background: color-mix(in srgb, var(--asap-brand) 14%, var(--asap-surface));
    color: var(--asap-brand-strong);
}

.chat-avatar.is-group {
    border-radius: calc(var(--chat-avatar-size, 36px) * 0.28);
    background: var(--asap-brand-soft);
    color: var(--asap-brand);
}

.chat-avatar__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.chat-avatar__glyph {
    position: absolute;
    right: -2px;
    bottom: -2px;
}

/* The user's own status on the user menu's avatars (OwnPresenceBadge.razor): the glyph on the lower
   right, its ring the colour behind it (the header, the framed panel's canvas from 992 px up, the
   hovered or open trigger, the menu's head band). */
.chat-own-presence {
    position: absolute;
    right: -3px;
    bottom: -3px;
    display: flex;
    line-height: 0;
    pointer-events: none;
    --chat-glyph-ring: var(--asap-surface);
}

@media (min-width: 992px) {
    .user-menu__trigger .chat-own-presence { --chat-glyph-ring: var(--asap-canvas); }
}

.user-menu__trigger:is(:hover, [aria-expanded="true"]) .chat-own-presence { --chat-glyph-ring: var(--asap-surface-3); }
.user-menu__head .chat-own-presence { --chat-glyph-ring: var(--asap-surface-2); }

/* Eyebrows, chips, meters, badges --------------------------------------------------- */

.chat-eyebrow {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--asap-text-2);
    white-space: nowrap;
}

.chat-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

/* On touch the chips keep one line and scroll sideways (the handoff's 2a), taller for a finger. */
.chat-chips.is-touch {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 5px 0 9px;
    border: 1px solid var(--asap-border);
    border-radius: var(--asap-radius-full);
    background: var(--asap-surface);
    color: var(--asap-text-2);
    font: inherit;
    font-size: 0.78125rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--asap-dur-fast) var(--asap-ease), border-color var(--asap-dur-fast) var(--asap-ease), color var(--asap-dur-fast) var(--asap-ease);
}

.chat-chips.is-touch .chat-chip {
    height: 34px;
}

.chat-chip.is-all {
    padding-left: 12px;
}

.chat-chip:hover:not(:disabled) {
    border-color: var(--asap-border-strong);
    background: var(--asap-surface-2);
    color: var(--asap-text);
}

.chat-chip[aria-pressed="true"] {
    border-color: color-mix(in srgb, var(--asap-brand) 45%, transparent);
    background: var(--asap-brand-soft);
    color: var(--asap-text);
}

.chat-chip:focus-visible {
    outline: 2px solid var(--asap-ring);
    outline-offset: 1px;
}

.chat-chip__count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: var(--asap-radius-full);
    background: var(--asap-surface-3);
    color: var(--asap-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
    text-align: center;
}

.chat-chip.is-loud .chat-chip__count {
    background: var(--asap-danger-fill);
    color: #fff;
}

/* A meter of how many have acknowledged or read: a fill and the rest, 2 px apart. */
.chat-meter {
    display: flex;
    gap: 2px;
    height: 6px;
    min-width: 0;
}

.chat-meter__fill,
.chat-meter__rest {
    border-radius: 3px;
}

.chat-meter__fill {
    flex: 0 0 var(--chat-meter-share, 0%);
    min-width: 3px;
    background: var(--chat-meter-fill, var(--asap-brand));
    transition: flex-basis var(--asap-dur-slow) var(--asap-ease);
}

.chat-meter__rest {
    flex: 1 1 0;
    min-width: 3px;
    background: var(--chat-meter-track, color-mix(in srgb, var(--asap-brand) 17%, var(--asap-surface)));
}

/* Count badges: unread (brand), urgent (danger), muted (grey), a mention (@). */
.chat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--chat-badge-size, 19px);
    height: var(--chat-badge-size, 19px);
    padding: 0 6px;
    border-radius: var(--asap-radius-full);
    background: var(--asap-brand-fill);
    color: var(--asap-on-brand);
    font-size: 0.6875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.chat-badge.is-urgent { background: var(--asap-danger-fill); color: #fff; }
.chat-badge.is-muted { background: var(--asap-surface-3); color: var(--asap-text-2); }
.chat-badge.is-mention { padding: 0; background: var(--asap-brand-soft); color: var(--asap-brand); }

/* Icon buttons in the chat's own chrome: the shell's icon-button look, at the size the place asks
   (--chat-btn: 32 in rows and toolbars, 34 in a thread head, 36 in the Sheet head, 48 on touch).
   Pressed (a pin, details open) takes the brand's tint. */
.chat-iconbtn {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: var(--chat-btn, 36px);
    height: var(--chat-btn, 36px);
    padding: 0;
    border: 0;
    border-radius: var(--asap-radius-sm);
    background: transparent;
    color: var(--asap-text-2);
    cursor: pointer;
    transition: background var(--asap-dur-fast) var(--asap-ease), color var(--asap-dur-fast) var(--asap-ease);
}

.chat-iconbtn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--asap-text) 8%, transparent);
    color: var(--asap-text);
}

.chat-iconbtn[aria-pressed="true"] {
    background: var(--asap-brand-soft);
    color: var(--asap-brand);
}

.chat-iconbtn:focus-visible {
    outline: 2px solid var(--asap-ring);
    outline-offset: 1px;
}

.chat-iconbtn:disabled {
    color: var(--asap-text-3);
    cursor: default;
}

/* The urgent halo (the header pill, a pending urgent card on touch): it always moves; reduced
   motion is a settled no in this app (every RDP session reports it). */
@keyframes chat-halo {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--asap-danger-mark) 50%, transparent); }
    70%, 100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--asap-danger-mark) 0%, transparent); }
}

/* Someone is typing: three dots that breathe in turn. */
@keyframes chat-typing {
    0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-2px); }
}

@media (forced-colors: active) {
    .chat-chip[aria-pressed="true"],
    .chat-iconbtn[aria-pressed="true"] {
        outline: 1px solid Highlight;
    }

    .chat-badge {
        border: 1px solid CanvasText;
    }
}

/* The chat in the shell's Sheet (ChatSheet.razor, Class="chat-sheet"): the thread and its composer
   fill the body edge to edge, the head keeps one line, and on a handheld the panel takes the whole
   width with the larger head of the handoff's 2a/2b. The developer tools of a host screen have no
   meaning here and would squeeze the head. */
.chat-sheet .app-sheet__body {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    scrollbar-gutter: auto;
}

.chat-sheet .app-sheet__header { flex-wrap: nowrap; }
.chat-sheet .app-sheet__heading { min-width: 0; }

/* The head keeps whole words. The title stays on one line and gives way with an ellipsis (the base
   Sheet's overflow-wrap: anywhere split "Nachrich|ten" in a narrow Sheet); clip, not hidden, so the
   foot of a g is not cut. The description still wraps between words (the do-not-disturb hint needs
   two lines at the default width). Below 560 px (the Sheet dragged towards its 380 px minimum, or a
   narrow window) the status pill keeps only its glyph and caret; its label still says the status.
   The panel is already a containing block (its filled sheet-in animation), so the container adds no
   new trap for a fixed layer. */
.chat-sheet .app-sheet__panel { container: chat-sheet / inline-size; }

.chat-sheet .app-sheet__title {
    overflow-x: clip;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: normal;
}

@container chat-sheet (max-width: 559.98px) {
    .chat-sheet .chat-status__text { display: none; }
}

/* Bootstrap's d-md-flex on it is !important. */
.chat-sheet .app-sheet__dev { display: none !important; }

.chat-sheet.is-handheld .app-sheet__panel { width: 100vw; border-left: 0; }
.chat-sheet.is-handheld .app-sheet__resizer { display: none; }
.chat-sheet.is-handheld .app-sheet__header { gap: 4px; padding: 10px 6px 12px 16px; }
.chat-sheet.is-handheld .app-sheet__heading { padding-top: 4px; }
.chat-sheet.is-handheld .app-sheet__eyebrow { margin-bottom: 4px; font-size: 0.8125rem; }
.chat-sheet.is-handheld .app-sheet__title { font-size: 1.375rem; line-height: 1.2; }
.chat-sheet.is-handheld .app-sheet__description { margin-top: 3px; font-size: 0.875rem; }
.chat-sheet.is-handheld .app-sheet__close.k-button { width: 48px; height: 48px; }

.chat-sheet.is-handheld .app-sheet__close.k-button .k-svg-icon,
.chat-sheet.is-handheld .app-sheet__close.k-button .k-svg-icon svg {
    width: 24px;
    height: 24px;
}

/* The urgent bar (UrgentBar.razor, in the shell's overlay slot inside .app-shell) pushes the
   workspace down rather than cover the form being filled: while it shows, the workspace gets a top
   inset of its height, and an open sheet starts below it (below the framed panel's 8 px edge from
   992 px up); on compact layouts the drawer and its backdrop do too. */
.app-shell:has(.chat-urgentbar) .app-body { padding-top: var(--chat-urgentbar-h); }
.app-shell:has(.chat-urgentbar) .app-sheet { top: var(--chat-urgentbar-h); }

@media (min-width: 992px) {
    .app-shell:has(.chat-urgentbar) .app-sheet { top: calc(var(--chat-urgentbar-h) + 8px); }
}

@media (max-width: 991.98px) {
    .app-shell:has(.chat-urgentbar) .app-sidebar,
    .app-shell:has(.chat-urgentbar) .app-backdrop { top: var(--chat-urgentbar-h) !important; }
}

/* Dark (Signal): the orange stays rare. A group's avatar is a neutral chip like a person's, and an
   unread count a calm light badge; urgent keeps its red, a mention of the user its fill. */
:root[data-theme="dark"] .chat-avatar.is-group {
    background: var(--asap-chip-neutral);
    color: var(--asap-text-2);
}

:root[data-theme="dark"] .chat-badge:not(.is-urgent, .is-muted, .is-mention) {
    background: var(--asap-calm);
    color: var(--asap-surface);
}

/* Inside the chat, what is merely "on" is calm, as in the cockpits (section 2): the user's own
   avatar, pressed chips and icon buttons, meters and played voice bars, the unread divider, the
   typing line, the chosen row and option. Focus keeps --asap-ring
   and the primary keys their -fill tokens (Senden, the walkie's microphone, Erlauben). The Sheet's
   head stays outside: its way back is a link and its status picker a choice. */
:root[data-theme="dark"] :is(.chat-sheet .app-sheet__body, .chat-page) {
    --asap-brand: var(--asap-calm);
    --asap-brand-strong: var(--asap-calm-strong);
    --asap-brand-soft: var(--asap-calm-soft);
}

/* These are resolved on :root, where a custom property takes its var() values, so the rescope
   above cannot reach them. A mention of someone else is a neutral chip; one of the user keeps its
   fill. */
:root[data-theme="dark"] {
    --chat-mention: var(--asap-chip-neutral);
    --chat-mention-ink: var(--asap-text);
}

/* The read receipt is drawn in --asap-brand-fill (a primary key's token): the unread count's calm
   badge instead. */
:root[data-theme="dark"] .chat-meta__read {
    background: var(--asap-calm);
    color: var(--asap-surface);
}

/* 14. Error page (host-rendered, outside the Blazor shell) ----------------------- */

.error-page {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.error-page__card {
    width: 100%;
    max-width: 560px;
    padding: 32px;
    background: var(--asap-surface);
    border: 1px solid var(--asap-border);
    border-radius: var(--asap-radius-xl);
    box-shadow: var(--asap-shadow-2);
}

.error-page__card h1 {
    font-size: 1.5rem;
    margin: 18px 0 6px;
}

.error-page__card p {
    color: var(--asap-text-2);
}

.error-page__card code {
    font-family: var(--asap-font-mono);
    font-size: 0.8125rem;
    padding: 2px 6px;
    border-radius: var(--asap-radius-xs);
    background: var(--asap-surface-3);
    color: var(--asap-text);
}

.error-page__dev {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--asap-border);
    font-size: 0.8125rem;
}


/* 15. Motion ----------------------------------------------------------------------- */

/* A theme switch is one state change (theme.js sets this for two frames): colour
   transitions would fade some elements over 360ms while the rest snap. */
.is-theming,
.is-theming *,
.is-theming *::before,
.is-theming *::after {
    transition: none !important;
}

/* except the theme control's own highlight, which slides to the choice that caused it */
.is-theming .segmented.is-ready::before {
    transition: transform var(--asap-dur) var(--asap-ease) !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes page-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    to { opacity: 0; }
}

/* Sheet (13a): in from the right edge, and back out. */
@keyframes sheet-in-right {
    from { transform: translateX(100%); }
    to { transform: none; }
}

@keyframes sheet-out-right {
    from { transform: none; }
    to { transform: translateX(100%); }
}

@keyframes pop-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes bar-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(260%); }
}

/* Sidebar: the open program's bar grows in; a new favourite's star pops with a ring. */
@keyframes tree-mark-in {
    from { opacity: 0; transform: scaleY(0.2); }
    to { opacity: 1; transform: none; }
}

@keyframes star-pop {
    0% { transform: scale(0.6) rotate(-18deg); }
    60% { transform: scale(1.25) rotate(6deg); }
    100% { transform: none; }
}

@keyframes star-ring {
    from { opacity: 0.9; transform: scale(0.4); }
    to { opacity: 0; transform: scale(1.7); }
}

/* Driven by the nav's scroll position, not by time (section 7). */
@keyframes tree-edge {
    to {
        border-bottom-color: var(--asap-border);
        box-shadow: var(--asap-edge-shadow);
    }
}

@keyframes skeleton-shimmer {
    from { background-position: 100% 0; }
    to { background-position: 0 0; }
}

 

/* 16. Blazor infrastructure ------------------------------------------------------ */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--asap-success);
}

.invalid {
    outline: 1px solid var(--asap-danger);
}

.validation-message {
    color: var(--asap-danger);
    font-size: 0.75rem;
    margin-top: 4px;
}

.blazor-error-boundary {
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: var(--asap-radius);
    border: 1px solid color-mix(in oklch, var(--asap-danger) 35%, transparent);
    background: color-mix(in oklch, var(--asap-danger) 9%, transparent);
    color: var(--asap-text);
}

.blazor-error-boundary::after {
    content: "Es ist ein Fehler aufgetreten.";
}

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40000;
    padding: 12px 20px;
    background: var(--asap-surface);
    border-top: 3px solid var(--asap-danger);
    box-shadow: var(--asap-shadow-3);
}

