/* ── Fonts (self-hosted, all SIL OFL — see THIRD-PARTY-NOTICES.md) ──
   Inter (declared in inter-fonts.css) carries dense UI body text, tables,
   forms, and controls; Archivo carries headings, brand wordmarks, and KPI
   numerals; IBM Plex Mono carries IDs/amounts/config.

   Self-hosted on purpose — the sign-in page makes no third-party
   request. Two slices per face: the latin slice covers the everyday
   run, and unicode-range hands the rest to the latin-ext slice so a
   client called "Łukasz" renders in the product faces instead of falling
   back to system sans mid-word.

   Archivo ships as one variable file per style (wght 100–900, verified
   against its fvar table) — 35 KB against 64 KB for four static cuts.
   It carries no width axis, so no font-stretch is declared here.

   ORDER IS LOAD-BEARING — ext first, latin LAST in every pair. Overlapping
   @font-face rules match in REVERSE declaration order, so the last one wins
   where the ranges collide (U+0131, U+0152-0153, U+0304, U+0308, U+0329,
   U+2020). The ext slice has no ı/Œ/œ, so latin-last keeps the browser off a
   33 KB file it cannot use. Do not sort these back. */

@font-face {
    font-family: "Archivo";
    src: url("/fonts/archivo-v25-latin-ext-variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Archivo";
    src: url("/fonts/archivo-v25-latin-variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Archivo";
    src: url("/fonts/archivo-v25-latin-ext-variable-italic.woff2") format("woff2");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Archivo";
    src: url("/fonts/archivo-v25-latin-variable-italic.woff2") format("woff2");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("../fonts/ibm-plex-mono-v20-latin-ext-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("../fonts/ibm-plex-mono-v20-latin-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("../fonts/ibm-plex-mono-v20-latin-ext-500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("../fonts/ibm-plex-mono-v20-latin-500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("../fonts/ibm-plex-mono-v20-latin-ext-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("../fonts/ibm-plex-mono-v20-latin-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Reset ──────────────────────────────────────────────────────── */

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--mud-palette-background);
    color: var(--mud-palette-text-primary);
}

/* ── Design tokens & budget (Phase 12.1) ────────────────────────────
   The semantic layer above MudBlazor's palette. The written budget
   lives in UI_STYLE_GUIDE.md ("Design language & budget"); short form:
   - Three card tiers: hero (at most ONE per page, accent-tinted border,
     "look here first") / standard (surface-card) / quiet (.summary-item
     tiles — numbers first, no chrome).
   - Status colors ONLY on true status, never decoration. One red thing
     per healthy screen; red multiplies only when things are genuinely
     on fire.
   - Type scale: big numbers (--itrela-num-*) over whispering uppercase
     labels (--itrela-label-*).
   - Card spacing is a token scale (--itrela-card-*) — padding, inter-card
     gap, and section rhythm come from tokens/containers, never ad-hoc
     per-card utilities or inline styles.
   - An empty queue collapses to a one-line .itrela-allclear strip — it
     never spends a full card proving nothing is wrong. */

:root {
    /* ── The look (2026-11-17): one set of sizes, steps, corners, lines
       and motion for the whole app. UI_STYLE_GUIDE.md "The look in one
       page" is the written rule; these names are a contract later
       changes snap per-page values onto. */

    /* Text: the only six sizes the app uses (display sizes on sign-in,
       marketing and print are separate). */
    --itrela-text-12: 0.75rem;    /* the floor: table headings, key hints, timestamps, helper text */
    --itrela-text-13: 0.8125rem;  /* dense rows, buttons, tabs, the rail */
    --itrela-text-14: 0.875rem;   /* reading text, fields, table cells */
    --itrela-text-16: 1rem;       /* card and section titles */
    --itrela-text-20: 1.25rem;    /* page titles */
    --itrela-text-28: 1.75rem;    /* big numbers */
    /* Only for text inside a fixed box under 24px: avatar initials, count
       dots and badges. Nothing else uses it (scripts/snap-style-values.py
       lists the rules). */
    --itrela-text-mark: 0.6875rem;
    --itrela-weight-regular: 400;
    --itrela-weight-medium: 500;
    --itrela-weight-strong: 600;
    --itrela-leading-tight: 1.2;
    --itrela-leading-text: 1.45;
    /* Font families: Inter for dense UI body/tables/forms, Archivo for
       headings/brand/KPIs, IBM Plex Mono (below) for IDs/amounts/config. */
    --itrela-font-sans: "Inter", "Archivo", system-ui, -apple-system, sans-serif;
    --itrela-font-display: "Archivo", "Inter", system-ui, sans-serif;
    /* Retired global body word-gap hack: Inter carries calibrated natural word
       spacing (~0.28em). Uppercase tracked labels keep explicit word-spacing via
       --itrela-label-word-spacing (overridden in inter-fonts.css). */
    --itrela-word-gap: 0em;
    /* Uppercase labels only; sentence-case text is never letter-spaced. */
    --itrela-caps-tracking: 0.04em;

    /* Space steps. */
    --itrela-space-4: 4px;
    --itrela-space-8: 8px;
    --itrela-space-12: 12px;
    --itrela-space-16: 16px;
    --itrela-space-24: 24px;
    --itrela-space-32: 32px;
    --itrela-space-48: 48px;

    /* Corners. */
    --itrela-radius-small: 4px;    /* key hints, bars, tiny marks */
    --itrela-radius-control: 8px;  /* buttons, fields, menu items */
    --itrela-radius-surface: 12px; /* cards, dialogs, popovers, panels */
    --itrela-radius-pill: 999px;   /* chips, avatars */

    /* Lines and the one shadow. Both lines come from the palette
       (ItrelaTheme.cs) so each theme carries its own grade:
         --itrela-line         LinesDefault  #DDE3E4 light / #383E3E dark
         --itrela-line-strong  LinesInputs   #C5CED0 light / #4A5252 dark */
    --itrela-line: var(--mud-palette-lines-default);
    --itrela-line-strong: var(--mud-palette-lines-inputs);
    /* Only things that float wear it: menus, dialogs, popovers, the help
       panel, the command bar, toasts. Cards and buttons never do. */
    --itrela-shadow-float: 0 12px 32px -12px rgb(8 16 18 / 0.28), 0 2px 6px -2px rgb(8 16 18 / 0.12);
    /* The dim behind something that takes the whole screen (the command bar),
       in the shadow's ink: it darkens the light ground and the dark one alike. */
    --itrela-scrim: rgb(8 16 18 / 0.45);

    /* Motion and focus. */
    --itrela-motion-fast: 120ms;
    --itrela-motion-base: 160ms;
    --itrela-ease: cubic-bezier(0.2, 0, 0, 1);
    --itrela-focus-ring: 2px solid var(--mud-palette-primary);
    --itrela-focus-offset: 2px;

    /* Two compact heights for the shared kit (2026-11-18): the status chip
       (Components/Shared/StatusChip) and the choice switch
       (Components/Shared/ChoiceSwitch). */
    --itrela-chip-height: 22px;
    --itrela-choice-height: 32px;
    /* Neutral light tile behind vendor SVGs (most ship as dark-on-transparent artwork). */
    --itrela-logo-tile: #F6F8F8;
    /* The buttons' minimum height (the look's 34px), for drawn buttons that
       are not MudButtons, such as a row list's quiet action. */
    --itrela-button-min-height: 34px;

    /* Older names, kept working and pointed at the scale above. */
    --itrela-radius-card: var(--itrela-radius-surface); /* hero + standard surfaces */
    --itrela-radius-tile: var(--itrela-radius-surface); /* quiet tiles */

    /* Card spacing scale (2026-07-29 standardization). The ONLY card
       spacing values a page may use; see UI_STYLE_GUIDE.md "Card spacing
       & alignment". --itrela-card-pad is applied to .surface-card
       .mud-card-content below because MudBlazor 9 ships CardContent
       with no padding. */
    --itrela-card-pad: 16px;         /* card interior padding (= pa-4) */
    --itrela-card-gap: 24px;         /* gap between cards in a page column */
    --itrela-card-section-gap: 16px; /* rhythm between sections inside a card */

    /* Type scale: numbers read first, labels whisper. Weight caps at
       600 — the heaviest IBM Plex Mono we ship (400/500/600). */
    --itrela-num-size: var(--itrela-text-28);
    --itrela-num-weight: var(--itrela-weight-strong);
    --itrela-label-size: var(--itrela-text-12);

    /* Word space for letter-spaced text. Archivo's own word space is
       narrow: below about 12.5px it lays out at 2px, and letter spacing
       widens every letter gap by as much as it widens that space, so
       small letter-spaced labels ran their words together on screen
       ("NEEDSDOING"). Every rule that adds letter spacing of 0.03em or
       more also sets word-spacing to this token; LabelWordSpacingLintTests
       keeps it that way. Body text carries --itrela-word-gap (see "The look");
       letter-spaced labels and captions add the caps tracking on top, because
       LabelWordGapBrowserTests holds every such label to a 0.25em gap and the
       body gap alone measured 0.244em on CI's renderer. */
    --itrela-label-word-spacing: calc(var(--itrela-word-gap) + var(--itrela-caps-tracking));

    /* Status inks — true status only, never decoration. Status is NOT a
       brand colour and never follows the teal accent, but it is re-graded
       for the graphite grounds. Both grades already live in the palette
       (ItrelaTheme.cs), so these point there rather than carry a
       second copy that only one theme could ever match:
         critical  #A82520 light / #F0857E dark
         warning   #814703 light / #EFC46A dark
         ok        #13602A light / #79C58F dark
       The token names stay put, so re-grading away from the palette later
       is a one-line change back to literals. */
    --itrela-status-critical: var(--mud-palette-error);
    --itrela-status-warning: var(--mud-palette-warning);
    --itrela-status-ok: var(--mud-palette-success);
    /* The design's bright warning grade (#C2860B light / #F5D083 dark) —
       for figures and dots, never small text. Lives in the palette as
       WarningLighten so the alias stays theme-paired. */
    --itrela-status-warning-bright: var(--mud-palette-warning-lighten);
    /* The status info ink (#2F5FA8 light / #8FB4E8 dark): "under way"
       statuses such as Awaiting payment, Sent and In progress. The palette's
       Info is the slate for information notices and read as grey on a chip,
       so this lives in the palette's TertiaryLighten slot (ItrelaTheme.cs),
       which nothing else draws with. */
    --itrela-status-info: var(--mud-palette-tertiary-lighten);

    /* Mono face, for IDs, durations, amounts. There is no display token:
       brand moments are Archivo 600, the family the theme already puts
       on body, so they just inherit it. */
    --itrela-font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

    /* Chalk — the light ink the graphite rail and login panel write with. */
    --itrela-chalk: #E8EDED;
    --itrela-chalk-bright: #F4F7F7;

    /* The graphite rail (Itrela) — fixed in both themes, exactly like the
       login brand panel. Chalk at graded opacities. The painted gradient
       lives in the "Sidebar & app frame" section; --itrela-rail-base is the
       light-theme ground those stops sit on. */
    --itrela-rail-base: #14191B;
    --itrela-rail-text: rgba(232, 237, 237, 0.86);
    --itrela-rail-text-dim: rgba(232, 237, 237, 0.60);
    --itrela-rail-icon: rgba(232, 237, 237, 0.76);
    --itrela-rail-hover: rgba(232, 237, 237, 0.07);
    --itrela-rail-active: rgba(232, 237, 237, 0.14);
    --itrela-rail-hairline: rgba(232, 237, 237, 0.14);
    /* Canonical rail accent tokens (teal on graphite). Historical
       --itrela-rail-copper* aliases remain for backwards compatibility. */
    --itrela-rail-accent: #3FC3CE;
    --itrela-rail-accent-ink: #08181B;
    --itrela-rail-copper: var(--itrela-rail-accent);
    --itrela-rail-copper-ink: var(--itrela-rail-accent-ink);
    --itrela-auth-glow: rgba(63, 195, 206, 0.16);
    --itrela-accent-ink: #06474E;
}

/* ── Global control polish ──────────────────────────────────────── */
/* Buttons and tabs read sentence-case app-wide (admin-center look).
   Previously this was scoped to the tickets pages only, which made the
   rest of the app shout in ALL CAPS. */

.mud-button-root {
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.mud-tabs .mud-tab {
    text-transform: none !important;
    letter-spacing: 0 !important;
}

/* Captions and overlines are sentence case and carry no letter spacing now
   (the theme sets 0 and no capitals). Both keep the word
   gap explicitly so a page that re-adds tracking cannot run words
   together ("Escgoesback" in the command bar's caption). */
.mud-typography-caption,
.mud-typography-overline {
    word-spacing: var(--itrela-label-word-spacing);
}

/* ── The look (2026-11-17) ─────────────────────────────────────────
   Theme-level rules that give every MudBlazor control one size, one
   corner and one line. UI_STYLE_GUIDE.md "The look in one page" is the
   written form. Per-page sizes are snapped onto the tokens separately;
   nothing here is page-specific. */

/* Word gap. Archivo's own word space is narrow (about 0.2em), so words in
   short headings ("At risk") nearly touch. The mono face has wide, even
   spaces of its own and takes none. */
body {
    word-spacing: var(--itrela-word-gap);
}

code,
kbd,
pre,
samp,
.itrela-mono,
.itrela-money,
td.itrela-num-cell,
.mud-table-root .mud-table-body .mud-table-cell.itrela-mono,
.mud-table-root .mud-table-body td.mud-table-cell.itrela-num-cell,
.level-webhook-url,
.portal-invoice-table tfoot td.portal-num {
    word-spacing: normal;
}

/* Fields: text fields, selects, autocompletes, numeric fields and date or
   time pickers. MudInput paints its text with the Subtitle1 style, which is
   a title style here (600), so the field restates reading text. */
.mud-input-control .mud-input,
.mud-input-control .mud-input > input,
.mud-input-control .mud-input > textarea,
.mud-input-control .mud-input .mud-input-slot {
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-regular);
    letter-spacing: 0;
}

.mud-input-control .mud-input {
    line-height: var(--itrela-leading-tight);
}

/* At phone width field text is 16px: iPhone Safari zooms the whole page when
   a field under 16px takes focus. Labels and helper text keep their sizes. */
@media (max-width: 599.98px) {
    .mud-input-control .mud-input,
    .mud-input-control .mud-input > input,
    .mud-input-control .mud-input > textarea,
    .mud-input-control .mud-input .mud-input-slot {
        font-size: var(--itrela-text-16);
    }
}

.mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol {
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-regular);
    letter-spacing: 0;
}

/* Dense outlined fields: 16.8px of text + 2 × 9.6px = 36px. The resting
   label is re-centred for that height; the floated label settles at 12px
   (14px × 6/7), the same size as the outline's notch. */
.mud-input > input.mud-input-root-outlined.mud-input-root-margin-dense,
div.mud-input-slot.mud-input-root-outlined.mud-input-root-margin-dense {
    padding-top: 9.6px;
    padding-bottom: 9.6px;
}

.mud-input-label-outlined.mud-input-label-margin-dense {
    transform: translate(14px, 9px) scale(1);
}

.mud-shrink ~ label.mud-input-label.mud-input-label-inputcontrol.mud-input-label-outlined,
.mud-input:focus-within ~ label.mud-input-label.mud-input-label-inputcontrol.mud-input-label-outlined,
.mud-input:has(:-webkit-autofill) ~ label.mud-input-label.mud-input-label-inputcontrol.mud-input-label-outlined {
    transform: translate(14px, -8px) scale(0.857143);
    max-width: calc((100% - 14px) / 0.857143);
}

.mud-input.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--itrela-line-strong);
    border-radius: var(--itrela-radius-control);
}

.mud-input-helper-text {
    font-size: var(--itrela-text-12);
    letter-spacing: 0;
}

/* Lists, menus, tables, choices, dialogs and toasts read at 14px. */
.mud-list-item,
.mud-menu-item,
.mud-list-item .mud-typography,
.mud-menu-item .mud-typography,
.mud-table-root .mud-table-body .mud-table-cell,
.mud-switch .mud-typography,
.mud-checkbox .mud-typography,
.mud-radio .mud-typography,
.mud-dialog .mud-dialog-content,
.mud-snackbar {
    font-size: var(--itrela-text-14);
    letter-spacing: 0;
}

.mud-menu-item,
.mud-list-item.mud-list-item-clickable {
    border-radius: var(--itrela-radius-control);
}

.mud-table-pagination,
.mud-table-pagination .mud-typography,
.mud-table-pagination-select .mud-input .mud-input-root {
    font-size: var(--itrela-text-13);
    letter-spacing: 0;
}

.mud-tabs .mud-tab {
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
}

.mud-tooltip {
    font-size: var(--itrela-text-12);
    letter-spacing: 0;
}

.mud-dialog .mud-dialog-title,
.mud-dialog .mud-dialog-title > .mud-typography {
    font-size: var(--itrela-text-16);
    font-weight: var(--itrela-weight-strong);
    line-height: var(--itrela-leading-tight);
    letter-spacing: 0;
}

/* Buttons: flat in every state, 13px/600, 8px corners. Medium buttons keep
   the 34px the layout gate and the header shells expect. */
.mud-button-root,
.mud-button-root:hover,
.mud-button-root:focus-visible,
.mud-button-root:active {
    box-shadow: none !important;
}

/* Button groups paint their children from the group's variant, and MudBlazor
   gives the group itself an elevation. */
.mud-button-group-root {
    box-shadow: none !important;
}

.mud-button-root.mud-button:not(.mud-input-numeric-spin *) {
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    border-radius: var(--itrela-radius-control);
    min-height: 34px;
}

.mud-button-root.mud-button[class*="-size-small"]:not(.mud-input-numeric-spin *) {
    min-height: 28px;
}

/* The one secondary style: every outlined button except the destructive
   one. A soft line, the surface behind it, ink text, a faint ink tint on
   hover. */
.mud-button-root.mud-button-outlined:not(.mud-button-outlined-error) {
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--itrela-line-strong);
    background-color: var(--mud-palette-surface);
    --mud-ripple-color: var(--mud-palette-text-primary);
}

.mud-button-root.mud-button-outlined:not(.mud-button-outlined-error):hover,
.mud-button-root.mud-button-outlined:not(.mud-button-outlined-error):focus-visible,
.mud-button-root.mud-button-outlined:not(.mud-button-outlined-error):active {
    border-color: var(--itrela-line-strong);
    background-color: color-mix(in oklab, var(--mud-palette-text-primary) 5%, var(--mud-palette-surface));
}

.mud-button-root.mud-button-outlined.mud-button-outlined-error {
    color: var(--mud-palette-error);
    border: 1px solid color-mix(in oklab, var(--mud-palette-error) 40%, transparent);
    background-color: var(--mud-palette-surface);
}

.mud-button-root.mud-button-outlined.mud-button-outlined-error:hover,
.mud-button-root.mud-button-outlined.mud-button-outlined-error:focus-visible,
.mud-button-root.mud-button-outlined.mud-button-outlined-error:active {
    border-color: color-mix(in oklab, var(--mud-palette-error) 55%, transparent);
    background-color: color-mix(in oklab, var(--mud-palette-error) 6%, var(--mud-palette-surface));
}

/* Text buttons default to ink; links stay teal. A text button a page gives
   an explicit colour (Color.Primary, Color.Error, Color.Inherit on the rail
   and in toasts) keeps that colour. */
.mud-button-root.mud-button-text.mud-button-text-default:not(.mud-snackbar-action-button):not(.mud-button-group-root *):not(.itrela-link-action) {
    color: var(--mud-palette-text-primary);
    --mud-ripple-color: var(--mud-palette-text-primary);
}

.mud-button-root.mud-button-text.mud-button-text-default:not(.mud-snackbar-action-button):not(.mud-button-group-root *):not(.itrela-link-action):hover,
.mud-button-root.mud-button-text.mud-button-text-default:not(.mud-snackbar-action-button):not(.mud-button-group-root *):not(.itrela-link-action):focus-visible,
.mud-button-root.mud-button-text.mud-button-text-default:not(.mud-snackbar-action-button):not(.mud-button-group-root *):not(.itrela-link-action):active {
    background-color: color-mix(in oklab, var(--mud-palette-text-primary) 6%, transparent);
}

/* Navigation link-actions inside cards and headers: clear teal link affordance
   while keeping routine Cancel/Dismiss/Clear text buttons quiet ink. */
.mud-button-root.mud-button-text.mud-button-text-default.itrela-link-action,
.mud-button-root.mud-button-text.itrela-link-action {
    color: var(--mud-palette-primary);
    --mud-ripple-color: var(--mud-palette-primary);
}

.mud-button-root.mud-button-text.mud-button-text-default.itrela-link-action:hover,
.mud-button-root.mud-button-text.mud-button-text-default.itrela-link-action:focus-visible,
.mud-button-root.mud-button-text.itrela-link-action:hover,
.mud-button-root.mud-button-text.itrela-link-action:focus-visible {
    background-color: color-mix(in oklab, var(--mud-palette-primary) 8%, transparent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Bill it sits under the job's unbilled amount and starts where it starts. */
[data-job-unbilled-work] .mud-button-root.itrela-link-action {
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
}

/* Disabled: muted text on a faint fill, never a grey slab. */
.mud-button-root.mud-button-filled:disabled,
.mud-button-root.mud-button-filled.mud-disabled {
    color: var(--mud-palette-text-disabled);
    background-color: color-mix(in oklab, var(--mud-palette-text-primary) 6%, transparent) !important;
}

.mud-button-root.mud-button-outlined:disabled,
.mud-button-root.mud-button-outlined.mud-disabled {
    color: var(--mud-palette-text-disabled);
    border-color: var(--itrela-line);
    background-color: color-mix(in oklab, var(--mud-palette-text-primary) 3%, var(--mud-palette-surface));
}

.mud-button-root.mud-button-text:disabled,
.mud-button-root.mud-button-text.mud-disabled {
    color: var(--mud-palette-text-disabled);
}

/* Icon buttons: a 32px square with control corners. Small ones keep their
   24px box (dense rows and field adornments are built around it).
   MudSwitch's thumb rides on an element that also carries .mud-icon-button,
   and its padding is what centres the thumb on the track. The 4px square
   padding pulled the thumb 5px up and left of the track's centre, off and
   on, so the switch keeps MudBlazor's own padding and round halo. */
.mud-icon-button:not(.mud-switch-base) {
    border-radius: var(--itrela-radius-control);
}

.mud-icon-button:not(.mud-icon-button-size-small):not(.mud-icon-button-size-large):not(.mud-button):not(.mud-switch-base) {
    padding: 4px;
}

/* One focus ring for everything a keyboard can land on. The tab strip
   clips its children, so tabs draw the ring inside. */
.mud-button-root:focus-visible,
.mud-icon-button:focus-visible,
a:focus-visible,
.mud-nav-link:focus-visible,
.mud-chip.mud-clickable:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
}

.mud-tabs .mud-tab:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: calc(var(--itrela-focus-offset) * -1);
}

/* Cards are flat: a hairline, never a shadow. Popovers and dialogs render
   outside the page content, so this never reaches a floating surface. */
.mud-main-content .mud-paper,
.mud-main-content .mud-card {
    box-shadow: none;
}

/* Things that float: menus, selects, pickers, dialogs. */
.mud-popover.mud-paper:not(.mud-tooltip),
.mud-dialog {
    box-shadow: var(--itrela-shadow-float);
}

.mud-popover.mud-paper:not(.mud-tooltip) {
    border-radius: var(--itrela-radius-surface);
}

.mud-tooltip {
    border-radius: var(--itrela-radius-control);
}

/* ── Machine values ─────────────────────────────────────────────── */
/* Ticket IDs, durations, and currency amounts in DATA positions
   (table cells, stat values, totals) wear IBM Plex Mono; the same
   value inside a sentence stays Archivo — prose is prose. Only weights
   400/500/600 are self-hosted, so font-synthesis is off: a <b> inside a
   mono cell renders at 600, never a faux 700. */

.itrela-mono,
.itrela-money {
    font-family: var(--itrela-font-mono);
    word-spacing: normal;
    font-variant-numeric: tabular-nums;
    letter-spacing: normal;
    font-synthesis-weight: none;
}

/* The one way an amount renders (2026-11-30): put .itrela-money on the
   element that holds the amount and nothing else, in a table cell, a tile, a
   total or a line. An amount never breaks across lines. A sentence that
   mentions an amount is a sentence, so it stays in the body face. */
.itrela-money {
    white-space: nowrap;
}

/* An amount typed into a field reads like an amount shown: put
   .itrela-money-field on the numeric field (with Format="N2"). */
.mud-input-control.itrela-money-field .mud-input > input {
    font-family: var(--itrela-font-mono);
    word-spacing: normal;
    font-variant-numeric: tabular-nums;
    letter-spacing: normal;
    font-synthesis-weight: none;
}

/* A machine value in a table cell (a number, an amount, a date) never
   breaks across lines: "Nov 27" split in two reads as two values. */
.mud-table-cell .itrela-mono {
    white-space: nowrap;
}

/* Numeric table cells: right-aligned, tabular digits (the type-scale
   rule — numbers read as columns, labels stay left). Global because
   the reports pages share the class; the mono face applies to data
   cells only, never the <th> label. */
.itrela-num-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

td.itrela-num-cell {
    font-family: var(--itrela-font-mono);
    word-spacing: normal;
    letter-spacing: normal;
    font-synthesis-weight: none;
}

/* MudBlazor's `.mud-table-root .mud-table-body .mud-table-cell` family
   rule out-ranks the single-class utilities above, so a `itrela-mono` or
   `itrela-num-cell` placed on a MudTd silently rendered Archivo. Restate the
   mono face at the same cell level for every Mud table app-wide. */
.mud-table-root .mud-table-body .mud-table-cell.itrela-mono,
.mud-table-root .mud-table-body .mud-table-cell.itrela-money,
.mud-table-root .mud-table-body td.mud-table-cell.itrela-num-cell {
    font-family: var(--itrela-font-mono);
    word-spacing: normal;
    font-variant-numeric: tabular-nums;
    letter-spacing: normal;
    font-synthesis-weight: none;
}

/* MudSimpleTable's `table * tr>td/th` rule (0,1,3) out-ranks the
   utility's alignment and face the same way — restate them, so an amount in
   a simple table's number cell is mono like one in a MudTable. */
.mud-simple-table table tr > th.itrela-num-cell,
.mud-simple-table table tr > td.itrela-num-cell {
    text-align: right;
}

.mud-simple-table table tr > td.itrela-num-cell,
.mud-simple-table table tr > td.itrela-money {
    font-family: var(--itrela-font-mono);
    word-spacing: normal;
    font-variant-numeric: tabular-nums;
    letter-spacing: normal;
    font-synthesis-weight: none;
}

/* ── Words for screen readers only ──────────────────────────────────
   The one app-wide class for text a screen reader reads and the eye
   never sees: a column heading over an icon column, a live-region
   announcement, a loading line. Clip it, never display:none it, or it
   leaves the accessibility tree. Pinned to its containing block's
   corner: left in its place inside a sideways-scrolling table, the 1px
   box counted toward the page's scroll width. */
.itrela-visually-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ── Wide tables on narrow screens: scroll sideways, never clip. ──────
   Add `report-table` beside data-grid-container and set --itrela-table-min
   in markup: the table gets a width floor so MudBlazor's own
   .mud-table-container scrolls it instead of crushing columns, and a
   right-edge fade signals that more columns are off-canvas. In engines
   with scroll-driven animations the fade lifts at scroll end and never
   shows when the table fits; elsewhere the scrollbar is the affordance. */
.report-table {
    position: relative;
    timeline-scope: --itrela-report-x;
}

.report-table .mud-table-container {
    scroll-timeline: --itrela-report-x inline;
}

.report-table table {
    /* Opt-in floor: pages set --itrela-table-min where columns would crush;
       without it the class still provides scroll + fade affordance. */
    min-width: var(--itrela-table-min, 0px);
}

.report-table::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 32px;
    pointer-events: none;
    border-radius: 0 var(--itrela-radius-surface) var(--itrela-radius-surface) 0;
    background: linear-gradient(to left, var(--mud-palette-surface), transparent);
    opacity: 0;
}

@supports (animation-timeline: scroll()) {
    .report-table::after {
        animation: itrela-report-scroll-fade linear both;
        animation-timeline: --itrela-report-x;
    }
}

@keyframes itrela-report-scroll-fade {
    0%, 96% { opacity: 1; }
    100% { opacity: 0; }
}

/* report-table composes with stacked MudTables: below the stacking
   breakpoint there is no "table" left to floor, so the min-width must
   not reintroduce sideways overflow. */
@media (max-width: 600px) {
    .report-table .mud-xs-table .mud-table-root {
        min-width: 0;
    }
}

/* Stacked-mode data labels (MudBlazor's ::before content:attr(data-label))
   read as the same uppercase whisper everywhere — half the app's stacked
   tables were title-case, half uppercase. */
@media (max-width: 600px) {
    .mud-xs-table .mud-table-body .mud-table-cell::before {
        font-size: var(--itrela-text-12);
        font-weight: var(--itrela-weight-strong);
        letter-spacing: var(--itrela-caps-tracking);
        word-spacing: var(--itrela-label-word-spacing);
        text-transform: uppercase;
        color: var(--mud-palette-text-secondary);
        font-family: var(--mud-typography-default-family);
    }
}

/* Canonical card containers. Use these whenever a page owns a vertical
   stack or CSS grid of cards. MudGrid keeps its responsive item mechanics
   and uses Spacing="6" + Class="itrela-card-grid" in markup. */
.itrela-card-stack {
    display: flex;
    flex-direction: column;
    gap: var(--itrela-card-gap) !important;
    min-width: 0;
}

.itrela-card-grid:not(.mud-grid) {
    display: grid;
    gap: var(--itrela-card-gap);
}

/* The quiet link a kit card writes into its foot ("All tickets →"): 13px
   strong teal, underlined on hover, the one focus ring. */
.itrela-foot-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    color: var(--mud-palette-primary);
    text-decoration: none;
    cursor: pointer;
}

.itrela-foot-link:hover {
    text-decoration: underline;
}

.itrela-foot-link:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
    border-radius: var(--itrela-radius-control);
}

/* ── Surface Card (shared "Itrela look" panel) ────────────────── */
/* Use Class="surface-card" on MudCard/MudPaper instead of inline
   border styles: white surface, hairline border, surface radius. */

.surface-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--itrela-line) !important;
    border-radius: var(--itrela-radius-surface) !important;
    box-shadow: none !important;
}

/* Card spacing standard (2026-07-29): MudBlazor 9's .mud-card-content
   ships with NO padding, so bare <MudCardContent> rendered flush — the
   source of half the app's "random" card padding. Supply the standard
   interior padding here so a bare MudCardContent inside a surface-card
   (app) or portal-card (client portal) IS the standard (16px =
   --itrela-card-pad = pa-4). Explicit pa-* on MudCardContent is non-standard
   (check-card-standards.sh flags it); full-bleed cards opt out with
   pa-0 + scoped interior CSS. */
.surface-card .mud-card-content,
.portal-card .mud-card-content {
    padding: var(--itrela-card-pad);
}

/* UX-01: clickable cards (e.g. Settings index) are keyboard buttons —
   show where focus is. */
.surface-card[role="button"]:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
}

/* Nine call sites already relied on this Bootstrap-ism that neither
   MudBlazor nor we ever defined — every "centered" empty state was
   silently left-aligned (2026-07-14 polish sweep). */
.text-center {
    text-align: center;
}

/* Card empty state (2026-07-29 standardization): the ONE centered card
   pattern. Replaces the ad-hoc "surface-card pa-8 text-center d-flex
   flex-column align-center gap-2" spellings. Body text in every other
   card stays left-aligned. */
.card-empty {
    padding: 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.contract-template-card:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
}

.contract-template-card--disabled {
    color: var(--mud-palette-text-disabled);
    cursor: default;
}

/* ── Mud Dialog (global polish) ─────────────────────────────────── */

.mud-dialog {
    border-radius: var(--itrela-radius-surface) !important;
}

.mud-dialog .mud-dialog-content {
    padding: 18px 20px !important;
}

.mud-dialog .mud-dialog-actions {
    padding: 12px 16px 16px !important;
}

/* FocusOnNavigate target for route changes (see Routes.razor) */
#itrela-main:focus {
    outline: none !important;
}

#itrela-main:focus-visible {
    outline: none !important;
}

/* ── Fallback frame (not-found / login-redirect) ────────────────────
   The router's NotFound view and RedirectToLogin's transient cards sit
   outside the page chromes by design: no shell, just one centred reading
   column inside the main content box. This replaces the framing the
   retired .page-shell used to give them. */

.itrela-fallback-frame {
    max-width: 720px;
    margin-inline: auto;
    padding: 32px 40px;
}

@media (max-width: 959.98px) {
    .itrela-fallback-frame {
        padding: 20px;
    }
}

/* ── Dashboard Summary (quiet tier — see the token block up top) ── */

.summary-item {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-tile);
    padding: 14px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: border-color 0.15s ease;
}

.summary-item:hover {
    border-color: var(--mud-palette-action-default);
}

a.summary-item {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

a.summary-item:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
}

.summary-label {
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
    color: var(--mud-palette-text-secondary);
}

.summary-value {
    font-size: var(--itrela-text-28);
    font-weight: var(--itrela-weight-strong);
    color: var(--mud-palette-text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

/* Legacy value tints (still used by the billing workspace strip). */
.active-value {
    color: var(--itrela-status-ok);
}

.onboarding-value {
    color: var(--itrela-status-warning);
}

.churned-value {
    color: var(--itrela-status-critical);
}

.action-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-card);
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* No border under the header — the first row's own border-top draws the
   separation, like the sheets do. */
.action-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
}

.action-card-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--itrela-radius-control);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--mud-palette-text-primary);
    background: color-mix(in oklab, var(--mud-palette-surface), #000 5%);
    border: 1px solid var(--mud-palette-lines-default);
    flex: 0 0 auto;
}

.action-card-title-block {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.action-card-title {
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: 0;
    line-height: 1.2;
    color: var(--mud-palette-text-primary);
}

.action-card-sub {
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
}

.dashboard-card-body-line {
    color: var(--mud-palette-text-primary);
    font-size: var(--itrela-text-14);
    line-height: 1.5;
}

.dashboard-card-body-sub {
    font-size: var(--itrela-text-13);
    line-height: 1.45;
}

.dashboard-notifications-empty {
    flex: 1 1 auto;
    padding: 11px 16px;
    font-size: var(--itrela-text-13);
}

.dashboard-notification-row {
    width: 100%;
    border-top: 0;
    border-right: 0;
    border-left: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.dashboard-notification-row--burst {
    background: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-surface) 95%);
}

.dashboard-notification-row--burst:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-surface) 91%);
}

.action-list {
    display: flex;
    flex-direction: column;
}

.action-row {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    color: inherit;
    text-decoration: none;
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.action-row:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-surface) 94%);
}

/* Email-triage rows carry a trailing AI button beside the link (Phase 10.3). */
.action-row-flex {
    display: flex;
    align-items: center;
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.action-row-flex > .action-row {
    flex: 1;
    min-width: 0;
    border-top: none;
}

.action-row-main,
.action-row-side {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.action-row-main {
    flex: 1 1 auto;
}

.action-row-side {
    flex: 0 0 auto;
    align-items: flex-end;
    max-width: 150px;
}

/* Titles wrap to two lines rather than truncating — a row you can't
   read isn't information (12.1: no truncated rows on the dashboard). */
.action-row-title {
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-strong);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.action-row-meta,
.action-row-detail {
    font-size: var(--itrela-text-12);
    line-height: 1.2;
    color: var(--mud-palette-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Side details wrap to two lines instead of truncating ("Unknown
   sender — assign a client" must stay readable). */
.action-row-detail {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: right;
}

.action-priority {
    font-size: var(--itrela-text-12);
    line-height: 1;
    font-weight: var(--itrela-weight-strong);
    color: var(--mud-palette-text-secondary);
}

.action-priority-medium {
    color: var(--mud-palette-secondary);
}

.action-priority-high {
    color: var(--itrela-status-warning);
}

.action-priority-critical {
    color: var(--itrela-status-critical);
}

/* flex:1 keeps the "all clear" state centered in the full card body
   when siblings in the row are taller. */
.action-empty {
    flex: 1;
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    color: color-mix(in oklab, var(--itrela-status-ok), var(--mud-palette-text-secondary) 45%);
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-13);
}

/* ── Hero card (12.1 hero tier) ─────────────────────────────────────
   At most ONE per page: the thing to look at first. On the dashboard
   this is "Needs attention" — the merged list of genuinely-on-fire
   queues (Critical severity comes from the data, not the styling). */

.itrela-card-hero {
    background: var(--mud-palette-surface);
    border: 1px solid color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 45%);
    border-radius: var(--itrela-radius-card);
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.itrela-priority-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.itrela-priority-dot--critical {
    background: var(--itrela-status-critical);
}

.itrela-priority-dot--high {
    background: var(--itrela-status-warning-bright);
}

.itrela-priority-dot--medium {
    background: var(--mud-palette-secondary);
}

.itrela-priority-dot--low {
    background: color-mix(in oklab, var(--mud-palette-text-secondary), transparent 40%);
}

/* ── All-clear strip (12.1 empty-state rule) ────────────────────────
   Empty queues collapse into ONE line — they never spend a full card
   proving nothing is wrong. */

.itrela-allclear {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    border: 1px dashed color-mix(in oklab, var(--mud-palette-lines-default), var(--mud-palette-text-secondary) 18%);
    border-radius: var(--itrela-radius-pill);
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-medium);
    min-width: 0;
}

.itrela-allclear .mud-icon-root {
    color: var(--itrela-status-ok);
    flex: 0 0 auto;
}

.itrela-allclear-text {
    /* The sentence is the point — an ellipsis clipped "Nothing is scheduled
       for you today." mid-word. Wrap instead of truncating. */
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ── Destination / category chips (My Day internal work) ────────────
   Single-select pill rows for "A ticket vs Internal work" and the
   internal-time category picker. Global (not scoped) so the same look
   serves both the gap card and the hand-log dialog, which renders at the
   MudBlazor provider root. Mirrors the .yourday-dur-chip look. */
.itrela-dest-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.itrela-dest-chip {
    display: inline-flex;
    align-items: center;
    height: 28px;
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 30%);
    background: transparent;
    border-radius: var(--itrela-radius-pill);
    padding: 0 12px;
    font: inherit;
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    color: var(--mud-palette-text-primary);
    cursor: pointer;
    white-space: nowrap;
}

.itrela-dest-chip:hover:not(:disabled) {
    border-color: var(--mud-palette-primary);
}

.itrela-dest-chip:disabled {
    opacity: 0.55;
    cursor: default;
}

.itrela-dest-chip--sel {
    border-color: color-mix(in oklab, var(--mud-palette-primary), transparent 60%);
    background: var(--mud-palette-primary-lighten);
    color: var(--mud-palette-primary-darken);
    font-weight: var(--itrela-weight-strong);
}

.itrela-dest-chip:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--mud-palette-primary), white 55%);
    outline-offset: 1px;
}

/* ── "Clients that need a decision today" card ──────────────────────
   Standard card (never a second hero). The amber intro appears only when
   Level's push has gone quiet; the footer states what the list can and
   can't claim. */
.itrela-level-decisions-intro {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    font-size: var(--itrela-text-13);
    line-height: 1.4;
    color: var(--itrela-status-warning);
    background: color-mix(in oklab, var(--itrela-status-warning), transparent 90%);
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.itrela-level-decisions-intro .mud-icon-root {
    flex: 0 0 auto;
    color: var(--itrela-status-warning);
}

.itrela-level-decisions-intro a {
    color: inherit;
    font-weight: var(--itrela-weight-strong);
    white-space: nowrap;
}

.itrela-level-decisions-witness {
    padding: 8px 14px 0;
}

.itrela-level-decisions-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.itrela-level-decisions-foot .mud-icon-root {
    flex: 0 0 auto;
    color: var(--mud-palette-text-secondary);
}

/* On phones the strip's message beats single-line purity: wrap up to
   two lines rather than ellipsing away the actual reassurance. */
@media (max-width: 599.98px) {
    .itrela-allclear-text {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

/* Phone table pagers: MudBlazor's fixed-height toolbar shears
   "Rows per page" and "1-10 of N" into ragged multi-line fragments at
   390px. Let the toolbar wrap as whole units instead. */
@media (max-width: 599.98px) {
    .mud-table-pagination-toolbar {
        height: auto;
        min-height: 48px;
        flex-wrap: wrap;
        justify-content: flex-end;
        padding-inline: 8px;
        row-gap: 2px;
    }

    .mud-table-pagination-toolbar .mud-table-pagination-caption,
    .mud-table-pagination-toolbar .mud-table-pagination-display {
        white-space: nowrap;
    }
}

/* ── Command Bar ────────────────────────────────────────────────── */

.command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.command-bar-items {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vault-embedded-grid {
    overflow-x: auto;
}

/* ── Data Grid Container ────────────────────────────────────────── */

.data-grid-container {
    background-color: var(--mud-palette-surface);
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
    border-radius: var(--itrela-radius-surface);
    overflow: hidden;
}

/* Flush-in-card variant: a grid that already sits inside a bordered
   surface-card drops its own chrome — Core Pages §O's "never a second
   border around the list". The head/row/hover standard still applies. */
.data-grid-container--flush {
    background: transparent;
    border: none;
    border-radius: 0;
}

/* Let MudDataGrid's internal borders flow without interference */
.data-grid-container .mud-table {
    border: none !important;
    box-shadow: none !important;
}

/* THE table standard, defined once: head 34px with .6875rem uppercase
   labels at .07em and one hairline below; rows min-height 44px; cell
   inset 22px; hover the quiet raise. No page-level table CSS — the two
   sanctioned mirrors (the .billing-page copies below and the flush-in-card
   scoped stylesheets the style guide lists) restate these exact values.

   On the graphite grounds the head tint steps AWAY from the card surface
   in both themes — down toward the hairline on paper, up off the ground in
   the dark. Mixing the page ground with lines-default does that from one
   expression; the old background/surface mix only ever went lighter, which
   on a white light surface left the head invisible. Measured targets are
   #E3E8E8 light / #282C2C dark (head) and #E1E6E7 / #2A2F2F (row
   dividers) — every value here lands inside 0.8 oklab ΔE·100 of them.
   Rows are NEVER striped; the ban is in UI_STYLE_GUIDE.md "Tables".
   (!important on the typography only, to win over MudBlazor's
   .mud-table-cell typography rules; the padding below stays
   !important-free on purpose — see the note there.)

   Height alone loses to MudBlazor's cell padding: measured live on the
   Clients workbench, the head sat at 47.5px and rows at 53px until the
   vertical padding came out too. So the vertical inset folds into the
   fixed heights — 0 in the 34px head, 4px under the 44px row floor — and
   the horizontal inset carries the standard's 22px, the same value
   --itrela-workbench-row-pad publishes to workbench rows. The padding
   selectors stay one class stronger than MudBlazor's dense rule but
   !important-free, so a page's own scoped inset (a deliberate tighter
   gutter) still wins. */
.data-grid-container .mud-table-head th.mud-table-cell {
    height: 34px;
    padding: 0 22px;
    background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 42%);
    font-size: var(--itrela-text-12) !important;
    font-weight: var(--itrela-weight-strong) !important;
    letter-spacing: var(--itrela-caps-tracking) !important;
    word-spacing: var(--itrela-label-word-spacing);
    text-transform: uppercase !important;
    color: var(--mud-palette-text-secondary) !important;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.data-grid-container .mud-table-body .mud-table-row {
    min-height: 44px;
}

.data-grid-container .mud-table-body td.mud-table-cell {
    height: 44px;
    padding: 4px 22px;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 52%);
}

/* The quiet raise: --mud-palette-table-striped is the value ItrelaTheme.cs
   keeps for exactly this — striping is banned, so the token's only job is
   the hover. */
.data-grid-container .mud-table-hover .mud-table-body .mud-table-row:hover {
    background: var(--mud-palette-table-striped);
}

/* Selection tints the whole row the accent tint; borders never change on
   either state. A grid opts in by returning itrela-row-selected from its
   RowClassFunc — MudDataGrid stamps no selected class of its own. */
.data-grid-container .mud-table-body .mud-table-row.itrela-row-selected {
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 91%);
}

/* MudSimpleTable renders plain <thead>/<tbody> without the .mud-table-cell
   classes, so it needs its own selectors to pick up the same standard head.
   :not(.mud-table-cell) keeps these from touching MudTable/MudDataGrid cells.
   Plain markup has no dense-padding fight, so these carry the standard's
   literal 10px 22px cell padding under the same 34px/44px floors. */
.data-grid-container thead th:not(.mud-table-cell) {
    height: 34px;
    background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 42%);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: var(--itrela-caps-tracking);
    word-spacing: var(--itrela-label-word-spacing);
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    text-align: left;
    padding: 10px 22px;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.data-grid-container tbody td:not(.mud-table-cell) {
    height: 44px;
    padding: 10px 22px;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 52%);
}

.data-grid-container .mud-table-hover tbody tr:hover td:not(.mud-table-cell) {
    background: var(--mud-palette-table-striped);
}

.clickable-row {
    cursor: pointer;
}

/* UX-01: the primary cell of a clickable grid row is a real link — it reads
   like plain text but gives keyboard users a tab stop and everyone
   middle-click/copy-link, while RowClick keeps the whole row mouse-clickable. */
.grid-row-link {
    color: inherit;
    text-decoration: none;
}

.grid-row-link:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
    border-radius: var(--itrela-radius-small);
}

/* ── Tables use the space they have (2026-12-02) ─────────────────────
   One rule for every list and report table. A name or title column (a
   client, a contact, a ticket title, an account) carries
   .itrela-name-cell on its heading and cells, with the full text in
   title. From 1280px:
     - headings stay on one line;
     - the name never wraps: past its cap it ends in an ellipsis;
     - number cells size to their content and never wrap.
   Between 1280px and 1600px the other columns give way first: their
   inset drops to 12px and the name's cap tightens. Below 1280px a table
   keeps its old wrapping; on a phone a report table keeps its name column
   in view while the figures scroll (below). */
@media (min-width: 1280px) {
    .data-grid-container thead th {
        white-space: nowrap;
    }

    .data-grid-container :is(th, td).itrela-name-cell {
        max-width: var(--itrela-name-cell-max, 36ch);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* A name drawn inside a flex wrapper (a link beside a chip) ends in
       its own ellipsis; the chip keeps its width. */
    .data-grid-container td.itrela-name-cell :is(div, span):has(> a) {
        min-width: 0;
    }

    .data-grid-container td.itrela-name-cell a {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .data-grid-container:has(.itrela-name-cell) td.itrela-num-cell {
        white-space: nowrap;
    }
}

@media (min-width: 1280px) and (max-width: 1599.98px) {
    .data-grid-container:has(.itrela-name-cell) {
        --itrela-name-cell-max: 28ch;
    }

    .data-grid-container:has(.itrela-name-cell) :is(thead th, tbody td):not(.itrela-name-cell) {
        padding-inline: var(--itrela-space-12);
    }
}

/* A report period picker beside the explainer line. */
.report-period-field {
    width: 9.5rem;
}

@media (max-width: 760px) {
    .report-period-field {
        flex: 1 1 9rem;
        width: auto;
    }
}

/* On a phone a report table stays a table: its first (name) column stays
   in view and the figures scroll sideways inside the card, never the
   page. The name ends in an ellipsis; its title holds the rest. A list
   drawn as phone rows (below) is not a table there and is left alone. */
@media (max-width: 600px) {
    .report-table:not(.itrela-phone-rows *) :is(thead tr:first-child > th:first-child, tbody td:first-child) {
        position: sticky;
        left: 0;
        z-index: 1;
        max-width: 45vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        /* The divider is painted, not a border: a collapsed table's border
           would scroll away from the sticky cell. */
        background-image: linear-gradient(to left, var(--itrela-line) 1px, transparent 1px);
    }

    .report-table:not(.itrela-phone-rows *) tbody td:first-child {
        background-color: var(--mud-palette-surface);
    }

    .report-table:not(.itrela-phone-rows *) :is(thead th, tbody td) {
        padding-inline: var(--itrela-space-12);
    }

    .report-table:not(.itrela-phone-rows *) td:first-child a {
        white-space: nowrap;
    }

    .report-table:not(.itrela-phone-rows *) td.itrela-num-cell {
        white-space: nowrap;
    }
}

/* ── Phone rows (2026-11-30) ─────────────────────────────────────────
   Below 600px a list table inside .itrela-phone-rows draws each record as a
   two-line row in the RowList look, instead of MudBlazor's stack of
   uppercase label/value pairs (about one and a half records per screen).
   The page only tags its cells by role, so one template serves a MudTable,
   a MudDataGrid (CellClass) and a plain <table> alike:

     line 1  .itrela-phone-title   the name; its first link covers the row
             .itrela-phone-chip    the status chip, after the name
             .itrela-phone-figure  the amount or key figure, on the right
     line 2  .itrela-phone-meta    one quiet line, composed in one cell
     right   .itrela-phone-menu    the row's ⋯ menu, its own tab stop

   Every other cell stays off the phone row; the record page has it.
   .itrela-phone-only marks a heading and cell drawn on phones only (the
   composed meta line); put it right after the title cell, never last,
   because MudBlazor pads a dense table's last cell narrower and a hidden
   last cell moved the desktop columns. Selection stays a desktop
   affordance. The selectors stay one class above MudBlazor's stacked-cell
   rules on purpose. */
.itrela-phone-rows .itrela-phone-only {
    display: none;
}

/* A meta part that needs a look (PhoneRowMeta): the warning ink. */
.itrela-phone-meta-warning {
    color: var(--itrela-status-warning);
    font-weight: var(--itrela-weight-medium);
}

@media (max-width: 600px) {
    .itrela-phone-rows :is(.mud-table-body > .mud-table-row, tbody > tr) {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, max-content) auto minmax(0, 1fr) auto auto;
        grid-template-areas:
            "title chip . figure menu"
            "meta meta meta meta menu";
        align-items: center;
        /* No column gap: the empty spacer column would take one too. The
           chip and the figure carry their own 8px; the menu button's own
           44px target already keeps its dots clear of the figure. */
        column-gap: 0;
        min-height: 44px;
        padding: var(--itrela-space-12) var(--itrela-space-16);
        border-bottom: 1px solid var(--itrela-line);
    }

    .itrela-phone-rows :is(.mud-table-body > .mud-table-row > .mud-table-cell, tbody > tr > td):not([colspan]) {
        display: none;
    }

    /* A list's own empty, loading or no-match row spans the phone row. */
    .itrela-phone-rows :is(.mud-table-body > .mud-table-row > .mud-table-cell, tbody > tr > td)[colspan] {
        grid-column: 1 / -1;
        padding: 0;
        border: 0;
    }

    .itrela-phone-rows :is(.mud-table-body > .mud-table-row > .mud-table-cell, tbody > tr > td)::before {
        content: none;
    }

    .itrela-phone-rows :is(.mud-table-body > .mud-table-row > .mud-table-cell, tbody > tr > td):is(.itrela-phone-title, .itrela-phone-chip, .itrela-phone-figure, .itrela-phone-meta, .itrela-phone-menu) {
        display: flex;
        align-items: center;
        gap: var(--itrela-space-8);
        /* auto, not a list's own 100%: a percentage width plus the cell's
           margin ran past its grid column. */
        width: auto;
        height: auto;
        min-height: 0;
        padding: 0;
        border: 0;
        background: none;
        font-size: var(--itrela-text-14);
        text-align: start;
    }

    .itrela-phone-rows .itrela-phone-title {
        grid-area: title;
        min-width: 0;
        font-weight: var(--itrela-weight-strong);
    }

    .itrela-phone-rows .itrela-phone-title > *,
    .itrela-phone-rows .itrela-phone-title :is(p, span, div) {
        min-width: 0;
    }

    /* The name gets at most two lines; the record page has the rest of it. */
    .itrela-phone-rows .itrela-phone-title a {
        display: -webkit-box;
        min-width: 0;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow-wrap: anywhere;
        font-weight: var(--itrela-weight-strong);
    }

    /* A number for a name (an invoice number) never breaks or gets cut
       mid-number: when the row is too narrow it ends in an ellipsis. */
    .itrela-phone-rows .itrela-phone-title a.itrela-mono {
        display: block;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* The name's link covers the whole row: one target, one tab stop, one
       name. Only the menu sits above it. */
    .itrela-phone-rows .itrela-phone-title a:first-of-type::after {
        content: "";
        position: absolute;
        inset: 0;
    }

    .itrela-phone-rows .itrela-phone-title a:first-of-type:focus-visible {
        outline: none;
    }

    .itrela-phone-rows .itrela-phone-title a:first-of-type:focus-visible::after {
        outline: var(--itrela-focus-ring);
        outline-offset: calc(-1 * var(--itrela-focus-offset));
    }

    /* The chip, the figure and the menu keep their whole width; the name
       gives way first. */
    .itrela-phone-rows .itrela-phone-chip {
        grid-area: chip;
        min-width: max-content;
        margin-inline-start: var(--itrela-space-8);
    }

    .itrela-phone-rows .itrela-phone-figure {
        grid-area: figure;
        min-width: max-content;
        margin-inline-start: var(--itrela-space-8);
        justify-content: flex-end;
        font-weight: var(--itrela-weight-medium);
        white-space: nowrap;
    }

    .itrela-phone-rows :is(.mud-table-body > .mud-table-row > .mud-table-cell, tbody > tr > td).itrela-phone-meta {
        display: block;
        grid-area: meta;
        min-width: 0;
        margin-top: var(--itrela-space-4);
        overflow: hidden;
        color: var(--mud-palette-text-secondary);
        font-size: var(--itrela-text-13);
        font-weight: var(--itrela-weight-regular);
        line-height: var(--itrela-leading-text);
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .itrela-phone-rows .itrela-phone-menu {
        position: relative;
        z-index: 1;
        grid-area: menu;
        justify-content: flex-end;
        margin-inline-end: calc(-1 * var(--itrela-space-8));
    }

    /* The menu button is a full 44px thumb target. */
    .itrela-phone-rows .itrela-phone-menu .mud-icon-button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ── Dialogs on a phone (2026-11-30) ─────────────────────────────────
   Below 600px every MudDialog takes the whole screen: the title bar at the
   top, the form scrolling under it, and the actions in a bar that stays at
   the bottom. One rule for every dialog, so none floats as a small card
   with its Create button out of reach. The command bar is not a MudDialog
   and keeps its own phone layout. */
@media (max-width: 599.98px) {
    .mud-dialog-container {
        padding: 0;
    }

    .mud-dialog-container .mud-dialog {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        margin: 0;
        border-radius: 0 !important;
        box-shadow: none;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-title {
        position: sticky;
        top: 0;
        z-index: 2;
        border-bottom: 1px solid var(--itrela-line);
        background: var(--mud-palette-surface);
    }

    .mud-dialog-container .mud-dialog .mud-dialog-content {
        flex: 1 1 auto;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        border-top: 1px solid var(--itrela-line);
        background: var(--mud-palette-surface);
        padding-bottom: calc(var(--itrela-space-12) + env(safe-area-inset-bottom)) !important;
    }

    /* On a phone toasts rise above the bottom band, where a dialog keeps
       its action bar and a list its footer, so a toast never covers Save or
       lands under the thumb that pressed it. They take the phone's width
       between the page gutters. */
    .mud-snackbar-location-bottom-left {
        bottom: calc(72px + env(safe-area-inset-bottom));
        left: var(--itrela-space-16);
        right: var(--itrela-space-16);
    }
}

.grid-cell-primary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grid-text-primary {
    font-weight: var(--itrela-weight-strong);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-text {
    color: var(--mud-palette-text-secondary);
}

/* ── Details Page ───────────────────────────────────────────────── */

.info-grid {
    display: grid;
    /* minmax(0, …) prevents long values (URLs, IDs) from forcing horizontal overflow */
    grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
    gap: 10px 20px;
}

.info-label {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
    padding-top: 4px;
}

.info-value {
    font-size: var(--itrela-text-14);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ── Auth (login / setup) ───────────────────────────────────────────
   Split shell: brand panel on the left (desktop only), form column on
   a surface-colored panel to the right. The brand panel wears fixed
   graphite in both themes (the rail's family — sign-in and app read
   as one product); the form side follows the theme. */

.auth-layout {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--mud-palette-background);
}

/* Demo instances only (LoginLayout): the demo strip stacks above the split
   shell, and this wrapper takes over the full-viewport minimum so the strip
   does not add a scroll of its own height. */
.auth-demo-frame {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.auth-demo-frame > .auth-layout {
    flex: 1 0 auto;
    min-height: 0;
}

.auth-brand {
    display: flex;
    position: relative;
    overflow: hidden;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding: 16px 20px 18px;
    color: var(--itrela-chalk);
    /* Graphite, and deliberately the SAME graphite as the rail: sign-in and
       the app have to read as one product. The three stops match the rail's
       top/mid/bottom exactly; only the angle and stop positions are this
       panel's own. The warm ember becomes the rail accent. */
    background:
        radial-gradient(1000px 640px at -10% 112%, var(--itrela-auth-glow), transparent 62%),
        radial-gradient(820px 540px at 112% -12%, rgba(232, 237, 237, 0.05), transparent 55%),
        linear-gradient(160deg, #1C2427 0%, #14191B 58%, #10191B 100%);
}

/* Faint drawing grid, faded toward the edges. */
.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(232, 237, 237, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(232, 237, 237, 0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(85% 85% at 30% 45%, #000 25%, transparent 100%);
    mask-image: radial-gradient(85% 85% at 30% 45%, #000 25%, transparent 100%);
    pointer-events: none;
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

.auth-brand-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
}

/* The Relay mark, sized and spaced exactly like the rail's glyph. */
.auth-brand-glyph {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* The Archivo wordmark sits directly on the graphite. */
.auth-brand-wordmark {
    display: block;
    color: var(--itrela-chalk);
    font-family: "Archivo", sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1;
}

.auth-brand-headline {
    margin: 6px 0 0;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: 0;
    max-width: 24ch;
    color: var(--itrela-chalk-bright);
}

.auth-brand-points {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-direction: column;
    gap: 14px;
}

.auth-brand-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--itrela-text-16);
    font-weight: var(--itrela-weight-medium);
    color: rgba(232, 237, 237, 0.92);
}

.auth-point-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--itrela-radius-control);
    background: rgba(232, 237, 237, 0.1);
    border: 1px solid rgba(232, 237, 237, 0.2);
    color: var(--itrela-rail-copper);
    flex-shrink: 0;
}

/* The whole tail (foot + instance line) leaves on phones together, so the
   hidden pair can't leave an empty gap slot behind. */
.auth-brand-tail {
    display: none;
}

.auth-brand-foot {
    font-size: var(--itrela-text-13);
    color: var(--itrela-rail-text-dim);
}

/* Which install this is — green dot for your own box, mono, dim chalk.
   Hidden with the footer on phones, revealed together at ≥900px. */
.auth-brand-instance {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    min-width: 0;
    font-size: var(--itrela-text-12);
    color: var(--itrela-rail-text-dim);
}

/* A long DNS label must trail off, not clip against the panel edge. */
.auth-instance-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-instance-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mud-palette-success);
    flex-shrink: 0;
}

.auth-panel {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 28px 20px 40px;
    background: var(--mud-palette-surface);
}

.auth-panel-inner {
    width: min(400px, 100%);
}

.auth-head {
    margin-bottom: 26px;
}

.auth-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
    line-height: 1.4;
}

.auth-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 750;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--mud-palette-text-primary);
}

.auth-title:focus,
.auth-title:focus-visible {
    outline: none !important;
}

.auth-subtitle {
    margin: 7px 0 0;
    font-size: var(--itrela-text-14);
    color: var(--mud-palette-text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-state-card {
    gap: 12px;
    padding: 22px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-surface);
    background: var(--mud-palette-surface);
    box-shadow: none;
}

.auth-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--itrela-radius-control);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    color: var(--mud-palette-primary);
}

.auth-state-title {
    margin: 0;
    color: var(--mud-palette-text-primary);
    font-size: var(--itrela-text-20);
    font-weight: var(--itrela-weight-strong);
    line-height: 1.3;
}

/* Password recovery, invitation, and access-denied states share one quiet
   ledger panel inside the shipped authentication frame. Each page keeps its
   own state machine and copy; these classes only make those states read as a
   related family. */
.auth-periphery-form {
    padding: 18px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-card);
    background: var(--mud-palette-surface);
    box-shadow: none;
}

.auth-periphery-head {
    margin-bottom: 18px;
}

.auth-state-card.auth-periphery-form {
    padding: 22px;
}

.auth-state-card--checking {
    align-items: center;
    justify-content: center;
    min-height: 132px;
    text-align: center;
}

.auth-state-card--success .auth-state-icon,
.auth-state-icon--success {
    color: var(--itrela-status-ok);
    background: color-mix(in oklab, var(--itrela-status-ok), transparent 88%);
}

.auth-state-card--error,
.auth-state-card--invalid,
.auth-state-card--denied {
    border-top-color: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 56%);
}

.auth-form .auth-submit {
    margin-top: 6px;
    height: 44px;
    font-weight: var(--itrela-weight-strong);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-inline-error {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--mud-palette-error);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    line-height: 1.45;
}

.auth-inline-error::before {
    content: "⚠";
    flex: none;
    font-size: var(--itrela-text-12);
}

.auth-inline-error a {
    color: inherit;
    font-weight: var(--itrela-weight-strong);
}

.auth-wrong-door {
    margin-top: 2px;
    padding-top: 14px;
    border-top: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-13);
    line-height: 1.5;
}

.auth-wrong-door a {
    color: var(--mud-palette-primary);
    font-weight: var(--itrela-weight-strong);
}

.auth-invite-sentence,
.auth-why {
    padding: 10px 12px;
    border-left: 3px solid var(--mud-palette-primary);
    border-radius: 0 var(--itrela-radius-control) var(--itrela-radius-control) 0;
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 92%);
    font-size: var(--itrela-text-13);
    line-height: 1.55;
}

.auth-note {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-13);
    line-height: 1.5;
}

/* Demo instances only (Demo:Mode): the one-click way in, above the ordinary
   form. It is the page's hero card (.itrela-card-hero supplies the accent
   border) and holds the page's only filled button, so the visitor's first
   choice is obvious; the page title above already names the demo, and the
   typed credentials sit quietly under the button. */
.auth-demo {
    gap: 12px;
    margin-bottom: 24px;
    padding: 18px;
}

.auth-demo-body {
    margin: 0;
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-14);
    line-height: 1.5;
}

.auth-demo .auth-demo-enter {
    height: 44px;
    font-weight: var(--itrela-weight-strong);
}

.auth-demo-typed {
    padding-top: 12px;
    border-top: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-13);
    line-height: 1.5;
}

.auth-demo-typed-lead {
    margin: 0 0 6px;
}

.auth-demo-credentials {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 12px;
    margin: 0;
}

.auth-demo-credentials dt {
    font-weight: var(--itrela-weight-strong);
}

.auth-demo-credentials dd {
    margin: 0;
    min-width: 0;
}

.auth-demo-credentials code {
    color: var(--mud-palette-text-primary);
    font-family: var(--itrela-font-mono);
    word-spacing: normal;
    font-size: var(--itrela-text-13);
    overflow-wrap: anywhere;
    user-select: all;
}

.setup-auth-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.setup-auth-step {
    padding: 4px 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-pill);
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-surface);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
}

.setup-auth-step-on {
    border-color: color-mix(in oklab, var(--mud-palette-primary), transparent 35%);
    color: var(--mud-palette-primary);
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 92%);
}

/* Staff MFA (A9). The QR box stays white in both themes — scanner contrast
   beats palette consistency. */
.auth-mfa-qr {
    align-self: center;
    padding: 10px;
    background: #fff;
    border-radius: var(--itrela-radius-control);
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
    line-height: 0;
}

.auth-mfa-qr svg {
    width: 190px;
    height: 190px;
    display: block;
}

.auth-mfa-secret {
    align-self: center;
    padding: 6px 10px;
    border-radius: var(--itrela-radius-control);
    background: color-mix(in oklab, var(--mud-palette-lines-default), transparent 82%);
    font-size: var(--itrela-text-14);
    letter-spacing: 0;
    word-spacing: var(--itrela-label-word-spacing);
    word-break: break-all;
    user-select: all;
}

.auth-mfa-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: var(--itrela-text-14);
}

.auth-mfa-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    padding: 14px 16px;
    border-radius: var(--itrela-radius-control);
    background: color-mix(in oklab, var(--mud-palette-lines-default), transparent 82%);
}

.auth-mfa-codes code {
    font-size: var(--itrela-text-14);
    letter-spacing: 0;
    word-spacing: var(--itrela-label-word-spacing);
    user-select: all;
}

/* Circuit reconnect modal (A10). The .NET 11 blazor.web.js contract (read
   from the shipped source): it finds the element by id, toggles exactly one
   state class via classList — show → (+retrying) → hide on success, paused on
   a graceful server pause, failed/resume-failed when it gives up, rejected
   when the server disowns the circuit. Everything below hangs off the id +
   those classes; no classes of our own on the root, so a future framework
   that rewrites className can't strand us.
   Mud palette vars are live by the time a circuit can drop (the page already
   rendered), so the overlay follows the active theme.
   The card sits over the page: the same light dim as the session-ended
   panel's, without its blur, so the page someone was reading stays readable
   behind it. MudBlazor.min.css paints this
   element with the page background and !important, which would replace the
   page; app.css loads after it, so this !important wins. */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    align-items: center;
    justify-content: center;
    background: color-mix(in oklab, var(--mud-palette-overlay-dark), transparent 25%) !important;
    backdrop-filter: none;
}

/* Fatal circuit errors do not enter the reconnect lifecycle. blazor.web.js
   reveals this standard hook with an inline display:block, including when an
   initial circuit is refused at the bounded admission gate. */
#blazor-error-ui {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3001;
    background: color-mix(in oklab, var(--mud-palette-overlay-dark, #0009), transparent 25%);
    backdrop-filter: blur(3px);
}

#blazor-error-ui .itrela-fatal-card {
    margin: 20vh auto 16px;
}

#blazor-error-ui .itrela-reconnect-actions {
    justify-content: center;
}

#blazor-error-ui .itrela-reconnect-btn {
    text-decoration: none;
}

/* Any active state reveals the modal. .NET 11 has five: show/retrying
   (client reconnect), paused (server-initiated graceful pause), failed/
   resume-failed (gave up), rejected (circuit gone). Only -hide keeps it down. */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-paused,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-resume-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

/* Full-page navigation intentionally tears down the current circuit, so keep
   the outgoing document quiet instead of reporting a connection failure.
   js/reconnect.js sets this marker at beforeunload (Firefox closes the
   circuit socket right after it, long before pagehide) through
   itrela.ui.markDocumentLeaving, and again at pagehide, before Blazor sends
   its disconnect beacon. A departure that is called off (a declined
   unsaved-changes prompt, a stopped load) leaves the page in place, so the
   marker lapses after 15 s. pageshow removes it; a restored page with a
   genuinely dead circuit still reveals whichever reconnect state the
   framework left in place. */
html[data-itrela-document-leaving] #components-reconnect-modal {
    display: none;
}

/* A drop is quiet at first. While the framework's retry loop runs
   (show/retrying), js/reconnect.js sets data-itrela-reconnect-phase on the
   modal: "quiet" for the first 1.5 s shows nothing, "chip" until 5 s shows
   only the small Reconnecting… chip at the bottom of the screen, with no dim
   and no blur, so the page stays in view (clicks and shortcuts are held back
   by reconnect.js while the connection is down; typing in text fields goes
   on); "card" (or no phase at all) is the Connection lost card above. The
   other states never consult the phase: they show their card at once. The
   rules below never set display on the chip phase, so the leaving marker
   above still hides everything. */
#components-reconnect-modal.components-reconnect-show[data-itrela-reconnect-phase="quiet"],
#components-reconnect-modal.components-reconnect-retrying[data-itrela-reconnect-phase="quiet"] {
    display: none;
}

#components-reconnect-modal.components-reconnect-show[data-itrela-reconnect-phase="chip"],
#components-reconnect-modal.components-reconnect-retrying[data-itrela-reconnect-phase="chip"] {
    align-items: flex-end;
    /* Clear of a phone's home indicator where there is one. */
    padding: 0 16px max(16px, env(safe-area-inset-bottom));
    /* MudBlazor.min.css paints this element with the page background and
       !important; only an !important rule takes it off the page. */
    background: transparent !important;
    backdrop-filter: none;
    pointer-events: none;
}

#components-reconnect-modal.components-reconnect-show[data-itrela-reconnect-phase="chip"] .itrela-reconnect-card,
#components-reconnect-modal.components-reconnect-retrying[data-itrela-reconnect-phase="chip"] .itrela-reconnect-card {
    display: none;
}

.itrela-reconnect-chip {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--itrela-radius-pill);
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-strong);
    background: var(--mud-palette-surface, #fff);
    color: var(--mud-palette-text-primary, #1a1a1a);
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default, #888), transparent 45%);
    box-shadow: var(--itrela-shadow-float);
}

#components-reconnect-modal.components-reconnect-show[data-itrela-reconnect-phase="chip"] .itrela-reconnect-chip,
#components-reconnect-modal.components-reconnect-retrying[data-itrela-reconnect-phase="chip"] .itrela-reconnect-chip {
    display: inline-flex;
}

.itrela-reconnect-chip-spinner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid color-mix(in oklab, var(--mud-palette-primary, var(--itrela-rail-accent)), transparent 75%);
    border-top-color: var(--mud-palette-primary, var(--itrela-rail-accent));
    animation: itrela-reconnect-spin 0.9s linear infinite;
}

/* A click or shortcut held back during a drop: the chip shows at once and
   draws the eye briefly (reconnect.js adds this class for 0.6 s). */
.itrela-reconnect-chip--nudge {
    border-color: var(--mud-palette-primary, var(--itrela-rail-accent));
    outline: 3px solid color-mix(in oklab, var(--mud-palette-primary, var(--itrela-rail-accent)), transparent 70%);
    box-shadow: var(--itrela-shadow-float);
    animation: itrela-reconnect-nudge 0.6s ease-out;
}

@keyframes itrela-reconnect-nudge {
    30% { transform: scale(1.06); }
}

/* No movement for people who ask for less: the chip keeps still and the
   emphasis is the ring alone. */
@media (prefers-reduced-motion: reduce) {
    .itrela-reconnect-chip-spinner,
    .itrela-reconnect-chip--nudge {
        animation: none;
    }
}

/* The announcement for screen readers. It stays rendered, visually hidden,
   so the text reconnect.js puts in is announced (the chip itself is
   aria-hidden). The same clip pattern as the closed rail's labels. */
.itrela-reconnect-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* A dialog in the house look: surface, hairline, the float shadow, 12px
   corners; a 16px/600 title, 14px text, a 12px note. */
.itrela-reconnect-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--itrela-space-8);
    max-width: 380px;
    margin: var(--itrela-space-16);
    padding: var(--itrela-space-24);
    border-radius: var(--itrela-radius-surface);
    text-align: center;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--itrela-line);
    box-shadow: var(--itrela-shadow-float);
    word-spacing: var(--itrela-word-gap);
}

.itrela-reconnect-card h2 {
    margin: 0 0 var(--itrela-space-4);
    font-size: var(--itrela-text-16);
    font-weight: var(--itrela-weight-strong);
    line-height: 1.2;
    letter-spacing: 0;
}

.itrela-reconnect-card p {
    margin: 0 0 var(--itrela-space-4);
    font-size: var(--itrela-text-14);
    line-height: 1.45;
}

.itrela-reconnect-note {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12) !important;
}

/* One panel per situation: show/retrying = the client retry loop is running,
   paused = a graceful server restart parked the circuit (no loop — resuming
   is the button), failed/resume-failed = gave up, rejected = circuit gone. */
.itrela-reconnect-state {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .itrela-reconnect-state--reconnecting,
#components-reconnect-modal.components-reconnect-retrying .itrela-reconnect-state--reconnecting,
#components-reconnect-modal.components-reconnect-paused .itrela-reconnect-state--paused,
#components-reconnect-modal.components-reconnect-failed .itrela-reconnect-state--failed,
#components-reconnect-modal.components-reconnect-resume-failed .itrela-reconnect-state--failed,
#components-reconnect-modal.components-reconnect-rejected .itrela-reconnect-state--rejected {
    display: block;
}

.itrela-reconnect-spinner {
    width: 34px;
    height: 34px;
    margin-bottom: 8px;
    border-radius: 50%;
    border: 3px solid color-mix(in oklab, var(--mud-palette-primary, var(--itrela-rail-accent)), transparent 75%);
    border-top-color: var(--mud-palette-primary, var(--itrela-rail-accent));
    animation: itrela-reconnect-spin 0.9s linear infinite;
}

/* Spinner keeps turning while there's still hope (show/retrying/paused);
   it stops once we've given up (failed/resume-failed/rejected). */
#components-reconnect-modal.components-reconnect-failed .itrela-reconnect-spinner,
#components-reconnect-modal.components-reconnect-resume-failed .itrela-reconnect-spinner,
#components-reconnect-modal.components-reconnect-rejected .itrela-reconnect-spinner {
    animation-play-state: paused;
    opacity: 0.35;
}

@keyframes itrela-reconnect-spin {
    to { transform: rotate(360deg); }
}

.itrela-reconnect-actions {
    display: flex;
    gap: var(--itrela-space-8);
    margin-top: var(--itrela-space-12);
}

/* The house buttons: 13px/600, sentence case, 8px corners, 34px tall, flat.
   Reload page is the filled primary (its own contrast colour on teal);
   Reconnect is the outlined secondary. MudBlazor.min.css styles every button
   in the modal (upper case, body-text colour, a 40px !important margin);
   the id in these selectors outranks it. */
.itrela-reconnect-btn,
#components-reconnect-modal .itrela-reconnect-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 34px;
    margin: 0 !important;
    padding: 0 var(--itrela-space-16);
    border: 1px solid transparent;
    border-radius: var(--itrela-radius-control);
    font: inherit;
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    line-height: 1.45;
    letter-spacing: 0;
    word-spacing: var(--itrela-word-gap);
    text-transform: none;
    text-decoration: none;
    cursor: pointer;
    color: var(--mud-palette-primary-text);
    background: var(--mud-palette-primary);
    transition: background-color var(--itrela-motion-fast) var(--itrela-ease);
}

.itrela-reconnect-btn:hover,
#components-reconnect-modal .itrela-reconnect-btn:hover {
    background: var(--mud-palette-primary-darken);
}

.itrela-reconnect-btn:focus-visible,
#components-reconnect-modal .itrela-reconnect-btn:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
}

.itrela-reconnect-btn:disabled,
#components-reconnect-modal .itrela-reconnect-btn:disabled {
    cursor: wait;
    color: var(--mud-palette-text-disabled);
    background: color-mix(in oklab, var(--mud-palette-text-primary) 6%, transparent);
}

#components-reconnect-modal .itrela-reconnect-btn--ghost {
    display: none;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
    border-color: var(--itrela-line-strong);
}

#components-reconnect-modal .itrela-reconnect-btn--ghost:hover {
    background: color-mix(in oklab, var(--mud-palette-text-primary) 5%, var(--mud-palette-surface));
}

/* The retry/resume button shows wherever a click is the way forward: paused
   (nothing retries until the user acts) and the two gave-up states. While the
   automatic loop is running (show/retrying) it stays hidden — a second
   in-flight attempt would just race the loop. */
#components-reconnect-modal.components-reconnect-paused .itrela-reconnect-btn--ghost,
#components-reconnect-modal.components-reconnect-failed .itrela-reconnect-btn--ghost,
#components-reconnect-modal.components-reconnect-resume-failed .itrela-reconnect-btn--ghost {
    display: inline-flex;
}

/* No loop runs while paused — a frozen "spinner" would overpromise. */
#components-reconnect-modal.components-reconnect-paused .itrela-reconnect-spinner {
    animation-play-state: paused;
    opacity: 0.35;
}

@media (min-width: 900px) {
    .auth-layout {
        flex-direction: row;
    }

    .auth-brand {
        justify-content: space-between;
        gap: 48px;
        width: clamp(400px, 44vw, 640px);
        padding: 44px 52px;
    }

    .auth-brand-wordmark {
        font-size: 2.5rem;
    }

    .auth-brand-headline {
        margin: 0 0 30px;
        font-size: clamp(1.6rem, 2.4vw, 2.15rem);
    }

    .auth-brand-points {
        display: flex;
    }

    .auth-brand-tail {
        display: block;
    }

    .auth-brand-instance {
        display: flex;
    }

    .auth-panel {
        align-items: center;
        padding: 40px 24px;
        border-left: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
    }
}

/* ── Integrations catalog & wizard ────────────────────────────────── */

.integrations-grid {
    width: 100%;
}

.integrations-grid .mud-grid-item {
    display: flex;
}

.integration-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-surface);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    min-height: 320px;
    height: 100%;
    overflow: hidden;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.integration-card-clickable {
    cursor: pointer;
    position: relative;
}

.integration-card-clickable:hover {
    border-color: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 40%);
    box-shadow: none;
    transform: translateY(-1px);
}

.integration-card-clickable:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--mud-palette-primary), #ffffff 70%);
    outline-offset: 4px;
}

.integration-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.integration-card-header {
    display: flex;
    gap: 14px;
    align-items: center;
}

.integration-logo {
    width: 72px;
    height: 52px;
    border-radius: var(--itrela-radius-surface);
    flex: 0 0 72px;
    box-sizing: border-box;
    object-fit: contain;
    padding: 8px;
    /* A near-white tile so vendor logos sit on a neutral ground in both
       themes — most ship as dark-on-transparent artwork. */
    background: var(--itrela-logo-tile);
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), #1A2123 8%);
    box-shadow: none;
}

.integration-card-footer {
    padding: 14px 16px 16px;
    margin-top: auto;
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), #000 8%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 58px;
}

.integration-card-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--mud-palette-primary);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: 0;
    text-transform: none;
}

.integration-card-clickable:hover .integration-card-footer-link {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.integration-card-footer-muted {
    color: var(--mud-palette-text-secondary);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: 0;
    text-transform: none;
}

/* Live tile state (Phase 12.2): the dot + text pair replaces the old
   hardcoded status strings. Kinds: ok / warn / off / none. Colors come
   from the Mud palette so both themes stay legible. */
.integration-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: var(--itrela-text-13);
    color: var(--mud-palette-text-secondary);
}

.integration-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
    background: var(--mud-palette-text-disabled);
}

.integration-status--ok {
    color: var(--mud-palette-success);
    font-weight: var(--itrela-weight-strong);
}

.integration-status--ok .integration-status-dot {
    background: var(--mud-palette-success);
}

.integration-status--warn {
    color: var(--mud-palette-warning);
    font-weight: var(--itrela-weight-strong);
}

.integration-status--warn .integration-status-dot {
    background: var(--mud-palette-warning);
}

.integration-status--none .integration-status-dot {
    display: none;
}

/* The feature strip on the Integrations home (12.3): sign-in, mail,
   calendars, and AI at a glance above the vendor tiles. */
.integration-feature-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.integration-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    flex: 1 1 200px;
    min-width: 200px;
    cursor: pointer;
    border-radius: var(--itrela-radius-control);
    transition: border-color 120ms ease;
}

.integration-feature-item:hover,
.integration-feature-item:focus-visible {
    border-color: var(--mud-palette-primary);
}

.integration-feature-icon {
    color: var(--mud-palette-text-secondary);
    flex: none;
}

.integration-feature-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* The strip items navigate — the trailing arrow says so at a glance and
   lights up with the same hover affordance as the border. */
.integration-feature-open {
    margin-left: auto;
    flex: none;
    color: var(--mud-palette-text-disabled);
    transition: color 120ms ease;
}

.integration-feature-item:hover .integration-feature-open,
.integration-feature-item:focus-visible .integration-feature-open {
    color: var(--mud-palette-primary);
}

.integration-provider-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.integration-provider-logo {
    width: 28px;
    height: 28px;
    border-radius: var(--itrela-radius-control);
    object-fit: cover;
    border: 1px solid var(--mud-palette-lines-default);
}

.integration-provider-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.integration-provider-name {
    font-weight: var(--itrela-weight-strong);
    line-height: 1.2;
}

.integration-provider-category {
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
    line-height: 1.2;
}

.level-brand-row {
    margin-bottom: 4px;
}

.level-workspace-logo {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: var(--itrela-radius-control);
    padding: 6px;
}

.level-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.level-status-item {
    border-radius: var(--itrela-radius-control);
    min-height: 94px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.level-tabs {
    margin-top: 4px;
}

.level-inline-section {
    padding: 12px;
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 40%);
    border-radius: var(--itrela-radius-control);
    background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-surface) 35%);
}

.level-webhook-url-block {
    border: 1px dashed color-mix(in oklab, var(--mud-palette-lines-default), #000 12%);
    border-radius: var(--itrela-radius-control);
    background: color-mix(in oklab, var(--mud-palette-surface), #000 3%);
}

.level-client-map-card {
    border-radius: var(--itrela-radius-control);
}

.level-webhook-url {
    font-family: var(--itrela-font-mono);
    word-spacing: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.level-webhook-event-option {
    margin-bottom: 0;
}

.level-recommended-events {
    margin-top: 8px;
    margin-bottom: 0;
    padding-left: 18px;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .command-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .command-bar-items {
        flex-wrap: wrap;
        width: 100%;
        min-width: 0;
    }

    .command-bar-items > * {
        max-width: 100%;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    /* Denser stat cards — at narrow widths the airy desktop padding
       turned five numbers into a full screen of scrolling. */
    .summary-item {
        flex: 1 1 calc(50% - 12px);
        min-width: 140px;
        padding: 14px 16px;
        gap: 4px;
    }

    .summary-value {
        font-size: var(--itrela-text-28);
    }

    .level-status-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 700px) {
    .level-status-grid {
        grid-template-columns: 1fr;
    }

    .action-row-side {
        max-width: 96px;
    }
}

@media (max-width: 360px) {
    .itrela-appbar .itrela-timer-chip {
        padding-inline: 6px;
    }

    .itrela-appbar .itrela-timer-chip .mud-icon-root {
        display: none;
    }
}

/* ── Sidebar & app frame ────────────────────────────────────────────
   ALL rules that start at a MudBlazor component root (.itrela-drawer,
   .itrela-nav, .itrela-appbar, .itrela-content) MUST live here: Blazor CSS
   isolation never tags those elements, so scoped ::deep selectors
   silently match nothing (this bit us — the sidebar ran on MudBlazor
   defaults for months). See the note in MainLayout.razor.css. */

/* App bar (mobile only — hidden on desktop further below) */
.itrela-appbar {
    background: var(--mud-palette-appbar-background) !important;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
    box-shadow: none !important;
    color: var(--mud-palette-appbar-text) !important;
}

.itrela-appbar .mud-toolbar {
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
}

.itrela-menu-toggle,
.itrela-theme-toggle {
    color: var(--mud-palette-appbar-text) !important;
}

.itrela-appbar-actions {
    margin-right: 4px;
}

@media (max-width: 599.98px) {
    /* Phone: the app bar's right edge clipped the last button. Tighten the
       toolbar and drop the help icon — the drawer's Help & learning entry
       covers the same destination. */
    .itrela-appbar .mud-toolbar {
        padding-left: 8px;
        padding-right: 8px;
    }

    .itrela-appbar-help {
        display: none;
    }

    .itrela-appbar-actions {
        margin-right: 0;
    }

    /* Keep the mobile top-bar timer/tracker chip readable on phone widths
       (TimerIndicator.razor.css clips the label span at <=599.98px; this
       4-class selector restores it cleanly inside 390px with zero overflow
       and without modifying TimerIndicator.razor*). */
    .mud-appbar.itrela-appbar .itrela-appbar-actions .itrela-timer-chip {
        padding: 2px 6px 2px 8px;
        gap: 4px;
        font-size: var(--itrela-text-12);
        max-width: 176px;
        min-width: 0;
    }

    .mud-appbar.itrela-appbar .itrela-appbar-actions .itrela-timer-chip > span,
    .mud-appbar.itrela-appbar .itrela-appbar-actions .itrela-working-chip-link > span {
        position: static;
        width: auto;
        height: auto;
        padding: 0;
        margin: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        clip: auto;
        white-space: nowrap;
        border: 0;
    }

    .mud-appbar.itrela-appbar .itrela-appbar-actions .itrela-working-clear {
        min-width: 26px;
        width: 26px;
        min-height: 26px;
        height: 26px;
        margin-left: 0;
    }
}

@media (min-width: 600px) {
    /* On desktop Service Desk shows QuickNoteButton directly in the header;
       hide the mobile-only overflow menu entry so it never duplicates. */
    .sd-mobile-menu-quicknote {
        display: none !important;
    }
}

/* Drawer frame — the graphite rail (Itrela): the login panel's graphite
   family carries into the app shell in BOTH themes. Keep this surface matte
   and quiet; the only decoration is the design package's faint blueprint
   grid, masked so it fades before it can read as ruling behind the rows.

   DELIBERATE INVERSION — do not "fix" this back to a darker rail. In dark
   mode the rail is LIGHTER than the page (#272C2C on a #1A1D1E ground),
   the opposite of the old warm-iron rail. The rail is the app's structural
   spine, so it comes forward as the nearest surface instead of sinking
   behind the content. The matching note sits above PaletteDark's Drawer
   block in ItrelaTheme.cs.

   One expression covers both themes. The middle stop IS
   --mud-palette-drawer-background (#14191B light / #272C2C dark) — the same
   value the theme gives MudBlazor's own drawer chrome, so the gradient and
   the palette cannot tear at the seam — and the outer stops are graded off
   it. Against the design package's stops (#1C2427 / #14191B / #10191B light,
   #2E3334 / #272C2C / #242A2A dark) every stop lands inside 1.0 oklab ΔE·100.
   The worst is the light top stop at 0.92 — the price of one expression
   serving both themes, and still below what reads on a flat area. */
.itrela-drawer {
    border-right: none !important;
    box-shadow: none !important;
    background: linear-gradient(180deg,
        color-mix(in oklab, var(--mud-palette-drawer-background), var(--itrela-chalk) 5%) 0%,
        var(--mud-palette-drawer-background) 52%,
        color-mix(in oklab, var(--mud-palette-drawer-background), #08181B 15%) 100%) !important;
}

/* The design package's 38px blueprint grid (ItrelaRail.dc.html): 4.5% chalk
   lines, masked by a radial so the texture fades out instead of ruling the
   whole column. pointer-events:none keeps it purely decorative. */
.itrela-drawer::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(232, 237, 237, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(232, 237, 237, 0.045) 1px, transparent 1px);
    background-size: 38px 38px;
    -webkit-mask-image: radial-gradient(130% 75% at 20% 10%, #000 20%, transparent 100%);
    mask-image: radial-gradient(130% 75% at 20% 10%, #000 20%, transparent 100%);
    pointer-events: none;
}

/* Full-height flex column so .itrela-nav-bottom can push itself and the
   footer to the bottom edge. (position/z-index lift the content above
   the blueprint-grid overlay.) */
.itrela-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Nav links */
.itrela-nav {
    padding: 0 12px !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 0 0 auto;
}

.itrela-nav-daily {
    padding-bottom: 8px !important;
}

/* The approved short-display state pins the day and utilities while only
   the business-area accordion scrolls. The thin scrollbar is one overflow
   affordance; the other is a soft fade on an edge that still has content
   past it, so a half-hidden group label reads as "more this way" instead of
   a hard cut. */
@property --itrela-rail-fade-top {
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
}

@property --itrela-rail-fade-bottom {
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
}

.itrela-nav-scrollzone {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    /* Without a colour the browser paints its default *light* scrollbar, which
       on the graphite rail reads as a pale stripe down the middle of the nav. */
    scrollbar-color: rgba(232, 237, 237, 0.2) transparent;
    /* Both fades are 0px unless the scroll-driven animation below moves them,
       so the mask is fully opaque when everything fits and in engines without
       scroll timelines (where the scrollbar stays the affordance). */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--itrela-rail-fade-top), #000 calc(100% - var(--itrela-rail-fade-bottom)), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 var(--itrela-rail-fade-top), #000 calc(100% - var(--itrela-rail-fade-bottom)), transparent 100%);
}

/* The timeline only exists while the zone can scroll, so a rail that fits
   never fades. This follows the scroll position rather than a clock, so it
   is not motion and stays on under reduced motion. */
@supports (animation-timeline: scroll()) {
    .itrela-nav-scrollzone {
        animation: itrela-rail-edge-fade linear both;
        animation-timeline: scroll(self block);
    }
}

@keyframes itrela-rail-edge-fade {
    0% { --itrela-rail-fade-top: 0px; --itrela-rail-fade-bottom: 28px; }
    8% { --itrela-rail-fade-top: 28px; }
    92% { --itrela-rail-fade-bottom: 28px; }
    100% { --itrela-rail-fade-top: 28px; --itrela-rail-fade-bottom: 0px; }
}

.itrela-nav-scrollzone::-webkit-scrollbar {
    width: 5px;
}

.itrela-nav-scrollzone::-webkit-scrollbar-track {
    background: transparent;
}

.itrela-nav-scrollzone::-webkit-scrollbar-thumb {
    background-color: rgba(232, 237, 237, 0.2);
    border-radius: var(--itrela-radius-pill);
}

.itrela-nav-scrollzone:hover::-webkit-scrollbar-thumb {
    background-color: rgba(232, 237, 237, 0.34);
}

.itrela-nav-scrollzone .itrela-nav-group + .itrela-nav-group {
    margin-top: 6px;
}

/* Everything below this hairline is a module that can be switched off. The
   permanent day job sits above it and never collapses. The line renders only
   when at least one optional group is on screen. */
.itrela-nav-optional {
    margin-top: 13px;
    padding-top: 7px;
    border-top: 1px solid var(--itrela-rail-hairline);
}

/* Plain text under a hairline at the end of the scrollable group list, not
   a boxed callout (ItrelaRail.dc.html). */
.itrela-nav-discovery {
    flex: 0 0 auto;
    margin: 6px 16px 0;
    padding: 8px 10px 0;
    border-top: 1px solid var(--itrela-rail-hairline);
    color: var(--itrela-rail-text-dim);
    font-size: var(--itrela-text-12);
    line-height: 1.45;
}

.itrela-nav-discovery a {
    color: var(--itrela-rail-copper);
    font-weight: var(--itrela-weight-strong);
    text-decoration: none;
}

.itrela-nav-discovery a:hover {
    color: var(--itrela-chalk-bright);
    text-decoration: underline;
}

.itrela-nav-discovery a:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--itrela-chalk), transparent 30%);
    outline-offset: 2px;
    border-radius: var(--itrela-radius-small);
}

.itrela-nav-group-label {
    padding: 6px 12px 2px;
    color: rgba(232, 237, 237, 0.78);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: var(--itrela-caps-tracking);
    word-spacing: var(--itrela-label-word-spacing);
    line-height: 1.2;
    text-transform: uppercase;
}

/* Business-area accordion. In the expanded drawer these rows read as quiet
   section labels, so destinations remain the strongest visual targets and
   the lead icon stays out of the way; the icon returns in the mini rail,
   where it is the header. */
.itrela-nav-accordion-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 10px 4px;
    border: 0;
    border-radius: var(--itrela-radius-control);
    background: transparent;
    color: var(--itrela-rail-text-dim);
    font: inherit;
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: var(--itrela-caps-tracking);
    word-spacing: var(--itrela-label-word-spacing);
    line-height: 1.2;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.itrela-nav-accordion-header:hover {
    background: transparent;
    color: var(--itrela-chalk-bright);
}

.itrela-nav-accordion-header:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--itrela-chalk), transparent 30%);
    outline-offset: -2px;
}

.itrela-nav-accordion-lead {
    display: none;
    flex: 0 0 auto;
    color: var(--itrela-rail-icon);
    font-size: var(--itrela-text-20) !important;
    transition: color 0.12s ease;
}

.itrela-nav-accordion-header:hover .itrela-nav-accordion-lead,
.itrela-nav-accordion-header.contains-active .itrela-nav-accordion-lead {
    color: var(--itrela-chalk-bright);
}

.itrela-nav-accordion-header.contains-active {
    color: var(--itrela-chalk-bright);
}

.itrela-nav-accordion-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.itrela-nav-accordion-chevron {
    flex: 0 0 auto;
    color: var(--itrela-rail-icon);
    font-size: 18px !important;
    transition: transform 0.15s ease;
}

.itrela-nav-accordion-header[aria-expanded="true"] .itrela-nav-accordion-chevron {
    transform: rotate(180deg);
}

/* Rolled-up badges only appear while their item is hidden inside a collapsed
   section. Number, dot, and failed presentations all come from the same
   RailBadgeDecision attributes used by the destination links. */
.itrela-nav-accordion-badge {
    display: none;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="number"][data-count]:not([data-count=""]) {
    display: inline-flex;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--itrela-radius-control);
    background: var(--itrela-rail-copper);
    color: var(--itrela-rail-copper-ink);
    font-size: var(--itrela-text-mark);
    font-weight: var(--itrela-weight-strong);
    line-height: 18px;
}

/* Hollow is the roll-up grade: filled means a count on this row, hollow means
   a count somewhere inside it, so a header can never be mistaken for its own
   child. Only the number changes shape. A dot is already a mark rather than a
   pill, which is why the 72px rail keeps the same solid dot every other count
   gets there. */
.itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-grade="hollow"][data-badge-display="number"][data-count]:not([data-count=""]) {
    padding: 0 6px;
    border: 1px solid color-mix(in oklab, var(--itrela-rail-copper), transparent 40%);
    background: transparent;
    color: var(--itrela-rail-copper);
    line-height: 16px;
}

.itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="dot"] {
    display: inline-flex;
    width: 9px;
    height: 9px;
    border-radius: var(--itrela-radius-pill);
    box-sizing: border-box;
    border: 2px solid var(--mud-palette-drawer-background);
    background: var(--itrela-rail-copper);
    color: transparent;
}

.itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="failed"] {
    display: inline-flex;
    width: 18px;
    height: 18px;
    border: 1px solid color-mix(in oklab, var(--itrela-chalk), transparent 48%);
    border-radius: 50%;
    color: var(--itrela-chalk);
    font-size: var(--itrela-text-mark);
    font-weight: var(--itrela-weight-strong);
    line-height: 1;
}

.itrela-nav-accordion-body {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 0 0 4px;
}

.itrela-nav-accordion-body.is-open {
    display: flex;
}

.itrela-nav .itrela-nav-accordion-body .mud-nav-link {
    min-height: 32px;
    padding: 6px 12px 6px 24px !important;
}

.itrela-nav-accordion-body .mud-nav-link .mud-nav-link-icon {
    font-size: 17px !important;
}

/* Help & learning and Settings ride the footer row beside the account
   (MainLayout.razor.css owns the row): two 36px icon buttons whose MudTooltip
   and aria-label carry the words. The text stays in the accessibility tree,
   clipped, exactly as the 72px rail keeps it. */
.itrela-nav.itrela-nav-bottom {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0 !important;
}

.itrela-nav-bottom .mud-tooltip-root {
    display: inline-flex;
}

.itrela-nav.itrela-nav-bottom .mud-nav-link {
    box-sizing: border-box;
    width: 36px;
    min-height: 36px;
    justify-content: center;
    padding: 0 !important;
}

.itrela-nav-bottom .mud-nav-link .mud-nav-link-icon {
    margin: 0 !important;
}

.itrela-nav-bottom .mud-nav-link-text {
    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;
}

/* Nav on graphite: chalk at graded opacities (login-panel idiom); the
   active state is a chalk pill, never the accent — the accent belongs
   to the content, the rail belongs to the brand. */
.itrela-nav .mud-nav-link {
    min-height: 34px;
    border-radius: var(--itrela-radius-control) !important;
    padding: 7px 12px !important;
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-medium);
    line-height: 1.2;
    color: var(--itrela-rail-text) !important;
    transition: background 0.12s ease, color 0.12s ease;
}

.itrela-nav .mud-nav-link .mud-nav-link-icon {
    color: var(--itrela-rail-icon) !important;
    font-size: 1.1875rem !important;
    transition: color 0.12s ease;
}

.itrela-nav .mud-nav-link:hover {
    background: var(--itrela-rail-hover) !important;
    color: var(--itrela-chalk-bright) !important;
}

.itrela-nav .mud-nav-link:hover .mud-nav-link-icon {
    color: var(--itrela-chalk-bright) !important;
}

.itrela-nav .mud-nav-link.active {
    background: var(--itrela-rail-active) !important;
    color: var(--itrela-chalk-bright) !important;
    font-weight: var(--itrela-weight-strong);
}

.itrela-nav .mud-nav-link.active .mud-nav-link-icon {
    color: var(--itrela-chalk-bright) !important;
}

/* The rail accent, matching every other focusable control in the rail. It
   measures 8.36:1 on the graphite, where chalk-on-chalk was near-invisible. */
.itrela-nav .mud-nav-link:focus-visible {
    outline: 2px solid var(--itrela-rail-copper);
    outline-offset: -2px;
}

/* ── Short windows: the whole rail fits a 1080p laptop at 125% ─────────
   At 730px of height (1536x730) the groups under the day used to fall below
   the rail's fold, the page you were on included. Below 820px of height on a
   desktop-width screen, rows and gaps tighten so Daily work, Clients &
   service, Sales and Money (open on its own pages) all fit with the footer
   row. Labels keep their size; only the air around them shrinks. Phones and
   the 72px rail keep their full-size targets. MainLayout.razor.css tightens
   the brand and search rows the same way. */
@media (min-width: 960px) and (max-height: 820px) {
    .itrela-nav .mud-nav-link {
        min-height: 30px;
        padding-top: 5px !important;
        padding-bottom: 5px !important;
    }

    .itrela-nav .itrela-nav-accordion-body .mud-nav-link {
        min-height: 28px;
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    .itrela-nav-daily {
        padding-bottom: 4px !important;
    }

    .itrela-nav-group-label {
        padding-top: 4px;
    }

    .itrela-nav-accordion-header {
        padding-top: 6px;
        padding-bottom: 3px;
    }

    .itrela-nav-optional {
        margin-top: 8px;
        padding-top: 4px;
    }

    .itrela-nav-scrollzone {
        padding-bottom: 8px;
    }

    /* Through .itrela-nav: the chip's base rule sits later in this file. */
    .itrela-nav .itrela-timer-nav {
        min-height: 30px;
        padding-top: 3px;
        padding-bottom: 3px;
    }
}

.itrela-notif-menu .mud-menu-activator {
    display: block !important;
}

/* MudBadge's default line box is 30px tall, so its 24px bell sits 3px above
   neighboring MudIconButton glyphs. Give the app-bar badge a true icon box
   and keep a wide `99+` pill inside the notification target instead of
   overlapping the theme button. */
.itrela-notif-button .itrela-notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    line-height: 1;
}

.itrela-notif-button .itrela-notif-badge > .mud-icon-root {
    display: block;
}

.itrela-notif-button .mud-badge {
    left: auto !important;
    right: -12px !important;
}

/* Help & learning is a reversible layer over the task. Its custom veil is
   intentionally lighter than MudOverlay's default modal black. */
.itrela-help-veil {
  background: rgba(8, 16, 18, 0.30) !important;
  backdrop-filter: none !important;
}

.itrela-help-drawer {
  z-index: 1400 !important;
  width: min(420px, 100vw) !important;
  max-width: 100vw;
  border-left: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 20%) !important;
  border-radius: 0;
  background: var(--mud-palette-surface) !important;
  box-shadow: var(--itrela-shadow-float) !important;
  overflow: hidden;
}

/* Closed, the panel parks off-screen and hides from hit-testing and assistive
   visibility while preserving its slide-out transition and inert state. */
.mud-drawer.itrela-help-drawer.mud-drawer--closed {
  box-shadow: 0 12px 32px -12px transparent, 0 2px 6px -2px transparent !important;
  visibility: hidden;
  pointer-events: none;
}

.mud-drawer.itrela-help-drawer.mud-drawer--open {
  visibility: visible;
  pointer-events: auto;
}

.mud-drawer.itrela-help-drawer.mud-drawer-pos-right:not(.mud-drawer--initial) {
  transition: right 225ms cubic-bezier(0, 0, 0.2, 1),
              box-shadow 225ms cubic-bezier(0, 0, 0.2, 1),
              visibility 0s linear 225ms;
}

.mud-drawer.itrela-help-drawer.mud-drawer-pos-right.mud-drawer--open:not(.mud-drawer--initial) {
  transition: right 225ms cubic-bezier(0, 0, 0.2, 1),
              box-shadow 225ms cubic-bezier(0, 0, 0.2, 1),
              visibility 0s linear 0s;
}

/* The Ctrl-K command bar (GlobalSearchPalette). MudOverlay centres its
   content, which made the bar's top edge jump every time the result list
   changed height. Its top is pinned instead, so the box only grows down,
   and its height is capped to what is left of the viewport below it. */
.mud-overlay.itrela-search-palette-overlay {
  align-items: flex-start;
}

/* The page behind dims in both themes: MudBlazor's own dark scrim is a grey
   that lightens the dark theme's ground instead of dimming it. */
.mud-overlay.itrela-search-palette-overlay .mud-overlay-scrim.mud-overlay-dark {
  border-color: var(--itrela-scrim);
  background-color: var(--itrela-scrim);
}

/* The bar: a search line on top, the results under a hairline, the keys at
   the foot. It floats, so it wears the one shadow, and a hairline keeps its
   edge on the dark theme, where a shadow barely shows. */
.itrela-search-palette {
  --itrela-search-palette-top: max(56px, 12vh);
  --itrela-command-bar-icon: 1.25rem; /* MudIcon Size.Small */
  --itrela-command-bar-inset: var(--itrela-space-12);
  /* Where a row's icon starts: the list's padding and the row's inset. The
     search line and the step line start there too, so icons and words line up. */
  --itrela-command-bar-edge: calc(var(--itrela-space-8) + var(--itrela-command-bar-inset));
  display: flex;
  flex-direction: column;
  width: min(620px, 92vw);
  max-height: min(70vh, calc(100dvh - var(--itrela-search-palette-top) - 16px));
  margin-top: var(--itrela-search-palette-top);
  overflow: hidden;
  border: 1px solid var(--itrela-line);
  border-radius: var(--itrela-radius-surface);
  background: var(--mud-palette-surface);
  box-shadow: var(--itrela-shadow-float);
}

@media (max-width: 599.98px) {
  .itrela-search-palette {
    --itrela-search-palette-top: 12px;
    width: calc(100vw - 2 * var(--itrela-space-16));
    max-height: calc(100dvh - 2 * var(--itrela-search-palette-top));
  }
}

/* The search line, with the "which client?" step's line above it. */
.itrela-command-bar-head {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--itrela-line);
}

.itrela-command-bar-step {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--itrela-space-12);
  padding: var(--itrela-space-12) var(--itrela-command-bar-edge) 0;
  line-height: var(--itrela-leading-text);
}

.itrela-command-bar-step-label {
  min-width: 0;
  font-size: var(--itrela-text-13);
  font-weight: var(--itrela-weight-strong);
  color: var(--mud-palette-text-primary);
  overflow-wrap: anywhere;
}

.itrela-command-bar-hint {
  flex: none;
  font-size: var(--itrela-text-12);
  color: var(--mud-palette-text-secondary);
  white-space: nowrap;
}

/* A borderless 16px box the bar's full width. The bar is the focused
   dialog; the search icon turns the accent while the box has the focus. */
.mud-input-control.itrela-command-bar-input {
  margin: 0;
}

.mud-input-control.itrela-command-bar-input .mud-input {
  min-height: calc(var(--itrela-space-48) + var(--itrela-space-4));
  margin: 0;
  padding-inline: var(--itrela-command-bar-edge);
  column-gap: var(--itrela-command-bar-inset);
  font-size: var(--itrela-text-16);
}

.mud-input-control.itrela-command-bar-input .mud-input > input {
  height: auto;
  padding: var(--itrela-space-12) 0;
  font-size: var(--itrela-text-16);
  line-height: var(--itrela-leading-text);
}

.mud-input-control.itrela-command-bar-input .mud-input-adornment-start {
  margin: 0;
  color: var(--mud-palette-text-secondary);
  transition: color var(--itrela-motion-fast) var(--itrela-ease);
}

.mud-input-control.itrela-command-bar-input:focus-within .mud-input-adornment-start {
  color: var(--mud-palette-primary);
}

/* MudBlazor paints the adornment icon itself; let it follow the line. */
.mud-input-control.itrela-command-bar-input .mud-input-adornment-start .mud-icon-root {
  color: inherit;
}

.itrela-command-bar-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--itrela-space-8);
  scroll-padding-block: var(--itrela-space-8);
}

/* Group headings: quiet, in line with the rows' words. */
.itrela-command-bar-group-label {
  padding: var(--itrela-space-12) var(--itrela-command-bar-inset) var(--itrela-space-4)
    calc(2 * var(--itrela-command-bar-inset) + var(--itrela-command-bar-icon));
  font-size: var(--itrela-text-12);
  font-weight: var(--itrela-weight-medium);
  line-height: var(--itrela-leading-text);
  color: var(--mud-palette-text-secondary);
}

.itrela-command-bar-list > [role="group"]:first-child > .itrela-command-bar-group-label {
  padding-top: var(--itrela-space-4);
}

/* One row: the kind's icon, the words, at least a 44px target. The
   highlighted row is a quiet accent tint with an accent bar on its leading
   edge; the words keep their own colours. Hovering tints lighter still. */
.itrela-command-bar-row {
  position: relative;
  display: grid;
  grid-template-columns: var(--itrela-command-bar-icon) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--itrela-command-bar-inset);
  width: 100%;
  min-height: calc(var(--itrela-space-48) - var(--itrela-space-4));
  padding: var(--itrela-space-8) var(--itrela-command-bar-inset);
  border: 0;
  border-radius: var(--itrela-radius-control);
  background: transparent;
  color: var(--mud-palette-text-primary);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: background-color var(--itrela-motion-fast) var(--itrela-ease);
}

.itrela-command-bar-row:hover {
  background: color-mix(in oklab, var(--mud-palette-primary), transparent 96%);
}

.itrela-command-bar-row[aria-selected="true"] {
  background: color-mix(in oklab, var(--mud-palette-primary), transparent 88%);
}

/* The tint lifts the dark theme's ground, which would take the quiet line
   under 4.5:1; a quarter of the ink keeps it readable in both themes. */
.itrela-command-bar-row[aria-selected="true"] .itrela-command-bar-row-meta {
  color: color-mix(in oklab, var(--mud-palette-text-secondary), var(--mud-palette-text-primary) 25%);
}

.itrela-command-bar-row[aria-selected="true"]::before {
  content: "";
  position: absolute;
  inset-block: var(--itrela-space-8);
  inset-inline-start: 0;
  width: 3px;
  border-radius: var(--itrela-radius-pill);
  background: var(--mud-palette-primary);
}

.itrela-command-bar-row:focus-visible {
  outline: var(--itrela-focus-ring);
  outline-offset: calc(-1 * var(--itrela-focus-offset));
}

/* High-contrast mode drops the tint and the accent bar, so the highlighted
   row gets the system's own highlight outline instead. */
@media (forced-colors: active) {
  .itrela-command-bar-row[aria-selected="true"] {
    outline: var(--itrela-focus-ring);
    outline-color: Highlight;
    outline-offset: calc(-1 * var(--itrela-focus-offset));
  }
}

.itrela-command-bar-row-icon {
  width: var(--itrela-command-bar-icon);
  height: var(--itrela-command-bar-icon);
  color: var(--mud-palette-text-secondary);
}

.itrela-command-bar-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.itrela-command-bar-row-title {
  font-size: var(--itrela-text-14);
  font-weight: var(--itrela-weight-medium);
  line-height: var(--itrela-leading-text);
  overflow-wrap: anywhere;
}

.itrela-command-bar-row-meta {
  font-size: var(--itrela-text-12);
  font-weight: var(--itrela-weight-regular);
  line-height: var(--itrela-leading-text);
  color: var(--mud-palette-text-secondary);
  overflow-wrap: anywhere;
}

/* Nothing found: the sentence, and under it what to try. */
.itrela-command-bar-empty {
  display: flex;
  flex-direction: column;
  gap: var(--itrela-space-4);
  padding: var(--itrela-space-24) var(--itrela-space-16);
  text-align: center;
  line-height: var(--itrela-leading-text);
}

.itrela-command-bar-empty-line,
.itrela-command-bar-empty-hint {
  margin: 0;
  overflow-wrap: anywhere;
}

.itrela-command-bar-empty-line {
  font-size: var(--itrela-text-14);
  font-weight: var(--itrela-weight-medium);
  color: var(--mud-palette-text-primary);
}

.itrela-command-bar-empty-hint {
  font-size: var(--itrela-text-13);
  color: var(--mud-palette-text-secondary);
}

/* The keys, at the foot. A phone has no arrow keys to hint at. */
.itrela-command-bar-keys {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--itrela-space-4) var(--itrela-space-16);
  padding: var(--itrela-space-8) var(--itrela-command-bar-edge);
  border-top: 1px solid var(--itrela-line);
  font-size: var(--itrela-text-12);
  line-height: var(--itrela-leading-text);
  color: var(--mud-palette-text-secondary);
}

.itrela-command-bar-keys > span {
  display: inline-flex;
  align-items: center;
  gap: var(--itrela-space-4);
  white-space: nowrap;
}

.itrela-command-bar-keys .shortcut-help-key {
  min-width: 0;
  padding: 0 var(--itrela-space-4);
  border-radius: var(--itrela-radius-small);
  font-size: var(--itrela-text-12);
  line-height: var(--itrela-leading-text);
}

@media (max-width: 599.98px) {
  .itrela-command-bar-keys {
    display: none;
  }
}

/* The bar's polite live region: read out, never shown. */
.itrela-command-bar-announce {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.itrela-help-drawer .mud-drawer-content {
  height: 100%;
}

.itrela-help-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  color: var(--mud-palette-text-primary);
}

.itrela-help-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 9px 16px;
  border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 45%);
  background: var(--mud-palette-surface);
}

.itrela-help-header-icon,
.itrela-help-spark,
.itrela-help-ai-provenance .mud-icon-root {
  flex: none;
  color: var(--mud-palette-primary);
}

.itrela-help-title {
  flex: 1;
  color: var(--mud-palette-text-primary) !important;
  font-size: var(--itrela-text-14) !important;
  font-weight: var(--itrela-weight-strong) !important;
}

.itrela-help-close {
  flex: none;
  color: var(--mud-palette-text-secondary) !important;
}

.itrela-help-kbd {
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--mud-palette-lines-default);
  border-bottom-width: 2px;
  border-radius: var(--itrela-radius-small);
  background: var(--mud-palette-surface);
  color: var(--mud-palette-text-secondary);
  font-family: var(--mud-typography-default-family);
  font-size: var(--itrela-text-12);
  font-weight: var(--itrela-weight-strong);
}

.itrela-help-ask-region {
  flex: 0 0 auto;
}

.itrela-help-ask {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 0;
  padding: 7px 9px 7px 11px;
  border: 1px solid color-mix(in oklab, var(--mud-palette-primary), transparent 45%);
  border-radius: var(--itrela-radius-control);
  background: color-mix(in oklab, var(--mud-palette-primary), transparent 94%);
  color: var(--mud-palette-text-primary);
  font-size: var(--itrela-text-14);
}

.itrela-help-ask--entry {
  align-items: flex-start;
}

.itrela-help-ask-field {
  flex: 1;
  min-width: 0;
}

.itrela-help-ask-field .mud-input-control,
.itrela-help-ask-field .mud-input,
.itrela-help-ask-field textarea {
  margin: 0 !important;
}

.itrela-help-ask-field .mud-input::before,
.itrela-help-ask-field .mud-input::after {
  display: none !important;
}

.itrela-help-ask-field textarea {
  min-height: 24px !important;
  padding-top: 3px !important;
  color: var(--mud-palette-text-primary);
  font-size: var(--itrela-text-14) !important;
  line-height: 1.4 !important;
}

.itrela-help-ask-submit {
  margin-top: 1px;
}

.itrela-help-ask-question {
  flex: 1;
  min-width: 0;
  font-weight: var(--itrela-weight-strong);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.itrela-help-ask-note {
  padding: 3px 18px 0;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
  line-height: 1.4;
}

.itrela-help-link-button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mud-palette-primary);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.itrela-help-link-button:disabled {
  color: var(--mud-palette-text-disabled);
  cursor: default;
  text-decoration: none;
}

.itrela-help-search-region {
  flex: 0 0 auto;
  padding: 9px 16px 0;
}

.itrela-help-search-field .mud-input-outlined {
  border-radius: var(--itrela-radius-control) !important;
  font-size: var(--itrela-text-14);
}

.itrela-help-search-field .mud-input-outlined-border {
  border-color: var(--mud-palette-lines-default) !important;
}

.itrela-help-search-field:focus-within .mud-input-outlined-border {
  border-color: var(--mud-palette-primary) !important;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--mud-palette-primary), transparent 70%);
}

.itrela-help-search-scope {
  display: block;
  padding: 2px 2px 0;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12) !important;
}

.itrela-help-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 0 12px;
}

.itrela-help-section-heading,
.itrela-help-context-heading {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 12px 18px 6px;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
  font-weight: var(--itrela-weight-medium);
  word-spacing: var(--itrela-label-word-spacing);
}

.itrela-help-section-heading span + span,
.itrela-help-section-count {
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12) !important;
  font-weight: var(--itrela-weight-medium) !important;
  letter-spacing: 0;
  text-transform: none;
}

.itrela-help-context-heading .itrela-help-section-label {
  margin: 0;
  color: inherit;
  font-size: var(--itrela-text-12) !important;
  font-weight: var(--itrela-weight-strong);
  letter-spacing: 0;
  word-spacing: var(--itrela-label-word-spacing);
}

.itrela-help-context-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 40px 24px;
  text-align: center;
}

.itrela-help-context-empty .mud-typography-subtitle1 {
  font-family: var(--mud-typography-h1-family);
  font-size: var(--itrela-text-16);
  font-weight: var(--itrela-weight-strong);
}

.itrela-help-empty {
  display: block;
  padding: 12px 18px;
}

.itrela-help-results {
  display: flex;
  flex-direction: column;
}

.itrela-help-article {
  border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 48%);
}

.itrela-help-article.is-open {
  background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-surface) 45%);
}

.itrela-help-article-toggle {
  display: block;
  width: 100%;
  padding: 10px 18px;
  border: 0;
  background: transparent;
  color: var(--mud-palette-text-primary);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.itrela-help-article-toggle:hover {
  background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-surface) 25%);
}

.itrela-help-result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.itrela-help-article-title {
  flex: 1;
  min-width: 0;
  font-size: var(--itrela-text-14);
  font-weight: var(--itrela-weight-strong);
  line-height: 1.35;
}

.itrela-help-kind-label {
  flex: none;
  padding: 1px 8px;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: var(--itrela-radius-pill);
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
  font-weight: var(--itrela-weight-strong);
}

.itrela-help-kind {
  flex: 0 0 auto;
  min-height: 20px !important;
  height: 20px !important;
  color: var(--mud-palette-text-secondary) !important;
  border-color: var(--mud-palette-lines-default) !important;
  background: var(--mud-palette-surface) !important;
  font-size: var(--itrela-text-mark) !important;
}

.itrela-help-glossary-kind {
  color: var(--mud-palette-primary) !important;
  border-color: color-mix(in oklab, var(--mud-palette-primary), transparent 50%) !important;
}

.itrela-help-summary {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-13);
  line-clamp: 2;
  line-height: 1.45;
  white-space: normal;
}

.itrela-help-result-screen {
  display: block;
  margin-top: 3px;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
}

.itrela-help-article-full {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 18px 14px;
  font-size: var(--itrela-text-13);
  line-height: 1.6;
}

.itrela-help-article-full p {
  margin: 0;
}

.itrela-help-why {
  padding: 9px 12px;
  border-left: 3px solid var(--mud-palette-primary);
  border-radius: 0 var(--itrela-radius-control) var(--itrela-radius-control) 0;
  background: color-mix(in oklab, var(--mud-palette-primary), transparent 92%);
}

.itrela-help-example {
  padding: 9px 12px;
  border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 38%);
  border-radius: var(--itrela-radius-control);
  background: var(--mud-palette-surface);
}

.itrela-help-block-label {
  display: block;
  margin-bottom: 2px;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
  font-weight: var(--itrela-weight-medium);
  word-spacing: var(--itrela-label-word-spacing);
}

.itrela-help-why .itrela-help-block-label {
  color: var(--mud-palette-primary);
}

.itrela-help-full-link {
  align-self: flex-start;
  font-size: var(--itrela-text-13);
}

.itrela-help-term-list {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 8px;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
}

.itrela-help-term {
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1.5px dotted var(--mud-palette-primary);
  background: transparent;
  color: var(--mud-palette-primary);
  cursor: pointer;
  font: inherit;
  font-weight: var(--itrela-weight-strong);
}

.itrela-help-glossary-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 18px 6px;
}

.itrela-help-glossary {
  padding: 10px 12px;
  border: 1px solid color-mix(in oklab, var(--mud-palette-primary), transparent 55%);
  border-radius: var(--itrela-radius-control);
  background: var(--mud-palette-surface);
}

.itrela-help-glossary-definition {
  display: block;
  margin: 5px 0 3px;
  line-height: 1.55;
}

.itrela-help-glossary-map {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--mud-palette-lines-default);
  color: var(--mud-palette-text-secondary);
  line-height: 1.45;
}

.itrela-help-ai-answer {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 2px;
  padding: 12px 18px;
  border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 48%);
}

.itrela-help-ai-provenance {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--mud-palette-primary);
  font-size: var(--itrela-text-12);
  font-weight: var(--itrela-weight-strong);
}

.itrela-help-answer {
  color: var(--mud-palette-text-primary);
  font-size: var(--itrela-text-13);
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.itrela-help-answer-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
  white-space: normal;
}

.itrela-help-answer-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.itrela-help-answer-step-number {
  display: grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  place-items: center;
  border-radius: var(--itrela-radius-pill);
  background: color-mix(in oklab, var(--mud-palette-primary), transparent 88%);
  color: var(--mud-palette-primary);
  font-size: var(--itrela-text-mark);
  font-weight: var(--itrela-weight-strong);
}

.itrela-help-citations {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
}

.itrela-help-source-chip {
  display: inline-flex;
  padding: 3px 10px;
  border: 1px solid var(--mud-palette-lines-default);
  border-radius: var(--itrela-radius-pill);
  background: var(--mud-palette-surface);
  color: var(--mud-palette-text-primary) !important;
  font-size: var(--itrela-text-12) !important;
  font-weight: var(--itrela-weight-strong);
  text-decoration: none !important;
}

.itrela-help-source-chip:hover {
  border-color: var(--mud-palette-primary);
}

.itrela-help-no-answer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 38%);
  border-radius: var(--itrela-radius-control);
  background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-surface) 35%);
  font-size: var(--itrela-text-13);
  line-height: 1.55;
}

.itrela-help-provider-failure {
  display: flex;
  gap: 8px;
  margin: 4px 16px 8px;
  padding: 10px 12px;
  border: 1px solid color-mix(in oklab, var(--mud-palette-warning), transparent 45%);
  border-radius: var(--itrela-radius-control);
  background: color-mix(in oklab, var(--mud-palette-warning), transparent 92%);
  color: var(--mud-palette-text-primary);
  font-size: var(--itrela-text-13);
  line-height: 1.5;
}

.itrela-help-provider-failure > .mud-icon-root {
  flex: none;
  color: var(--mud-palette-warning);
}

.itrela-help-fallback-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 6px;
  padding: 2px 18px 9px;
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
  line-height: 1.45;
}

.itrela-help-fallback-heading b {
  color: var(--mud-palette-text-primary);
}

.itrela-help-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.itrela-help-skeleton-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.itrela-help-skeleton-number,
.itrela-help-skeleton-bar,
.itrela-help-skeleton-chips span {
  display: block;
  background: color-mix(in oklab, var(--mud-palette-text-primary), transparent 89%);
  animation: itrela-help-pulse 1.4s ease-in-out infinite;
}

.itrela-help-skeleton-number {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: var(--itrela-radius-pill);
}

.itrela-help-skeleton-bar {
  height: 10px;
  border-radius: var(--itrela-radius-control);
}

.itrela-help-skeleton-bar.is-long {
  width: 80%;
}

.itrela-help-skeleton-bar.is-short {
  width: 60%;
}

.itrela-help-skeleton-chips {
  display: flex;
  gap: 6px;
}

.itrela-help-skeleton-chips span {
  width: 34%;
  height: 20px;
  border-radius: var(--itrela-radius-pill);
}

.itrela-help-skeleton-chips span + span {
  width: 28%;
}

@keyframes itrela-help-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.itrela-help-context-more {
  border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 48%);
}

.itrela-help-context-more > summary {
  padding: 10px 18px;
  color: var(--mud-palette-text-secondary);
  cursor: pointer;
  font-size: var(--itrela-text-13);
  font-weight: var(--itrela-weight-strong);
}

.itrela-help-context-more > summary:hover {
  background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-surface) 25%);
}

.itrela-help-follow-up {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 12px 9px 16px;
  border-top: 1px solid var(--mud-palette-lines-default);
  background: var(--mud-palette-surface);
}

.itrela-help-follow-up-field {
  flex: 1;
  min-width: 0;
}

.itrela-help-follow-up-field .mud-input-outlined {
  border-radius: var(--itrela-radius-control) !important;
  font-size: var(--itrela-text-13);
}

.itrela-help-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 18px;
  border-top: 1px solid var(--mud-palette-lines-default);
  background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-surface) 45%);
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12);
  line-height: 1.45;
}

.itrela-help-provenance {
  color: var(--mud-palette-text-secondary);
  font-size: var(--itrela-text-12) !important;
  line-height: 1.45 !important;
}

@media (prefers-reduced-motion: reduce) {
  .itrela-help-skeleton-number,
  .itrela-help-skeleton-bar,
  .itrela-help-skeleton-chips span {
    animation: none;
  }
}

@media (max-width: 599.98px) {
  .itrela-help-drawer {
    width: 100vw !important;
    border-left: 0 !important;
  }

  .itrela-help-ask,
  .itrela-help-search-region {
    margin-right: 12px;
    margin-left: 12px;
  }

  .itrela-help-search-region {
    padding-right: 0;
    padding-left: 0;
  }
}

/* Account menu popover (rendered at the popover provider root, so it
   can only be styled globally). */
.itrela-user-menu-list {
    min-width: 220px;
    padding: 6px !important;
}

.itrela-user-menu-list .mud-menu-item {
    border-radius: var(--itrela-radius-control);
    padding: 8px 12px;
}

.itrela-user-menu-list .mud-menu-item .mud-menu-item-text {
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-medium);
}

.itrela-user-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 6px;
}

/* Same identity mark as the rail trigger, popover-sized. */
.itrela-user-menu-avatar {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--mud-palette-primary-lighten);
    color: var(--mud-palette-primary);
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    overflow: hidden;
}

.itrela-user-menu-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.itrela-user-menu-copy {
    min-width: 0;
}

.itrela-user-menu-name {
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: 0;
    color: var(--mud-palette-text-primary);
}

.itrela-user-menu-role {
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
    color: var(--mud-palette-text-secondary);
}

/* First-load layout stability: MudLayout only applies breakpoint
   classes after JS interop reports the viewport, which briefly renders
   content under the drawer. Apply the desktop offsets immediately. */
@media (min-width: 960px) {
    .itrela-drawer.mud-drawer-mini.mud-drawer--open ~ .mud-main-content {
        margin-left: var(--mud-drawer-width-left) !important;
    }

    .itrela-drawer.mud-drawer-mini.mud-drawer--closed ~ .mud-main-content {
        margin-left: var(--mud-drawer-width-mini-left, 72px) !important;
    }
}

/* ── Collapsed rail (mini variant) ─────────────────────────────── */

/* Prevent horizontal scrollbar on the collapsed drawer */
.itrela-drawer.mud-drawer--closed {
    overflow: hidden !important;
}

.itrela-drawer.mud-drawer--closed .mud-drawer-content {
    overflow-x: hidden !important;
}

/* Brand: centre icon, hide text */
.itrela-drawer.mud-drawer--closed .itrela-brand {
    padding: 14px 0;
    justify-content: center;
}

.itrela-drawer.mud-drawer--closed .itrela-brand-name {
    display: none !important;
}

/* Nav: visually hide text labels, centre icons. Keeping the text in the
   accessibility tree gives each icon-only link its real name while the
   rail is collapsed; display:none made every focusable nav link unnamed. */
.itrela-drawer.mud-drawer--closed .itrela-nav {
    align-items: center;
    padding: 0 14px !important;
}

.itrela-drawer.mud-drawer--closed .itrela-nav-group-label {
    display: none;
}

.itrela-drawer.mud-drawer--closed .itrela-nav-accordion-header {
    position: relative;
    width: 44px;
    min-height: 42px;
    justify-content: center;
    padding: 0;
    border-radius: var(--itrela-radius-surface);
}

/* Collapsed, a group header is its lead icon: the same 44px target as the
   destination rows, the chevron gone, and the children rendered only while
   the group is open (ItrelaRail.dc.html). The label text stays in the
   accessibility tree — clip it, never display:none it. */
.itrela-drawer.mud-drawer--closed .itrela-nav-accordion-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.itrela-drawer.mud-drawer--closed .itrela-nav-accordion-chevron {
    display: none;
}

/* The lead icon is the collapsed header's only visible content, so it takes
   the full text weight like the destination icons beside it. */
.itrela-drawer.mud-drawer--closed .itrela-nav-accordion-lead {
    display: block;
    color: var(--itrela-chalk);
}

.itrela-drawer.mud-drawer--closed .itrela-nav-accordion-body {
    width: 100%;
    align-items: center;
    padding-bottom: 0;
}

/* A closed group's roll-up mark has no room for a pill at 72px: it becomes
   the same 9px dot the destination rows wear, accent for a count (the hollow
   roll-up included — it has no fill to shrink into), chalk for a failure. */
.itrela-drawer.mud-drawer--closed .itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="number"][data-count]:not([data-count=""]) {
    position: absolute;
    top: 3px;
    right: 11px;
    min-width: 9px;
    width: 9px;
    height: 9px;
    padding: 0;
    border: 2px solid var(--mud-palette-drawer-background);
    border-radius: var(--itrela-radius-pill);
    box-sizing: border-box;
    background: var(--itrela-rail-copper);
    color: transparent;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}

.itrela-drawer.mud-drawer--closed .itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="dot"] {
    position: absolute;
    top: 3px;
    right: 11px;
}

.itrela-drawer.mud-drawer--closed .itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="failed"] {
    position: absolute;
    top: 3px;
    right: 11px;
    width: 9px;
    height: 9px;
    padding: 0;
    border: 2px solid var(--mud-palette-drawer-background);
    border-radius: var(--itrela-radius-pill);
    box-sizing: border-box;
    background: var(--itrela-chalk);
    color: transparent;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}

.itrela-drawer.mud-drawer--closed .itrela-nav-discovery {
    display: none;
}

.itrela-drawer.mud-drawer--closed .itrela-nav .mud-nav-link {
    width: 44px;
    min-height: 42px;
    justify-content: center;
    padding: 0 !important;
    border-radius: var(--itrela-radius-surface) !important;
}

.itrela-drawer.mud-drawer--closed .itrela-nav .mud-nav-item,
.itrela-drawer.mud-drawer--closed .itrela-nav .itrela-notif-menu {
    width: 44px;
}

.itrela-drawer.mud-drawer--closed .itrela-working-nav-link {
    justify-content: center;
}

/* Collapsed, the icon is the link's only visible content, so it has to carry
   the full text weight — at the 0.68 icon alpha it read as disabled. */
.itrela-drawer.mud-drawer--closed .itrela-nav .mud-nav-link .mud-nav-link-icon {
    color: var(--itrela-chalk) !important;
}

/* Keep the middle destinations scrollable while Daily work, utilities, and
   the account remain pinned. Hide the narrow rail's scrollbar; a clipped
   partial target still supplies the overflow affordance without a grey stripe. */
.itrela-drawer.mud-drawer--closed .itrela-nav-scrollzone {
    overflow-y: auto;
    scrollbar-width: none;
}

.itrela-drawer.mud-drawer--closed .itrela-nav-scrollzone::-webkit-scrollbar {
    display: none;
}

.itrela-drawer.mud-drawer--closed .mud-nav-link-text {
    display: block !important;
    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;
}

.itrela-drawer.mud-drawer--closed .mud-nav-link .mud-nav-link-icon {
    margin: 0 !important;
}

/* Footer: the row stands up as a column of 44px targets — avatar, Help,
   Settings (the MudMenu popover anchors itself, so no positioning hacks are
   needed in either state). */
.itrela-drawer.mud-drawer--closed .itrela-drawer-footer {
    flex-direction: column;
    padding: 8px 14px 12px;
    align-items: center;
}

.itrela-drawer.mud-drawer--closed .itrela-nav.itrela-nav-bottom {
    flex-direction: column;
    padding: 0 !important;
}

.itrela-drawer.mud-drawer--closed .itrela-nav.itrela-nav-bottom .mud-nav-link {
    width: 44px;
    min-height: 42px;
}

/* The expanded menu wrapper is 100% wide. In the mini rail that leaves
   its fixed-width trigger aligned to the wrapper's left edge, four pixels
   left of the drawer centre. Shrink the wrapper with the trigger so the
   footer's centring applies to both. */
.itrela-drawer.mud-drawer--closed .itrela-user-menu {
    flex: 0 0 44px;
    width: 44px !important;
}

/* Collapsed, only the grid and padding change. */
.itrela-drawer.mud-drawer--closed .itrela-account-trigger {
    display: grid;
    grid-template-columns: 30px;
    box-sizing: border-box;
    width: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 4px;
}

.itrela-drawer.mud-drawer--closed .itrela-account-copy,
.itrela-drawer.mud-drawer--closed .itrela-working-clear {
    display: none;
}

/* ── Collapsed rail → reclaim content width ─────────────────────────
   The legacy shells' bumps died with the shells, and .itrela-content-inner
   no longer carries a cap of its own — each page chrome owns its framing
   now, so there is no shared column left to widen. What remains is the
   Service Desk body, the one place a capped reading column survives:
   collapsing the rail is the user opting into "more room", so that column
   widens to put the reclaimed space to work. Desktop only — below the Md
   breakpoint the drawer overlays the page and content is already
   full-width. */

/* Always on, so the width animates in step with the drawer slide in
   BOTH directions (collapse and expand). */
.service-desk {
    transition: max-width 0.2s ease;
}

@media (min-width: 960px) {
    .itrela-drawer.mud-drawer--closed ~ .mud-main-content .service-desk {
        max-width: 1600px;
    }
}

/* ── Workbench chrome: the frame is the page ────────────────────────
   Chrome 1 is full-bleed with one scrolling list and a pinned footer
   (UI_STYLE_GUIDE.md "Two page chromes"). The content column is an ordinary
   page-scrolling box, so on its own WorkbenchShell would have nothing for
   its body to scroll inside. These rules hand the shell the frame.

   Opt-in, and only opt-in: a WorkbenchShell may be the page root, while an
   IndexShell is always a viewport-height module frame. An index body decides
   whether its current screen scrolls as a workbench list or as an ordinary
   card screen; switching routes must never change the index rail's bottom
   edge. A page that has adopted neither matches none of these rules and keeps
   the page-scrolling column exactly as it is. The first two rule groups use
   :has(); the last keeps plain direct-child rules on the page shell and the
   workbench inside an index body. So a browser without :has() keeps that same
   untouched column.

   They live here rather than in MainLayout.razor.css because they are frame
   wiring, not layout defaults — leading with `body` keeps them one step
   above the scoped .itrela-content-inner rule, instead of tying and leaning
   on file order. */
body .mud-main-content.itrela-content:has(> .itrela-content-inner > .itrela-workbench),
body .mud-main-content.itrela-content:has(> .itrela-content-inner > .itrela-index) {
    /* border-box so the app bar's padding-top comes out of the 100dvh
       instead of adding to it. Desktop has no app bar and no padding; the
       arithmetic is right in both cases. */
    box-sizing: border-box;
    height: 100dvh;
    overflow: hidden;
}

body .mud-main-content.itrela-content .itrela-content-inner:has(> .itrela-workbench),
body .mud-main-content.itrela-content .itrela-content-inner:has(> .itrela-index) {
    /* The scroll column becomes the flex parent that holds the workbench
       body to the frame. Gutter and cap are gone for every page now — the
       chromes own their framing — so nothing here is restated. */
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* min-height:0 is what actually lets .itrela-workbench-body scroll: without it
   the flex item refuses to shrink below its content and the list pushes the
   footer off the bottom instead. */
body .mud-main-content.itrela-content .itrela-content-inner > .itrela-workbench,
body .mud-main-content.itrela-content .itrela-content-inner > .itrela-index,
body .mud-main-content.itrela-content .itrela-content-inner > .itrela-index > .itrela-index-body > .itrela-workbench {
    flex: 1 1 auto;
    min-height: 0;
}

/* Calendar's MudDropContainer sits directly inside .itrela-workbench-body;
   stretch it so its grid ground always fills the viewport without a void. */
.itrela-workbench-body > .cal-drop-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* ── Desktop: full-height sidebar, no top bar ───────────────────────
   The collapse control now lives on the sidebar seam (.itrela-seam-toggle),
   so the desktop app bar holds nothing useful — hide it and reclaim the
   ~48px of vertical space on every page. The app bar (with its
   hamburger) stays on mobile, where the drawer overlays the page and
   still needs a visible trigger. The drawer uses ClipMode.Never, so it
   already spans full height once the bar is gone. */
@media (min-width: 960px) {
    .itrela-appbar {
        display: none !important;
    }

    /* No app bar to clear → drop MudMainContent's reserved top padding. */
    .itrela-content {
        padding-top: 0 !important;
    }
}

/* ── Sidebar seam toggle (collapse / expand) ────────────────────────
   A round chevron straddling the drawer's right edge. It sits OUTSIDE
   the drawer (a fixed-positioned sibling) so the collapsed drawer's
   overflow:hidden can't clip it; its `left` tracks the drawer width and
   animates in step with the drawer (225ms, matching MudBlazor). */
.itrela-seam-toggle {
    position: fixed;
    top: 21px;
    left: calc(var(--mud-drawer-width-left, 240px) - 14px);
    z-index: 1150; /* above drawer (1100); below popovers/menus/dialogs */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    /* Page colours, not rail graphite: it straddles the seam and belongs to
       the content side (Itrela States §01). */
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    box-shadow: none;
    transition: left 225ms cubic-bezier(0, 0, 0.2, 1),
                color 0.15s ease, border-color 0.15s ease,
                background-color 0.15s ease, box-shadow 0.15s ease;
}

/* Collapsed: re-centre on the mini rail's edge. */
.itrela-seam-toggle.is-collapsed {
    left: calc(var(--mud-drawer-width-mini-left, 72px) - 14px);
}

.itrela-seam-toggle:hover {
    color: var(--mud-palette-text-primary);
    border-color: color-mix(in oklab, var(--mud-palette-lines-default), var(--mud-palette-text-secondary) 35%);
    background: var(--mud-palette-surface);
    box-shadow: none;
}

/* No focus ring here. The toggle straddles the rail and the page, so it needs
   the two-tone ring, and that lives with the rest of MainLayout's own controls
   in MainLayout.razor.css — where the isolation attribute outranks anything
   written here. Two rules that disagree is one rule too many. */

.itrela-seam-toggle .itrela-seam-icon {
    font-size: 18px;
}

/* Desktop only — on mobile the app bar's hamburger is the trigger. */
@media (max-width: 959.98px) {
    .itrela-seam-toggle {
        display: none;
    }

    /* MudAppBar tracks a Mini drawer's desktop offset in its generated
       classes. When a collapsed 72px rail crosses into the mobile layout,
       that stale offset otherwise leaves the whole bar — including the
       hamburger — shifted 72px to the right. Mobile chrome always spans the
       viewport because the drawer is an overlay here. */
    .itrela-appbar {
        left: 0 !important;
        right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }

    /* Mini drawers remain docked below their breakpoint: "closed" still
       reserves the 72px rail and "open" pushes the page by 240px. On phones
       that leaves too little room for the application and makes the expanded
       menu create horizontal page scroll. Treat the same drawer as a mobile
       sheet instead: place it above MudBlazor's native veil and app bar so
       its brand row and explicit close control stay visible and interactive,
       while keeping search/dialog overlays above it, then move it completely
       off-canvas when closed. */
    .itrela-drawer {
        top: 0 !important;
        z-index: 1390 !important;
        height: 100dvh !important;
        /* The MudBlazor width variable can still be the 72px mini-rail value
           for one breakpoint cycle after resizing from desktop. This sheet is
           the mockup's wider 280px phone sheet, while the desktop rail remains
           MainLayout's explicit 240px Width. */
        width: 280px !important;
    }

    /* Keep overflow in the middle group zone; daily work and the footer row
       (account, Help, Settings) remain pinned in the mobile drawer too. */
    .itrela-drawer .mud-drawer-content {
        overflow: hidden;
    }

    /* Extra bottom clearance keeps the last optional group / discovery link
       from clipping behind the pinned footer row on phones. */
    .itrela-drawer .itrela-nav-scrollzone {
        padding-bottom: 24px;
    }

    /* A finger needs more than the desktop's 36px for Help and Settings. */
    .itrela-nav.itrela-nav-bottom .mud-nav-link {
        width: 40px;
        min-height: 40px;
    }

    .itrela-drawer.mud-drawer--closed {
        transform: translateX(-100%) !important;
        visibility: hidden;
    }

    .itrela-drawer.mud-drawer--open {
        transform: translateX(0) !important;
        visibility: visible;
    }

    .itrela-drawer ~ .mud-main-content {
        margin-left: 0 !important;
    }

    /* MudBlazor also keys the mini-drawer offset from a class on the layout
       root. When a desktop-open drawer crosses the breakpoint, that selector
       can survive the resize even though the drawer has become an overlay.
       Reset the logical and physical offset on the content itself. */
    body .mud-layout .mud-main-content.itrela-content {
        margin-left: 0 !important;
        margin-inline-start: 0 !important;
        width: 100% !important;
    }
}

/* ── Sidebar nav badges ─────────────────────────────────────────────
   Actionable counts are supplied through data-count. One decision drives
   both states: a filled accent pill when expanded, an accent dot on the
   icon when collapsed. Zero emits no mark.
   (Collapsed page-name tooltips use the native title attribute — a CSS
   tooltip would be clipped by the collapsed drawer's overflow:hidden.) */
.itrela-nav .mud-nav-link {
    position: relative;
}

/* Expanded: count pill pushed to the trailing edge of the link. */
.itrela-nav .mud-nav-link[data-badge-display="number"][data-count]:not([data-count=""])::after {
    content: attr(data-count);
    margin-left: auto;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: var(--itrela-radius-control);
    background: var(--itrela-rail-copper);
    color: var(--itrela-rail-copper-ink);
    font-size: var(--itrela-text-mark);
    font-weight: var(--itrela-weight-strong);
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
}

/* ── A count we could not load ──────────────────────────────────────
   The row says so itself, in the chalk "!" the section header already
   uses. It has to live on the row, not only on the header: a section
   header only paints its badge while the section is CLOSED, and the
   Notifications bell sits in Daily work, which has no header at all — so
   until this rule existed, "count unavailable" was a fact in the data
   and in the accessible name with nothing on screen.
   No [data-count] gate here: a failed decision carries an empty count on
   purpose, because there is no number to show. Chalk, not the accent —
   the accent means "here is your number", and this is the opposite. */
.itrela-nav .mud-nav-link[data-badge-display="failed"]::after {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid color-mix(in oklab, var(--itrela-chalk), transparent 48%);
    border-radius: 50%;
    color: var(--itrela-chalk);
    font-size: var(--itrela-text-mark);
    font-weight: var(--itrela-weight-strong);
    line-height: 1;
    box-sizing: border-box;
}

.itrela-nav .mud-nav-link[data-badge-display="failed"]::after {
    margin-left: auto;
    /* A pseudo-element is a flex item in the link's row, and the row squeezes
       it into an oval (measured 14.2px of the 18) unless it refuses to shrink. */
    flex: 0 0 auto;
}

/* ── Sidebar notification bell ──────────────────────────────────────
   The app bar keeps its compact mobile bell; the overlay drawer also keeps
   the named Notifications destination required by the rail contract. The
   desktop app bar is hidden, so the rail is the only desktop home. */

/* The bell activator is a <button>, not MudNavLink's <a>. Make the menu
   wrapper and button stretch full-width so the unread pill (drawn by the
   [data-count] ::after rule above) trails to the edge like other nav
   counts instead of butting against the word. */
.itrela-nav .itrela-notif-menu {
    display: block;
    width: 100%;
}

.itrela-notif-nav {
    width: 100%;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.itrela-help-nav {
    width: 100%;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

/* Collapsed: the same actionable decision becomes one dot on the icon. */
.itrela-drawer.mud-drawer--closed .itrela-nav .mud-nav-link[data-badge-display="dot"][data-count]:not([data-count=""])::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 11px;
    margin: 0;
    min-width: 9px;
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: var(--itrela-radius-pill);
    /* The ring is a border, not a box-shadow, so the dot cannot grow the
       icon's hit area. box-sizing is set explicitly right below: it is not
       inherited by pseudo-elements and nothing in this file resets them. */
    box-sizing: border-box;
    border: 2px solid var(--mud-palette-drawer-background);
    background: var(--itrela-rail-copper);
    color: transparent;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}

/* Collapsed, a failed count keeps the count dot's exact geometry and swaps
   the accent for chalk. There is no room for the "!" beside a 44px icon, and
   the words are already in the row's tooltip and accessible name — this mark
   only has to say "look here, and it is not a number". The failed decision is
   the same in both rail widths, so unlike the number/dot pair these rules
   override the expanded ones rather than sitting beside them. */
.itrela-drawer.mud-drawer--closed .itrela-nav .mud-nav-link[data-badge-display="failed"]::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 11px;
    transform: none;
    margin: 0;
    min-width: 9px;
    width: 9px;
    height: 9px;
    padding: 0;
    border: 2px solid var(--mud-palette-drawer-background);
    border-radius: var(--itrela-radius-pill);
    box-sizing: border-box;
    background: var(--itrela-chalk);
    color: transparent;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}

/* Click-away veil for the 1024px compact-rail 240px overlay; inactive outside
   the 960–1099.98px band. */
.itrela-compact-nav-veil {
    display: none;
}

/* The mockup's compact breakpoint is 1100px, while the drawer component's
   mobile breakpoint remains 960px. In the in-between laptop band the rail
   defaults to a real 72px mini rail and expands as a 240px overlay when the
   user clicks the seam toggle, keeping SALES/MONEY/ACCOUNTING reachable. */
@media (min-width: 960px) and (max-width: 1099.98px) {
    .itrela-compact-nav-veil {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1190;
        background: color-mix(in oklab, var(--mud-palette-dark), transparent 72%);
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) {
        width: 72px !important;
        overflow: hidden !important;
    }

    .itrela-drawer.itrela-drawer--compact-expanded {
        width: 240px !important;
        z-index: 1200 !important;
        box-shadow: var(--itrela-shadow-float);
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .mud-drawer-content {
        overflow-x: hidden !important;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-brand {
        justify-content: center;
        padding: 14px 0;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-brand-name,
    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-group-label,
    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-discovery {
        display: none !important;
    }

    /* Same collapsed shape as the saved-preference mini rail above: group
       headers stay as icon-only rows and a group's children render only
       while the group is open. */
    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-accordion-header {
        position: relative;
        width: 44px;
        min-height: 42px;
        justify-content: center;
        padding: 0;
        border-radius: var(--itrela-radius-surface);
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-accordion-text {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-accordion-chevron {
        display: none;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-accordion-lead {
        display: block;
        color: var(--itrela-chalk);
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-accordion-body {
        width: 100%;
        align-items: center;
        padding-bottom: 0;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="number"][data-count]:not([data-count=""]) {
        position: absolute;
        top: 3px;
        right: 11px;
        min-width: 9px;
        width: 9px;
        height: 9px;
        padding: 0;
        border: 2px solid var(--mud-palette-drawer-background);
        border-radius: var(--itrela-radius-pill);
        box-sizing: border-box;
        background: var(--itrela-rail-copper);
        color: transparent;
        font-size: 0;
        line-height: 0;
        overflow: hidden;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="dot"] {
        position: absolute;
        top: 3px;
        right: 11px;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-accordion-header[aria-expanded="false"] .itrela-nav-accordion-badge[data-badge-display="failed"] {
        position: absolute;
        top: 3px;
        right: 11px;
        width: 9px;
        height: 9px;
        padding: 0;
        border: 2px solid var(--mud-palette-drawer-background);
        border-radius: var(--itrela-radius-pill);
        box-sizing: border-box;
        background: var(--itrela-chalk);
        color: transparent;
        font-size: 0;
        line-height: 0;
        overflow: hidden;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav {
        align-items: center;
        padding: 0 14px !important;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav .mud-nav-link {
        width: 44px;
        min-height: 42px;
        justify-content: center;
        padding: 0 !important;
        border-radius: var(--itrela-radius-surface) !important;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav .mud-nav-item,
    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav .itrela-notif-menu {
        width: 44px;
    }

    /* Constrain collapsed timer/working chip strictly to 44px in CSS only. */
    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-timer-nav {
        width: 44px;
        max-width: 44px;
        min-height: 42px;
        justify-content: center;
        padding: 6px;
        gap: 0;
        overflow: hidden;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-working-nav-link {
        flex: 0 0 auto;
        justify-content: center;
        gap: 0;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-timer-nav .itrela-timer-ticket,
    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-timer-nav .itrela-timer-elapsed {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .mud-nav-link-text {
        display: block !important;
        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;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .mud-nav-link .mud-nav-link-icon {
        margin: 0 !important;
        /* Same reason as the manual 72px rail: with the label hidden the icon
           is the only thing carrying the link, so it takes the text weight. */
        color: var(--itrela-chalk) !important;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-scrollzone {
        overflow-y: auto;
        scrollbar-width: none;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav-scrollzone::-webkit-scrollbar {
        display: none;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-drawer-footer {
        flex-direction: column;
        padding: 8px 14px 12px;
        align-items: center;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav.itrela-nav-bottom {
        flex-direction: column;
        padding: 0 !important;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav.itrela-nav-bottom .mud-nav-link {
        width: 44px;
        min-height: 42px;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-user-menu {
        flex: 0 0 44px;
        width: 44px !important;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-account-trigger {
        display: grid;
        grid-template-columns: 30px;
        box-sizing: border-box;
        width: 44px;
        min-height: 44px;
        justify-content: center;
        justify-items: center;
        padding: 4px;
        gap: 0;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-account-copy,
    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-working-clear {
        display: none;
    }

    .itrela-drawer.mud-drawer-mini.mud-drawer--open ~ .mud-main-content.itrela-content,
    .itrela-drawer.mud-drawer-mini.mud-drawer--closed ~ .mud-main-content.itrela-content,
    body .mud-main-content.itrela-content {
        margin-left: 72px !important;
        margin-inline-start: 72px !important;
    }

    /* Keep the seam toggle visible in the 960–1099.98px band so the 72px rail
       can expand as a 240px overlay without shifting page content. */
    .itrela-seam-toggle:not(.is-compact-expanded) {
        left: calc(var(--mud-drawer-width-mini-left, 72px) - 14px);
    }

    .itrela-seam-toggle.is-expanded:not(.is-compact-expanded) .itrela-seam-icon {
        transform: rotate(180deg);
    }

    .itrela-seam-toggle.is-compact-expanded {
        left: calc(var(--mud-drawer-width-left, 240px) - 14px);
        z-index: 1210;
    }

    .itrela-seam-toggle.is-collapsed.is-compact-expanded .itrela-seam-icon {
        transform: rotate(180deg);
    }

    .mud-main-content.itrela-content .service-desk {
        max-width: 1600px;
    }

    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav .mud-nav-link[data-badge-display="number"][data-count]:not([data-count=""])::after {
        position: absolute;
        top: 3px;
        right: 11px;
        margin: 0;
        min-width: 9px;
        width: 9px;
        height: 9px;
        padding: 0;
        border-radius: var(--itrela-radius-pill);
        box-sizing: border-box;
        border: 2px solid var(--mud-palette-drawer-background);
        background: var(--itrela-rail-copper);
        color: transparent;
        content: "";
        font-size: 0;
        line-height: 0;
    }

    /* Same swap as the saved-collapse rail: a failed count is a chalk mark in
       the count dot's place, never the trailing "!" the 240px rail can fit. */
    .itrela-drawer:not(.itrela-drawer--compact-expanded) .itrela-nav .mud-nav-link[data-badge-display="failed"]::after {
        content: "";
        position: absolute;
        top: 3px;
        right: 11px;
        transform: none;
        margin: 0;
        min-width: 9px;
        width: 9px;
        height: 9px;
        padding: 0;
        border: 2px solid var(--mud-palette-drawer-background);
        border-radius: var(--itrela-radius-pill);
        box-sizing: border-box;
        background: var(--itrela-chalk);
        color: transparent;
        font-size: 0;
        line-height: 0;
        overflow: hidden;
    }
}

/* ── Billing Page ────────────────────────────────────────────────── */
/* Global styles for the billing page layout components.              */

/* Cycle card — "this month's billing" state + prompts */
.billing-page .billing-cycle {
    border-color: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 55%) !important;
}

.billing-page .billing-cycle-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.billing-page .billing-cycle-prompt {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px dashed var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-control);
    font-size: var(--itrela-text-14);
}

.billing-page .billing-cycle-prompt > span:first-of-type {
    flex: 1;
    min-width: 220px;
}

/* Section wrappers */
.billing-page .billing-section {
    padding: 24px;
}

.billing-page .billing-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

/* Accounting export dialog (Phase 8.3) */
.accounting-export-guidance-list {
    margin: 6px 0 0;
    padding-left: 18px;
    font-size: var(--itrela-text-13);
    line-height: 1.45;
}

.accounting-export-guidance-list li + li {
    margin-top: 4px;
}

/* Period quick-select bar */
.billing-page .billing-period-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.billing-page .billing-period-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.billing-page .billing-period-label {
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-14);
    min-width: 180px;
    text-align: center;
    white-space: nowrap;
}

.billing-page .billing-period-presets {
    display: flex;
    gap: 4px;
}

/* PARITY-2j confirm lines: one sentence and one or two actions, never a chip wall. */
.billing-page .billing-confirm-line {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 10px;
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 45%);
    border-radius: var(--itrela-radius-surface);
    background: var(--mud-palette-surface);
    font-size: var(--itrela-text-14);
}

/* The drawn invoice tabs are a quiet underline row, not status chips. */
.billing-page .billing-tabs {
    display: flex;
    overflow-x: auto;
    margin: 0 0 8px;
    padding: 0 2px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    scrollbar-width: thin;
}

.billing-page .billing-tab {
    position: relative;
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 13px;
    border: 0;
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font: inherit;
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    cursor: pointer;
}

.billing-page .billing-tab:hover {
    color: var(--mud-palette-text-primary);
    background: color-mix(in oklab, var(--mud-palette-background), transparent 45%);
}

/* The active tab speaks in the accent, matching its underline. */
.billing-page .billing-tab--active {
    color: var(--mud-palette-primary);
}

.billing-page .billing-tab--active::after {
    position: absolute;
    right: 8px;
    bottom: -1px;
    left: 8px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--mud-palette-primary);
    content: "";
}

.billing-page .billing-tab--warning::before {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 6px 1px 0;
    border-radius: 50%;
    background: var(--itrela-status-warning);
    content: "";
}

.billing-page .billing-tab:focus-visible {
    z-index: 1;
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -3px;
    border-radius: var(--itrela-radius-control);
}

/* Irreversible batch arc: each invoice gets one plain-language status. */
.billing-page .billing-arc {
    display: flex;
    flex-direction: column;
}

.billing-page .billing-arc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 14px;
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 55%);
    font-size: var(--itrela-text-13);
}

.billing-page .billing-arc-row:first-child {
    border-top: 0;
}

.billing-page .billing-arc-copy {
    min-width: 0;
}

.billing-page .billing-arc-reason {
    margin-top: 2px;
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
}

.billing-page .billing-arc-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.billing-page .billing-arc-stat {
    margin-left: auto;
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    white-space: nowrap;
}

.billing-page .billing-arc-actions .billing-arc-stat {
    margin-left: 0;
}

.billing-page .billing-arc-stat--ok {
    color: var(--mud-palette-success);
}

.billing-page .billing-arc-stat--run {
    color: var(--mud-palette-primary);
}

.billing-page .billing-arc-stat--wait {
    color: var(--mud-palette-text-secondary);
    font-weight: var(--itrela-weight-medium);
}

.billing-page .billing-arc-stat--err {
    color: var(--mud-palette-error);
}

.billing-page .billing-batch--failed {
    border-color: color-mix(in oklab, var(--mud-palette-error), transparent 65%) !important;
}

/* Card-foot pager + quiet links. */
.billing-page .billing-card-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 14px;
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 55%);
}

.billing-page .billing-muted {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
}

.billing-page .billing-link-btn {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--mud-palette-primary);
    font: inherit;
    cursor: pointer;
}

.billing-page .billing-link-btn:hover {
    text-decoration: underline;
}

.billing-page .billing-link-btn:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--mud-palette-primary), white 55%);
    outline-offset: 1px;
    border-radius: var(--itrela-radius-small);
}

/* One status cell, with a quieter sent/due/lateness line beneath it. */
.billing-page .billing-status-sub {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
    white-space: nowrap;
}

.billing-page .billing-status-sub--warn {
    color: var(--mud-palette-warning);
}

.billing-page .billing-status-sub--crit {
    color: var(--mud-palette-error);
}

@media (max-width: 700px) {
    .billing-page .billing-section {
        padding: 16px;
    }
}

@media (max-width: 599.98px) {
    .billing-page .billing-cycle-main {
        flex-direction: column;
        align-items: stretch;
    }

    .billing-page .billing-cycle-main > .mud-stack {
        width: 100%;
        flex-wrap: wrap;
    }

    .billing-page .billing-arc-row--action {
        align-items: flex-start;
        flex-direction: column;
    }

    .billing-page .billing-arc-actions {
        width: 100%;
        margin-left: 0;
    }
}

/* ── Billing Page – MudBlazor overrides ─────────────────────────── */
/* Global overrides scoped by .billing-page wrapper class.           */

.billing-page .billing-section .mud-table {
    background: transparent !important;
    box-shadow: none !important;
}

.billing-page .billing-section .mud-table-container {
    border-radius: var(--itrela-radius-control) !important;
    border: 1px solid var(--mud-palette-lines-default) !important;
    overflow: hidden !important;
}

/* The table standard, second copy: head, row floor, inset and hover are
   kept identical to .data-grid-container so billing tables read the same
   as the Clients/Users grids. */
.billing-page .billing-section .mud-table-head .mud-table-cell {
    height: 34px;
    font-size: var(--itrela-text-12) !important;
    font-weight: var(--itrela-weight-strong) !important;
    letter-spacing: var(--itrela-caps-tracking) !important;
    word-spacing: var(--itrela-label-word-spacing);
    text-transform: uppercase !important;
    color: var(--mud-palette-text-secondary) !important;
    padding: 0 22px !important;
    background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 42%) !important;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%) !important;
}

.billing-page .billing-section .mud-table-body .mud-table-row {
    min-height: 44px;
}

.billing-page .billing-section .mud-table-body .mud-table-cell {
    height: 44px;
    padding: 4px 22px !important;
    font-size: var(--itrela-text-14) !important;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 52%);
}

.billing-page .billing-section .mud-table-hover .mud-table-body .mud-table-row:hover {
    background: var(--mud-palette-table-striped);
}

/* The cell-level itrela-mono/itrela-num-cell restatement lives with the machine-value
   utilities near the top of this file (app-wide, not billing-only). Only the
   right-alignment nudge for Mud's cell rule stays here. */
.billing-page .mud-table .mud-table-cell.itrela-num-cell {
    text-align: right;
}

/* Invoice numbers never break mid-ID; the ID column keeps room for them
   while low-value columns (Delivery/Due dashes) give up space first. */
.billing-page .billing-invoice-id {
    white-space: nowrap;
}

.billing-page th.billing-invoice-id-col {
    min-width: 9rem;
}

/* Invoice rows keep the two drawn quick actions and overflow trigger together;
   draft approval remains a short text action beside the same menu. */
.billing-page .billing-invoice-actions {
    min-width: 116px;
    justify-content: flex-end;
}

.billing-page .billing-invoice-actions .mud-button-root {
    white-space: nowrap;
}

/* Nested draft line-item breakdown (a MudSimpleTable inside an expanded preview
   row) — plain <thead>/<tbody>, so it needs the standard head by element. */
.billing-page .billing-section .mud-simple-table thead th {
    height: 34px;
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: var(--itrela-caps-tracking);
    word-spacing: var(--itrela-label-word-spacing);
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    text-align: left;
    padding: 10px 22px;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.billing-page .billing-section .mud-simple-table tbody td {
    height: 44px;
    padding: 10px 22px;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 52%);
}

.billing-page .billing-section .mud-table-foot .mud-table-cell {
    border-top: 1px solid var(--mud-palette-lines-default) !important;
    padding: 6px 22px !important;
}

/* MudBlazor 9's pager wrapper (.mud-table-pagination) is display:inline with
   a block toolbar child — border/padding on the wrapper paint as orphan
   ~20px hairline stubs at the card's left edge (the leftover inline
   fragments). Keep the wrapper inert; the toolbar carries the divider. */
.billing-page .billing-section .mud-table-pagination {
    border-top: 0 !important;
    padding: 0 !important;
}

.billing-page .billing-section .mud-table-pagination-toolbar {
    border-top: 1px solid var(--mud-palette-lines-default) !important;
}

/* Tabs (Pending / Paid / Voided) */
.billing-page .billing-section .mud-tabs .mud-tabs-tabbar {
    background: transparent !important;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
    min-height: 40px !important;
}

.billing-page .billing-section .mud-tabs .mud-tab {
    min-height: 40px !important;
    font-size: var(--itrela-text-13) !important;
    font-weight: var(--itrela-weight-strong) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding: 0 16px !important;
}

.billing-page .billing-section .mud-tabs-panels {
    padding: 0 !important;
}

/* Expansion panel (Billing Run History) */
.billing-page .mud-expand-panel {
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: var(--itrela-radius-control) !important;
    overflow: hidden !important;
    box-shadow: none !important;
}

.billing-page .mud-expand-panel::before {
    display: none !important;
}

.billing-page .mud-expand-panel .mud-expand-panel-header {
    padding: 12px 20px !important;
    min-height: 48px !important;
    font-weight: var(--itrela-weight-strong) !important;
}

.billing-page .mud-expand-panel .mud-expand-panel-content {
    padding: 0 20px 16px !important;
}

.billing-page .mud-expand-panel .mud-table-container {
    border-radius: var(--itrela-radius-control) !important;
    border: 1px solid var(--mud-palette-lines-default) !important;
    overflow: hidden !important;
}

/* Third copy of the table standard (Billing Run History). Head fill,
   row floor, inset and hover are kept identical to .data-grid-container —
   the source of truth — so the run-history table reads like every other
   grid. The old background/surface mix only ever went lighter, which left
   the head invisible on the white light surface. */
.billing-page .mud-expand-panel .mud-table-head .mud-table-cell {
    height: 34px;
    font-size: var(--itrela-text-12) !important;
    font-weight: var(--itrela-weight-strong) !important;
    letter-spacing: var(--itrela-caps-tracking) !important;
    word-spacing: var(--itrela-label-word-spacing);
    text-transform: uppercase !important;
    color: var(--mud-palette-text-secondary) !important;
    padding: 0 22px !important;
    background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 42%) !important;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%) !important;
}

.billing-page .mud-expand-panel .mud-table-body .mud-table-row {
    min-height: 44px;
}

.billing-page .mud-expand-panel .mud-table-body .mud-table-cell {
    height: 44px;
    padding: 4px 22px !important;
    font-size: var(--itrela-text-14) !important;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 52%);
}

.billing-page .mud-expand-panel .mud-table-hover .mud-table-body .mud-table-row:hover {
    background: var(--mud-palette-table-striped);
}

/* Alert & Paper rounding */
.billing-page .billing-section .mud-alert {
    border-radius: var(--itrela-radius-control) !important;
}

/* Period chip cursor */
.billing-page .billing-period-presets .mud-chip {
    cursor: pointer !important;
}

@media (max-width: 700px) {

    .billing-page .billing-section .mud-table-body .mud-table-cell,
    .billing-page .billing-section .mud-table-head .mud-table-cell {
        padding: 8px 10px;
    }

    .billing-page .billing-invoice-actions {
        justify-content: flex-end;
        min-width: 0;
    }
}

/* == Table column headings (the shared kit, 2026-11-18) =============
   One heading look for every standard data table: 12px, strong, capitals
   with the caps tracking, quiet ink, and no fill band. The heading sits on
   the table's own surface (a sticky heading still needs an opaque one) and
   the hairline under it is its only edge. These restate the rules above for
   the standard container and the billing mirrors, so they win over them
   without editing them. The capitals come from those rules; they stay on
   table headings and the rail's group labels only. */
.data-grid-container .mud-table-head th.mud-table-cell,
.billing-page .billing-section .mud-table-head .mud-table-cell,
.billing-page .mud-expand-panel .mud-table-head .mud-table-cell {
    font-size: var(--itrela-text-12) !important;
    font-weight: var(--itrela-weight-strong) !important;
    letter-spacing: var(--itrela-caps-tracking) !important;
    word-spacing: var(--itrela-label-word-spacing);
    color: var(--mud-palette-text-secondary) !important;
    background: var(--mud-palette-surface) !important;
}

.data-grid-container thead th:not(.mud-table-cell),
.billing-page .billing-section .mud-simple-table thead th {
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    letter-spacing: var(--itrela-caps-tracking);
    word-spacing: var(--itrela-label-word-spacing);
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-surface);
}

/* == Client portal (Phase 8.5) ==================================== */
/* Portal page-level styles live globally (layout-scoped CSS cannot
   reach page markup). All classes are portal- prefixed. */

.portal-card-wrap {
    max-width: 420px;
    margin: max(6vh, 16px) auto 0;
}

.portal-card {
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 20%);
    border-radius: var(--itrela-radius-card, 14px);
    background: var(--mud-palette-surface);
    box-shadow: none;
}

.portal-auth-card {
    overflow: hidden;
    border-color: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 74%);
    box-shadow: none;
}

/* Portal restyle: every route uses the same quiet page, panel, and loading
   grammar while the active MSP's theme owns all branded color. */
.portal-page {
    min-width: 0;
}

.portal-page-head {
    min-width: 0;
}

/* Portal card titles are .portal-card-title (the shared card title, with
   .dash-card-title); a quiet line written under one keeps a little air. */
.portal-card-title + .mud-typography {
    margin-top: var(--itrela-space-4);
}

.portal-page-head--tinted {
    padding: clamp(16px, 3vw, 24px);
    border: 1px solid color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 78%);
    border-radius: var(--itrela-radius-card, 14px);
    background: linear-gradient(
        135deg,
        var(--itrela-portal-accent-tint),
        color-mix(in oklab, var(--mud-palette-surface), var(--itrela-portal-accent-tint) 30%));
}

.portal-panel,
.portal-form-card,
.portal-profile-card,
.portal-article-card,
.portal-sign-card,
.portal-token-card,
.portal-state-card {
    box-shadow: none;
}

.portal-route-loading {
    display: flex;
    min-height: 144px;
    align-items: center;
    justify-content: center;
}

.portal-route-loading .mud-progress-linear {
    width: 100%;
}

.portal-route-skeleton {
    padding: 16px;
}

.portal-chat-loading-region {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.portal-new-request-drop {
    position: relative;
}

.portal-token-stage {
    width: 100%;
    max-width: 620px;
    margin: clamp(18px, 5vh, 48px) auto 0;
}

.portal-token-stage .portal-fail-wrap {
    margin-top: 0;
}

.portal-token-card {
    overflow: hidden;
}

.portal-sign-stage {
    display: flex;
    width: 100%;
    max-width: 780px;
    margin-inline: auto;
    flex-direction: column;
}

.portal-sign-heading {
    margin-bottom: 4px;
}

.portal-sign-downloads,
.portal-form-files {
    flex-wrap: wrap;
}

.portal-form-files {
    gap: 6px;
}

.portal-form-actions,
.portal-invoice-downloads {
    gap: 10px;
}

.portal-search-band {
    padding: 12px;
    border: 1px solid color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 84%);
    border-radius: var(--itrela-radius-tile, 12px);
    background: color-mix(in oklab, var(--itrela-portal-accent-tint), var(--mud-palette-surface) 64%);
}

.portal-pay-layout {
    gap: 12px;
}

.portal-pay-copy {
    min-width: 0;
    flex: 1;
}

.portal-auth-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--itrela-radius-surface);
    background: var(--itrela-portal-accent-tint, color-mix(in srgb, var(--mud-palette-primary) 12%, transparent));
    color: var(--mud-palette-primary);
}

.portal-auth-icon-ok {
    background: color-mix(in srgb, var(--mud-palette-success) 12%, transparent);
    color: var(--mud-palette-success);
}

/* Demo instances only (Demo:Mode, DX-3): "See what your client sees" above
   the portal's email form. A demo has no mailbox, so the emailed link can
   never arrive and this is the way in; it holds the screen's only filled
   button. */
.portal-auth-demo {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 78%);
    border-radius: var(--itrela-radius-tile, 12px);
    background: color-mix(in oklab, var(--itrela-portal-accent-tint), var(--mud-palette-surface) 50%);
}

.portal-auth-wrong-door,
.portal-auth-escape {
    padding-top: 12px;
    border-top: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-13);
    line-height: 1.5;
}

.portal-auth-wrong-door a,
.portal-auth-escape a {
    color: var(--mud-palette-primary);
    font-weight: var(--itrela-weight-strong);
}

.portal-auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.portal-auth-brand-logo-frame {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    max-width: 200px;
    height: 36px;
    flex: 0 1 auto;
}

.portal-auth-brand-logo-frame.portal-brand-logo-frame--dark {
    padding: 4px 8px;
    border-radius: var(--itrela-radius-control);
    background: color-mix(in srgb, var(--mud-palette-white) 92%, transparent);
}

.portal-auth-brand-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

.portal-auth-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--itrela-radius-control);
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--mud-palette-primary), var(--mud-palette-primary-darken));
    color: var(--mud-palette-primary-text);
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-strong);
    overflow: hidden;
}

.portal-auth-brand-mark--image {
    background: transparent;
}

.portal-auth-brand-mark-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.portal-auth-brand-name {
    overflow: hidden;
    font-size: var(--itrela-text-15);
    font-weight: var(--itrela-weight-strong);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-auth-welcome {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-lines-default) 78%);
    border-radius: var(--itrela-radius-control);
    background: color-mix(in oklab, var(--itrela-portal-accent-tint), var(--mud-palette-surface) 60%);
    color: var(--mud-palette-text-primary);
    font-size: var(--itrela-text-13);
    line-height: 1.5;
}

.portal-auth-escape-heading {
    margin-bottom: 4px;
    font-weight: var(--itrela-weight-medium);
}

.portal-auth-escape-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
}

.portal-auth-support-hours {
    margin-top: 4px;
    font-size: var(--itrela-text-12);
}

.portal-share-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.portal-share-field-row--multiline {
    align-items: flex-start;
}

.portal-share-field-input {
    flex: 1;
    min-width: 0;
}

.portal-share-field-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.portal-continue {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--itrela-radius-control);
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font: inherit;
    font-size: var(--itrela-text-16);
    font-weight: var(--itrela-weight-strong);
    cursor: pointer;
    transition: filter 0.15s ease;
}

.portal-continue:hover {
    filter: brightness(1.05);
}

.portal-continue:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--mud-palette-primary) 40%, transparent);
    outline-offset: 2px;
}

/* Portal ticket list rows */
.portal-ticket-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-surface);
    background: var(--mud-palette-surface);
    text-decoration: none;
    color: var(--mud-palette-text-primary);
    min-width: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.portal-ticket-row:hover {
    background: var(--mud-palette-action-default-hover);
    border-color: color-mix(in srgb, var(--mud-palette-primary) 35%, var(--mud-palette-lines-default));
}

.portal-ticket-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.portal-ticket-title {
    font-weight: var(--itrela-weight-strong);
    overflow-wrap: anywhere;
}

.portal-ticket-snippet {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-14);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60ch;
}

.portal-ticket-time {
    color: var(--mud-palette-text-disabled);
    font-size: var(--itrela-text-12);
}

.portal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 40px 16px;
    text-align: center;
    color: var(--mud-palette-text-secondary);
}

.portal-empty .mud-icon-root {
    font-size: 2.6rem;
    opacity: 0.4;
}

.portal-narrow {
    max-width: 640px;
}

.portal-tabs .mud-tabs-panels {
    padding-top: 16px;
}

/* Portal home leaf components render outside Home.razor's CSS-isolation
   scope, so their shared card grammar lives here. The portal prefix keeps
   the client surface independent from staff dashboard cards. */
.portal-home-card {
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-surface);
    background: var(--mud-palette-surface);
}

.portal-home-card--money {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 32%, var(--mud-palette-lines-default));
}

.portal-home-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 16px;
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 70%, transparent);
}

.portal-home-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.portal-home-rows {
    display: flex;
    flex-direction: column;
}

.portal-home-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    color: var(--mud-palette-text-primary);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 55%, transparent);
}

.portal-home-row:last-child {
    border-bottom: 0;
}

.portal-home-row:hover {
    background: var(--mud-palette-action-default-hover);
}

.portal-home-row:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: calc(var(--itrela-focus-offset) * -1);
}

.portal-home-row-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.portal-home-row-title {
    overflow-wrap: anywhere;
    font-weight: var(--itrela-weight-strong);
}

.portal-home-row-detail {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-13);
}

/* The money row's Pay is a drawn 30px outlined button, not a text link. */
.portal-home-pay {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 13px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-control);
    color: var(--mud-palette-text-primary);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    white-space: nowrap;
}

.portal-home-card-foot {
    display: block;
    padding: 10px 16px;
    border-top: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 55%, transparent);
}

.portal-home-all-clear {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    color: var(--mud-palette-success);
    font-size: var(--itrela-text-14);
}

.portal-home-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px;
    text-align: center;
}

.portal-home-empty .mud-button-root {
    margin-top: 7px;
}

.portal-home-state-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 13px 16px;
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-14);
}

.portal-home-visit {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px 16px;
}

.portal-home-visit .portal-home-visit-action {
    align-self: flex-start;
    margin-top: 8px;
}

@media (max-width: 600px) {
    .portal-home-card-head,
    .portal-home-row {
        align-items: stretch;
        flex-direction: column;
    }

    .portal-home-head-actions {
        align-items: stretch;
        justify-content: flex-start;
    }

    .portal-home-head-actions .mud-button-root {
        width: 100%;
    }

    /* The row stacks, but a status chip keeps its own width, as on Requests. */
    .portal-home-row .itrela-status-chip {
        align-self: flex-start;
    }
}

/* Profile page (12.9): plain definition rows, mobile-first. */
.portal-profile-rows {
    display: flex;
    flex-direction: column;
}

.portal-profile-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    font-size: var(--itrela-text-14);
}

.portal-profile-row:last-child {
    border-bottom: none;
}

.portal-profile-key {
    color: var(--mud-palette-text-secondary);
}

.portal-profile-val {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 480px) {
    /* Phone browsers normally use transient overlay scroll indicators. The
       desktop Chromium track used by responsive testing instead reserves a
       permanent gutter, making the fixed app bar look short and misaligned.
       Hide only the root track; scrolling still works by touch, wheel, keys,
       and assistive technology, while nested drawers/menus keep their own
       visible scrollbars. */
    html {
        scrollbar-width: none !important;
    }

    body {
        scrollbar-width: none !important;
    }

    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

    .portal-profile-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

.portal-cap-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
}

.portal-cap-row .mud-icon-root {
    margin-top: 2px;
}

.portal-contact-link {
    color: var(--mud-palette-primary);
    text-decoration: none;
}

.portal-contact-link:hover {
    text-decoration: underline;
}

/* Receipt strip (12.9): the request detail acknowledges "we've got it" until
   a human replies — quiet info tint, one line, never a dialog. */
.portal-ack-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin: 8px 0 0;
    border: 1px solid color-mix(in srgb, var(--mud-palette-info) 35%, transparent);
    background: color-mix(in srgb, var(--mud-palette-info) 8%, var(--mud-palette-surface));
    border-radius: var(--itrela-radius-control);
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-14);
}

.portal-ack-strip .mud-icon-root {
    color: var(--mud-palette-info);
    flex-shrink: 0;
}

/* Portal conversation — it reads top down like a document: the request's
   heading, the strips, then the thread growing downward, with the composer
   right after the last message. The page itself scrolls; the composer
   sticks to the bottom of the viewport only once the thread is taller than
   the window (position: sticky does nothing while it fits). The footer
   stays off this page so the composer is the last thing on it. */
.portal-shell:has(.portal-chat-page) .portal-foot {
    display: none;
}

.portal-main:has(.portal-chat-page) {
    padding-bottom: var(--itrela-space-12);
}

.portal-chat-page {
    position: relative;
    display: flex;
    flex-direction: column;
}

.portal-chat-page .portal-chat-heading {
    margin-bottom: var(--itrela-space-8);
}

.portal-chat-sub {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.portal-handler {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.portal-handler-avatar {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 50%;
    object-fit: cover;
}

.portal-chat-status {
    flex-shrink: 0;
}

/* The thread wrapper keeps its old name; it no longer scrolls on its own. */
.portal-chat-scroll {
    padding: 14px 2px 10px;
}

.portal-chat-thread {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.portal-chat-sys {
    text-align: center;
    color: var(--mud-palette-text-disabled);
    font-size: var(--itrela-text-12);
}

.portal-chat-day {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--mud-palette-text-disabled);
    font-size: var(--itrela-text-12);
}

.portal-chat-day::before,
.portal-chat-day::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--mud-palette-lines-default);
}

/* One message row: optional avatar + (meta line above bubble) */
.portal-msg {
    display: flex;
    gap: 8px;
    max-width: min(85%, 620px);
}

.portal-msg-client {
    align-self: flex-end;
}

.portal-msg-msp {
    align-self: flex-start;
}

.portal-msg-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 2px;
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 14%, var(--mud-palette-surface));
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    overflow: hidden;
}

.portal-msg-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-msg-avatar img.portal-msg-avatar-mark {
    object-fit: contain;
    padding: 3px;
}

.portal-msg-avatar-msp {
    background: color-mix(in srgb, var(--mud-palette-primary) 16%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
}

.portal-msg-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.portal-msg-client .portal-msg-main {
    align-items: flex-end;
}

.portal-msg-meta {
    display: flex;
    gap: 6px;
    padding: 0 4px;
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
}

.portal-msg-author {
    font-weight: var(--itrela-weight-strong);
}

.portal-bubble {
    width: fit-content;
    max-width: 100%;
    padding: 10px 14px;
    border-radius: var(--itrela-radius-surface);
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    overflow-wrap: anywhere;
}

.portal-bubble-client {
    border-bottom-right-radius: 6px;
    background: color-mix(in srgb, var(--mud-palette-primary) 11%, var(--mud-palette-surface));
    border-color: color-mix(in srgb, var(--mud-palette-primary) 24%, transparent);
}

.portal-bubble-msp {
    border-bottom-left-radius: 6px;
}

.portal-bubble-body {
    white-space: pre-wrap;
}

.portal-bubble-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.portal-bubble-body + .portal-bubble-images,
.portal-bubble-body + .portal-bubble-files,
.portal-bubble-images + .portal-bubble-files {
    margin-top: 8px;
}

/* Fixed thumbnail boxes: no layout shift when the image loads, so the
   auto-scroll landing spot stays put. */
.portal-msg-image {
    display: block;
    width: 200px;
    height: 150px;
    border-radius: var(--itrela-radius-control);
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background);
}

.portal-msg-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-bubble-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.portal-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-pill);
    text-decoration: none;
    color: var(--mud-palette-text-primary);
    font-size: var(--itrela-text-14);
    background: var(--mud-palette-background);
}

.portal-file-chip:hover {
    background: var(--mud-palette-action-default-hover);
}

/* Composer — right after the last message; sticks to the bottom of the
   viewport only while the thread is taller than the window. The page ground
   behind it hides the messages scrolling underneath. */
.portal-chat-composer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex-shrink: 0;
    padding-top: 10px;
    padding-bottom: max(var(--itrela-space-12), env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background);
}

.portal-composer-box {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-surface);
    background: var(--mud-palette-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.portal-composer-box:focus-within {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-primary) 15%, transparent);
}

.portal-composer-box .mud-input-control {
    margin: 0;
}

.portal-composer-input {
    flex: 1;
    min-width: 0;
}

.portal-composer-input .mud-input {
    padding: 4px 4px 5px;
    font-size: var(--itrela-text-16);
}

.portal-composer-upload {
    align-self: flex-end;
    margin-bottom: 2px;
}

.portal-composer-send {
    align-self: flex-end;
}

.portal-composer-upload .mud-icon-button,
.portal-composer-send,
.portal-csat-actions .mud-icon-button,
.portal-resolution-actions .mud-button-root,
.portal-sign-form-panel form > button,
.portal-new-attach {
    min-width: 44px;
    min-height: 44px;
}

.portal-composer-hint {
    padding: 6px 6px 0;
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-disabled);
    min-height: 1.4em;
}

@media (hover: none) {
    /* Keyboard-shortcut and paste hints mean nothing on touch. */
    .portal-composer-hint {
        display: none;
    }
}

/* A closed request's note is read once; it does not follow the reader. */
.portal-chat-closed {
    position: static;
    padding: 12px 4px 4px;
}

/* Drag-and-drop hint: overlay scoped to the chat page and new-request form,
   click-through so the drop still lands on the page's own listeners. */
.portal-chat-page.portal-dropping::after,
.portal-new-request-drop.portal-dropping::after {
    content: "Drop files to attach";
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-16);
    color: var(--mud-palette-primary);
    border: 2px dashed color-mix(in srgb, var(--mud-palette-primary) 55%, transparent);
    border-radius: var(--itrela-radius-surface);
    background: color-mix(in srgb, var(--mud-palette-surface) 82%, transparent);
    backdrop-filter: blur(2px);
}

/* Portal invoices */
.portal-invoice-total {
    font-weight: var(--itrela-weight-strong);
    white-space: nowrap;
}

.portal-pay-card {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 35%, transparent);
}

.portal-invoice-table-wrap {
    overflow-x: auto;
}

.portal-invoice-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--itrela-text-14);
}

.portal-invoice-table th,
.portal-invoice-table td {
    padding: 10px 22px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    text-align: left;
    overflow-wrap: anywhere;
}

/* The drawn lines head (Contracts 03): small, 700, tracked uppercase on the
   quiet tint. */
.portal-invoice-table th {
    background: color-mix(in oklab, var(--mud-palette-background), var(--mud-palette-lines-default) 42%);
    color: var(--mud-palette-text-secondary);
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-12);
    letter-spacing: var(--itrela-caps-tracking);
    word-spacing: var(--itrela-label-word-spacing);
    text-transform: uppercase;
}

.portal-invoice-table .portal-num {
    text-align: right;
    white-space: nowrap;
}

/* Money and quantity cells are data: mono face, tabular digits, right edge.
   The tfoot's colspan labels stay Archivo — prose is prose. */
.portal-invoice-table tbody .portal-num,
.portal-invoice-table tfoot td.portal-num:not([colspan]) {
    font-family: var(--itrela-font-mono);
    word-spacing: normal;
    font-variant-numeric: tabular-nums;
    font-synthesis-weight: none;
}

.portal-invoice-table tfoot td {
    border-bottom: none;
    padding-top: 6px;
    padding-bottom: 2px;
}

.portal-invoice-total-row td {
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-16);
    padding-top: 8px;
}

/* Settings → Email: outgoing-mail routing rows */
.routing-row {
    padding: 10px 0;
    border-top: 1px solid var(--mud-palette-lines-default);
}
.routing-row:first-of-type {
    border-top: none;
    padding-top: 0;
}

/* ===== Calendar workspace (Phase 11.2, docs/SCHEDULING-ARCHITECTURE.md D10) ===== */

.calendar-page .cal-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.calendar-page .cal-period-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.calendar-page .cal-period-label {
    min-width: 172px;
    text-align: center;
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-16);
}

.calendar-page .cal-toolbar-spacer {
    flex: 1 1 auto;
}

.calendar-page .cal-tech-search {
    flex: 0 1 220px;
    min-width: 180px;
}

.calendar-page .cal-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 360px;
    flex-wrap: nowrap;
    min-width: 220px;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.calendar-page .cal-legend .mud-chip {
    flex: 0 0 auto;
}

.calendar-page .cal-canceled-switch {
    margin-left: 4px;
}

.cal-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 6px;
    background: var(--cal-accent, var(--mud-palette-text-secondary));
    flex: 0 0 auto;
}

/* Per-tech accent hues — fills derive via color-mix so dark mode is free. */
.cal-accent-c0, .cal-dot-c0 { --cal-accent: #4f7cff; }
.cal-accent-c1, .cal-dot-c1 { --cal-accent: #2eaa6e; }
.cal-accent-c2, .cal-dot-c2 { --cal-accent: #d98324; }
.cal-accent-c3, .cal-dot-c3 { --cal-accent: #9d5cf0; }
.cal-accent-c4, .cal-dot-c4 { --cal-accent: #14a3b8; }
.cal-accent-c5, .cal-dot-c5 { --cal-accent: #e2547a; }
.cal-accent-c6, .cal-dot-c6 { --cal-accent: #7a8c2e; }
.cal-accent-c7, .cal-dot-c7 { --cal-accent: #b8562e; }
.cal-accent-c8, .cal-dot-c8 { --cal-accent: #8a93a6; }

.calendar-page .cal-head {
    display: grid;
    grid-template-columns: 56px repeat(var(--cal-days), minmax(var(--cal-lane-min), 1fr));
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.calendar-page .cal-head-day {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    padding: 6px 0;
    font-size: var(--itrela-text-14);
    color: var(--mud-palette-text-secondary);
}

.calendar-page .cal-head-day .cal-head-num {
    font-weight: var(--itrela-weight-strong);
    color: var(--mud-palette-text-primary);
}

.calendar-page .cal-head-day.cal-today-head .cal-head-num {
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-contrast-text);
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.calendar-page .cal-allday-row {
    display: grid;
    grid-template-columns: 56px repeat(var(--cal-days), minmax(var(--cal-lane-min), 1fr));
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
    min-height: 32px;
}

.calendar-page .cal-allday-gutter {
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
    text-align: right;
    padding: 6px 6px 0 0;
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
}

.calendar-page .cal-allday-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 3px;
    border-left: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 55%);
    cursor: pointer;
}

.calendar-page .cal-allday-cell:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 94%);
}

.calendar-page .cal-allday-zone {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 22px;
}

.calendar-page .cal-scroll {
    max-height: 66vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.calendar-page .cal-grid {
    display: grid;
    grid-template-columns: 56px repeat(var(--cal-days), minmax(var(--cal-lane-min), 1fr));
}

.calendar-page .cal-hour-label {
    height: var(--cal-hour);
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
    text-align: right;
    padding-right: 6px;
    transform: translateY(-7px);
}

.calendar-page .cal-daycol {
    position: relative;
    border-left: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 55%);
}

.calendar-page .cal-daycol.cal-today {
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 97%);
}

.calendar-page .cal-slot-wrap {
    height: var(--cal-slot);
    box-sizing: border-box;
    cursor: pointer;
}

.calendar-page .cal-slot-wrap.cal-slot-hour {
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 55%);
}

.calendar-page .cal-slot-wrap:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 92%);
}

.calendar-page .cal-slot-zone {
    position: relative;
    height: 100%;
    width: 100%;
    min-height: 0;
    padding: 0;
    overflow: visible;
}

/* Idle zones are click-transparent: empty-slot clicks reach the wrapper's
   create handler, and entry blocks spilling over later slots stay clickable.
   cal-board.js stamps .cal-dragging on the page while a drag is live so
   zones can receive dragenter; MudBlazor then marks only the hovered zone
   with cal-zone-can-drop (ApplyDropClassesOnDragStarted is off). Items
   inside a zone re-enable themselves — except during a drag, when they'd
   otherwise sit on top of the slot under the cursor and swallow the drop. */
.calendar-page .cal-slot-zone,
.calendar-page .cal-allday-zone {
    pointer-events: none;
}

.calendar-page.cal-dragging .cal-slot-zone,
.calendar-page.cal-dragging .cal-allday-zone {
    pointer-events: auto;
}

.calendar-page .cal-slot-zone > *,
.calendar-page .cal-allday-zone > * {
    pointer-events: auto;
}

.calendar-page.cal-dragging .cal-slot-zone > *,
.calendar-page.cal-dragging .cal-allday-zone > * {
    pointer-events: none;
}

/* The one zone the drag is over: a clear target with its time as a chip. */
.calendar-page .cal-zone-can-drop {
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 78%);
    box-shadow: inset 0 0 0 2px var(--mud-palette-primary);
    border-radius: var(--itrela-radius-small);
}

.calendar-page .cal-zone-can-drop::after {
    content: attr(data-time);
    position: absolute;
    top: -1px;
    left: 3px;
    z-index: 5;
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    line-height: 1.5;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    border: 1px solid color-mix(in oklab, var(--mud-palette-primary), transparent 55%);
    border-radius: var(--itrela-radius-small);
    padding: 0 5px;
    pointer-events: none;
    white-space: nowrap;
}

.cal-block {
    position: absolute;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    box-sizing: border-box;
    border-radius: var(--itrela-radius-control);
    padding: 2px 6px;
    font-size: var(--itrela-text-12);
    line-height: 1.25;
    overflow: hidden;
    z-index: 3;
    cursor: pointer;
    border-left: 3px solid var(--cal-accent);
    background: color-mix(in oklab, var(--cal-accent), var(--mud-palette-surface) 82%);
    color: var(--mud-palette-text-primary);
}

.cal-block:hover {
    background: color-mix(in oklab, var(--cal-accent), var(--mud-palette-surface) 72%);
}

.cal-block-action {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.cal-block .cal-block-time {
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-12);
    white-space: nowrap;
}

.cal-block .cal-block-title {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.cal-block .cal-block-icon {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    opacity: 0.75;
}

.cal-block .cal-block-ticket {
    display: inline-flex;
    color: inherit;
}

.cal-block.cal-block-allday {
    position: static;
    border-radius: var(--itrela-radius-small);
    padding: 1px 6px;
}

.cal-block.cal-kind-maintenance {
    background-image: repeating-linear-gradient(135deg, transparent 0 6px,
        color-mix(in oklab, var(--cal-accent), transparent 88%) 6px 12px);
}

.cal-block.cal-kind-timeoff,
.cal-block.cal-kind-internal {
    border-left-style: dashed;
    background: color-mix(in oklab, var(--cal-accent), var(--mud-palette-surface) 90%);
}

.cal-block.cal-status-completed {
    opacity: 0.55;
}

.cal-block.cal-status-canceled {
    opacity: 0.5;
    border-left-style: dotted;
}

.cal-block.cal-status-canceled .cal-block-title {
    text-decoration: line-through;
}

.cal-now {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--mud-palette-error);
    z-index: 4;
    pointer-events: none;
}

.cal-now::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mud-palette-error);
}

/* Agenda list — the below-900px rendering (also how 784px stays scroll-free). */
.calendar-page .cal-agenda {
    display: none;
}

.calendar-page .cal-agenda-day {
    padding: 10px 2px;
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.calendar-page .cal-agenda-day:first-of-type {
    border-top: none;
}

.calendar-page .cal-agenda-head {
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-14);
    margin-bottom: 6px;
}

.calendar-page .cal-agenda-today .cal-agenda-head {
    color: var(--mud-palette-primary);
}

.calendar-page .cal-agenda-empty {
    font-size: var(--itrela-text-13);
    color: var(--mud-palette-text-secondary);
    padding: 2px 0 4px;
}

.calendar-page .cal-agenda-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    min-height: 44px;
    width: 100%;
    border: 0;
    border-radius: var(--itrela-radius-control);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    min-width: 0;
}

.calendar-page .cal-agenda-row:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 94%);
}

.calendar-page .cal-agenda-row:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
}

.calendar-page .cal-agenda-row.cal-agenda-muted {
    opacity: 0.55;
}

.calendar-page .cal-agenda-time {
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    white-space: nowrap;
    min-width: 84px;
}

.calendar-page .cal-agenda-title {
    font-size: var(--itrela-text-13);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.calendar-page .cal-agenda-sub {
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-left: auto;
}

/* Capacity strip (D9): information, not judgment — amber, never red alarms. */
.calendar-page .cal-capacity-row {
    display: grid;
    grid-template-columns: 56px repeat(var(--cal-days), minmax(var(--cal-lane-min), 1fr));
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 55%);
}

.calendar-page .cal-capacity-gutter {
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
    text-align: right;
    padding: 3px 6px 3px 0;
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
}

.calendar-page .cal-capacity-cell {
    font-size: var(--itrela-text-12);
    text-align: center;
    padding: 3px 0;
    color: var(--mud-palette-text-secondary);
    border-left: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 55%);
}

.calendar-page .cal-capacity-cell.cal-capacity-over {
    color: color-mix(in oklab, var(--mud-palette-warning), black 22%);
    background: color-mix(in oklab, var(--mud-palette-warning), transparent 88%);
    font-weight: var(--itrela-weight-strong);
}

/* Non-working shading + external busy — render context, never blockers. */
.calendar-page .cal-nonwork {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
    background: color-mix(in oklab, var(--mud-palette-text-secondary), transparent 92%);
}

.cal-block.cal-busy {
    --cal-accent: #8a93a6;
    z-index: 2;
    pointer-events: none;
    background: repeating-linear-gradient(135deg,
        color-mix(in oklab, var(--cal-accent), transparent 90%) 0 5px,
        color-mix(in oklab, var(--cal-accent), transparent 80%) 5px 10px);
    color: var(--mud-palette-text-secondary);
    border-left-style: solid;
}

/* 12.7 Books front door — the "what needs you" rows on the overview. */
.books-action-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    min-height: 44px;
    width: 100%;
    border: 0;
    border-radius: var(--itrela-radius-control);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.books-action-row:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 94%);
}

.books-action-row:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: var(--itrela-focus-offset);
}

.books-action-row .books-action-main {
    flex: 1 1 auto;
    min-width: 0;
}

.books-action-row > .mud-icon-root:first-child {
    margin-top: 2px;
}

/* Portal upcoming-visits card (Phase 11.5 D7) — read-only, client-zone times. */
.portal-visits-card {
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 24%, transparent);
    border-radius: var(--itrela-radius-surface);
    padding: 14px 16px;
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-surface));
}

.portal-visits-title {
    display: flex;
    align-items: center;
    font-weight: var(--itrela-weight-strong);
    margin-bottom: 8px;
}

.portal-visit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}

.portal-visit-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.portal-visit-title {
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-16);
}

.portal-visit-when {
    font-size: var(--itrela-text-13);
    color: var(--mud-palette-text-secondary);
}

.portal-visit-note {
    font-size: var(--itrela-text-13);
    white-space: pre-wrap;
}

/* Account settings → Calendar connections (Phase 11.6): connection rows + connect forms. */
.cal-conn-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 45%);
}

.cal-conn-row:first-of-type {
    border-top: none;
    padding-top: 0;
}

.cal-conn-main {
    flex: 1;
    min-width: 0;
}

.cal-conn-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: var(--itrela-weight-strong);
    font-size: var(--itrela-text-16);
}

.cal-conn-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--itrela-text-13);
    color: var(--mud-palette-text-secondary);
    margin-top: 2px;
}

.cal-conn-form {
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed color-mix(in oklab, var(--mud-palette-lines-default), transparent 25%);
    border-radius: var(--itrela-radius-control);
}

/* Dashboard per-tech load chips ("Alex 4.5h/8h") on Scheduled today (D9). */
.action-load-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 8px;
}

.action-load-chip {
    font-size: var(--itrela-text-12);
    padding: 2px 8px;
    border-radius: var(--itrela-radius-pill);
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 45%);
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.action-load-chip--over {
    color: color-mix(in oklab, var(--mud-palette-warning), black 22%);
    border-color: color-mix(in oklab, var(--mud-palette-warning), transparent 70%);
    background: color-mix(in oklab, var(--mud-palette-warning), transparent 88%);
}

/* ── 12.4: notifications page ── */

/* Bell panel grouped rows: the clickable item plus a trailing dismiss. New
   structural classes live here (not the component's scoped CSS) because this
   block is 12.4's single append-only home. */
.itrela-notif-row {
    display: flex;
    align-items: flex-start;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

.itrela-notif-row > .itrela-notif-item {
    flex: 1 1 auto;
    min-width: 0;
}

.itrela-notif-row--burst {
    background: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-surface) 95%);
}

.itrela-notif-row--burst:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-surface) 91%);
}

.itrela-notif-row .itrela-notif-item-body {
    flex: 1 1 auto;
}

.itrela-notif-item-action,
.notif-row-action {
    flex: 0 0 auto;
    align-self: center;
    color: color-mix(in oklab, var(--mud-palette-warning), var(--mud-palette-text-primary) 24%);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    white-space: nowrap;
}

.itrela-notif-row .itrela-notif-dismiss {
    flex: 0 0 auto;
    margin: 4px 6px 0 0;
    opacity: 0.55;
}

.itrela-notif-row:hover .itrela-notif-dismiss,
.itrela-notif-row .itrela-notif-dismiss:focus-visible {
    opacity: 1;
}

/* "×3" pill next to a grouped message — how many announcements one row holds. */
.itrela-notif-count {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: var(--itrela-radius-pill);
    font-size: var(--itrela-text-mark);
    font-weight: var(--itrela-weight-strong);
    line-height: 16px;
    background: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-surface) 85%);
    color: var(--mud-palette-primary);
    white-space: nowrap;
    vertical-align: text-bottom;
}

.itrela-notif-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    background: var(--mud-palette-table-striped);
}

.itrela-notif-footer-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--mud-palette-primary);
    cursor: pointer;
    font: inherit;
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
}

.itrela-notif-footer-link:hover {
    text-decoration: underline;
}

.itrela-notif-footer-link--quiet {
    color: var(--mud-palette-text-secondary);
}

.itrela-notif-footer-spacer {
    flex: 1 1 auto;
}

/* /notifications history list, bucketed by local day. The page is a
   workbench: day heads and rows take the shell's row inset so the first glyph
   sits under the band content's left edge. */
.notif-day-head {
    padding: 12px var(--itrela-workbench-row-pad, 22px) 4px;
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
    color: var(--mud-palette-text-secondary);
}

.notif-day-head:not(:first-child) {
    border-top: 1px solid var(--mud-palette-lines-default);
    margin-top: 4px;
}

.notif-row {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding-right: 8px;
}

.notif-row:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), transparent 94%);
}

.notif-row--burst {
    background: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-surface) 95%);
}

.notif-row--burst:hover {
    background: color-mix(in oklab, var(--mud-palette-primary), var(--mud-palette-surface) 91%);
}

.notif-row-open {
    min-width: 0;
    min-height: 44px;
    flex: 1 1 auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 8px 10px var(--itrela-workbench-row-pad, 22px);
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.notif-row-open:focus-visible {
    outline: var(--itrela-focus-ring);
    outline-offset: calc(var(--itrela-focus-offset) * -1);
}

.notif-row-icon {
    margin-top: 2px;
    opacity: 0.7;
    flex-shrink: 0;
}

.notif-row-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.notif-row-message {
    font-size: var(--itrela-text-14);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.notif-row--unread .notif-row-message {
    font-weight: var(--itrela-weight-strong);
}

.notif-row-meta {
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
}

/* Dot and dismiss X both center on the row's FIRST text line (10px row
   padding + half the ~19px line box ≈ 19.5px) — they were ~9px apart. */
.notif-row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    margin-top: 5px;
    flex-shrink: 0;
}

.notif-row-dismiss {
    opacity: 0.55;
    margin-top: 7px;
}

.notif-row:hover .notif-row-dismiss,
.notif-row-dismiss:focus-visible {
    opacity: 1;
}

/* The header band content fills the band. */
.notif-header {
    width: 100%;
    min-width: 0;
    /* MudSwitch draws its ripple box from the top of its track, so it hangs
       below the "Unread only" row; 2px under the row keeps it 12px clear of
       the band's bottom edge. Nothing above it: the title starts where every
       other page title starts. */
    padding-bottom: 2px;
}

.notif-load-more {
    display: flex;
    justify-content: center;
    padding: 12px var(--itrela-workbench-row-pad, 22px);
}

/* ── 12.4: service-desk stretched row links ── */
/* The ticket title is a real <a>; its ::after stretches over the whole row so
   middle-click/ctrl-click/copy-link work without nesting anchors. Interactive
   cells opt out by stacking above the overlay via .sd-row-interactive. */
.sd-row {
    position: relative;
}

.sd-row-link {
    color: inherit;
    text-decoration: none;
}

.sd-row-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.sd-row-link:focus-visible {
    outline: none;
}

.sd-row-link:focus-visible::after {
    outline: var(--itrela-focus-ring);
    outline-offset: calc(var(--itrela-focus-offset) * -1);
    border-radius: inherit;
}

.sd-row-interactive {
    position: relative;
    z-index: 1;
}

/* ── 12.4: running timer chip + composer/shortcut helpers ── */
.ticket-timer-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--itrela-radius-pill);
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-primary-hover);
}

.itrela-timer-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--itrela-radius-pill);
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    font-variant-numeric: tabular-nums;
    color: inherit;
    text-decoration: none;
    border: 1px solid currentColor;
    /* The app bar squeezes hard at 390px — the chip shrinks its padding
       (360px rule above) but its label never breaks mid-phrase. */
    white-space: nowrap;
}

/* Sidebar timer chip, drawn from ItrelaRail.dc.html [data-timer]: one
   row — 7px accent dot, the "TK-NNNN" ticket number (the title lives in the
   tooltip; the rail is too narrow for it), mono elapsed —
   on the accent-tinted 9px-radius frame. The chip is the way back to the
   ticket the timer counts against. */
.itrela-timer-nav {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid color-mix(in oklab, var(--itrela-rail-copper), transparent 62%);
    border-radius: var(--itrela-radius-control);
    background: color-mix(in oklab, var(--itrela-rail-copper), transparent 88%);
    color: var(--itrela-chalk-bright);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
    line-height: 1.2;
    text-decoration: none;
    box-sizing: border-box;
}

.itrela-timer-nav:hover {
    background: color-mix(in oklab, var(--itrela-rail-copper), transparent 80%);
    color: var(--itrela-chalk-bright);
    text-decoration: none;
}

.itrela-timer-dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--itrela-rail-copper);
}

.itrela-timer-nav .itrela-timer-icon {
    flex: 0 0 auto;
    opacity: 0.82;
}

.itrela-timer-nav .itrela-timer-ticket {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.itrela-timer-nav .itrela-timer-elapsed {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

/* Collapsed rail: the chip keeps its frame, shrinks to the sibling items'
   44px target, and shows only the dot/icon. The labels stay in the accessibility
   tree, the same rule every other nav item's text follows. */
.itrela-drawer.mud-drawer--closed .itrela-timer-nav {
    width: 44px;
    max-width: 44px;
    min-height: 42px;
    justify-content: center;
    padding: 6px;
    gap: 0;
    overflow: hidden;
}

.itrela-drawer.mud-drawer--closed .itrela-working-nav-link {
    flex: 0 0 auto;
    justify-content: center;
    gap: 0;
}

.itrela-drawer.mud-drawer--closed .itrela-timer-nav .itrela-timer-ticket,
.itrela-drawer.mud-drawer--closed .itrela-timer-nav .itrela-timer-elapsed {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Working-on belief chip (Phase 14.1) — the timer chip's quieter sibling:
   dashed ring, no tint fill, softer weight, because a guess must not dress
   like a deliberate act. The ✕ stays subdued until pointed at. */
.itrela-working-chip {
    border-style: dashed;
    font-weight: var(--itrela-weight-medium);
}

.itrela-working-nav {
    border-style: dashed;
    background: transparent;
    color: var(--itrela-rail-text);
    font-weight: var(--itrela-weight-medium);
}

.itrela-working-nav:hover {
    background: var(--itrela-rail-hover);
    color: var(--itrela-chalk-bright);
}

.itrela-working-nav-link,
.itrela-working-chip-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.itrela-working-nav-link {
    flex: 1 1 auto;
    gap: 9px;
}

.itrela-working-chip-link {
    gap: 4px;
    white-space: nowrap;
}

.itrela-working-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    padding: 1px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    line-height: 0;
    min-width: 24px;
    min-height: 24px;
}

.itrela-working-clear:hover {
    opacity: 1;
    background: var(--mud-palette-action-default-hover);
}

/* Focus rings for the chip's own controls. The sidebar variant's outer <a>
   rides .mud-nav-link and inherits the rail ring above, but these buttons and
   the inner link are the chip's own elements and had none at all — a keyboard
   user could not see where they were. In the rail they wear the rail accent
   like every sibling; the ring is inset because the rail's scrolling column
   would clip an outward one. */
.itrela-nav .itrela-working-nav-link:focus-visible,
.itrela-nav .itrela-working-clear:focus-visible {
    outline: 2px solid var(--itrela-rail-copper);
    outline-offset: -2px;
    border-radius: var(--itrela-radius-control);
}

/* The mobile app bar is the same chip's other home. It sits on the bar, not
   on the graphite, so its ring wears the bar's own ink — whatever the theme
   makes that, it is already the readable colour there. */
.itrela-timer-chip:focus-visible,
.itrela-working-chip-link:focus-visible,
.itrela-working-chip .itrela-working-clear:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: var(--itrela-radius-pill);
}

/* Time Truth consent surfaces (14.2a): the observed number always dresses as
   a quiet offer — dashed like the working-on chip, never like a record. */
.work-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.work-unlogged,
.ticket-log-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px dashed var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-surface);
    background: transparent;
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-medium);
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
}

.work-unlogged:hover,
.ticket-log-chip:hover {
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
}

/* Armed = a made decision; the send button restates it in words. */
.ticket-log-chip--armed {
    border-style: solid;
    border-color: var(--mud-palette-primary);
    background: var(--mud-palette-primary-hover);
    color: var(--mud-palette-primary);
}

/* The composer chip splits in two: the body arms, the dial adjusts — because
   the number is an estimate and the person sending knows better. */
.ticket-log-chip-group {
    display: inline-flex;
    align-items: stretch;
}

.ticket-log-chip-group .ticket-log-chip--main {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right-style: none;
}

.ticket-log-chip--edit {
    padding: 3px 6px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    height: 100%;
}

.ticket-log-chip-group--armed .ticket-log-chip {
    border-style: solid;
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary);
}

.ticket-log-chip-group--armed .ticket-log-chip--main {
    background: var(--mud-palette-primary-hover);
    border-right-style: none;
}

/* The chip's inline editor (MudMenu panel). */
.ticket-log-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 280px;
    padding: 14px;
}

.ticket-log-editor-basis {
    font-size: var(--itrela-text-12);
    line-height: 1.35;
    color: var(--mud-palette-text-secondary);
}

.ticket-log-editor-fields {
    display: flex;
    gap: 10px;
}

.ticket-log-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.work-unlogged .mud-icon-root,
.ticket-log-chip .mud-icon-root,
.work-tracked-icon {
    opacity: 0.7;
}

.work-tracked-icon {
    color: var(--mud-palette-text-secondary);
    cursor: default;
}

/* Provenance caption under a pre-filled duration (14.2a). */
.time-prefill-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--itrela-text-12);
    color: var(--mud-palette-text-secondary);
}

.time-prefill-hint .mud-icon-root {
    opacity: 0.7;
}

.ticket-composer-hint--draft {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 4px 2px 0;
}

.shortcut-help-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shortcut-help-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.shortcut-help-key {
    min-width: 28px;
    padding: 2px 8px;
    border: 1px solid var(--mud-palette-lines-default);
    border-bottom-width: 2px;
    border-radius: var(--itrela-radius-control);
    text-align: center;
    font-family: inherit;
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    background: var(--mud-palette-background-gray);
}

/* ── In-app image lightbox (js/lightbox.js) ── */
/* Above dialogs and snackbars: whatever you were doing, the image is on top. */
.itrela-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    background: rgba(12, 15, 22, 0.88);
    cursor: zoom-out;
}

.itrela-lightbox img {
    max-width: 100%;
    max-height: calc(100% - 36px);
    border-radius: var(--itrela-radius-control);
    box-shadow: var(--itrela-shadow-float);
}

.itrela-lightbox-open {
    color: #cfd6e4;
    font-size: var(--itrela-text-13);
}

.itrela-lightbox-open:hover {
    color: #ffffff;
}

/* ── Portal v2 (Phase 17.3): CSAT strip + knowledge ─────────────────── */

.portal-csat-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 16px 0;
    padding: 8px 12px;
    border-radius: var(--itrela-radius-control);
    background: var(--itrela-portal-accent-tint, color-mix(in oklab, var(--mud-palette-primary), transparent 92%));
    border: 1px solid color-mix(in oklab, var(--mud-palette-primary), transparent 78%);
    font-size: var(--itrela-text-14);
}

.portal-csat-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.portal-csat-comment {
    flex: 1 1 220px;
}

/* The resolved banner (flow review F16): the afterlife question sits above
   the thread in the same strip idiom as the receipt and CSAT — success tint
   while it asks, one quiet line once it's answered. */
.portal-resolution-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 16px 0;
    padding: 8px 12px;
    border-radius: var(--itrela-radius-control);
    background: color-mix(in oklab, var(--mud-palette-success), transparent 92%);
    border: 1px solid color-mix(in oklab, var(--mud-palette-success), transparent 78%);
    font-size: var(--itrela-text-14);
}

.portal-resolution-strip .mud-icon-root {
    color: var(--mud-palette-success);
    flex-shrink: 0;
}

.portal-resolution-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.portal-csat-page {
    max-width: 560px;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .portal-card-wrap,
    .portal-token-stage {
        margin-top: 4px;
    }

    .portal-page-head--tinted {
        padding: 16px;
    }

    .portal-form-actions,
    .portal-invoice-downloads,
    .portal-pay-layout,
    .portal-sign-downloads {
        align-items: stretch !important;
        flex-direction: column;
    }

    .portal-form-actions .mud-button-root,
    .portal-invoice-downloads .mud-button-root,
    .portal-pay-layout .mud-button-root,
    .portal-sign-downloads .mud-button-root {
        width: 100%;
        min-height: 44px;
    }
}

.portal-kb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.portal-kb-title {
    font-weight: var(--itrela-weight-strong);
    flex: 1 1 auto;
}

/* ── Shared card grammar (Phase 15) ──────────────────────────────────
   The dash-card idiom began life scoped to Clients/Details.razor.css;
   the asset workspace and the 15.3 shared Related-items panel render the
   same cards from other components, so the generic rules live here now.
   (Clients' scoped copies are identical and harmless; they de-dupe when
   15.3 replaces that page's inline cards.) */

.dash-card {
    padding: 20px;
    border-radius: var(--itrela-radius-surface);
    background: var(--mud-palette-surface);
}

.dash-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--mud-palette-text-secondary);
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
}

/* The card title: 16px, strong, ink, sentence case. It is the one heading
   look for a whole card, the same values the shared RowList, LabelValueList
   and FactStrip titles draw in their own sheets ("Right now", "Open
   tickets"). Every .dash-card-title heads a whole card; it is no longer the
   12px quiet label it once was. .portal-card-title is the client portal's
   name for the same title. */
.dash-card-title,
.portal-card-title {
    margin: 0;
    color: var(--mud-palette-text-primary);
    font-size: var(--itrela-text-16);
    font-weight: var(--itrela-weight-strong);
    line-height: var(--itrela-leading-tight);
}

/* First-value evidence: a compact, relational path through one ticket and
   its linked invoice. Neutral completed tiles keep the dashboard color budget;
   primary marks only the next action. */
.activation-journey-card {
    width: 100%;
}

.activation-journey-header {
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.activation-journey-title {
    color: var(--mud-palette-text-primary);
    font-size: var(--itrela-text-16);
    letter-spacing: normal;
    text-transform: none;
}

.activation-journey-intro {
    margin-top: 4px;
    font-size: var(--itrela-text-14);
    line-height: 1.5;
}

.activation-journey-progress {
    flex: 0 0 auto;
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-13);
    font-weight: var(--itrela-weight-strong);
    white-space: nowrap;
}

.activation-journey-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--itrela-radius-control);
    background: var(--mud-palette-lines-default);
}

.activation-milestone {
    min-width: 0;
    min-height: 126px;
    padding: 14px;
    background: var(--mud-palette-surface);
}

.activation-milestone--done {
    background: color-mix(in oklab, var(--mud-palette-background-gray), var(--mud-palette-surface) 72%);
}

.activation-milestone--current {
    box-shadow: inset 3px 0 0 var(--mud-palette-primary);
}

.activation-milestone-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 22px;
}

.activation-milestone-number {
    display: inline-flex;
    align-items: center;
    color: var(--mud-palette-text-disabled);
    font-variant-numeric: tabular-nums;
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-strong);
}

.activation-milestone--done .activation-milestone-number {
    color: var(--mud-palette-text-secondary);
}

.activation-milestone--current .activation-milestone-number {
    color: var(--mud-palette-primary);
}

.activation-milestone-time {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
    white-space: nowrap;
}

.activation-milestone-title {
    margin-top: 9px;
    color: var(--mud-palette-text-primary);
    font-size: var(--itrela-text-14);
    font-weight: var(--itrela-weight-strong);
    line-height: 1.35;
}

.activation-milestone--done .activation-milestone-title {
    color: var(--mud-palette-text-secondary);
}

.activation-milestone-evidence {
    margin-top: 4px;
    font-size: var(--itrela-text-12);
    line-height: 1.4;
}

.activation-journey-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 14px;
}

.activation-journey-boundary {
    max-width: 760px;
    font-size: var(--itrela-text-12);
    line-height: 1.45;
}

.activation-journey-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

@media (max-width: 700px) {
    .activation-journey-header {
        display: block;
    }

    .activation-journey-progress {
        margin-top: 10px;
    }

    .activation-journey-grid {
        grid-template-columns: 1fr;
    }

    .activation-milestone {
        min-height: 0;
    }

    .activation-journey-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .activation-journey-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }
}

.dash-kv-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-kv {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.dash-k {
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
    color: var(--mud-palette-text-secondary);
    line-height: 1.2;
    padding-top: 2px;
}

.dash-v {
    font-size: var(--itrela-text-14);
    color: var(--mud-palette-text-primary);
    min-width: 0;
    overflow-wrap: anywhere;
}

.dash-link-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dash-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
}

.dash-link-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-link-action {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    text-align: right;
}

@media (max-width: 480px) {
    /* Long ticket/document names are the useful part of an asset relation.
       Give them the full card width and move secondary metadata below instead
       of spending half the row on a rigid status/date column. */
    .asset-detail-page .dash-link-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding: 8px 0;
    }

    .asset-detail-page .dash-link-row + .dash-link-row {
        border-top: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 50%);
    }

    .asset-detail-page .dash-link-text {
        display: -webkit-box;
        width: 100%;
        overflow: hidden;
        white-space: normal;
        text-overflow: clip;
        overflow-wrap: anywhere;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        line-height: 1.35;
    }
}

@media (max-width: 360px) {
    /* On the smallest supported phones, protect the values from the fixed
       desktop label column. Labels may wrap; serials, models, and IPs remain
       the information a technician can actually scan. */
    .asset-detail-page .dash-kv {
        grid-template-columns: 105px minmax(0, 1fr);
    }
}

.portal-kb-meta {
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
    flex: 0 0 auto;
}

/* ── Rendered markdown bodies ───────────────────────────────────────
   Every body MarkdownRenderer draws sits in .knowledge-content: a help
   article in the portal, the staff Knowledge read view and its preview,
   an agreement preview. MudBlazor's reset takes list padding to zero,
   which hung bullets and numbers on the card's edge. This indent puts the
   markers inside the text column; a nested list steps in once more. */
.knowledge-content :is(ul, ol) {
    padding-inline-start: var(--itrela-space-24);
}

.portal-kb-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--itrela-radius-control);
}

/* An article's own headings sit under the page title (20px), never above
   it: the browser's 32px h1 made the article outshout its page heading. */
.portal-kb-content :is(h1, h2, h3, h4, h5, h6) {
    margin: var(--itrela-space-16) 0 var(--itrela-space-8);
    font-weight: var(--itrela-weight-strong);
    line-height: var(--itrela-leading-tight);
}

.portal-kb-content > :first-child {
    margin-top: 0;
}

.portal-kb-content h1 {
    font-size: var(--itrela-text-20);
}

.portal-kb-content h2 {
    font-size: var(--itrela-text-16);
}

.portal-kb-content :is(h3, h4, h5, h6) {
    font-size: var(--itrela-text-14);
}

.summary-sub {
    font-size: 0.75em;
    color: var(--mud-palette-text-secondary);
    font-weight: var(--itrela-weight-regular);
}

.dash-empty {
    font-size: var(--itrela-text-14);
    color: var(--mud-palette-text-secondary);
    padding: 12px 0 4px;
}

/* MudNumericField's steppers. Above phone width a numeric field is as tall as
   every other dense field (36px), so its two steppers share the field's
   height. At phone width the field grows to 48px so each stepper keeps the
   WCAG 2.2 minimum 24px target without overlapping its neighbour. */
.mud-input-numeric-spin {
    width: 24px;
    height: 32px;
}

.mud-input-numeric-spin .mud-button-root {
    min-width: 24px !important;
    width: 24px;
    min-height: 16px !important;
    height: 16px;
    padding: 0 !important;
}

@media (max-width: 599.98px) {
    .mud-input-number-control .mud-input-control-input-container,
    .mud-input-number-control .mud-input {
        min-height: 48px;
    }

    .mud-input-numeric-spin {
        height: 48px;
    }

    .mud-input-numeric-spin .mud-button-root {
        min-height: 24px !important;
        height: 24px;
    }
}

/* Assignee pickers stay usable for teams of 20, 50, or 75 people. Pinned
   shortcuts never scroll away; only the filtered team list does. */
.itrela-assignee-picker {
    display: flex;
    flex-direction: column;
    width: min(320px, calc(100vw - 32px));
    max-height: min(440px, 70vh);
    overflow: hidden;
    background: var(--mud-palette-surface);
}

.itrela-assignee-search {
    flex: 0 0 auto;
    padding: 8px 10px 6px;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.itrela-assignee-options {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.itrela-assignee-results {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.itrela-assignee-empty {
    padding: 16px;
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-13);
    text-align: center;
}

/* Menu popovers render at the provider root, so the shared status/assignee
   option layout belongs here rather than in List.razor.css. */
.itrela-status-options {
    min-width: min(220px, calc(100vw - 32px));
}

.itrela-menu-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.itrela-menu-option-check {
    width: 18px;
    flex: 0 0 18px;
    color: var(--mud-palette-primary);
    font-weight: var(--itrela-weight-strong);
    text-align: center;
}

.itrela-menu-option-count {
    margin-left: auto;
    padding-left: 12px;
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    white-space: nowrap;
}

/* Picker popovers per the ticket-list mockup: a quiet uppercase header
   ("Assign — TK-0192", "Set status — TK-0192"), avatar + presence + open
   load on every person row, status-colored dots on status rows. */
.itrela-picker-head {
    padding: 9px 12px 7px;
    border-bottom: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 35%);
    color: var(--mud-palette-text-secondary);
    font-size: var(--itrela-text-12);
    font-weight: var(--itrela-weight-medium);
    word-spacing: var(--itrela-label-word-spacing);
}

.itrela-picker-avatar {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: var(--itrela-radius-pill);
    background: var(--sd-assign-bg, var(--mud-palette-primary));
    color: #fff;
    font-size: var(--itrela-text-mark);
    font-weight: var(--itrela-weight-strong);
}

.itrela-picker-glyph {
    width: 22px;
    flex: 0 0 auto;
    text-align: center;
}

.itrela-picker-dot {
    width: 7px;
    height: 7px;
    display: inline-block;
    flex: 0 0 auto;
    border-radius: var(--itrela-radius-pill);
}

.itrela-picker-dot--active {
    background: var(--itrela-status-ok);
}

.itrela-picker-dot--away {
    background: var(--itrela-status-warning);
}

.itrela-picker-dot--offline {
    background: #9AA4AD;
}

.itrela-status-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    flex: 0 0 auto;
    border-radius: var(--itrela-radius-pill);
}

.itrela-status-dot--new {
    background: var(--mud-palette-primary);
}

.itrela-status-dot--inprogress {
    background: var(--mud-palette-secondary);
}

.itrela-status-dot--waiting {
    background: var(--itrela-status-warning);
}

.itrela-status-dot--resolved {
    background: var(--itrela-status-ok);
}

.itrela-status-dot--closed {
    background: #9AA4AD;
}

.itrela-picker-muted {
    color: var(--mud-palette-text-secondary);
}

/* Inline Mud pickers are rendered through a portal. When the activator is
   narrower than the picker's 310px content, the portal can inherit the
   activator width and the paper's hidden overflow clips the calendar/clock.
   Size the shared portal to its actual minimum so every date and time picker
   opens as a complete, usable surface. MudPicker also copies its Style value
   from the activator to the portal paper, so this minimum must override an
   inline control width. */
.mud-picker-popover.mud-popover-open {
    min-width: min(310px, calc(100vw - 40px));
}

.mud-picker-popover.mud-popover-open > .mud-picker-inline-paper,
.mud-picker-popover.mud-popover-open .mud-picker-popover-paper {
    min-width: min(310px, calc(100vw - 40px)) !important;
}

.mud-picker-popover.mud-popover-open .mud-picker-content {
    min-width: min(310px, calc(100vw - 40px));
}

@media (max-height: 640px) {
    .itrela-assignee-picker {
        max-height: min(360px, 65vh);
    }
}

/* Compact desktop controls need a larger hit area once they become touch-first.
   Keep the 24px numeric steppers intact: each field already provides two
   adjacent 24px controls inside a 48px-tall input. */
@media (max-width: 700px) {
    button.mud-icon-button-size-small {
        min-width: 40px !important;
        width: 40px;
        min-height: 40px !important;
        height: 40px;
    }

    .mud-button-size-small:not(.mud-input-numeric-spin .mud-button-root),
    .mud-button-text-size-small,
    .mud-button-filled-size-small,
    .mud-button-outlined-size-small,
    .sd-assign-trigger {
        min-height: 36px;
    }

    .mud-chip.mud-clickable.mud-chip-size-small {
        min-width: 32px;
        min-height: 32px;
    }

    .itrela-working-clear {
        min-width: 32px;
        width: 32px;
        min-height: 32px;
        height: 32px;
    }
}

/* ── Print: generic single-report documents ───────────────────────────────
   ReportPrintRoot owns the print isolation shared by Books and owner reports.
   The document stays out of the screen flow; an explicit print action marks
   exactly one root active and hides the application chrome. */
@media screen {
    .report-print-root {
        display: none;
    }
}

/* The isolation is gated by the collocated print module, so Ctrl+P elsewhere still
   prints the page normally. */
@media print {
    body.itrela-report-printing * {
        visibility: hidden !important;
    }

    body.itrela-report-printing .report-print-root--active,
    body.itrela-report-printing .report-print-root--active * {
        visibility: visible !important;
    }

    body.itrela-report-printing .report-print-root--active {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    body.itrela-report-printing .report-print-root--active thead {
        display: table-header-group;
    }

    body.itrela-report-printing .report-print-root--active tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    @page {
        margin: 0.6in;
    }
}

/* ── Toasts over the rail (2026-12-01) ────────────────────────────────
   Toasts sit bottom-left (ToastDefaults). On a desktop that puts them over
   the rail, the one strip no page content uses, as Gmail places them: above
   the rail's footer row (account, Help, Settings), so they never cover a
   button the page draws, nor the pointer that pressed it. The width is
   capped so a long message covers as little of the page as it can; a short
   one is only as wide as its words. On a phone the rule in "Dialogs on a
   phone" lifts them above the action bar instead. They arrive opaque:
   ToastDefaults turns MudBlazor's fade-in off. */
:root {
    --itrela-toast-width: 280px;
    --itrela-toast-width-with-action: 360px;
    /* Over the open rail, just above its 57px footer row. */
    --itrela-toast-left: var(--itrela-space-12);
    --itrela-toast-bottom: 68px;
}

.mud-snackbar-location-bottom-left .mud-snackbar {
    min-width: 0;
    max-width: var(--itrela-toast-width);
}

/* A toast with an action (View, Undo) needs room for it beside the words;
   at 280px a notification's text stood seven lines tall. */
.mud-snackbar-location-bottom-left .mud-snackbar:has(.mud-snackbar-action-button) {
    max-width: var(--itrela-toast-width-with-action);
}

@media (min-width: 960px) {
    body:has(.itrela-drawer) .mud-snackbar-location-bottom-left {
        left: var(--itrela-toast-left);
        bottom: var(--itrela-toast-bottom);
    }

    /* The collapsed rail is 72px wide and its footer stands up as a 153px
       column. No toast fits over it, and one above that column lands
       mid-page, on the very buttons that were just pressed. So the toast
       sits beside the column, at the foot of the window. */
    body:has(.itrela-drawer.mud-drawer--closed) {
        --itrela-toast-left: calc(72px + var(--itrela-space-12));
        --itrela-toast-bottom: var(--itrela-space-16);
    }
}

/* A phone's toast takes the width between the page gutters. */
@media (max-width: 599.98px) {
    .mud-snackbar-location-bottom-left .mud-snackbar,
    .mud-snackbar-location-bottom-left .mud-snackbar:has(.mud-snackbar-action-button) {
        width: 100%;
        max-width: none;
    }
}

/* From 960 to 1099px the open rail is the compact 72px one, with the same
   footer column. */
@media (min-width: 960px) and (max-width: 1099.98px) {
    body:has(.itrela-drawer:not(.itrela-drawer--compact-expanded)) {
        --itrela-toast-left: calc(72px + var(--itrela-space-12));
        --itrela-toast-bottom: var(--itrela-space-16);
    }
}
/* ── end toasts over the rail ── */

/* ── Toasts: one surface, status as a coloured edge ───────────────────
   Every toast in the app is a MudBlazor snackbar (ISnackbar.Add — see
   Program.cs for the position/stack config), so this block is the whole
   presentation contract: there is no toast component to change instead.

   Why it is needed. Mud's default `filled` variant paints the ENTIRE
   toast with the severity colour. Itrela's palette is a text-grade set
   (see ItrelaTheme.cs), which is right for text and status dots but far
   too heavy as a full fill: a success toast arrived as a dark green slab
   (#13602A) beside a steel-grey Info toast (#4B5E66), so two toasts of
   the same component read as two different components. The app's own
   status language is tonal — a raised surface, a quiet border, the
   status ink carried by the icon and a 6px left edge (the same
   `color-mix` idiom as `.portal-resolution-strip`).

   So severity still reads at a glance, but every toast shares one
   surface. Both grades work because the tint is mixed in `oklab` against
   the theme's own surface and ink, so light and dark stay in step with
   the palette instead of carrying a second copy of the colours. */
.mud-snackbar {
    background: linear-gradient(
        90deg,
        color-mix(in oklab, var(--mud-palette-text-primary), transparent 92%) 0%,
        color-mix(in oklab, var(--mud-palette-text-primary), transparent 97%) 38%,
        transparent 100%);
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border: 1px solid color-mix(in oklab, var(--mud-palette-lines-default), transparent 30%);
    /* The left edge is the status band, so it must not inherit the 1px
       hairline above. Corners stay fully rounded: toasts touch no edge of
       the screen, so a squared left corner would read as a clip. */
    border-left: 6px solid var(--mud-palette-text-secondary);
    border-radius: var(--mud-default-borderradius);
    box-shadow: var(--itrela-shadow-float);
    font-weight: var(--itrela-weight-medium);
}

.mud-snackbar.mud-alert-filled-success {
    border-left-color: var(--mud-palette-success);
}

.mud-snackbar.mud-alert-filled-success .mud-snackbar-icon {
    color: var(--mud-palette-success);
}

.mud-snackbar.mud-alert-filled-info {
    border-left-color: var(--mud-palette-info);
}

.mud-snackbar.mud-alert-filled-info .mud-snackbar-icon {
    color: var(--mud-palette-info);
}

.mud-snackbar.mud-alert-filled-warning {
    border-left-color: var(--mud-palette-warning);
}

.mud-snackbar.mud-alert-filled-warning .mud-snackbar-icon {
    color: var(--mud-palette-warning);
}

.mud-snackbar.mud-alert-filled-error {
    border-left-color: var(--mud-palette-error);
}

.mud-snackbar.mud-alert-filled-error .mud-snackbar-icon {
    color: var(--mud-palette-error);
}

/* Normal carries no status — it keeps the neutral edge and ink set above. */
.mud-snackbar.mud-alert-filled-normal .mud-snackbar-icon {
    color: var(--mud-palette-text-secondary);
}

/* The View/Undo action is the only teal in a toast, and teal is action.
   The `button` in the selector is load-bearing: Mud ships
   `.mud-snackbar .mud-snackbar-content-action > button { color: inherit }`,
   which ties a two-class selector and wins on source order, so the action
   stayed ink until this carried one more element.
   The action is a text button whatever variant the toast asks for. Left to
   MudBlazor, an action without its own variant takes the toast's (Filled),
   so View drew as a teal pill with its teal text on it: no visible word.
   Teal on the toast's surface is 5.9:1 in light and 7.9:1 in dark. */
.mud-snackbar button.mud-snackbar-action-button {
    color: var(--mud-palette-primary);
    background-color: transparent;
}

.mud-snackbar button.mud-snackbar-action-button:hover {
    background-color: color-mix(in oklab, var(--mud-palette-primary) 8%, transparent);
}

.mud-snackbar button.mud-snackbar-action-button:focus-visible {
    background-color: color-mix(in oklab, var(--mud-palette-primary) 8%, transparent);
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* Ink at 90%, not Mud's 60% — on a light surface the close glyph was the
   faintest thing in the toast. */
.mud-snackbar .mud-snackbar-close-button {
    color: color-mix(in oklab, var(--mud-palette-text-primary), transparent 10%);
}
