/* ==========================================================================
   SolviaInvoiceFlow BlazorAdmin - Design System
   ========================================================================== */

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */
:root {
    /* Primary Colors */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-primary-dark: #1e40af;

    /* Accent Colors */
    --color-accent: #0891b2;
    --color-accent-hover: #0e7490;
    --color-accent-light: #cffafe;

    /* Neutral Colors */
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;

    /* Semantic Colors */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-success-dark: #059669;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-warning-dark: #d97706;
    /* Look 71a5c24: everything in warning tone ON the warning background (alert, badge, banner, notes and the
       icons on warning-light tiles). warning-dark is only 2.86:1 on warning-light; amber-800 reaches AA there
       and on cards. warning-dark stays for warning icons on cards (3.19:1 on --bg-card, non-text). */
    --color-warning-text: #92400e;
    /* Look c7e4d4c (F040-011 extended app-wide): the same for success, error and info. The base and -dark steps
       stay for icons, dots and borders (non-text, 3:1); TEXT in a semantic colour takes the -text step, which
       reaches 4.5:1 on white and on its own -light tint (success 4.84, error 5.30, info 5.49 on the tint).
       Guarded by LookC7e4d4cCssTests (Coloured_text_reaches_AA, No_text_is_painted_in_a_light_semantic_colour). */
    --color-success-text: #047857;
    --color-success-hover: #065f46;
    --color-error-text: #b91c1c;
    --color-info-text: #1d4ed8;
    --color-error: #ef4444;
    --color-error-light: #fee2e2;
    --color-error-dark: #dc2626;
    --color-info: #3b82f6;
    --color-info-light: #dbeafe;
    --color-info-dark: #2563eb;

    /* Background Colors */
    --bg-body: #f3f4f6;
    --bg-sidebar: #1f2937;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    /* Disabled fields (look 71a5c24): one look for every disabled input, select and textarea. */
    --bg-input-disabled: var(--color-gray-100);
    --text-input-disabled: var(--text-muted);
    --border-input-disabled: var(--color-gray-200);
    --bg-primary: #ffffff;           /* alias of --bg-card for legacy refs (main-header, .tab-active) */

    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #6b7280;           /* gray-500 — 4.62:1 on white, WCAG AA compliant */
    --text-inverse: #ffffff;
    --text-link: #2563eb;

    /* Border Colors */
    --border-color: #e5e7eb;
    --border-color-dark: #d1d5db;
    --border-focus: #2563eb;

    /* Focus ring — used by .btn, .form-control, :focus-visible */
    --shadow-focus:       0 0 0 3px rgba(37, 99, 235, 0.35);
    --shadow-focus-error: 0 0 0 3px rgba(239, 68, 68, 0.25);

    /* Accent purple — used by notification type "task-assigned" (NotificationPanel + Notifications) */
    --color-accent-purple:       #a855f7;
    --color-accent-purple-light: rgba(168, 85, 247, 0.1);
    --color-accent-purple-text:  #7e22ce;   /* purple-700: text on the light purple, 6.4:1 */

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* NOTE: 15px base (not 16px) is an intentional density choice for a dense
       admin UI. All --font-size-* tokens derive from this. Do not "normalize"
       to 16px without a visual audit of every page — it will subtly reflow
       every element that uses rem-based sizing. */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* Spacing */
    --spacing-0: 0;
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.25rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-10: 2.5rem;
    --spacing-12: 3rem;
    --spacing-16: 4rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --duration-normal: 200ms;   /* the duration alone, for a delay that waits for a normal transition (sidebar visibility) */
    --transition-normal: var(--duration-normal) ease;
    --transition-slow: 300ms ease;

    /* Z-Index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-tooltip: 1060;
    --z-toast: 1070;

    /* Layout */
    --sidebar-width: var(--nav-width-expanded);   /* FEAT-037: was 260px; the rail switches it (:root.nav-collapsed) */
    --header-height: 64px;
    /* Navigation sidebar (FEAT-037, docs/concepts/2026-12-02-nav-sidebar-concept-v1.md): 208 px expanded,
       56 px icon rail. Icons, brand and avatar are inset so they sit centred in the rail width in BOTH
       states: collapsing never moves an icon sideways. */
    --nav-width-expanded: 208px;
    --nav-width-rail: 56px;
    --nav-item-height: 32px;
    --nav-item-gap: 1px;
    --nav-icon-size: 18px;
    --nav-brand-icon-size: 28px;
    --nav-glyph-size: 16px;          /* icon inside the brand tile and the avatar */
    --nav-avatar-size: 28px;
    --nav-header-height: 52px;
    --nav-active-bar: 3px;
    --nav-focus-ring: var(--color-gray-300);   /* focus ring on the dark sidebar: ~10:1 on --bg-sidebar (primary was 2.83:1) */
    --nav-link-inset: calc((var(--nav-width-rail) - var(--nav-icon-size)) / 2 - var(--nav-active-bar));
    --nav-text-inset: calc(var(--nav-link-inset) + var(--nav-active-bar));
    --nav-brand-inset: calc((var(--nav-width-rail) - var(--nav-brand-icon-size)) / 2);
    --nav-avatar-inset: calc((var(--nav-width-rail) - var(--nav-avatar-size)) / 2);
    --nav-separator-width: 1px;
    --nav-separator-color: rgba(255, 255, 255, 0.1);
    --nav-separator: var(--nav-separator-width) solid var(--nav-separator-color);
    --nav-hover-bg: rgba(255, 255, 255, 0.05);
    --nav-active-bg: rgba(255, 255, 255, 0.1);
    --nav-control-border: 1px solid rgba(255, 255, 255, 0.12);
    --nav-control-hover-bg: rgba(255, 255, 255, 0.08);
    --nav-section-title-tracking: 0.05em;
    --nav-badge-font-size: 0.6875rem;
    --nav-badge-height: 18px;
    --nav-badge-rail-font-size: 0.625rem;
    --nav-badge-rail-height: 14px;
    --nav-badge-rail-top: 2px;
    --nav-tooltip-offset: var(--spacing-2);
    --nav-tooltip-hide-delay: 100ms;  /* WCAG 1.4.13: time to move the pointer onto the tooltip */
    --nav-peek-delay: 300ms;          /* hover intent before the rail opens as an overlay */
    --nav-menu-border: 1px solid var(--border-color);
    --nav-user-menu-min-width: 220px;
    --nav-user-menu-max-width: 20rem;   /* a long role list wraps instead of widening the menu */
    /* Footer heights, so the toggle row keeps its y in both states (the card never shrinks in the rail)
       and the menu can sit right above the footer in the off-canvas sidebar below 1024 px. */
    --nav-user-card-height: calc(var(--nav-item-height) + 2 * var(--spacing-1));
    --nav-footer-height: calc(var(--nav-user-card-height) + 2 * var(--spacing-2) + var(--nav-separator-width));
    --nav-about-height: calc(var(--font-size-xs) * var(--line-height-normal) + 2 * var(--spacing-1) + var(--nav-separator-width));
    --group-bar-width: 3px;          /* FEAT-031: accent bar that ties the rows of one email group together */
    --form-check-size: 18px;         /* checkbox / switch box */
    --field-width-short-number: 14rem;  /* short number fields: seconds, retries, days (settings pages, worker rows) */
    --settings-action-min-width: 10rem; /* every button of the settings action bar (Reset | Save changes) */
    /* One line of a field message (error under a field): reserved even when empty, so an error
       appearing never moves the fields or the action below it. */
    --form-message-line-height: calc(var(--font-size-xs) * var(--line-height-normal));
    /* Data grid column sizes (DataGridColumnClass): address columns take a share and truncate.
       The process column fits the number of an indented group child row (built from the same
       indent tokens as that row), so collapsing or expanding a group never moves a column edge. */
    --grid-col-address-width: 18%;
    /* Below these widths a column stops shrinking and the table scrolls inside .data-grid-body
       (demo look 7de3354: addresses shrank to two letters, names to one letter per line). */
    --grid-col-address-min-width: 7rem;
    --grid-col-wrap-min-width: 12rem;
    --process-number-width: 10ch;    /* "P-1000000" (9 characters, tabular digits are 1ch) + headroom */
    --grid-col-process-width: calc(var(--spacing-4) + var(--spacing-8) + var(--process-number-width) + var(--spacing-4));
    /* FEAT-034 mail blocks: one grid for the column labels and every document line, so labels
       and values stay aligned. */
    --mail-doc-indent: calc(var(--spacing-4) + var(--spacing-8));
    --mail-doc-col-vendor: 13rem;
    --mail-doc-col-vendor-archive: 11rem;
    --mail-doc-col-amount: 8.5rem;
    --mail-doc-col-date: 6.5rem;
    /* 8rem: "Zusammengeführt" (114.5 px) overflowed the 7rem (105 px) column into the gap (look f68ad07 round 3). */
    --mail-doc-col-status: 8rem;
    /* Archive at a narrow card (look f68ad07 round 3, LOOK-F68-H1): the vendor column of the compact grid. */
    --mail-doc-col-vendor-compact: 9rem;
    --mail-doc-col-owner: 8.5rem;
    --mail-doc-col-resolved: 8.5rem;
    --mail-doc-col-actions: 2rem;
    --mail-block-main-basis: 20rem;      /* subject column before the header side wraps below it */
    --mail-doc-label-tracking: 0.05em;   /* same tracking as the data-grid column labels */
    --row-menu-min-width: 14rem;
    /* FEAT-038: the quiet line between rows of the merge preview and the Beilagen list; gray-100 like the mail-doc rows
       (--dup-banner-row-separator and --card-border use the darker --border-color). */
    --merge-row-separator: 1px solid var(--color-gray-100);
    /* Look f68ad07 F3: the merge dialog sizes to its content up to this height (and the screen); its body scrolls. The
       loading state shows the expected layout (skeleton), so the footer does not jump when the candidates arrive. */
    --merge-dialog-max-height: 760px;
    /* F6: an invisible tap area centred on a small link (the merged source's "→ P-…"): full width of the link, at least the
       touch target, moved by half of its own size. */
    --hit-area-center: 50%;
    --hit-area-shift: -50%;
    --hit-area-full: 100%;
    /* /users list (demo look 1ceec93): the user column takes a share and shrinks to its minimum (name and
       address end in an ellipsis); KPI cards wrap from a minimum width; every list filter has one width. */
    --users-col-user-width: 30%;
    --users-col-user-min-width: 10rem;   /* avatar + about 6rem of name; measured to fit de-CH headers at 1163 */
    --stat-card-min-width: 8rem;
    --list-filter-field-width: 13rem;
    /* Look 861a82b item 7: one flexible width for a list's search field (inbox, admin grids) - the preferred width holds
       the longest placeholder ("Vorgang, Betreff, Absender, Datei suchen"), the field shrinks down to the minimum when
       the toolbar is narrow. */
    --search-field-width: 24rem;
    --search-field-min-width: 15rem;
    /* Look 4a7ef94: the inbox search icon's slot (18 px icon + gap) after --spacing-3, and the field's border width — the
       search hint (SearchHint.razor) starts exactly where the field's own text starts. */
    --search-field-icon-slot: 24px;
    --field-border-width: 1px;
    /* Distance of a dialog from the top (and bottom) of a phone screen: the dialog is anchored
       there instead of centred, so its tabs do not jump when a tab changes the height. */
    --modal-offset-top-sm: var(--spacing-4);
    /* Floating menu button below --bp-lg: its size, and the space above the page content that keeps
       it off the license banner and the page title (demo look 7de3354). */
    --sidebar-toggle-size: 40px;
    /* F040-015 (Chris 2026-12-03): below --bp-lg a slim sticky top bar holds the menu button and the page title. */
    --topbar-height: 44px;
    /* Look 4d6af57 item 2: a focused field scrolls in below the bar WITH its label — the label line, its gap to the field
       and one more gap (a date input scrolls its inner date part, ~5 px inside the box, to the edge). */
    --focus-label-allowance: calc(var(--font-size-sm) * var(--line-height-normal) + 2 * var(--spacing-2));
    --topbar-border: 1px solid var(--border-color);
    /* Look 4d6af57 item 4: the line between two candidates of the duplicate banner. */
    --dup-banner-row-separator: 1px solid var(--border-color);
    /* Look 4d6af57 item 5: scroll cue of a horizontal strip — a shadow at an edge where more items wait. */
    /* Look 5829a87 item 2: the cue was hard to see (24 px wide, its shadow 12 px at 18 %): 40 px, shadow 20 px at 32 %.
       px, not rem: the root size is 15 px here (2.5rem was 37.5 px, review M-4). */
    /* Look 9b073ba item 2: the 40 px cover faded with no solid part over the 20 px shadow — a shade showed on rows that do
       not overflow, and a 15 px overflow uncovered only the faint end of the shadow. Now cover and shadow share one
       width and the cover is solid: no shade at rest; a 16 px overflow shows the whole shadow. */
    --scroll-cue-size: 16px;
    --scroll-cue-shadow: rgb(17 24 39 / 0.32);
    /* The surface the strip sits on: the settings page lies directly on the page background (body; .main-content,
       .main-body and .settings-layout paint none — measured). The covers and the strip itself use it. */
    --scroll-cue-surface: var(--bg-body);
    /* Look 4d6af57 item 10: the license banner icon keeps its size on a phone (shrank to ~8 px at 375). */
    --license-banner-icon-size: 20px;
    --card-border: 1px solid var(--border-color);    /* the one-pixel outline of a card (mobile meta card, error text boxes) */
    --error-details-max-height: 200px;               /* exception text box before it scrolls */
    --err-pre-max-height: 300px;                     /* error page stack trace before it scrolls */
    --main-content-pad: var(--spacing-6);

    /* FEAT-036 process detail (scroll model A + side panel B). Own names: the app-wide density switch
       (FEAT-035) comes later and may map them onto its global tokens; the compact values follow
       docs/mockups/2026-12-02-density-tokens-compact-v1.css. */
    --pd-side-width: 400px;                 /* side panel (was 420 px) */
    --pd-pane-gap: var(--spacing-4);        /* between document pane and side panel */
    --pd-bar-pad-y: var(--spacing-2);       /* e-mail head and document toolbar */
    --pd-bar-pad-x: var(--spacing-4);
    --pd-control-height: 1.875rem;          /* every control in the document toolbar */
    --pd-chip-pad-y: 0.125rem;              /* chips in the e-mail sub-line */
    --pd-chip-max-width: 20rem;             /* attachment chip in the toolbar: content width up to this */
    --email-sibling-menu-min-width: 16rem;  /* "+N" menu of the sibling documents (number · file name) */
    /* One height for every control of a list toolbar (archive: filters, search, export); FEAT-036
       follow-up, look c4f9281: filters 43 px next to a 36.7 px search. = the .form-control height. */
    --list-toolbar-control-height: var(--control-height);
    /* Look 5829a87 item 6: the one control height of a row = the natural .form-control height (13.125 px × 1.5 + 2 × 7.5 px
       padding + 2 × 1 px border = 36.7 px). A button next to a field takes it too (settings Export / KI-Integration:
       36.7 px field next to a 44.2 px button). */
    --control-height: calc(var(--font-size-sm) * var(--line-height-normal) + var(--spacing-2) * 2 + 2px);
    /* Look 0ed9dd5 item 2: the one height of a tab, both sorts (.tab pill, .tab-btn boxed). Before: 39.4 px (storage, the
       count badge set it), 34.7 px (workflow settings), 42.2 px (workflow configuration). A tab is a control: the
       control height, the touch target on touch devices. */
    --tab-height: var(--control-height);
    /* Look 9b073ba item 4: one height per button role, set as the min-height of .btn / .btn-sm and as the square of
       .btn-icon.btn-sm. Desktop: .btn 36.7, .btn-sm 26.4, the small icon button 28 px. Touch devices: every role is the
       44 px target (touch block below) — on a phone "Übernehmen" was 26.4, "Erneut auslesen" 25.5, "Alle offenen zeigen"
       36.7, "Alle zeigen" 26.4 px. A .btn-sm that sized itself from padding: 0 grows to the min-height (look 5374281: the
       PDF version banner link ~7 px taller on the desktop); an inline text link (a .btn-link inside a line of text or a
       label row) is not a button role and opts out (min-height: 0, rule after .btn-icon). */
    --btn-height: var(--control-height);
    --btn-sm-height: calc(var(--font-size-xs) * var(--line-height-normal) + var(--spacing-1) * 2 + 2px);
    --btn-icon-sm-size: 28px;
    /* Look 9d4bfe1 review: the icon inside an icon-only button, one size per button size. One 18 px rule for every
       .btn-icon grew the icons of the small row actions (Icon Size="16") to 18 px. */
    --btn-icon-glyph-size: 18px;
    --btn-icon-sm-glyph-size: 16px;
    /* Look 9d4bfe1 item 3: the room the document stage keeps for the floating zoom (its control, its padding and border,
       its offset from the bottom and as much room above it). Below that the zoom left its stage and covered the
       read-only version banner on a phone. */
    --pd-stage-min-height: calc(var(--pd-control-height) + 3 * var(--spacing-1) + 2 * var(--spacing-4));
    /* Look f1c1079 item 2: the floating zoom's distance from the right and bottom edge of its stage (or of the visible
       part of the stage when the stage reaches below the window). */
    --pd-zoom-float-inset-x: var(--spacing-5);
    --pd-zoom-float-inset-y: var(--spacing-4);
    --phase-segments-pad: var(--spacing-1);  /* the pill around the inbox phase segments */
    /* Item 7: heights of fixed-height controls come from tokens, not from the font's line metrics (the inherited
       line-height of 4d6af57 grew the settings items 36 → 37.7 px and the mobile buttons by 3 – 5.5 px). */
    --settings-nav-item-height: 36px;      /* px: the root size is 15 px here, 2.25rem would be 33.75 px */
    --m-btn-height: 48px;
    --m-btn-lg-height: 52px;
    --m-btn-ghost-height: 44px;
    --touch-target-size: 44px;
    --m-back-height: var(--touch-target-size); /* the mobile back link and its slot */
    --license-detail-label-width: 140px;    /* /about license details: the label column (the row wraps when narrower) */
    --pd-zoom-label-width: 3rem;            /* "125%" without jumping */
    --pd-toolbar-btn-height: 36px;          /* buttons of the full PDF viewer toolbar (look 5374281: was a raw 36px rule) */
    --pd-section-header-height: 2.25rem;    /* compact: section header */
    /* Look 9b073ba item 3: header padding so a small button (+ the 1 px bottom border) fills the header height exactly. */
    --pd-section-header-pad-y: max(0px, calc((var(--pd-section-header-height) - var(--btn-sm-height) - 1px) / 2));
    --pd-section-pad-x: 0.75rem;
    --pd-section-pad-y: 0.75rem;
    --pd-field-gap-y: 0.5rem;               /* between field rows */
    --pd-field-gap-x: 0.75rem;              /* between field columns */
    --pd-label-gap: 0.25rem;                /* label → field */
    --pd-control-pad-x: 0.5rem;
    --pd-row-gap: 0.125rem;                 /* key/value rows, processing grid, history lines */
    --pd-line-height-dense: 1.4;
    --pd-kv-label-width: 6.5rem;            /* key column of the key/value rows */
    --pd-currency-width: 4.75rem;           /* currency next to the amount ("CHF", "EUR") */
    --flex-full-row: 100%;                  /* flex-basis of an item that always takes a line of its own */
    --pd-event-icon-size: 0.875rem;         /* icon column of a history line */
    --pd-float-border: 1px solid var(--border-color); /* floating zoom control */
    /* Inbox quick view (Variant A, Chris 2026-12-05; mockup 2026-12-05-quick-view-v1-a-modal.html) */
    --qv-modal-width: 80vw;                 /* the dialog: ~80 % of the window */
    --qv-modal-height: 86vh;
    --qv-close-size: var(--touch-target-size); /* the close button is a 44 px target everywhere */
    --qv-page-max: 52rem;                   /* an image at 100 %: the viewer width, at most this */
    --qv-skeleton-height: min(22rem, 50vh); /* the page placeholder while the document loads */
    --qv-empty-max-width: 28rem;            /* the text of "Keine Vorschau verfügbar" */
    --qv-kbd-min-width: 1.4em;              /* a key cap (← → Esc) */
    --qv-shimmer-duration: 1.4s;            /* one sweep of the loading placeholder */
    --pd-zoom-sep-width: 1px;               /* floating zoom: the line between zoom and page number */
    --qv-underline-offset: 2px;             /* the underlined file name of a hovered trigger */
    /* FEAT-042 (spec §6.8, OQ-10): every toast at the bottom; the undo toast with its timer bar. --ik-toast-duration equals
       ToastDurations.Undo (pinned by ToastUndoTests). */
    --ik-toast-width: 30rem;                /* the toast column, centred at the bottom */
    --ik-toast-duration: 8s;                /* the undo toast («Rückgängig») */
    --ik-toast-timer-height: 3px;           /* the timer bar of an action toast */
    --ik-bulkbar-height: 0px;               /* lane C sets it (:root:has(.ik-bulkbar)) while the selection bar shows: the toast sits above it */
    /* FEAT-042 shared document pieces (app.css section K): source tile, menus, group labels and the type chip colours. */
    --ik-src-size: var(--spacing-8);              /* source tile (the size of the inbox mail avatar) */
    --ik-menu-check-size: 14px;                   /* the check mark column of a menu item (the icon size) */
    --ik-label-tracking: var(--mail-doc-label-tracking); /* group labels of the FEAT-042 menus, dialogs and lists: one tracking */
    --ik-type-invoice-bg: var(--color-info-light);
    --ik-type-invoice-fg: var(--color-info-text);
    --ik-type-credit-bg: var(--color-success-light);
    --ik-type-credit-fg: var(--color-success-text);
    --ik-type-report-bg: var(--color-accent-purple-light);
    --ik-type-report-fg: var(--color-accent-purple-text);
    --ik-type-reminder-bg: var(--color-warning-light);
    --ik-type-reminder-fg: var(--color-warning-text);
    --ik-type-other-bg: var(--color-gray-100);
    --ik-type-other-fg: var(--color-gray-700);
    /* FEAT-042 inbox by Eingang (app.css section C). */
    --ik-hairline: 1px;                           /* borders and separators of the inbox pieces */
    --ik-list-width: 22rem;                       /* the compact list next to the reading pane */
    --ik-list-width-md: 18rem;                    /* ... below --bp-xl */
    --ik-table-min-width: 52rem;                  /* below this the table scrolls inside its card */
    --ik-col-src: 2.75rem;
    --ik-col-from: 11rem;
    --ik-col-docs: 12rem;
    --ik-col-date: 6.5rem;
    --ik-col-status: 7.5rem;
    --ik-col-owner: 7rem;
    --ik-col-check: 3rem;
    --ik-doc-type-col: 8rem;                      /* the «Typ» column of a document row */
    --ik-preview-height: 26rem;                   /* the preview stage of the pane */
    --ik-preview-height-phone: 22rem;
    --ik-select-size: var(--spacing-8);           /* the tap target around a checkbox */
    --ik-bulkbar-width: 44rem;
    --ik-row-selected: var(--color-gray-100);     /* not primary-light: the «Rechnung» chip has that colour */
    --ik-dismissed-opacity: 0.55;
    /* The selection bar: its height plus a gap, so the toast stands above it (toast rules read --ik-bulkbar-height). */
    --ik-bulkbar-reserve: calc(var(--control-height) + 2 * var(--spacing-2) + 2 * var(--ik-hairline) + var(--spacing-2));
    --ik-bulkbar-reserve-phone: calc(var(--spacing-4) + 2 * var(--control-height) + 3 * var(--spacing-2) + 2 * var(--ik-hairline) + var(--spacing-2));
    /* FEAT-042 Rechnung / document view (section D). */
    --ik-family-label-width: 5.5rem;              /* «Eingang», «Dokumente», «Beilagen» stand in one column */
    --ik-choice-min-width: 12rem;                 /* a choice card of «Was soll mit diesem Dokument geschehen?» */
    --ik-family-pad: var(--spacing-1) var(--pd-bar-pad-x);   /* every row of the family block: the labels align */
    /* FEAT-042 archive (section E). */
    --archive-list-border: var(--ik-hairline) solid var(--border-color);
    --archive-col-src: calc(var(--ik-src-size) + var(--spacing-4) * 2);
    --archive-col-type: 7.5rem;
    --archive-col-amount: 8rem;
    --archive-col-status: 9rem;
    --archive-col-done: 9.5rem;
    --archive-col-actions: calc(var(--control-height) + var(--spacing-4) * 2);

    /* Breakpoints — single source of truth. CSS variables are NOT resolvable
       inside @media conditions, so every media query must literally repeat
       one of these numeric values. Do not invent new breakpoints elsewhere. */
    --bp-sm:  640px;   /* phones landscape, small tablets */
    --bp-md:  768px;   /* tablets portrait */
    --bp-lg: 1024px;   /* tablets landscape, small desktops — sidebar collapses BELOW this */
    --bp-xl: 1280px;   /* desktops — 2-column layouts collapse below this */
    --bp-2xl: 1536px;  /* wide desktops */

    /* Workflow Map (FEAT-025) — mirrors the classDef palette hardcoded in
       WorkflowMermaidBuilder.cs (Mermaid SVG can't consume CSS vars, so the
       diagram nodes and this legend/card palette are kept in lockstep by
       convention, not by a shared token). Grouped here as one block per the
       existing "one :root" rule rather than a second :root selector. */
    --wm-accent: #2563eb;
    --wm-accent-soft: #dbeafe;
    --wm-accent-border: #93c5fd;
    --wm-backbone-bg: #f1f5f9;
    --wm-backbone-br: #cbd5e1;
    --wm-gap-bg: #fee2e2;
    --wm-gap-br: #ef4444;
    --wm-term-bg: #dcfce7;
    --wm-term-br: #22c55e;
    --wm-radius: 12px;
}

/* Touch keeps 44 px (FEAT-035, Chris 2026-12-02, docs/features/2026-12-02-ux-decisions.md: compact density app-wide, "touch
   keeps 44 px"; it refines FEAT-021 §4.16). Desktop controls take --control-height; on a touch device every control that
   takes its height from it (directly or through --list-toolbar-control-height) becomes the touch target, measured on the
   tappable element. A control that derives a SMALLER height from the token (the inbox segments inside their pill) has
   its own rule in the touch block after the inbox toolbar (it must follow the component rules); LookFix5829a87Tests
   guards both.
   Detection: (pointer: coarse) = the primary input is a finger (phones, tablets); (any-pointer: coarse) = SOME input is a
   finger, e.g. a touch laptop whose primary pointer is the trackpad, or a tablet with a keyboard cover — it gets tapped,
   so it needs the target too. A missed tap costs more than the denser layout gains. Hover-capable mice without a touch
   screen match neither and keep the compact density. */
@media (pointer: coarse), (any-pointer: coarse) {
    :root {
        --control-height: var(--touch-target-size);
        --settings-nav-item-height: var(--touch-target-size); /* the settings navigation items are tapped too */
        /* Look f68ad07 (b): the document toolbar (attachment chips, version select, tools) and the invoice fields are
           tapped too; they took --pd-control-height (28.1 px) and stayed small on touch. */
        --pd-control-height: var(--touch-target-size);
        /* Look 9b073ba item 4: the small button roles are tapped too (--btn-height follows --control-height). */
        --btn-sm-height: var(--touch-target-size);
        --btn-icon-sm-size: var(--touch-target-size);
        /* Look 5374281 item 4: the 44 px button is taller than the section header, whose computed padding fell to 0 —
           the button sat flush on the header's bottom border. A small token padding gives it room. */
        --pd-section-header-pad-y: var(--spacing-1);
        --pd-toolbar-btn-height: var(--touch-target-size); /* the PDF toolbar buttons are tapped too */
        --sidebar-toggle-size: var(--touch-target-size); /* FEAT-042 G9: the hamburger and the panel's close button */
    }
}

/* ==========================================================================
   Keyboard Focus (WCAG 2.4.7) — applied globally, refined per component
   ========================================================================== */
:focus { outline: none; }

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.btn:focus-visible,
.form-control:focus-visible {
    box-shadow: var(--shadow-focus);
    outline: none;
}

.form-control.is-invalid:focus-visible {
    box-shadow: var(--shadow-focus-error);
    outline: none;
}

.nav-link:focus-visible,
.nav-toggle:focus-visible,
.nav-user-menu-item:focus-visible {
    background-color: var(--nav-active-bg);
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.modal-close:focus-visible,
.toast-close:focus-visible,
.pd-side-header-back:focus-visible,
.pd-attachment-chip:focus-visible,
.settings-nav-item:focus-visible,
.cockpit-btn-icon:focus-visible,
.sidebar-user-avatar:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* One font everywhere (Chris 2026-12-03): the browser sets pre, code, kbd and samp in its monospace face; they use the
   app font with figures of equal width. White-space stays the element's own (pre keeps its line breaks). */
pre, code, kbd, samp {
    font-family: var(--font-family);
    font-variant-numeric: tabular-nums;
}

/* One font everywhere, form controls too (look 4d6af57 item 1): browsers give button, input, select and textarea their
   own system font and size (Arial 13.33 px — phase tabs, settings items, chips, checkboxes, sidebar buttons, the dialog
   close button). They inherit the app font here; a component that wants another size sets it on its own class. */
button, input, select, textarea {
    font: inherit;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--spacing-4) 0;
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

h1:focus {
    outline: none;
}

p {
    margin: 0 0 var(--spacing-4) 0;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing-6) 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* min-width: 0 — a flex item's default minimum is its widest content, so one wide table or a long
   e-mail address widened the whole page beyond the screen (demo look b755b97: /activity 1396 px
   at 1163). Wide content scrolls or wraps inside its own container instead (.data-grid-body). */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    padding: var(--main-content-pad);
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

/* Legacy support - will be replaced */
.main {
    margin-left: var(--sidebar-width);
    padding: var(--spacing-6);
    min-height: 100vh;
}

/* Main header strip — sticky top bar inside .main-content (holds notification bell, user menu) */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-3) var(--spacing-6);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-spacer { flex: 1; }

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.main-body {
    flex: 1;
    overflow-y: auto;
}

/* ==========================================================================
   Sidebar / Navigation
   ========================================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: var(--z-fixed);
    transition: width var(--transition-normal);
}

/* FEAT-037: compact header (52 px); the brand tile sits centred in the rail width. */
.sidebar-header {
    display: flex;
    align-items: center;
    height: var(--nav-header-height);
    padding: 0 var(--spacing-3) 0 var(--nav-brand-inset);
    border-bottom: var(--nav-separator);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    color: var(--text-inverse);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    white-space: nowrap;
}

.sidebar-brand-icon {
    width: var(--nav-brand-icon-size);
    height: var(--nav-brand-icon-size);
    background: var(--color-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-icon svg {
    width: var(--nav-glyph-size);
    height: var(--nav-glyph-size);
    color: var(--text-inverse);
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-2) 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--spacing-3);
}

.nav-section-title {
    padding: var(--spacing-1) var(--spacing-3) var(--spacing-1) var(--nav-text-inset);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
    text-transform: uppercase;
    letter-spacing: var(--nav-section-title-tracking);
    color: var(--color-gray-400);
    white-space: nowrap;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin: var(--nav-item-gap) 0;
}

/* One item height (32 px); the icon is inset so it keeps its x position in the rail. */
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    height: var(--nav-item-height);
    padding: 0 var(--spacing-3) 0 var(--nav-link-inset);
    color: var(--color-gray-300);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    border-left: var(--nav-active-bar) solid transparent;
    /* Look 5829a87 item 1: the changing properties only. "all" also animated the INHERITED visibility of the opening
       off-canvas sidebar, so the link was still hidden when it should take the focus (0 of 12 opens focused it). */
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.nav-link > span:not(.nav-badge) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link:hover {
    color: var(--text-inverse);
    background-color: var(--nav-hover-bg);
}

.nav-link.active {
    color: var(--text-inverse);
    background-color: var(--nav-active-bg);
    border-left-color: var(--color-primary);
}

.nav-link svg,
.nav-link .nav-icon {
    width: var(--nav-icon-size);
    height: var(--nav-icon-size);
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-link:hover svg,
.nav-link.active svg,
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

/* FEAT-021 §4.15: NavMenu inbox count badge. Pushed to the right of the label
   via margin-left: auto so it stays flush against the sidebar edge regardless
   of label length. In the rail it moves onto the icon corner (desktop block below). */
.nav-link .nav-badge {
    margin-left: auto;
    font-size: var(--nav-badge-font-size);
    padding: 0 var(--spacing-2);
    line-height: var(--nav-badge-height);
    min-width: var(--nav-badge-height);
    justify-content: center;
}

/* FEAT-037: collapse/expand row at the bottom of the nav, the same place in both states. Both icons
   and texts are in the markup; the state class on <html> shows one (desktop block below). */
.nav-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    width: 100%;
    height: var(--nav-item-height);
    padding: 0 var(--spacing-3) 0 var(--nav-text-inset);
    border: 0;
    border-top: var(--nav-separator);
    background: transparent;
    color: var(--color-gray-400);
    font: inherit;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
}

.nav-toggle:hover {
    color: var(--text-inverse);
    background-color: var(--nav-hover-bg);
}

.nav-toggle svg {
    width: var(--nav-icon-size);
    height: var(--nav-icon-size);
    flex-shrink: 0;
}

.nav-toggle-icon--expand,
.nav-toggle-text--expand {
    display: none;
}

.sidebar-footer {
    padding: var(--spacing-2);
    border-top: var(--nav-separator);
    flex-shrink: 0;
}

/* Compact About link + build version pinned at the very bottom of the sidebar: only "Version x"
   is visible (fits 208 px); the full "About Invoice Flow, version x" is the accessible name. */
.sidebar-about {
    display: block;
    padding: var(--spacing-1) var(--spacing-3) var(--spacing-1) var(--nav-text-inset);
    border-top: var(--nav-separator);
    font-size: var(--font-size-xs);
    color: var(--color-gray-400);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.sidebar-about:hover {
    color: var(--text-inverse);
}

/* The version stays in the app font (one font family per app); tabular digits keep it steady. */
.sidebar-about-version {
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
}

/* Compact user card; the avatar sits centred in the rail width in both states. */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-height: var(--nav-user-card-height);
    padding: var(--spacing-1) var(--spacing-1) var(--spacing-1) calc(var(--nav-avatar-inset) - var(--spacing-2));
    border-radius: var(--radius-lg);
    transition: background-color var(--transition-fast);
}

.sidebar-user:hover {
    background-color: var(--nav-hover-bg);
}

/* The avatar is the button of the user menu (name, role, About, sign out). */
.sidebar-user-avatar {
    width: var(--nav-avatar-size);
    height: var(--nav-avatar-size);
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--color-gray-600);
    color: var(--color-gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.sidebar-user-avatar svg {
    width: var(--nav-glyph-size);
    height: var(--nav-glyph-size);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    color: var(--text-inverse);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-tight);
    color: var(--color-gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sign-out button lives alongside the user name/role in the sidebar
   footer. Replaces the old UserMenu dropdown in the removed top bar. */
.sidebar-signout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--nav-item-height);
    height: var(--nav-item-height);
    padding: 0;
    border: var(--nav-control-border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-gray-300);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}
.sidebar-signout:hover {
    background-color: var(--nav-control-hover-bg);
    color: var(--text-inverse);
}
.sidebar-signout:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Look 5829a87 item 1: the close button of the open off-canvas sidebar (a modal dialog below --bp-lg; the bar button
   lies under the panel then). The sign-out button's look on the dark surface; shown below --bp-lg only. */
.sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 0;
    border: var(--nav-control-border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-gray-300);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}
.sidebar-close:hover {
    background-color: var(--nav-control-hover-bg);
    color: var(--text-inverse);
}

/* FEAT-037: every focus ring inside the dark sidebar is light (WCAG 1.4.11, >= 3:1); the rules above keep
   width and offset. Must stay AFTER them (same specificity). The user menu (white) is outside .sidebar. */
.sidebar :focus-visible {
    outline-color: var(--nav-focus-ring);
}

/* FEAT-037: the rail's tooltip (WCAG 1.4.13) — one real element, fixed next to the rail at the
   position wwwroot/js/nav-sidebar.js writes into --nav-tip-x / --nav-tip-y, so the scrolling
   .sidebar-nav cannot clip it. Hoverable (pointer events stay on), dismissed with Escape. */
.nav-tooltip {
    position: fixed;
    left: var(--nav-tip-x);
    top: var(--nav-tip-y);
    transform: translate(var(--nav-tooltip-offset), -50%);
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: var(--radius-md);
    background: var(--color-gray-900);
    color: var(--text-inverse);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: var(--z-tooltip);
}

.nav-tooltip[hidden] {
    display: none;
}

/* FEAT-037: user menu of the avatar (name, role, About + version, sign out). */
.nav-user-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-fixed) + 1);   /* above the sidebar and its scrim (off-canvas below 1024 px) */
}

.nav-user-menu {
    position: fixed;
    left: calc(var(--sidebar-width) + var(--nav-tooltip-offset));
    bottom: var(--spacing-2);
    min-width: var(--nav-user-menu-min-width);
    max-width: min(var(--nav-user-menu-max-width), calc(100vw - var(--sidebar-width) - 2 * var(--nav-tooltip-offset)));
    background: var(--bg-card);
    color: var(--text-primary);
    border: var(--nav-menu-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: calc(var(--z-fixed) + 2);
    overflow: hidden;
}

.nav-user-menu-head {
    padding: var(--spacing-3);
    border-bottom: var(--nav-menu-border);
}

.nav-user-menu-name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.nav-user-menu-role {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    overflow-wrap: break-word;
}

.nav-user-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    width: 100%;
    height: var(--nav-item-height);
    padding: 0 var(--spacing-3);
    border: 0;
    background: transparent;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

/* One line per item; the full text is the item's title. */
.nav-user-menu-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-menu-item:hover {
    background: var(--color-gray-50);
}

.nav-user-menu-item svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* The About item: label and version on two lines (on one line the version left "Ü…" at 375 px). */
.nav-user-menu-item--about {
    height: auto;
    min-height: var(--nav-item-height);
    padding-top: var(--spacing-1);
    padding-bottom: var(--spacing-1);
}

.nav-user-menu-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.nav-user-menu-version {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-tight);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The stored state is applied after sign-in without the width animation (one frame, nav-sidebar.js). */
:root.nav-no-transition .sidebar,
:root.nav-no-transition .main-content {
    transition: none;
}

/* FEAT-037: the icon rail (56 px) and the hover peek — desktop only. Below --bp-lg the sidebar stays
   the off-canvas panel it was. The one switch is the class on <html> (set before Blazor starts):
   .sidebar and .main-content already read --sidebar-width. */
@media (min-width: 1024px) {   /* --bp-lg */
    :root.nav-collapsed {
        --sidebar-width: var(--nav-width-rail);
    }

    /* Labels and section titles stay in the DOM as accessible names (the .sr-only pattern). */
    :root.nav-collapsed:not(.nav-peek) .nav-link > span:not(.nav-badge),
    :root.nav-collapsed:not(.nav-peek) .nav-section-title {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    /* Reachable through the avatar menu, so not focusable while invisible. */
    :root.nav-collapsed:not(.nav-peek) .sidebar-brand-name,
    :root.nav-collapsed:not(.nav-peek) .nav-toggle-text,
    :root.nav-collapsed:not(.nav-peek) .sidebar-user-info,
    :root.nav-collapsed:not(.nav-peek) .sidebar-signout {
        display: none;
    }

    /* The About line keeps its height (invisible, not removed), so the toggle row stays at the same y. */
    :root.nav-collapsed:not(.nav-peek) .sidebar-about {
        visibility: hidden;
    }

    :root.nav-collapsed .nav-toggle-icon--collapse,
    :root.nav-collapsed .nav-toggle-text--collapse {
        display: none;
    }

    :root.nav-collapsed .nav-toggle-icon--expand {
        display: block;
    }

    :root.nav-collapsed.nav-peek .nav-toggle-text--expand {
        display: inline;
    }

    /* Section titles become thin separators. */
    :root.nav-collapsed:not(.nav-peek) .nav-section {
        margin-bottom: 0;
    }

    :root.nav-collapsed:not(.nav-peek) .nav-section + .nav-section::before {
        content: "";
        display: block;
        height: var(--nav-separator-width);
        margin: var(--spacing-1) var(--spacing-3);
        background: var(--nav-separator-color);
    }

    /* Inbox count: a small pill on the icon's top-right corner. */
    :root.nav-collapsed:not(.nav-peek) .nav-link .nav-badge {
        position: absolute;
        top: var(--nav-badge-rail-top);
        left: calc(var(--nav-link-inset) + var(--nav-icon-size) - var(--spacing-1));
        margin: 0;
        padding: 0 var(--spacing-1);
        min-width: var(--nav-badge-rail-height);
        line-height: var(--nav-badge-rail-height);
        font-size: var(--nav-badge-rail-font-size);
        border: var(--nav-separator-width) solid var(--bg-sidebar);
    }

    /* Peek: the expanded nav lies OVER the content; --sidebar-width keeps the rail, nothing moves. */
    :root.nav-collapsed.nav-peek .sidebar {
        width: var(--nav-width-expanded);
        box-shadow: var(--shadow-xl);
    }
}

/* --- Sidebar toggle (hamburger) — hidden on desktop, shown below --bp-lg --- */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: var(--sidebar-toggle-size);
    height: var(--sidebar-toggle-size);
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--color-gray-50);
    color: var(--text-primary);
    border-color: var(--border-color-dark);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* --- Top bar (F040-015, Chris 2026-12-03) — menu button + page title, below --bp-lg only. The floating button
   it replaces covered content when fixed (look c7e4d4c) and scrolled away with the menu when absolute. --- */
.app-topbar {
    display: none;
}

.app-topbar__title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

/* --- Scrim — covers main content when sidebar is open on mobile --- */
.sidebar-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: calc(var(--z-fixed) - 1);
}

/* --- Mobile / tablet sidebar collapse — below --bp-lg (1024) --- */
@media (max-width: 1023.98px) {   /* --bp-lg off-by-one safe */
    /* Look 4d6af57 item 3: the closed off-canvas panel is out of the tab order and the accessibility tree (48 of 80 Tab
       stops at 375 px went to invisible links). visibility switches after the slide-out (delay = its duration), and at
       once when it opens, so the animation stays. */
    .sidebar {
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform var(--transition-normal), visibility 0s linear var(--duration-normal);
        box-shadow: var(--shadow-xl);
    }

    .app-layout.sidebar-open .sidebar {
        transform: translateX(0);
        visibility: visible;
        transition: transform var(--transition-normal), visibility 0s;
    }

    .main-content,
    .main {
        margin-left: 0;
    }

    /* WCAG 2.4.11: a field that takes the focus scrolls into view below the sticky bar, never under it — and its label
       above it too (look 4d6af57 item 2: "Fällig am" ended 4–5 px under the bar, its label hidden). */
    html {
        scroll-padding-top: calc(var(--topbar-height) + var(--focus-label-allowance));
    }

    /* The bar stays at the top while the page scrolls; it spans the content's full width (cancels the padding of
       .main-content) and the content starts below it — nothing scrolls over or under the button. */
    .app-topbar {
        display: flex;
        align-items: center;
        gap: var(--spacing-3);
        position: sticky;
        top: 0;
        z-index: var(--z-sticky);
        height: var(--topbar-height);
        margin: calc(-1 * var(--main-content-pad)) calc(-1 * var(--main-content-pad)) var(--spacing-4);
        padding: 0 var(--spacing-2);
        background: var(--bg-card);
        border-bottom: var(--topbar-border);
    }

    .app-layout.sidebar-open .sidebar-scrim {
        display: block;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    /* The same size as the bar button that opened the panel. */
    .sidebar-close {
        display: inline-flex;
        width: var(--sidebar-toggle-size);
        height: var(--sidebar-toggle-size);
    }

    /* FEAT-037: collapsing is a desktop feature; below --bp-lg the off-canvas panel stays as it was. */
    .nav-toggle {
        display: none;
    }

    /* The user menu lies inside the open off-canvas sidebar, right above the user card, and never
       wider than the screen (look dbdd0bd: at 375 px it opened at x=215 and ran 60 px off-screen). */
    .nav-user-menu {
        left: var(--spacing-2);
        bottom: calc(var(--nav-footer-height) + var(--nav-about-height));
        width: calc(var(--sidebar-width) - 2 * var(--spacing-2));
        min-width: 0;
        max-width: calc(100vw - 2 * var(--spacing-2));
    }
}

/* Review M-2: the global reduced-motion rule shortens transition DURATIONS only; the visibility DELAY above stayed, so the
   closed sidebar remained focusable for --duration-normal. Without motion there is nothing to wait for: no transition,
   the panel shows and hides at once. */
@media (prefers-reduced-motion: reduce) and (max-width: 1023.98px) {
    .sidebar,
    .app-layout.sidebar-open .sidebar {
        transition: none;
    }
}

/* ==========================================================================
   Page Header
   ========================================================================== */
.page-header {
    margin-bottom: var(--spacing-6);
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.page-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: var(--spacing-2) 0 0 0;
}

/* Look 4d6af57: the not-found state (unknown route, missing process; desktop page header and mobile empty state).
   Title, text and the way back stack in one column with one gap; the action stands at the end of the block in the
   text column (CLAUDE.md action places: section actions at its end, not floating), the same in both variants. */
.not-found-state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-2);
}

.not-found-state > * {
    margin: 0;
}

.not-found-state__actions {
    display: flex;
    gap: var(--spacing-2);
    margin-top: var(--spacing-4);
}

/* Mobile: the empty state is centred like every other mobile empty state. */
.m-empty.not-found-state {
    align-items: center;
}

/* Look 5829a87 item 5: the heading takes the focus by script so a screen reader starts there (tabindex="-1": not in the
   Tab order, not interactive). It is no control, so it shows no focus ring — the global :focus-visible drew a blue box
   around the heading on every visit, most visibly on the phone. */
.not-found-state [tabindex="-1"]:focus {
    outline: none;
}

/* ==========================================================================
   Cards
   ========================================================================== */

/* Shared surface recipe — compose on any card-like element written from now on.
   Existing .card/.settings-card/.cockpit-*/pd-viewer/pd-side are intentionally
   left with their own copies of the 4-line recipe (low-churn pragma). */
.surface {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-header {
    padding: var(--spacing-4) var(--spacing-5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: var(--spacing-5);
}

.card-footer {
    padding: var(--spacing-4) var(--spacing-5);
    border-top: 1px solid var(--border-color);
    background: var(--color-gray-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.content-area {
    display: block;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-4);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    min-height: var(--btn-height);   /* look 9b073ba item 4: the height of the role; the touch target on touch devices */
}

.btn:focus {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Button Variants */
.btn-primary {
    background-color: var(--color-primary);
    color: var(--text-inverse);
    border-color: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-secondary {
    background-color: var(--color-gray-100);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-gray-200);
    border-color: var(--border-color-dark);
}

/* White on --color-success was 2.54:1 (look c7e4d4c): the button takes the AA step, hover one darker. */
.btn-success {
    background-color: var(--color-success-text);
    color: var(--text-inverse);
    border-color: var(--color-success-text);
}

.btn-success:hover:not(:disabled) {
    background-color: var(--color-success-hover);
    border-color: var(--color-success-hover);
}

/* White on amber was 2.15:1 (look c7e4d4c): dark text on the amber button. */
.btn-warning {
    background-color: var(--color-warning);
    color: var(--text-primary);
    border-color: var(--color-warning);
}

.btn-warning:hover:not(:disabled) {
    background-color: var(--color-warning-dark);
    border-color: var(--color-warning-dark);
}

/* White on --color-error was 3.76:1 (look c7e4d4c, "Als Duplikat verwerfen"): red-600 reaches 4.83:1,
   hover one step darker (6.47:1). */
.btn-danger {
    background-color: var(--color-error-dark);
    color: var(--text-inverse);
    border-color: var(--color-error-dark);
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--color-error-text);
    border-color: var(--color-error-text);
}

.btn-outline-primary {
    background-color: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline-primary:hover:not(:disabled) {
    background-color: var(--color-primary);
    color: var(--text-inverse);
}

.btn-outline-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover:not(:disabled) {
    background-color: var(--color-gray-100);
    color: var(--text-primary);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--color-gray-100);
    color: var(--text-primary);
}

/* Button Sizes */
.btn-sm {
    padding: var(--spacing-1) var(--spacing-3);
    font-size: var(--font-size-xs);
    min-height: var(--btn-sm-height);
}

.btn-lg {
    padding: var(--spacing-3) var(--spacing-6);
    font-size: var(--font-size-base);
}

/* Icon-only Buttons - square at the one control height, so an icon button beside a field (the bexio copy button) is as
   high as the field (look d63395d: 36.0 vs 36.7 px); on touch devices the token is the 44 px target.
   Look 5374281 item 2: EVERY icon-only button carries .btn-icon (LookFix5374281Tests guards the markup) — a .btn-sm with
   only an icon sized its width from padding and was 38–40.5 × 44 px on touch. .btn-icon.btn-sm is the one square rule for
   the small role: 28 px on the desktop, the 44 px target on touch; a context that needs another square sets the token. */
.btn-icon {
    padding: var(--spacing-2);
    width: var(--control-height);
    height: var(--control-height);
    flex-shrink: 0;   /* look 9b073ba: beside a 100 %-wide field the flex item shrank to 35.4 px wide */
}

.btn-icon.btn-sm {
    width: var(--btn-icon-sm-size);
    height: var(--btn-icon-sm-size);
    padding: var(--spacing-1);
}

.btn-icon svg {
    width: var(--btn-icon-glyph-size);
    height: var(--btn-icon-glyph-size);
}

.btn-icon.btn-sm svg {
    width: var(--btn-icon-sm-glyph-size);
    height: var(--btn-icon-sm-glyph-size);
}

/* Look 5374281 item 3: an inline text link (a .btn-link inside a line of text or a label row, padding 0) keeps the height
   of its line: it is not a button role and takes no role min-height (the PDF version banner grew ~7 px on the desktop,
   the "Modelle laden" label row to 44 px on touch). A standalone link action (archive "Alle zeigen") keeps its role. */
.pd-pdfviewer-banner .btn-link,
.settings-label-row .btn-link {
    min-height: 0;
}

/* Button Group */
.btn-group {
    display: inline-flex;
    gap: var(--spacing-2);
}

/* ==========================================================================
   Tabs
   ========================================================================== */
/* Look d63395d (2026-12-05): a tab row never grows past its box and never wraps a label - on a narrow screen it scrolls
   sideways inside its own box (not the page), and TabRow (Components/Shared) scrolls the active tab into view. Measured
   before: 519 px row in a 328 px card at 375 px; "Weitere Ziele" wrapped to two lines (54 px tabs) at 1163 px. */
.tabs {
    display: inline-flex;
    gap: var(--spacing-2);
    --scroll-cue-surface: var(--color-gray-100);   /* the pill's surface; painted by the shared scroll cue below */
    padding: var(--spacing-2);
    border-radius: var(--radius-md);
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scroll-padding-inline: var(--spacing-2);
}

.tab {
    display: inline-flex;
    flex-shrink: 0;
    white-space: nowrap;
    align-items: center;
    gap: var(--spacing-2);
    box-sizing: border-box;
    height: var(--tab-height);   /* look 0ed9dd5 item 2: the token, not padding + content (a count badge grew the tab) */
    padding: 0 var(--spacing-4);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    background-color: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.tab:hover:not(.tab-active) {
    background-color: var(--color-gray-200);
    color: var(--text-primary);
}

.tab-active {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Form Elements
   ========================================================================== */
.form-group {
    margin-bottom: var(--spacing-4);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.form-label-required::after {
    content: ' *';
    color: var(--color-error-text);   /* the asterisk is text: AA (review M-2) */
}

/* Look 0ed9dd5 item 1: every field takes the one control height from the token, so a field, a select, a date field
   and the buttons beside it are equally tall at every width (on a touch device the copy button was 44 px next to a
   36.7 px field). On a mouse device the token is the field's natural height (no change); the text keeps its line. */
.form-control {
    width: 100%;
    height: var(--control-height);
    padding: var(--spacing-2) var(--spacing-3);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Time and date inputs: Chromium's inner editor (wrapper padding 1px 0, picker indicator
   padding) makes them 2.1 px taller than text/number inputs. Neutralise both so
   a time or date input has the same control height as every other .form-control
   (look 6b3737c: the absence dates were 38.7 px next to 36.7 px). */
.form-control[type="time"]::-webkit-datetime-edit-fields-wrapper,
.form-control[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

.form-control[type="time"]::-webkit-calendar-picker-indicator,
.form-control[type="date"]::-webkit-calendar-picker-indicator {
    height: 1lh;
    margin: 0;
    padding: 0;
}

/* Select */
select.form-control {
    padding-right: var(--spacing-8);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right var(--spacing-2) center;
    background-repeat: no-repeat;
    background-size: 1.5rem 1.5rem;
    appearance: none;
}

/* Textarea (look aeeee19): an inline-block textarea sits on the text baseline, so the line's descender added 5 px
   between the field and its help text (16.3 px vs 11.3 px under an input). Top-aligned it ends the line box like an
   input does: the same margin + help-text gap under both. (display: block would let its margin collapse with the
   help text's and make the gap 7.5 px, again different from the input's.) */
textarea.form-control {
    height: auto;   /* a multi-line field keeps the height of its rows (look 0ed9dd5: not the one-line control height) */
    vertical-align: top;
    min-height: 100px;
    resize: vertical;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-2);
}

.form-check-input {
    width: var(--form-check-size);
    height: var(--form-check-size);
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.form-check-label {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
}

/* Form-switch modifier — makes the label block-level so stacked content
   (strong + description) lays out vertically instead of inline. */
.form-check.form-switch .form-check-label {
    display: block;
    padding-left: var(--spacing-2);
}

/* A switch with a title + description label: the box sits on the TITLE line (centred on its
   line box), not on the centre of the whole two-line label. Switches without a label
   (settings toggles) keep the centred layout. */
.form-check.form-switch:has(> .form-check-label) {
    align-items: flex-start;
}

.form-check.form-switch:has(> .form-check-label) > .form-check-input {
    flex-shrink: 0;
    margin-top: calc((var(--font-size-sm) * var(--line-height-normal) - var(--form-check-size)) / 2);
}

/* Switches that depend on the switch above them (e.g. the four mail types under
   "Email notifications"): one indented sub-list with a guide line. */
.form-check-subgroup {
    margin-left: calc(var(--form-check-size) / 2);
    margin-bottom: var(--spacing-4);
    padding-left: var(--spacing-4);
    border-left: 1px solid var(--border-color);
}

/* The guide line ends with the last switch; the group carries the spacing below it. */
.form-check-subgroup > .form-group:last-child {
    margin-bottom: 0;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

/* Form Help Text */
.form-text {
    display: block;
    margin-top: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* Form Error State */
.form-control.is-invalid,
.form-group .form-control.is-invalid,
.invalid {
    border-color: var(--color-error);
}

.form-control.is-invalid:focus {
    box-shadow: var(--shadow-focus-error);
}

.invalid-feedback,
.validation-message {
    display: block;
    margin-top: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--color-error-text);
}

/* Message line of one field (or of the form end): always rendered, one line high when empty, so
   an error or a success text appears in place instead of pushing the button down. */
.form-message-line {
    display: block;
    min-height: var(--form-message-line-height);
    margin: var(--spacing-1) 0 0;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-normal);
    color: var(--color-error-text);
}

.form-message-line--success {
    color: var(--color-success-text);
}

/* The reserved message line is the space below its field: it replaces the group spacing instead of
   adding to it (demo look 7de3354: 40 px between the fields and 75 px before the action). */
.form-group:has(> .form-message-line) {
    margin-bottom: 0;
}

.form-message-line + .settings-actions {
    padding-top: 0;
}

/* Form Success State */
.form-control.is-valid,
.valid.modified:not([type=checkbox]) {
    border-color: var(--color-success);
    outline: none;
}

.form-control.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-4);
}

/* Legacy form-group styles */
.form-group label {
    display: block;
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.form-group input:not([type="checkbox"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--spacing-2) var(--spacing-3);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Look 9b073ba item 1: the space under a field belongs to the group, on its field slot — a field directly in the group,
   or the row that holds one (input + button). Before, every input in a group carried it, also inside a centred
   input-plus-button row: the field's margin box was 7.5 px taller and the copy button sat 3.7 px lower. Same distances
   as before for a field directly in the group and for a row (its height held the input's margin). */
.form-group > :is(input:not([type="checkbox"]), select, textarea, :has(> input:not([type="checkbox"]), > select, > textarea)) {
    margin-bottom: var(--spacing-2);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: var(--spacing-2);
}

/* One disabled look for every field (look 71a5c24). It also lists the .form-group selectors: their rule above
   (0,2,1) sets the background and beat a plain .form-control:disabled (0,2,0), so a disabled field in a form
   group stayed white and looked editable. */
.form-control:disabled,
.form-group input:not([type="checkbox"]):disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background-color: var(--bg-input-disabled);
    color: var(--text-input-disabled);
    border-color: var(--border-input-disabled);
    cursor: not-allowed;
}

.form-group-column {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Data Table / Grid
   ========================================================================== */
.data-grid {
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.data-grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4);
    padding: var(--spacing-4);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--border-color);
}

/* Look 861a82b item 7: the field had no width of its own (a content-sized input up to 300px): "Postfächer su…". */
.data-grid-search {
    position: relative;
    flex: 1 1 var(--search-field-width);
    min-width: var(--search-field-min-width);
    max-width: var(--search-field-width);
}

/* The toolbar's start group (search + ToolbarStart) takes the free room of its line, so the search can reach its width. */
.data-grid-toolbar > :first-child {
    flex: 1 1 auto;
}

/* Look 0ed9dd5 item 5: the create action has one place - the right end of the toolbar, also when it wraps under the
   search on a phone ("Netzlaufwerk hinzufügen" sat left there, "Ziel hinzufügen" right). */
.data-grid-toolbar > :last-child {
    margin-inline-start: auto;
}

.data-grid-search input {
    width: 100%;
    padding-left: var(--spacing-10);
}

.data-grid-search svg {
    position: absolute;
    left: var(--spacing-3);
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

/* The table's own container (DataGrid, and every raw .data-grid-table): a table wider than the card
   scrolls sideways here instead of widening the page. */
.data-grid-body {
    overflow-x: auto;
}

.data-grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-grid-table thead {
    background: var(--color-gray-50);
}

.data-grid-table th {
    padding: var(--spacing-3) var(--spacing-4);
    text-align: left;
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-grid-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-grid-table th.sortable:hover {
    color: var(--text-primary);
}

.data-grid-table th .sort-icon {
    margin-left: var(--spacing-1);
    opacity: 0.5;
}

.data-grid-table th.sorted .sort-icon {
    opacity: 1;
    color: var(--color-primary);
}

.data-grid-table td {
    padding: var(--spacing-3) var(--spacing-4);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-grid-table tbody tr:last-child td {
    border-bottom: none;
}

.data-grid-table tbody tr:hover {
    background-color: var(--color-gray-50);
}

.data-grid-table .actions {
    white-space: nowrap;
    text-align: right;
}

.data-grid-empty {
    padding: var(--spacing-12) var(--spacing-4);
    text-align: center;
    color: var(--text-secondary);
}

.data-grid-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--spacing-4);
    opacity: 0.5;
}

.data-grid-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-3) var(--spacing-4);
    background: var(--color-gray-50);
    border-top: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
}

.data-grid-pagination-info {
    color: var(--text-secondary);
}

.data-grid-pagination-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

/* --- Cell color/alignment utilities — reusable on any .data-grid-table --- */
.data-grid-table .dim  { color: var(--text-muted); }
.data-grid-table .ok   { color: var(--color-success-text); }
.data-grid-table .warn { color: var(--color-warning-text); }
.data-grid-table .err  { color: var(--color-error-text); }
.data-grid-table .num  { text-align: right; font-variant-numeric: tabular-nums; }

.data-grid-table .process-link {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
}

.data-grid-table .process-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* --- Dense modifier — metrics-style: no uppercase, tabular-nums, nowrap.
       Used by the service dashboard; opt in via .data-grid-table--dense. --- */
.data-grid-table--dense thead th {
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-grid-table--dense tbody td {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    padding: var(--spacing-3) var(--spacing-5);
}

.data-grid-table--dense thead th {
    padding: var(--spacing-3) var(--spacing-5);
}

.data-grid-table--dense tbody tr:hover td {
    background: var(--color-gray-50);
}

/* --- FEAT-031: opt-in grouping (DataGrid GroupKey). A header row has one cell per
       column, the first holds the toggle; child rows are indented; the hint row is muted.
       The accent bar on the first cell ties header, children and hint together.
       Grids without GroupKey render none of these classes. --- */
.data-grid-row--clickable {
    cursor: pointer;
}

.data-grid-table tr.data-grid-group-header {
    background: var(--color-gray-50);
}

.data-grid-table tr.data-grid-group-header > td {
    border-bottom-color: var(--color-gray-100);
}

.data-grid-table tr.data-grid-group-header > td:first-child {
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-accent);
}

/* Collapsed: nothing follows inside the group, so the header closes with the full row border. */
.data-grid-table tr.data-grid-group-header--collapsed > td {
    border-bottom-color: var(--border-color);
}

/* The toggle is a .btn.btn-sm.btn-ghost (size, hover and focus ring come from there). */
.data-grid-group-toggle {
    color: var(--text-secondary);
}

.data-grid-table tr.data-grid-group-child > td:first-child,
.data-grid-table tr.data-grid-group-hint > td:first-child {
    padding-left: calc(var(--spacing-4) + var(--spacing-8));
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-accent);
}

/* Lighter divider between the rows of one group; the last row keeps the full border. */
.data-grid-table tr.data-grid-group-child:has(+ tr.data-grid-group-child) > td,
.data-grid-table tr.data-grid-group-child:has(+ tr.data-grid-group-hint) > td {
    border-bottom-color: var(--color-gray-100);
}

.data-grid-table tr.data-grid-group-hint > td {
    padding-top: var(--spacing-2);
    padding-bottom: var(--spacing-2);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* --- Column layout classes (DataGridColumn.CssClass, on th and every td of the column).
       No data table scrolls sideways for long e-mail addresses: an address column takes a
       fixed share and truncates (max-width: 0 lets the auto table layout shrink it below its
       content; the full value is the cell text's title). The subject column gets the rest;
       its subject and file names keep `overflow-wrap: anywhere` (email-group block), so a long
       name without spaces never widens the table — words still break at spaces when they fit. --- */
.data-grid-table .data-grid-col--process {
    width: var(--grid-col-process-width);
    white-space: nowrap;
}

.data-grid-table .data-grid-col--address {
    width: var(--grid-col-address-width);
    max-width: 0;
    min-width: var(--grid-col-address-min-width);   /* wins over max-width: the table scrolls instead */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Text that must stay readable in full (an address in a list of addresses, a subject): wraps at
   word boundaries; addresses get break points after '@' and '.' from the WrapText component.
   Never `overflow-wrap: anywhere` on the cell (demo look 7de3354): it lowers the cell's minimum
   width to one character, and the auto table layout then set names one letter per line. The
   minimum width keeps the column readable; a wider table scrolls inside .data-grid-body. */
.data-grid-table .data-grid-col--wrap {
    min-width: var(--grid-col-wrap-min-width);
    overflow-wrap: break-word;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal-backdrop.show {
    opacity: 1;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: var(--z-modal);
    width: 100%;
    max-width: 500px;
    max-height: calc(100vh - 2rem);
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
    display: flex;
    flex-direction: column;
}

/* Look 861a82b item 5: the dialog takes the focus itself (tabindex=-1) only while its body has no control yet (the merge
   dialog's skeleton); it is never a Tab stop, so it draws no ring (it framed the whole dialog in blue). modal-focus.js
   moves the focus to the first control once the content is there. */
.modal:focus {
    outline: none;
}

.modal.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 700px; }
.modal-xl { max-width: 900px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-4) var(--spacing-5);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--color-gray-100);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: var(--spacing-5);
    overflow-y: auto;
    flex: 1;
    /* Look 9d4bfe1 item 2: a long word (a URL, a path in a test message) breaks instead of widening the dialog body —
       the SharePoint preview URL scrolled it sideways to 542 px at 375 px. */
    overflow-wrap: break-word;
}

/* A URL or path shown as code (SharePoint "Vorschau") has no break opportunity: it may break anywhere. */
.modal-body code {
    overflow-wrap: anywhere;
}

/* The one action bar of every dialog (Chris 2026-10-12): bottom right, the main action furthest right ("Abbrechen |
   Speichern"); a secondary action ("Verbindung testen", "Verbinden") or a destructive one sits in the start slot, set
   apart on the left. Look 9d4bfe1 item 1: the bar wraps — at 375 px it overflowed ("Verbindung testen" at l=-57.8). */
.modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-3);
    padding: var(--spacing-4) var(--spacing-5);
    border-top: 1px solid var(--border-color);
    background: var(--color-gray-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* The start slot: first in the markup, the free space pushes everything after it to the right. */
.modal-footer__start {
    margin-inline-end: auto;
}

/* On a phone a centred dialog moved its top (and with it the tab strip and the footer) whenever a
   tab had a different height (demo look b755b97, user dialog at 375 px). The dialog is anchored to
   the top instead; a dialog with tabs keeps one height, so its footer stays in place as well.
   Heights use the dynamic viewport (100dvh: the area between the browser bars, so the footer is not
   hidden behind the bottom bar); the 100vh line before it is the fallback for browsers without dvh. */
@media (max-width: 640px) {   /* --bp-sm */
    .modal {
        top: var(--modal-offset-top-sm);
        transform: translate(-50%, 0) scale(0.95);
        max-height: calc(100vh - 2 * var(--modal-offset-top-sm));
        max-height: calc(100dvh - 2 * var(--modal-offset-top-sm));
    }

    .modal.show {
        transform: translate(-50%, 0) scale(1);
    }

    .modal:has(.modal-tabs) {
        height: calc(100vh - 2 * var(--modal-offset-top-sm));
        height: calc(100dvh - 2 * var(--modal-offset-top-sm));
        max-height: calc(100vh - 2 * var(--modal-offset-top-sm));
        max-height: calc(100dvh - 2 * var(--modal-offset-top-sm));
    }

    /* Look 9d4bfe1 item 1: on a phone the start slot takes a row of its own, above "Abbrechen | Speichern" (which stay
       together, right-aligned) — wrapping item by item split Cancel from Save. */
    .modal-footer__start {
        flex: 1 0 100%;
        margin-inline-end: 0;
    }
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
/* FEAT-042 (spec §6.8, OQ-10 «all toasts at the bottom»): centred at the bottom of the content area on the desktop, full
   width at the bottom on the phone (--bp-sm block below). */
.toast-container {
    position: fixed;
    bottom: calc(var(--spacing-5) + var(--ik-bulkbar-height));
    left: 50%;
    transform: translateX(-50%);
    width: min(var(--ik-toast-width), calc(100vw - 2 * var(--spacing-4)));
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    pointer-events: none;
}

/* Desktop with the sidebar: centred over the content, not over the whole window. */
@media (min-width: 1024px) {   /* --bp-lg */
    .toast-container {
        left: calc(50% + var(--sidebar-width) / 2);
    }
}

.toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    overflow: hidden;
    padding: var(--spacing-4);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--border-color);
    pointer-events: auto;
    animation: toast-slide-in var(--transition-normal) ease-out;
}

.toast.toast-exiting {
    animation: toast-slide-out var(--transition-normal) ease-in forwards;
}

@keyframes toast-slide-in {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

.toast-success { border-left-color: var(--color-success); }
.toast-error { border-left-color: var(--color-error); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-info { border-left-color: var(--color-info); }

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-error); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--color-info); }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-1);
}

.toast-message {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.toast-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-close svg {
    width: 16px;
    height: 16px;
}

/* FEAT-042: the one action of a toast («Rückgängig») and the timer bar that runs for --ik-toast-duration. */
.toast-action {
    flex-shrink: 0;
    align-self: center;
    min-height: var(--btn-sm-height);   /* the small button role (44 px on touch, from the token) */
    white-space: nowrap;
}

.toast-timer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--ik-toast-timer-height);
    background: var(--color-gray-200);
}

.toast-timer > span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--color-primary);
    transform-origin: left center;
    animation: toast-timer var(--ik-toast-duration) linear forwards;
}

/* The bar stands still while the toast is hovered or holds the keyboard focus (the server timer pauses with it). */
.toast:hover .toast-timer > span,
.toast:focus-within .toast-timer > span {
    animation-play-state: paused;
}

@keyframes toast-timer {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .toast-timer > span {
        animation: none;
    }
}

@media (max-width: 640px) {   /* --bp-sm */
    /* FEAT-042: full width at the bottom on the phone, above a visible selection bar. */
    .toast-container {
        left: 0;
        right: 0;
        bottom: var(--ik-bulkbar-height);
        width: auto;
        transform: none;
        padding: var(--spacing-2) var(--spacing-3);
    }
}

/* ==========================================================================
   Status Badge
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    padding: var(--spacing-1) var(--spacing-2);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-full);
}

.badge-success {
    background-color: var(--color-success-light);
    color: var(--color-success-text);
}

.badge-warning {
    background-color: var(--color-warning-light);
    color: var(--color-warning-text);
}

.badge-error {
    background-color: var(--color-error-light);
    color: var(--color-error-text);
}

.badge-info {
    background-color: var(--color-info-light);
    color: var(--color-info-text);
}

.badge-neutral {
    background-color: var(--color-gray-100);
    color: var(--color-gray-600);
}

/* FEAT-021 §4.13: action-needed signal. Reserved for "this specific row needs
   you right now" — currently only the Approval pill when the current user is the
   approver. Never reuse for counts or descriptive badges. */
.badge-attention {
    background-color: var(--color-error-light);
    color: var(--color-error-text);
}

/* FEAT-021 §4.13: informational count badge — NavMenu Inbox count. Distinct
   from badge-attention so a queue of N items doesn't read as "N urgent alerts".
   Indigo chosen to sit between primary blue and accent purple without collision. */
.badge-count {
    background-color: #e0e7ff;
    color: #4338ca;
}

/* FEAT-021 §4.6: age pill — slate grey, non-interactive. Appears on inbox rows
   that have been waiting longer than InboxOptions.AgeWarningDays. */
.badge-age {
    background-color: var(--color-gray-200);
    color: var(--color-gray-700);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
}

/* Status dot — subtle circular indicator. Works in flex rows and inline text.
   Modifiers: legacy `.status-dot-*` (used by .status-indicator) and the newer
   `.status-dot.ok|err|warn|info` (used by the service dashboard). Both supported. */
.status-dot {
    display: inline-block;
    vertical-align: middle;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    background: var(--color-gray-400);
}

.status-dot-active { background-color: var(--color-success); }
.status-dot-inactive { background-color: var(--color-gray-400); }
.status-dot-warning { background-color: var(--color-warning); }
.status-dot-error { background-color: var(--color-error); }

.status-dot.ok   { background: var(--color-success); }
.status-dot.err  { background: var(--color-error); }
.status-dot.warn { background: var(--color-warning); }
.status-dot.info { background: var(--color-primary); }
.status-dot.neutral { background: var(--color-gray-400); }   /* FEAT-031: explicit neutral for ProcessStatusBadge DotOnly */

/* ==========================================================================
   Spinner / Loading
   ========================================================================== */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: inherit;
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-4);
}

.alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-1);
}

.alert-message {
    font-size: var(--font-size-sm);
}

.error-details {
    background-color: var(--color-gray-100);
    border: var(--card-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-3);
    font-size: var(--font-size-sm);
    font-variant-numeric: tabular-nums;   /* one font (Chris 2026-12-03): app font, aligned digits */
    line-height: var(--line-height-normal);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: var(--error-details-max-height);
    overflow-y: auto;
    margin-top: var(--spacing-2);
}

.alert-success {
    background-color: var(--color-success-light);
    color: var(--color-success-text);
}

.alert-warning {
    background-color: var(--color-warning-light);
    color: var(--color-warning-text);
}

.alert-error {
    background-color: var(--color-error-light);
    color: var(--color-error-text);
}

.alert-info {
    background-color: var(--color-info-light);
    color: var(--color-info-text);
}

/* Compact alert — used inside side panels where space is tight. */
.alert--sm {
    font-size: var(--font-size-xs);
    padding: var(--spacing-2) var(--spacing-3);
}

/* ==========================================================================
   FEAT-040 Duplicate detection — layout only. Colours come from the classes the
   markup combines them with (alert alert-warning / alert-info, badge badge-*),
   so a duplicate box looks like every other alert and a reason like every badge.
   ========================================================================== */

/* Banner on the suspect's detail page (spec §9.2): used with "alert alert-warning"
   (Hint: "alert alert-info"); title, one row per candidate, actions on the right. */
.dup-banner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-3);
}

/* One candidate: P-number, Kreditor, Rechnungsnummer, Betrag, dates, status, reasons, actions. */
.dup-banner__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2) var(--spacing-3);
    font-size: var(--font-size-sm);
}

/* Look 4d6af57 item 4: at 375 px the next candidate started right under the buttons of the one before; a line and the
   same space as between the banner's parts separate the candidates. */
.dup-banner__row + .dup-banner__row {
    border-top: var(--dup-banner-row-separator);
    padding-top: var(--spacing-3);
}

/* Reason chips ("Gleiche Rechnungsnummer", "Betrag innerhalb 5 %"): badges in a wrapping row. */
.dup-banner__reasons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-1);
}

/* "Kein Duplikat" / "Als Duplikat verwerfen": always their own line below the candidate, right-aligned — the same
   in every row (look c7e4d4c: inline in one row, on their own line in the next, depending on the wrap). */
.dup-banner__actions {
    display: flex;
    flex-wrap: wrap;
    flex-basis: var(--flex-full-row);
    justify-content: flex-end;
    gap: var(--spacing-2);
}

/* "Erkannt mit den Angaben aus dem Dialog «Freigabe starten»" — muted note. */
.dup-banner__source {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* After a decision: one muted line instead of the box. */
.dup-banner--resolved {
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-4);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* In the side panel the banner and the resolved line share the inset of the section content
   (--pd-section-pad-x), so text starts on one line with the sections below (look 71a5c24: 15 vs 11.25 px;
   the resolved line had none). */
.pd-side-body > .dup-banner {
    padding-inline: var(--pd-section-pad-x);
    border-radius: 0;
    margin-bottom: 0;
}

.pd-side-body > .dup-banner--resolved {
    padding: var(--pd-section-pad-y) var(--pd-section-pad-x);
    margin: 0;
}

/* On the original (spec §9.3): "Möglicherweise doppelt eingegangen als P-000456". */
.dup-original-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* Visible reason next to the disabled "Freigabe starten" button under Block (F-29). The text stays
   primary (AA on card and page); the warning icon in front of it carries the colour. */
.dup-start-blocked {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.dup-start-blocked > svg {
    flex-shrink: 0;
    color: var(--color-warning-dark);
}

/* Settings: summary of errors on a tab that is not open (F-36), used with "alert alert-warning". */
.settings-error-summary {
    flex-direction: column;
    gap: var(--spacing-2);
}

/* ==========================================================================
   Icon Tile — colored square that wraps an icon on stat/landing cards.
   Previously inline-styled via .sidebar-brand-icon; now a real component.
   ========================================================================== */
.icon-tile {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-tile--lg { width: 48px; height: 48px; }

.icon-tile--info    { background: var(--color-info-light);    color: var(--color-info-dark); }
.icon-tile--primary { background: var(--color-primary-light); color: var(--color-primary-dark); }
.icon-tile--warning { background: var(--color-warning-light); color: var(--color-warning-text); }
.icon-tile--success { background: var(--color-success-light); color: var(--color-success-dark); }
.icon-tile--error   { background: var(--color-error-light);   color: var(--color-error-dark); }

/* ==========================================================================
   DESIGN-003 shared primitives — cross-feature building blocks
   ========================================================================== */

/* --- Avatar (cross-feature) — circular initial-bubble or profile photo wrapper --- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.avatar.avatar-available { border: 2px solid var(--color-success); }
.avatar.avatar-busy      { border: 2px solid var(--color-warning); }
.avatar.avatar-onleave   { border: 2px solid var(--color-error); }

/* --- Row state modifier — faded look for inactive list items --- */
.row-inactive { opacity: 0.6; }

/* --- Toolbar — horizontal action row above a content panel --- */
/* Look 4a7ef94: the row wraps (/service-accounts at 320 px: "Aktualisieren" ran past the screen edge); on a phone each
   action fills its row, like .list-toolbar-actions. */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-6);
}

@media (max-width: 640px) {   /* --bp-sm */
    .toolbar > .btn,
    .notifications-toolbar > .btn {
        flex: 1 1 auto;
    }
}

/* Look 4a7ef94: the buttons of every page toolbar and of every dialog footer take the one control height — their
   natural height with a mouse (36.7 px, no change), the touch target on touch devices (--control-height is 44 px there,
   FEAT-035 token block); before they stayed 36.7 px on touch. The same one-token pattern as the merge dialog footer. */
.toolbar .btn,
.notifications-toolbar .btn,
.list-toolbar-actions .btn,
.data-grid-toolbar .btn,
.page-header .btn,
.settings-actions .btn,
.modal-footer .btn {
    min-height: var(--control-height);
}

/* --- Detail row — stacked label/value pair, used in cards and panels --- */
.detail-row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
}

.detail-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}

.detail-value {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

/* --- 2-column form grid — replaces Bootstrap .row/.col-md-6 pattern --- */
/* The grid owns the vertical rhythm of its fields: row-gap and the space after the grid are the
   .form-group spacing token, and the fields inside carry no margin of their own. Before, the field
   margin added to the row gap, so stacked pairs on a phone stood 15 px further apart inside a pair
   than between pairs (demo look b755b97, user dialog at 375 px). */
.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--spacing-4);
    row-gap: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

.form-row-2col > .form-group {
    margin-bottom: 0;
}

/* On a phone two fields side by side are too narrow (an e-mail address is cut): one column. */
@media (max-width: 640px) {   /* --bp-sm */
    .form-row-2col {
        grid-template-columns: 1fr;
    }
}

/* --- Machine text (code, IDs, API keys): the app font with figures of equal width — one font everywhere,
   no monospace (Chris 2026-12-03). The class name stays for the markup that uses it. --- */
.mono { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Notification type modifiers — shared by NotificationPanel (bell dropdown)
   and Notifications (full page). Maps 1:1 to NotificationType enum values.
   Applied to .notification-icon regardless of container. Size variants are
   ancestor-scoped below.
   ========================================================================== */
.notification-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-primary);
}
.notification-icon.task-assigned {
    background: var(--color-accent-purple-light);
    color: var(--color-accent-purple);
}
.notification-icon.approval-required {
    background: var(--color-warning-light);
    color: var(--color-warning-text);
}
.notification-icon.approval-completed {
    background: var(--color-success-light);
    color: var(--color-success);
}
.notification-icon.rejected {
    background: var(--color-error-light);
    color: var(--color-error);
}
.notification-icon.escalated {
    background: var(--color-error-light);
    color: var(--color-error);
}
.notification-icon.reminder {
    background: var(--color-warning-light);
    color: var(--color-warning-text);
}
.notification-icon.system-alert {
    background: var(--color-error-light);
    color: var(--color-error);
}
/* FEAT-040 D9: "Mögliches Duplikat" notification — warning tone like approval-required. */
.notification-icon.duplicate-detected {
    background: var(--color-warning-light);
    color: var(--color-warning-text);
}

/* ---- Notification dropdown (NotificationPanel) — 32px compact variant ---- */
.notification-panel .notification-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-panel .notification-title {
    font-size: 13px;
    font-weight: var(--font-weight-medium);
}

.notification-panel .notification-message {
    font-size: var(--font-size-xs);
    line-height: 1.4;
}

.notification-panel .notification-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: var(--spacing-1);
}

/* ---- Notifications page (Notifications) — 40px full variant ---- */
.notification-card .notification-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-card .notification-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.notification-card .notification-message {
    font-size: 13px;
    line-height: 1.5;
}

.notification-card .notification-time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

/* ==========================================================================
   Notification Panel — dropdown structure (used by NotificationBell)
   Migrated from NotificationPanel.razor (DESIGN-003 Phase 5)
   Size variants for .notification-icon/-title/-message/-time are ancestor-
   scoped above (Phase 0 § 5.4); 8 type modifiers are in § 5.3.
   ========================================================================== */
.notification-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notification-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-4);
    border-bottom: 1px solid var(--border-color);
}

.notification-panel-header h4 {
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.notification-panel-actions .btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: var(--font-size-xs);
    cursor: pointer;
    padding: 0;
}

.notification-panel-actions .btn-link:hover {
    text-decoration: underline;
}

.notification-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
}

.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-12) var(--spacing-4);
    color: var(--text-muted);
    gap: var(--spacing-3);
}

.notification-list {
    display: flex;
    flex-direction: column;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-3) var(--spacing-4);
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
}

.notification-item:hover {
    background: var(--color-gray-50);
}

.notification-item.unread {
    background: var(--color-primary-light);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    flex-shrink: 0;
    margin-top: var(--spacing-1);
}

.notification-panel-footer {
    padding: var(--spacing-3) var(--spacing-4);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notification-panel-footer a {
    color: var(--color-primary);
    font-size: var(--font-size-sm);
    text-decoration: none;
}

.notification-panel-footer a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Notifications Page — full-page list structure
   Migrated from Notifications.razor (DESIGN-003 Phase 5)
   ========================================================================== */
.notifications-toolbar {
    display: flex;
    flex-wrap: wrap;   /* look 4a7ef94: "Aktualisieren" ran past the screen edge at 320/375 px (phone rule at .toolbar) */
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-6);
}

.notifications-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.notifications-list {
    display: flex;
    flex-direction: column;
}

.notification-card {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-4);
    padding: var(--spacing-4) var(--spacing-5);
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.notification-card:last-child {
    border-bottom: none;
}

.notification-card:hover {
    background: var(--color-gray-50);
}

.notification-card.unread {
    background: var(--color-primary-light);
}

.notification-card.unread:hover {
    background: var(--color-primary-light);
    filter: brightness(0.98);
}

.notification-body {
    flex: 1;
    min-width: 0;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-1);
}

.notification-action {
    display: inline-block;
    margin-top: var(--spacing-2);
    font-size: var(--font-size-xs);
    color: var(--color-primary);
}

.unread-indicator {
    position: absolute;
    left: var(--spacing-2);
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
}

/* ==========================================================================
   Notification Bell — header icon button + unread badge
   Migrated from NotificationBell.razor (DESIGN-003 Phase 1)
   ========================================================================== */
.notification-bell-container {
    position: relative;
}

.notification-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notification-bell-btn:hover,
.notification-bell-btn.active {
    background: var(--color-gray-50);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--color-error-text);   /* white on it 6.47:1 (was 3.76:1 on --color-error, review M-1) */
    color: var(--text-inverse);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notification-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-dropdown) - 1);
}

/* ==========================================================================
   User Menu — header avatar button + dropdown
   Migrated from UserMenu.razor (DESIGN-003 Phase 2)
   ========================================================================== */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-3);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.user-menu-toggle:hover {
    background: var(--color-gray-50);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    color: #ffffff;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

.user-name {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--spacing-2);
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: var(--z-dropdown);
    overflow: hidden;
}

.dropdown-header {
    padding: var(--spacing-3) var(--spacing-4);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-name {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.dropdown-email {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    width: 100%;
    padding: var(--spacing-3) var(--spacing-4);
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    transition: background-color var(--transition-fast);
    text-align: left;
}

.dropdown-item:hover {
    background: var(--color-gray-50);
}

.dropdown-icon {
    font-size: var(--font-size-base);
}

/* ==========================================================================
   Group Management — group icon, member avatars, member list
   Migrated from GroupManagementView.razor (DESIGN-003 Phase 2)
   .avatar and .row-inactive are shared primitives (Phase 0), not redefined here.
   ========================================================================== */
.group-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: var(--color-gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.member-avatars {
    display: flex;
    align-items: center;
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    margin-right: calc(-1 * var(--spacing-2));
    border: 2px solid var(--bg-body);
}

.member-avatar.admin {
    background: var(--color-warning);
}

.member-avatar.more {
    background: var(--color-gray-50);
    color: var(--text-muted);
}

.member-avatar:last-child {
    margin-right: 0;
}

.member-list {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 400px;
    overflow-y: auto;
}

.member-item {
    border-bottom: 1px solid var(--border-color);
}

.member-item:last-child {
    border-bottom: none;
}

.add-member-section {
    padding: var(--spacing-4);
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
}

/* ==========================================================================
   User Management — modal tabs, role grid, availability options, subsection box
   Migrated from UserManagementView.razor (DESIGN-003 Phase 3)
   .avatar / .avatar-available / .avatar-busy / .avatar-onleave / .row-inactive
   are shared primitives (Phase 0), not redefined here.
   .status-dot* consolidated in DESIGN-002 Phase 5, not redefined here.
   ========================================================================== */

/* Modal tabs — tab bar inside a modal header strip. When the tabs are wider than the dialog
   (phone), the strip scrolls by itself; it never widens .modal-body (demo look 2c4837e: the
   body scrolled 177 px sideways at 375 px and cut the form).
   Look 5374281 item 5: the row is the shared TabRow (role=tablist, the active tab scrolled into view) and shows the
   shared scroll cue (rule after .tabs-header) on the dialog surface — at 375 px the tabs ran out of the row unannounced. */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin: calc(-1 * var(--spacing-4)) calc(-1 * var(--spacing-4)) var(--spacing-4) calc(-1 * var(--spacing-4));
    padding: 0 var(--spacing-4);
    --scroll-cue-surface: var(--bg-card);   /* the dialog's surface; painted by the shared scroll cue */
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scroll-padding-inline: var(--spacing-4);
}

.modal-tab {
    flex-shrink: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-4);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-tab:hover {
    color: var(--text-primary);
}

.modal-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    padding: var(--spacing-2) 0;
}

/* Role grid — selectable role cards inside the Roles tab */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-4);
}

/* A role card is the <label> of its checkbox, so its parts are spans laid out as blocks. */
.role-card {
    display: block;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.role-card:hover {
    border-color: var(--color-primary);
}

/* Keyboard focus sits on the checkbox inside the card; the whole card shows it.
   :focus-visible keeps mouse clicks free of the ring. */
.role-card:has(.form-check-input:focus-visible) {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

.role-card.role-active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.role-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-2);
}

.role-icon {
    color: var(--text-muted);
}

.role-active .role-icon {
    color: var(--color-primary);
}

.role-title {
    display: block;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-1);
}

.role-description {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Availability options — selectable chips inside the Availability tab */
.availability-options {
    display: flex;
    gap: var(--spacing-4);
}

.availability-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    /* Rendered as <button role="radio"> (keyboard reachable): reset the native button look. */
    background: var(--bg-card);
    color: inherit;
    font: inherit;
}

.availability-option:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.availability-option:hover {
    border-color: var(--color-primary);
}

.availability-option.active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* Modal subsection — boxed gray container for sub-groups of fields inside a modal.
   Replaces the Bootstrap-ghost pattern `class="mt-4 p-3 bg-secondary rounded"`. */
.modal-subsection {
    margin-top: var(--spacing-4);
    padding: var(--spacing-3);
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
}

/* Title of a subsection: the same distance to the fields below as between two field groups. */
.modal-subsection-title {
    margin: 0 0 var(--spacing-4);
}

/* --- KPI cards above a list (users, groups): a grid that wraps instead of a row that is cut
   (demo look 1ceec93: the fourth card ended at 382 px on a 375 px screen). --- */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--stat-card-min-width), 1fr));
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

/* --- List filters (users, groups): one field width for every filter, full width on a phone
   (demo look 1ceec93: three filters, three widths). --- */
.list-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-3);
}

.form-control.list-filter-field {
    width: var(--list-filter-field-width);
}

/* The card toolbar around them: filters left, actions right, both wrap. Look 6b3737c: at 375 px the row ran 20.7 px
   past the card — it was a flex item of .card-header with min-width:auto and its two actions could not wrap, so its
   min-content width (137.1 + 7.5 + 186.4 = 331 px) beat the 290 px header box and the full-width filters took those
   331 px. Now the row may shrink, the actions wrap, and on a phone each action fills its row. */
.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
    min-width: 0;
}

.list-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
}

@media (max-width: 640px) {   /* --bp-sm */
    .list-filters {
        width: 100%;
    }

    .form-control.list-filter-field {
        width: 100%;
    }

    .list-toolbar {
        flex: 1 1 100%;
    }

    .list-toolbar-actions {
        width: 100%;
    }

    .list-toolbar-actions > .btn {
        flex: 1 1 auto;
    }
}

/* --- /users list (demo look 1ceec93: the table was 916 px in a 911 px card and scrolled sideways;
   addresses broke mid-word). The list is a size container, so its layout follows the space the list
   really has (sidebar expanded or collapsed, sub-navigation beside it):
   - wide: seven columns; headers may wrap, so "Approval limit" no longer sets a column minimum, and
     the user column takes a share and shrinks down to its minimum, name and address in one line each
     with an ellipsis (full text as tooltip);
   - below 60rem: department and last login leave the table and appear as a meta line under the address;
   - below 45rem: every user is a stacked block (identity and actions, roles, status and limit). --- */
.users-list {
    container: users-list / inline-size;
}

.data-grid-table.users-table th {
    white-space: normal;
}

.data-grid-table.users-table .users-col-user {
    width: var(--users-col-user-width);
    max-width: 0;
    min-width: var(--users-col-user-min-width);   /* wins over max-width: a narrower list changes layout first */
}

/* "14h ago" and "CHF 10,000" stay one value on one line (the cells only: the headers may wrap). */
.data-grid-table.users-table td.users-col-limit,
.data-grid-table.users-table td.users-col-login {
    white-space: nowrap;
}

.users-identity {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
}

.users-identity-text {
    flex: 1;
    min-width: 0;
}

.users-identity-name, .users-identity-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Department and last login under the address (narrow list only); it wraps instead of hiding them. */
.users-identity-meta {
    display: none;
}

/* Label of a value in the stacked layout only; in the table the column header names it. */
.users-cell-label {
    display: none;
}

@container users-list (max-width: 60rem) {
    .data-grid-table.users-table .users-col-department,
    .data-grid-table.users-table .users-col-login {
        display: none;
    }

    .users-identity-meta {
        display: block;
    }
}

@container users-list (max-width: 45rem) {
    .data-grid-table.users-table,
    .data-grid-table.users-table tbody {
        display: block;
    }

    .data-grid-table.users-table thead {
        display: none;
    }

    .data-grid-table.users-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "user actions"
            "roles roles"
            "status limit";
        align-items: center;
        gap: var(--spacing-2) var(--spacing-3);
        padding: var(--spacing-3) var(--spacing-4);
        border-bottom: 1px solid var(--border-color);
    }

    .data-grid-table.users-table tr:last-child {
        border-bottom: none;
    }

    .data-grid-table.users-table td {
        display: block;
        padding: 0;
        border-bottom: none;
    }

    .data-grid-table.users-table .users-col-user {
        grid-area: user;
        width: auto;
        max-width: none;
        min-width: 0;
    }

    .data-grid-table.users-table .users-col-roles {
        grid-area: roles;
    }

    .data-grid-table.users-table .users-col-status {
        grid-area: status;
    }

    .data-grid-table.users-table .users-col-limit {
        grid-area: limit;
        text-align: right;
    }

    .data-grid-table.users-table .actions {
        grid-area: actions;
    }

    .users-cell-label {
        display: block;
        font-size: var(--font-size-xs);
        color: var(--text-muted);
    }
}

/* ==========================================================================
   Service Accounts — account cards, API key display, code block
   Migrated from ServiceAccounts.razor (DESIGN-003 Phase 4)
   .toolbar / .detail-row / .detail-label / .detail-value / .mono are shared
   primitives (Phase 0), not redefined here.
   .alert* / .btn-warning / .empty-state / .loading-container are already in
   global, not redefined here.
   ========================================================================== */
.content-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.account-list {
    display: flex;
    flex-direction: column;
}

.account-card {
    padding: var(--spacing-5) var(--spacing-6);
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.account-card:last-child {
    border-bottom: none;
}

.account-card:hover {
    background: var(--color-gray-50);
}

.account-card.inactive {
    opacity: 0.6;
}

.account-header {
    margin-bottom: var(--spacing-4);
}

.account-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-1);
}

.account-name {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
}

.account-name h4 {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.account-description {
    margin: var(--spacing-1) 0 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.account-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-4);
}

/* Mono pill — the ServiceAccounts detail-value.mono variant adds a pill-box
   treatment on top of the generic .mono utility (tabular figures). Compound
   selector so it only applies when both classes are present. */
.detail-value.mono {
    background: var(--color-gray-100);
    padding: 2px var(--spacing-2);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* Look aeeee19: the row was 392 px in a 283 px card at 375 px de-CH, "Löschen" out of reach; the buttons wrap. */
.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
}

.api-key-display {
    margin-top: var(--spacing-4);
}

.api-key-display .form-control.mono {
    font-size: 13px;
    background: var(--color-gray-100);
}

.code-block {
    background: var(--color-gray-100);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-3);
    font-variant-numeric: tabular-nums;   /* one font (Chris 2026-12-03) */
    line-height: var(--line-height-normal);
    font-size: var(--font-size-xs);
    overflow-x: auto;
    margin: 0;
}

/* ==========================================================================
   Workflow Configuration — boxed tab system + config cards + form sections
   Migrated from WorkflowConfigView.razor (DESIGN-003 Phase 6)
   .form-row-2col / .detail-row / .detail-label / .detail-value are shared
   primitives (Phase 0), not redefined here.
   .badge* / .empty-state / .loading-container are already in global.
   This is a SECOND tab system — "boxed tabs" with a card-wrapped container
   and full-width tab buttons. It coexists with the global `.tabs` pill group
   (DESIGN-001) — different names, different visual patterns, both valid.
   ========================================================================== */
.tabs-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
}

/* Look d63395d: same row behaviour as .tabs - labels on one line, the row scrolls inside its own box. */
.tabs-header {
    display: flex;
    gap: var(--spacing-1);
    padding: var(--spacing-3);
    border-bottom: 1px solid var(--border-color);
    --scroll-cue-surface: var(--color-gray-50);   /* the header's surface; painted by the shared scroll cue below */
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scroll-padding-inline: var(--spacing-3);
}

/* Look 0ed9dd5 item 3: both tab rows show where more tabs wait, with the scroll cue of the settings strip (look 4d6af57
   item 5, same tokens, same technique): covers in the row's own surface ("local") move with the tabs and hide the
   shadow ("scroll") at the end the row rests on. Before: the storage row overflowed by 15 px at 1163 px without a hint.
   Each row names its surface in --scroll-cue-surface (above; the settings strip takes the page surface from :root); the
   last layer paints it. Look 9b073ba item 2: ONE rule for every strip (tab rows and the phone settings strip); solid
   covers exactly as wide as the shadows, so a row that does not overflow shows no shade. The desktop settings column
   never scrolls sideways: its covers rest on the shadows and the layers paint the page colour it already sits on. */
.tabs,
.tabs-header,
.modal-tabs,
.settings-nav {
    background:
        linear-gradient(var(--scroll-cue-surface), var(--scroll-cue-surface)) left / var(--scroll-cue-size) auto no-repeat local,
        linear-gradient(var(--scroll-cue-surface), var(--scroll-cue-surface)) right / var(--scroll-cue-size) auto no-repeat local,
        linear-gradient(to right, var(--scroll-cue-shadow), transparent) left / var(--scroll-cue-size) auto no-repeat scroll,
        linear-gradient(to left, var(--scroll-cue-shadow), transparent) right / var(--scroll-cue-size) auto no-repeat scroll,
        var(--scroll-cue-surface);
}

.tab-btn {
    display: flex;
    flex-shrink: 0;
    white-space: nowrap;
    align-items: center;
    gap: var(--spacing-2);
    box-sizing: border-box;
    height: var(--tab-height);   /* look 0ed9dd5 item 2: the same tab height as the .tab pills */
    padding: 0 var(--spacing-4);
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.tabs-content {
    padding: var(--spacing-6);
}

.panel-header {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-3);
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-6);
}

.panel-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.config-list {
    display: grid;
    gap: var(--spacing-4);
}

.config-card {
    background: var(--color-gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-5);
}

.config-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-4);
}

.config-info h4 {
    margin: 0 0 var(--spacing-1) 0;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
}

.config-description {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.config-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-4);
}

/* Inside config-details, detail-value becomes a flex row (icon + text),
   overriding the Phase 0 shared primitive's vertical-only behavior. */
.config-details .detail-value {
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
}

.config-card-actions {
    display: flex;
    flex-wrap: wrap;   /* look aeeee19: card action rows wrap instead of running past the card */
    gap: var(--spacing-2);
    padding-top: var(--spacing-4);
    border-top: 1px solid var(--border-color);
}

.approval-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--spacing-12) var(--spacing-6);
}

.approval-info h3 {
    margin: var(--spacing-4) 0 var(--spacing-2);
}

.approval-info p {
    color: var(--text-secondary);
    max-width: 400px;
    margin-bottom: var(--spacing-6);
}

.form-section {
    margin-top: var(--spacing-6);
    padding-top: var(--spacing-6);
    border-top: 1px solid var(--border-color);
}

.form-section h4 {
    margin: 0 0 var(--spacing-4) 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

/* Look 9b073ba item 5: the switches of a line align at the top. Stretched, a switch next to one with a hint below it
   ("Duplikatprüfung …") centred itself in the taller line: "Aktiv" sat 10 px lower. */
.toggle-group {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--spacing-4);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.delete-confirmation {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--spacing-6);
}

.delete-confirmation p {
    margin: var(--spacing-4) 0 0;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-12) var(--spacing-4);
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--spacing-4);
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-2);
}

.empty-state-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    max-width: 400px;
    margin-inline: auto; /* look d63395d: centred like the title also in a block container (.data-grid-empty) */
    margin-bottom: var(--spacing-6);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

/* Flex */
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.gap-1 { gap: var(--spacing-1); }
.gap-2 { gap: var(--spacing-2); }
.gap-3 { gap: var(--spacing-3); }
.gap-4 { gap: var(--spacing-4); }
.gap-6 { gap: var(--spacing-6); }

/* Margin */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--spacing-1) !important; }
.mt-2 { margin-top: var(--spacing-2) !important; }
.mt-3 { margin-top: var(--spacing-3) !important; }
.mt-4 { margin-top: var(--spacing-4) !important; }
.mt-6 { margin-top: var(--spacing-6) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-1) !important; }
.mb-2 { margin-bottom: var(--spacing-2) !important; }
.mb-3 { margin-bottom: var(--spacing-3) !important; }
.mb-4 { margin-bottom: var(--spacing-4) !important; }
.mb-6 { margin-bottom: var(--spacing-6) !important; }
.ml-auto { margin-left: auto !important; }
.mr-2 { margin-right: var(--spacing-2) !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-2 { padding: var(--spacing-2) !important; }
.p-3 { padding: var(--spacing-3) !important; }
.p-4 { padding: var(--spacing-4) !important; }
.py-2 { padding-top: var(--spacing-2) !important; padding-bottom: var(--spacing-2) !important; }
.px-3 { padding-left: var(--spacing-3) !important; padding-right: var(--spacing-3) !important; }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-lg { font-size: var(--font-size-lg); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
/* Link/brand accent — used on process-number links in the Audit Trail + event detail modal.
   Uses the brand primary (not --text-primary body color) so links read as links. */
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success-text); }
.text-error { color: var(--color-error-text); }
.text-warning { color: var(--color-warning-text); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
/* A process number (P-nnnnnn) never breaks across lines; add this class to every element
   that renders one (owner rule 2026-11-30). Keeps the table column at least as wide as the number. */
.process-number {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }
.max-w-sm { max-width: 400px; }
.max-w-md { max-width: 600px; }
.max-w-lg { max-width: 800px; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }

/* Visibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   Blazor Error Boundary
   ========================================================================== */
.blazor-error-boundary {
    background: var(--color-error-light);
    padding: var(--spacing-4);
    border-radius: var(--radius-lg);
    color: var(--color-error-text);
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
}

.blazor-error-boundary::before {
    content: '';
    width: 24px;
    height: 24px;
    background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23dc2626'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'/%3e%3c/svg%3e") no-repeat center;
    flex-shrink: 0;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ==========================================================================
   Scrollbar Styling
   ========================================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

/* ==========================================================================
   Reduced Motion (WCAG 2.3.3) — honor user OS preference.
   !important is required here: the whole point is to defeat component-level
   animations and transitions that were authored without opting out.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   License Warning Banner
   ========================================================================== */
.license-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4);   /* look 861a82b item 7: the text never runs into "Lizenz verwalten" */
    padding: var(--spacing-3) var(--spacing-4);
    margin-bottom: var(--spacing-4);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.license-banner-warning {
    background: var(--color-warning-light);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning);
}

.license-banner-error {
    background: var(--color-error-light);
    color: var(--color-error-text);
    border: 1px solid var(--color-error);
}

/* Status could not be read (R-017351): neutral, not an alarm. */
.license-banner-neutral {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-300);
}

.license-banner-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

/* Look 4d6af57 item 10: the icon is a flex item; next to two lines of text at 375 px it shrank to ~8 px. */
.license-banner-content > svg {
    flex-shrink: 0;
    width: var(--license-banner-icon-size);
    height: var(--license-banner-icon-size);
}

/* Look 861a82b item 7: "Lizenz verwalten" wrapped to two lines at 1024 px; the link keeps its line, the text wraps. */
.license-banner-link {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: var(--spacing-1);
    white-space: nowrap;
    color: inherit;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.license-banner-link:hover {
    opacity: 1;
    color: inherit;
}

/* Non-admins cannot manage the license: same place as the link, plain text. */
.license-banner-hint {
    opacity: 0.8;
}

/* Look 861a82b item 7: on a phone the text takes the full width and the link its own line at the right (beside the text it
   squeezed the text into a narrow column once the link no longer wraps). */
@media (max-width: 640px) {   /* --bp-sm */
    .license-banner {
        flex-wrap: wrap;
    }

    .license-banner-link {
        margin-left: auto;
    }
}

/* ==========================================================================
   About Page
   ========================================================================== */
/* Look c3d299b: minmax(0, 1fr) instead of 1fr (= minmax(auto, 1fr)): a card never grows its column past the page
   because of its content's min-content width (at 320 px the cards ran 8.1 px past .main-body). */
.about-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-4);
}

.about-card {
    min-height: 200px;
}

.about-card-full {
    grid-column: span 2;
}

.about-info {
    line-height: var(--line-height-relaxed);
}

.about-info p {
    margin: var(--spacing-1) 0;
    color: var(--text-secondary);
}

.about-company-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-2);
}

.about-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing-3) 0;
}

.about-contact {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.about-contact a {
    color: var(--text-link);
    text-decoration: none;
}

.about-contact a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   License Status
   ========================================================================== */
.license-status {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
}

.license-status-badge {
    display: flex;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-4);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.status-badge-success {
    background: var(--color-success-light);
    color: var(--color-success-text);
}

.status-badge-error {
    background: var(--color-error-light);
    color: var(--color-error-text);
}

.status-badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning-text);
}

.license-details {
    padding: var(--spacing-4);
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

/* Look c3d299b: the row wraps - the value moves below its label when both do not fit (the fixed label plus the
   longest unbreakable part of the value set the card's min-content width at 320 px). */
.license-detail-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--spacing-2);
    padding: var(--spacing-2) 0;
    border-bottom: 1px solid var(--border-color);
}

.license-detail-row:last-child {
    border-bottom: none;
}

.license-detail-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    min-width: var(--license-detail-label-width);
}

.license-detail-value {
    color: var(--text-primary);
    min-width: 0;
    overflow-wrap: anywhere;   /* a license id or feature list never widens the card */
}

.license-input {
    font-variant-numeric: tabular-nums;   /* one font (Chris 2026-12-03) */
    font-size: var(--font-size-sm);
}

.text-danger {
    color: var(--color-error-text);
}

/* Responsive adjustments for About page */
@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .about-card-full {
        grid-column: span 1;
    }
}

/* ==========================================================================
   Utility Classes for Flex
   ========================================================================== */
.flex-1 {
    flex: 1;
}

/* Auto-fitting responsive card grid — used by landing pages and stat rows. */
.grid-auto-cards {
    display: grid;
    gap: var(--spacing-4);
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.h-100 {
    height: 100%;
}

/* ==========================================================================
   Settings Panel — Unified Design System (DESIGN-001)
   ========================================================================== */

/* --- Layout --- */
.settings-layout {
    display: flex;
    gap: 1.5rem;
    min-height: 600px;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
    flex-shrink: 0;
}

.settings-nav-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 1rem;
    margin-bottom: 0.25rem;
}

/* Look 5829a87 item 7: the height from a token (36 px), not from the font's line metrics. */
.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: var(--settings-nav-item-height);
    padding: 0 1rem;
    line-height: var(--line-height-tight);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    width: 100%;
}

.settings-nav-item:hover {
    background: var(--color-gray-100);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.settings-content {
    flex: 1;
    min-width: 0;
}

/* --- Container --- */
.settings-container {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: var(--spacing-6);
    align-items: start;
}

/* --- Cards --- */
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
    /* The behaviour cards inside follow the card's width, not the window's (look 71a5c24). */
    container: settings-card / inline-size;
}

.settings-card-full {
    grid-column: 1 / -1;
}

/* One column of full-width section cards (Settings → Workers & Storage, settings-workers 2026-12-03):
   no masonry, every card spans the content width at every screen size. */
.settings-container--stacked {
    grid-template-columns: minmax(0, 1fr);
}

/* --- Worker rows: name + description | interval field | on/off switch --- */
.settings-worker-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.settings-worker-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--field-width-short-number) auto;
    align-items: center;
    gap: var(--spacing-5);
    padding: var(--spacing-3) var(--spacing-4);
    background: var(--bg-body);
    border-radius: var(--radius-lg);
}

.settings-worker-row .settings-worker-interval,
.settings-worker-row .settings-worker-switch {
    margin-bottom: 0;
}

.settings-worker-switch .form-check-label {
    white-space: nowrap;
}

/* Tablet width (641–900 px): the name and description take the first line, interval and switch the second. */
@media (min-width: 641px) and (max-width: 900px) {
    .settings-worker-row {
        grid-template-columns: var(--field-width-short-number) auto;
    }
    .settings-worker-info {
        grid-column: 1 / -1;
    }
}

/* A message line under a field that is reserved even while empty (nothing jumps when it appears),
   e.g. the staging-folder warning on Workers & Storage. */
.settings-field-note {
    min-height: calc(var(--font-size-xs) * var(--line-height-normal));
    margin-top: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--color-warning-text);
}

.settings-card-header {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-2);
}

.settings-card-header h2 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    color: var(--text-primary);
}

.settings-card-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-5) 0;
}

/* --- Form Grid --- */
.settings-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-5);
    margin-bottom: var(--spacing-4);
}

.settings-form-full {
    grid-column: 1 / -1;
}

/* In the grid the gap spaces the fields; a field's own margin would add to it (pattern .form-row-2col). */
.settings-form-grid > .form-group {
    margin-bottom: 0;
}

/* Every settings card ends on its own padding (one token, --spacing-6): the last element's margin
   (a description, a field grid, a toggle) made the bottoms uneven (look 71a5c24). */
.settings-card > :last-child {
    margin-bottom: 0;
}

/* --- Form Hint (promoted from component-scoped CSS) --- */
.form-hint {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Toggle Rows --- */
.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-3) var(--spacing-4);
    background: var(--bg-body);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-3);
}

.settings-toggle-info {
    flex: 1;
}

.settings-toggle-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.settings-toggle-desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Subsection Titles --- */
.settings-subsection {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: var(--spacing-6) 0 var(--spacing-4);
    padding-top: var(--spacing-4);
    border-top: 1px solid var(--border-color);
}

/* --- Option Grid (criteria, behavior selection) --- */
/* Option cards (duplicate behaviour): stacked, and side by side in ONE equal row only when all fit —
   auto-fill wrapped three cards as 2 + 1 at 1163 px (look 71a5c24). */
.settings-option-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-3);
}

@container settings-card (min-width: 36rem) {
    .settings-option-grid {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
    }
}

.settings-option-card {
    padding: var(--spacing-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.settings-option-card:hover {
    border-color: var(--border-color-dark);
}

.settings-option-card.active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* --- Export Path List --- */
.settings-path-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.settings-path-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-3) var(--spacing-4);
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.settings-path-text {
    font-variant-numeric: tabular-nums;   /* one font (Chris 2026-12-03) */
    font-size: var(--font-size-sm);
}

.settings-empty-state {
    text-align: center;
    padding: var(--spacing-8);
    background: var(--bg-body);
    border-radius: var(--radius-lg);
}

/* --- API Key Row --- */
/* An input with its button on one line (API key + validate, new export path + add). */
.settings-input-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

/* Look 5829a87 item 6: field and button of the row in one height (the button was 44.2 px next to a 36.7 px field). The
   field takes it from .form-control itself (look 0ed9dd5), so only the button needs the rule (review 9b073ba). */
.settings-input-row > .btn {
    box-sizing: border-box;
    height: var(--control-height);
    padding-block: 0;
}

.settings-input-row .form-control { flex: 1; }
.settings-input-row .btn { white-space: nowrap; display: flex; align-items: center; gap: 6px; }

/* Label with an inline action (e.g. "Load models" next to the model dropdown). */
.settings-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
}

.settings-label-row .btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: var(--font-size-xs);
    cursor: pointer;
}

.settings-label-row .btn-link:hover:not(:disabled) { text-decoration: underline; }
.settings-label-row .btn-link:disabled { opacity: 0.6; cursor: default; }

/* --- Usage Stats --- */
.settings-usage-bar {
    display: flex;
    gap: var(--spacing-8);
    padding: var(--spacing-4);
    background: var(--bg-body);
    border-radius: var(--radius-lg);
}

.settings-usage-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-usage-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-weight-medium);
}

.settings-usage-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

/* --- Short number field (settings-look): one width for every short number on a settings page --- */
.form-control--short-number {
    max-width: var(--field-width-short-number);
}

/* --- Action Bar --- */
/* "Last updated" (settings-look-2): one place on every settings tab — right-aligned under the action bar. */
.settings-last-updated {
    grid-column: 1 / -1;
    margin-top: calc(-1 * var(--spacing-2));
    text-align: right;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.settings-actions-button {
    min-width: var(--settings-action-min-width);
    justify-content: center;
}

.settings-actions {
    display: flex;
    gap: var(--spacing-3);
    justify-content: flex-end;
    padding-top: var(--spacing-4);
    grid-column: 1 / -1;
}

/* --- Responsive --- */
/* On a phone the sub-navigation (200 px) beside the content left the content ~107 px and cut its
   cards (demo look 7de3354): the layout stacks, the sub-navigation becomes a horizontal strip that
   scrolls by itself above the content. minmax(0, 1fr): a card is never wider than the screen
   (a plain 1fr track grows to the card's widest content). */
@media (max-width: 640px) {   /* --bp-sm */
    .settings-layout {
        flex-direction: column;
        min-height: 0;
    }

    /* Look c7e4d4c item 12: the strip snaps to whole items and group titles, so it never rests on a cut label
       ("…ENDUNG" after the active tab was scrolled into view). */
    .settings-nav {
        flex-direction: row;
        align-items: center;
        min-width: 0;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: var(--spacing-1);
        /* Look 4d6af57 item 5: scrolling shadows show where more items wait — the shared scroll cue rule (Tabs section,
           look 9b073ba item 2) paints them; here the strip only starts to scroll. */
    }

    .settings-nav-group {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .settings-nav-group-title {
        margin-bottom: 0;
        white-space: nowrap;
        scroll-snap-align: start;
    }

    .settings-nav-item {
        width: auto;
        flex-shrink: 0;
        white-space: nowrap;
        scroll-snap-align: start;
    }

    .availability-options {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .settings-container {
        grid-template-columns: minmax(0, 1fr);
    }
    .settings-worker-row {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--spacing-3);
    }
    .settings-form-grid {
        grid-template-columns: 1fr;
    }
    .settings-usage-bar {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {   /* --bp-sm — normalized from 480 */
    .settings-actions {
        flex-direction: column;
    }
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 64px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.settings-container > .empty-state {
    grid-column: 1 / -1;
}

/* ==========================================================================
   Login Screen & Empty Layout
   ========================================================================== */
.empty-layout {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

/* Decorative left panel (desktop only) */
.login-panel {
    flex: 1;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--spacing-12);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.login-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 40%);
    pointer-events: none;
}

.login-panel::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -80px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.login-panel-content {
    position: relative;
    z-index: 1;
    max-width: 440px;
}

.login-panel-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-16);
}

.login-panel-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-panel-brand-text {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
}

.login-panel-headline {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 var(--spacing-5) 0;
    color: #ffffff;
}

.login-panel-headline em {
    font-style: normal;
    color: var(--color-primary-light);
    position: relative;
}

.login-panel-subhead {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
    max-width: 420px;
}

.login-panel-features {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    margin-top: var(--spacing-8);
    position: relative;
    z-index: 1;
}

.login-panel-feature {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
}

.login-panel-feature-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

.login-panel-footer {
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.05em;
}

/* Right panel with the form */
.login-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-8);
    position: relative;
}

.login-container {
    width: 100%;
    max-width: 420px;
    animation: loginEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes loginEnter {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-10) var(--spacing-8);
    box-shadow: var(--shadow-xl);
    position: relative;
}

.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--spacing-8);
    right: var(--spacing-8);
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 100%);
    border-radius: 0 0 3px 3px;
}

.login-header {
    margin-bottom: var(--spacing-8);
}

.login-eyebrow {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: var(--spacing-2);
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0 0 var(--spacing-2) 0;
    line-height: 1.2;
}

.login-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-5);
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    margin-bottom: 0;
}

.login-form label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 0;
}

.login-form .form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: var(--font-family);
}

.login-form .form-input::placeholder {
    color: var(--text-muted);
}

.login-form .form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-form .form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: 13px 20px;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    margin-top: var(--spacing-2);
    letter-spacing: 0.01em;
    font-family: var(--font-family);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 0 0 1px rgba(37, 99, 235, 0.1) inset;
}

.btn-login:hover:not(:disabled) {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-login:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-3) var(--spacing-4);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    line-height: 1.5;
}

.login-alert-error {
    background: var(--color-error-light);
    color: var(--color-error-text);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-alert-success {
    background: var(--color-success-light);
    color: var(--color-success-text);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.login-alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.login-alert-error .login-alert-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-error-dark);
}

.login-alert-success .login-alert-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success-dark);
}

.login-setup-info {
    background: var(--color-primary-light);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-lg);
    padding: var(--spacing-3) var(--spacing-4);
    font-size: 0.875rem;
    color: var(--color-primary-dark);
    line-height: 1.5;
}

.login-loading {
    display: flex;
    justify-content: center;
    padding: var(--spacing-12) 0;
}

.login-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* The setup check on the white card: the spinner in the primary colour (was an inline style). */
.login-loading .login-spinner {
    border-color: var(--color-primary-light);
    border-top-color: var(--color-primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.login-footer {
    margin-top: var(--spacing-6);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.login-footer-meta {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    /* The version stays in the app font (one font family per app, demo look 1ceec93); tabular digits
       keep it steady. */
    font-variant-numeric: tabular-nums;
    font-size: 0.6875rem;
}

.login-footer-version {
    color: var(--text-muted);
}

/* Responsive: hide side panel on narrow screens */
@media (min-width: 1024px) {
    .login-panel {
        display: flex;
    }
}

@media (max-width: 640px) {   /* --bp-sm — normalized from 480 */
    .login-stage {
        padding: var(--spacing-4);
    }
    .login-card {
        padding: var(--spacing-8) var(--spacing-5);
    }
    .login-title {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   Service Dashboard — uses the app's .card/.badge vocabulary
   Dense layout, but same visual language as the rest of Invoice Flow.
   ========================================================================== */

.cockpit {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-5);
}

/* ---- Top status strip — styled like a .card ---- */
.cockpit-statusbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-6);
    padding: var(--spacing-4) var(--spacing-5);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.cockpit-statusbar-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding-right: var(--spacing-5);
    border-right: 1px solid var(--border-color);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.cockpit-statusbar-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    white-space: nowrap;
}

.cockpit-statusbar-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}

.cockpit-statusbar-value {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
}

.cockpit-statusbar-spacer { flex: 1; }

.cockpit-statusbar-live {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-1) var(--spacing-3);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    background: var(--color-success-light);
    color: var(--color-success-text);
}

.cockpit-statusbar-live.offline {
    background: var(--color-gray-100);
    color: var(--text-muted);
}

/* .status-dot consolidated with the badges section — see above. */

/* ---- KPI strip — scaled-down .card ---- */
.cockpit-kpis {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--spacing-4);
}

.cockpit-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-4) var(--spacing-5);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    min-width: 0;
}

.cockpit-kpi-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cockpit-kpi-value {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    margin-top: 2px;
}

.cockpit-kpi-sub {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.cockpit-kpi-sub.ok { color: var(--color-success-text); }
.cockpit-kpi-sub.warn { color: var(--color-warning-text); }
.cockpit-kpi-sub.err { color: var(--color-error-text); }

/* ---- Worker strip ---- */
.cockpit-workers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--spacing-4);
}

.cockpit-worker {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-4) var(--spacing-5);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.cockpit-worker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
}

.cockpit-worker-name {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.cockpit-worker-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--spacing-3);
}

.cockpit-worker-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cockpit-worker-metric-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}

.cockpit-worker-metric-value {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.cockpit-worker-error {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-xs);
    color: var(--color-error-text);
    padding-top: var(--spacing-2);
    border-top: 1px solid var(--color-error-light);
}

/* ---- Main panel grid — panels are .card-like ---- */
.cockpit-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--spacing-4);
}

.cockpit-grid-full {
    grid-column: 1 / -1;
}

.cockpit-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.cockpit-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-4) var(--spacing-5);
    border-bottom: 1px solid var(--border-color);
    gap: var(--spacing-3);
}

.cockpit-panel-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.cockpit-panel-count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
    font-variant-numeric: tabular-nums;
}

.cockpit-panel-body {
    flex: 1;
    overflow-x: auto;
    min-height: 0;
}

/* Table styles now live in the .data-grid-table section — the dashboard uses
   .data-grid-table .data-grid-table--dense. */

/* Empty state inside panel */
.cockpit-empty {
    padding: var(--spacing-8) var(--spacing-5);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* Small icon button (for statusbar refresh) */
.cockpit-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.cockpit-btn-icon:hover {
    background: var(--color-gray-50);
    color: var(--text-primary);
    border-color: var(--border-color-dark);
}

/* Responsive */
@media (max-width: 1280px) {
    .cockpit-kpis {
        grid-template-columns: repeat(3, 1fr);
    }
    .cockpit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .cockpit-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
    .cockpit-statusbar-title {
        width: 100%;
        border-right: none;
        padding-right: 0;
        padding-bottom: var(--spacing-3);
        border-bottom: 1px solid var(--border-color);
    }
}

/* ==========================================================================
   Process Detail — Split viewer layout (invoice-first)
   ========================================================================== */

/* FEAT-036 scroll model A "Zwei Bereiche, volle Höhe": the detail page never scrolls as a page and
   never sideways; the PDF and the side panel body are the only scroll containers.
   The shell hands the page exactly the remaining height (flex chain), no magic number: the former
   calc(100vh - 80px) assumed a top header that no longer exists, and the former negative margin
   (calc(-1 * --spacing-5)) stuck out of .main-body by ~19 px right and bottom, which — with
   .main-body { overflow-y: auto } — produced a horizontal and an extra vertical scrollbar.
   A license banner above simply takes its share. :has() is supported by Chromium/Edge/Firefox. */
.main-content:has(.process-workspace) {
    display: flex;
    flex-direction: column;
    height: 100vh;      /* fallback for browsers without dvh */
    height: 100dvh;
    min-height: 0;
}

.main-content:has(.process-workspace) > .main-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Split: document pane left, side panel right, each exactly as high as the space left. */
.process-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--pd-side-width);
    /* FEAT-042: the head is first in the DOM (keyboard and screen-reader order); on the desktop it heads the right column. */
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "viewer head" "viewer side";
    column-gap: var(--pd-pane-gap);
    row-gap: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    min-height: 0;
}

/* ---- Left: Viewer pane ---- */
.pd-viewer {
    grid-area: viewer;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    /* Look f1c1079 item 2: clip, not hidden — hidden makes the card a scroll container, and the floating zoom would
       then stick to the card (which never scrolls) instead of to the window. */
    overflow: clip;
    min-width: 0;
    min-height: 0;
}

/* FEAT-036: ONE document toolbar (attachment chips · version select · archive link · annotation
   tools · original email). It wraps onto a second line instead of scrolling sideways. */
.pd-viewer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--pd-bar-pad-y) var(--pd-bar-pad-x);
    border-bottom: 1px solid var(--border-color);
    background: var(--color-gray-50);
    flex-shrink: 0;
}

/* (a) ONE height for every control of the toolbar (chip, version select, archive link, tools, original
   e-mail): demo look 1ceec93 measured 26.4 / 28 / 32.9 px side by side. Height from the token, no vertical
   padding, content centred; the badge inside a chip may not stretch it. */
.pd-viewer-toolbar .btn,
.pd-viewer-toolbar .pd-attachment-chip,
.pd-viewer-toolbar .pd-attachment-chip-archived,
.pd-viewer-toolbar .pd-version-select {
    box-sizing: border-box;
    height: var(--pd-control-height);
    min-height: 0;
    padding-block: 0;
}

.pd-viewer-toolbar .pd-attachment-chip-badge {
    line-height: var(--line-height-tight);
}

/* (b) Chips size to their content up to a sensible limit (full name in the tooltip); (d) on a narrow
   screen a chip is never wider than the toolbar and the name truncates inside it instead of being clipped. */
.pd-viewer-toolbar .pd-attachment-chip {
    max-width: min(100%, var(--pd-chip-max-width));
}

.pd-viewer-toolbar .pd-attachment-chip-name {
    min-width: 0;
}

/* SW-010: "Erneut archivieren" next to a chip whose archive failed — a toolbar control of the shared height. */
.pd-viewer-toolbar .pd-attachment-retry {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    height: var(--pd-control-height);
    white-space: nowrap;
}

/* (e) The original e-mail action is at least as prominent as the active chip: outlined primary in the
   primary colour, semibold, same height. */
.pd-viewer-toolbar .pd-viewer-toolbar-action {
    font-weight: var(--font-weight-semibold);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

/* Warning marker on an attachment chip whose archive failed (reason in the tooltip). */
.pd-attachment-chip-warning {
    display: inline-flex;
    align-items: center;
    color: var(--color-error-text);
    cursor: help;
}

/* "Archiviert ↗" in the toolbar is a link, not a status pill: plain text in the chip. */
.pd-viewer-toolbar .pd-attachment-chip-archived .pd-attachment-chip-badge {
    padding: 0;
    background: none;
    text-transform: none;
    letter-spacing: 0;
    font-weight: var(--font-weight-medium);
}

/* Version select: compact, sized by its longest option ("v2 · Gestempelt"). */
.pd-version-select {
    width: auto;
    min-width: 0;
    height: var(--pd-control-height);
    padding-block: 0;
    padding-inline: var(--pd-control-pad-x);
    font-size: var(--font-size-xs);
}

/* Source-email card — sits at the top of .pd-viewer, above the toolbar.
   Collapsed by default (sender + subject + 1-line preview), expandable.
   Absent entirely for manually-uploaded processes (no source email). */
.pd-email-card {
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    flex-shrink: 0;
}
.pd-email-card-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;   /* FEAT-042: sender · subject (shortens with «…»), chevron at the right edge */
    align-items: center;
    gap: var(--spacing-3);
    width: 100%;
    padding: 0;   /* FEAT-042: the family row carries the padding (one token for every row) */
    font: inherit;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary);
}
.pd-email-card-toggle:hover {
    background: var(--color-gray-50);
}
.pd-email-card-toggle:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}
.pd-email-card-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.pd-email-line {
    display: flex;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
    line-height: 1.35;
    min-width: 0;
}
.pd-email-label {
    flex-shrink: 0;
    width: 56px;
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}
.pd-email-value {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.pd-email-value.pd-email-subject {
    font-weight: var(--font-weight-semibold);
}
.pd-email-preview {
    margin-top: 4px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* FEAT-036 e-mail head, line 1: "Von … · Betreff …" on one line, both values truncate. */
.pd-email-oneline {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-2);
    min-width: 0;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-tight);
}

.pd-email-oneline .pd-email-label {
    width: auto;
}

.pd-email-oneline .pd-email-value {
    flex: 0 1 auto;
}

.pd-email-oneline .pd-email-subject {
    flex: 1 1 auto;
}

.pd-email-oneline-sep {
    color: var(--text-muted);
}

/* On a phone the sender and the subject each get their own line instead of both shrinking to a few
   characters (look 375 px). */
@media (max-width: 640px) {   /* --bp-sm */
    .pd-email-oneline {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: var(--spacing-2);
    }

    .pd-email-oneline-sep {
        display: none;
    }
}

/* FEAT-036 e-mail head, line 2: the documents of the same email and the one inline-image hint.
   ONE line from 641 px (look 9f072ea: the chips wrapped to 4 lines, head 117 px): the sibling row keeps its
   width (numbers only, the rest behind "+N"), the hint gives way and truncates (full text in its tooltip).
   Never scrolls sideways; a phone wraps (640 px block below).
   FEAT-042: the line is the «Dokumente» row of the family block (ProcessFamilyBlock); the row itself (flex, gap, the one
   padding token) is styled with the family block in the lane D section. */
.ik-family__row--documents {
    flex-wrap: nowrap;
}

.ik-family__row--documents > .email-sibling-strip {
    flex-wrap: nowrap;
    flex-shrink: 0;
    padding: 0;
}

.ik-family__row--documents .email-group-summary {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.email-group-summary__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* "+N": the siblings beyond the inline chips, in a menu over the document. The menu is placed in the
   e-mail card (not at the toggle), so it never runs past the screen edge (look harness 800 / 375 px). */
.pd-email-card:has(.email-sibling-more) {
    position: relative;
}

.email-sibling-more {
    position: static;
}

.email-sibling-more__toggle {
    font: inherit;
    font-size: var(--font-size-xs);
}

/* Transparent layer under the open menu: a click outside the menu lands here and closes it. */
.email-sibling-more__backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-dropdown);
}

.email-sibling-more__menu {
    position: absolute;
    top: 100%;
    left: var(--pd-bar-pad-x);
    z-index: calc(var(--z-dropdown) + 1);
    display: flex;
    flex-direction: column;
    min-width: min(var(--email-sibling-menu-min-width), calc(100% - 2 * var(--pd-bar-pad-x)));
    max-width: calc(100% - 2 * var(--pd-bar-pad-x));
    margin-top: var(--spacing-1);
    padding: var(--spacing-1) 0;
    background: var(--bg-card);
    border: var(--pd-float-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.email-sibling-more__item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    white-space: nowrap;
    text-decoration: none;
}

.email-sibling-more__item > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {   /* --bp-sm */
    /* A phone may wrap the sub-line (compact: numbers only); nothing runs off the screen. */
    .ik-family__row--documents {
        flex-wrap: wrap;
    }

    .ik-family__row--documents > .email-sibling-strip {
        flex-wrap: wrap;
        flex-shrink: 1;
        min-width: 0;
    }
}

.ik-family__row--documents .pd-attachment-chip {
    max-width: 100%;
    padding-block: var(--pd-chip-pad-y);
}

.ik-family__row--documents .email-sibling-chip__file {
    min-width: 0;
}

/* "4 eingebettete Bilder nicht importiert" — names in the tooltip. */
.email-group-summary {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    margin-left: auto;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    cursor: help;
}

.pd-email-card-body {
    padding: var(--spacing-3) var(--spacing-4) var(--spacing-4);
    border-top: 1px dashed var(--border-color);
    background: var(--color-gray-50);
}
.pd-email-body-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.5;
    max-height: 40vh;
    overflow-y: auto;
}
.pd-email-body-empty {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    font-style: italic;
}

.pd-viewer-filename {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.pd-attachment-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    /* FEAT-036: shrinks and wraps (never scrolls sideways), so a toolbar action next to it stays in view.
       (d) It keeps its content width (flex-basis auto) and may take the full toolbar line, so on a phone the
       chip is not squeezed to ~110 px; the controls after it wrap onto the next line. */
    flex-shrink: 1;
    min-width: 0;
    max-width: 100%;
}

/* An action in the viewer toolbar (e.g. "Download original email"): pinned right, never shrinks. */
.pd-viewer-toolbar-action {
    margin-left: auto;
    flex-shrink: 0;
}

.pd-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: 6px var(--spacing-3);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    max-width: 200px;
}

.pd-attachment-chip:hover {
    border-color: var(--color-primary);
    color: var(--text-primary);
}

.pd-attachment-chip.active {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.pd-attachment-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.pd-attachment-chip-badge {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    background: var(--color-gray-200);
    color: var(--text-secondary);
}

.pd-attachment-chip.active .pd-attachment-chip-badge {
    background: var(--color-primary);
    color: white;
}

.pd-attachment-chip-archived {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: 6px var(--spacing-3);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    white-space: nowrap;
    text-decoration: none;
}

a.pd-attachment-chip-archived:hover {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

/* Failed-archival variant — red, hover-tooltip carries the error reason. */
.pd-attachment-chip-failed {
    color: var(--color-danger, #dc2626);
    border-color: var(--color-danger, #dc2626);
    cursor: help;
}

.pd-viewer-body {
    flex: 1;
    position: relative;
    background: var(--color-gray-100);
    min-height: 0;
}

.pd-viewer-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.pd-viewer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--spacing-3);
    color: var(--text-muted);
    padding: var(--spacing-8);
    text-align: center;
}

.pd-viewer-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* ---- Right: Side panel ---- */
.pd-side {
    grid-area: side;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;   /* FEAT-042: the head above is the top of the panel */
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Head — path, title, status, facts, actions (FEAT-042: its own grid item, the top of the right panel) */
.pd-side-header {
    grid-area: head;
    padding: var(--spacing-4) var(--spacing-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    flex-shrink: 0;
}

.pd-side-header-top {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-2);
}

.pd-side-header-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
}

.pd-side-header-back:hover {
    background: var(--color-gray-100);
    color: var(--text-primary);
}

.pd-side-header-number {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.pd-side-header-subject {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-3) 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pd-side-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
}

.pd-side-header-actions .btn {
    flex: 1;
    min-width: 110px;
    justify-content: center;
}

/* Look c7e4d4c item 3: the reason of a blocked start ("Mögliches Duplikat – zuerst entscheiden") stands in its own
   slot under the action row. Between the buttons it forced a wrap at 1440 px (Verwerfen 61 px down, 123 px left,
   Start 360 px wide); here the buttons keep their places in every duplicate behaviour. */
.pd-side-header-reason {
    display: flex;
    margin-top: var(--spacing-2);
    margin-bottom: 0;
}

/* "Send by email" target picker (FEAT invoice-email-delivery) — dropdown + Send,
   shown only when more than one enabled target is configured. */
/* "Send by email" with >1 target: button expands on click into a target picker (mirrors
   the .user-dropdown pattern, reusing the shared .dropdown-* item styles). */
.pd-email-send {
    position: relative;
    display: inline-block;
}

/* R-017320: off-screen iframe that hosts the PDF while the browser print dialog is open
   (print-pdf.js). Not display:none — Chromium does not print a hidden frame. The px values
   only park the frame off-screen (like .sr-only); they are not design values, so no tokens. */
.print-pdf-frame {
    position: fixed;
    top: 0;
    left: -10000px;
    width: 1px;
    height: 1px;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.pd-email-menu {
    position: absolute;
    top: 100%;
    /* Open left-aligned (from the button's left edge), NOT right-aligned. The
       "Send by email" button sits near the LEFT edge of the ~420px-wide .pd-side
       panel, and that panel has overflow:hidden. A right-anchored menu (right:0)
       extends ~310px leftward — past the panel's left edge — where overflow:hidden
       clips its left half away, so metadata behind it shows through (looks like a
       z-index bug but is really clipping). Left-aligning opens the menu into the
       free space to the right, keeping it inside the panel. max-width keeps a long
       recipient address from pushing the menu past the panel's right edge. */
    left: 0;
    margin-top: var(--spacing-2);
    min-width: 220px;
    max-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: var(--z-dropdown);
    overflow: hidden;
}

/* Scrollable body with stacked sections */
.pd-side-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.pd-section {
    border-bottom: 1px solid var(--border-color);
}

.pd-section:last-child {
    border-bottom: none;
}

/* FEAT-036 side panel B: compact section header (one height for every section). */
/* Look 9b073ba item 3: at 375 px "QR neu lesen" ran over the card edge (title, status and action on one unbreakable
   line). The status wraps under the title when the line is too narrow; the vertical padding keeps a header with a small
   button exactly at --pd-section-header-height on the desktop (no change) and gives a wrapped header its breathing room
   (on touch, where the 44 px button is taller than the header, the touch block sets --spacing-1 — look 5374281 item 4). */
.pd-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-1) var(--spacing-2);
    min-height: var(--pd-section-header-height);
    padding: var(--pd-section-header-pad-y) var(--pd-section-pad-x);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--border-color);
}

/* A section whose header carries its whole state (KI "Noch nicht ausgelesen" + action): no body. */
.pd-section-header--status-only {
    border-bottom: none;
}

/* Status text and actions on the right of a section header (AI extraction). The section title
   keeps its line; the status gives way. */
.pd-section-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-2);
    min-width: 0;
    margin-left: auto;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.pd-section-header > .pd-section-title {
    flex-shrink: 0;
    white-space: nowrap;
}

.pd-section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.pd-section-badge {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}

/* container-type: the field grid, key/value rows and processing grid follow the PANEL width
   (container query), not the window — the panel is 400 px wide whatever the screen. */
.pd-section-body {
    padding: var(--pd-section-pad-y) var(--pd-section-pad-x);
    container-type: inline-size;
}

/* Field grid (invoice data): 2 columns in the 400 px panel, 3 from a 32rem section body. */
.pd-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--pd-field-gap-y) var(--pd-field-gap-x);
}

.pd-field-grid > .form-group {
    min-width: 0;
    margin-bottom: 0;
}

.pd-field-grid .form-group label {
    display: block;
    margin-bottom: var(--pd-label-gap);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
}

.pd-field-grid .form-control {
    height: var(--pd-control-height);
    padding-block: 0;
    padding-inline: var(--pd-control-pad-x);
    font-size: var(--font-size-sm);
}

.pd-field--wide {
    grid-column: 1 / -1;
}

@container (min-width: 32rem) {
    .pd-field-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .pd-field--wide,
    .pd-field--wide-lg {
        grid-column: span 2;
    }
}

/* Read-only facts: key/value rows, label column on the left. */
.pd-kv {
    display: grid;
    grid-template-columns: var(--pd-kv-label-width) minmax(0, 1fr);
    column-gap: var(--pd-field-gap-x);
    row-gap: var(--pd-row-gap);
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: var(--pd-line-height-dense);
}

.pd-kv dt {
    align-self: baseline;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
}

.pd-kv dd {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

@container (min-width: 32rem) {
    .pd-kv--2col {
        grid-template-columns: var(--pd-kv-label-width) minmax(0, 1fr) var(--pd-kv-label-width) minmax(0, 1fr);
    }
}

.pd-kv-note {
    margin-top: var(--pd-field-gap-y);
}

/* Metadata grid inside the side panel */
.pd-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3);
}

.pd-meta-grid .form-group {
    margin-bottom: 0;
}

.pd-meta-grid .form-group label,
.pd-section-body > .form-group > label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--spacing-1);
}

.pd-meta-grid .form-control {
    font-size: var(--font-size-sm);
    padding: var(--spacing-2) var(--spacing-3);   /* review 9b073ba: the field tokens (8px 10px left an 18.7 px content box) */
}

.pd-meta-readonly {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
    margin: 0;
}

.pd-meta-amount {
    display: flex;
    gap: var(--spacing-2);
}

.pd-meta-amount .form-control:first-child {
    flex: 1;
}

.pd-meta-amount .form-control:last-child {
    max-width: var(--pd-currency-width);
}

/* Look c7e4d4c item 11: in a narrow panel (375 px screen: ~305 px section body) amount and currency in half a row
   left the amount 66 px ("100.(" cut). Below 22rem the amount field takes the whole row; the 400 px panel
   (376 px body) keeps the two columns. */
@container (max-width: 22rem) {
    /* The ERP reference, the last field, takes the whole row too: otherwise it stood alone in a half row with an
       empty cell next to it once the amount had moved to its own row (review M-7). */
    .pd-field--amount,
    .pd-field--wide-lg {
        grid-column: 1 / -1;
    }
}

.pd-meta-full {
    grid-column: 1 / -1;
}

/* Compact timeline for history section */
.pd-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.pd-timeline-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: var(--spacing-3);
    position: relative;
}

.pd-timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 22px;
    bottom: -12px;
    width: 2px;
    background: var(--border-color);
}

.pd-timeline-item--clickable {
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.pd-timeline-item--clickable:hover {
    background: var(--color-gray-100);
}

.pd-timeline-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    z-index: 1;
    flex-shrink: 0;
}

.pd-timeline-content {
    min-width: 0;
}

.pd-timeline-head {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
}

.pd-timeline-type {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.pd-timeline-time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.pd-timeline-summary {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin: 2px 0 0 0;
    line-height: 1.5;
}

.pd-timeline-actor {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

/* Timeline outcome states (OK/NOK) */
.pd-timeline-dot--success {
    border-color: var(--color-success);
    color: var(--color-success);
}

.pd-timeline-dot--failure {
    border-color: var(--color-error);
    color: var(--color-error);
}

.pd-timeline-summary--failure {
    color: var(--color-error-text);
}

/* Outputs panel */
.pd-outputs {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.pd-output {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
}

.pd-output-label {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.pd-output-detail {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.pd-output--ok { color: var(--color-success-text); }
.pd-output--failed { color: var(--color-error-text); }
.pd-output--inprogress { color: var(--color-warning-text); }
.pd-output--notyet { color: var(--text-muted); }
/* Look f68ad07: a merged source is closed - nothing more happens on its channels (it said "Eingang läuft"). */
.pd-output--merged { color: var(--text-secondary); }

/* FEAT-036 processing: 2×2 grid of one-line states (4 in a row from a 32rem panel). */
.pd-outputs--grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--pd-row-gap) var(--pd-field-gap-x);
}

@container (min-width: 32rem) {
    .pd-outputs--grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.pd-outputs--grid .pd-output {
    grid-template-columns: var(--pd-event-icon-size) auto minmax(0, 1fr);
    gap: var(--spacing-1);
    white-space: nowrap;
    line-height: var(--pd-line-height-dense);
}

.pd-outputs--grid .pd-output-detail {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Look 861a82b item 3: a merged source - one sentence where the processing continues instead of four "zusammengeführt"
   channels (they were cut at 1440 px: "Gestempelt zusammenge…"). Wraps like text; a finished channel follows below. */
.pd-outputs-merged {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-2);
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: var(--pd-line-height-dense);
    color: var(--text-secondary);
}

.pd-outputs-merged > svg {
    flex-shrink: 0;
    margin-top: var(--spacing-1);
}

.pd-outputs-merged + .pd-outputs {
    margin-top: var(--spacing-2);
}

/* FEAT-036 history: one line per event — icon · type · summary/actor (truncated) · time.
   The whole line opens the event detail. */
.pd-events {
    display: flex;
    flex-direction: column;
    gap: var(--pd-row-gap);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--font-size-sm);
    line-height: var(--pd-line-height-dense);
}

.pd-event {
    display: grid;
    grid-template-columns: var(--pd-event-icon-size) minmax(0, 1fr) auto;
    gap: var(--spacing-2);
    align-items: baseline;
    padding: var(--pd-row-gap) var(--spacing-1);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.pd-event:hover {
    background: var(--color-gray-100);
}

.pd-event > svg {
    align-self: center;
    color: var(--color-primary);
}

.pd-event--success > svg {
    color: var(--color-success);
}

.pd-event--failure > svg {
    color: var(--color-error);
}

.pd-event-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-event-text strong {
    font-weight: var(--font-weight-semibold);
}

.pd-event-text span {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.pd-event--failure .pd-event-text span {
    color: var(--color-error-text);
}

.pd-event-time {
    font-size: var(--font-size-xs);
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Extraction panel compact */
.pd-extraction-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-3);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: var(--spacing-3);
}

.pd-extraction-meta strong {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
}

.pd-extraction-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: var(--spacing-3);
}

.pd-extraction-field {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: var(--spacing-3);
    align-items: baseline;
    font-size: var(--font-size-xs);
    padding: 6px 0;
    border-bottom: 1px dashed var(--border-color);
}

.pd-extraction-field:last-child {
    border-bottom: none;
}

/* Look 5829a87 item 4: the label as the resources write it ("Fällig am", "Due date") — capitalize dated from the raw
   model keys and turned it into "Fällig Am". */
.pd-extraction-field-name {
    color: var(--text-muted);
}

.pd-extraction-field-value {
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Swiss QR-bill trust callout — QR vs AI IBAN comparison (FEAT-028) */
.qr-mismatch-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
}

.qr-mismatch-compare {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--spacing-1);
}

.qr-mismatch-row {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: var(--spacing-2);
    align-items: baseline;
}

.qr-mismatch-label {
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}

.qr-mismatch-value {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    word-break: break-all;
}

/* Approval round compact */
.pd-approval-round {
    padding: var(--spacing-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-3);
}

.pd-approval-round:last-child {
    margin-bottom: 0;
}

.pd-approval-round-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-3);
}

.pd-approval-round-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.pd-approval-levels {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.pd-approval-level {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-2) var(--spacing-3);
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
}

.pd-approval-level-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.pd-approval-level-info {
    flex: 1;
    min-width: 0;
}

.pd-approval-level-name {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "by H. Maly" under the level's approver when someone else decided (deputy, Supervisor). */
.pd-approval-level-actor {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.pd-approval-level-date {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

/* Responsive: stack on narrow screens. Here the page scrolls by design (document pane, then the side
   panel below it); the flex chain of the full-height layout is released, the document pane keeps a
   fixed share of the window and the side panel grows with its content (no inner scrollbar). */
@media (max-width: 1280px) {   /* --bp-xl — normalized from 1200 */
    .main-content:has(.process-workspace) {
        display: block;
        height: auto;
    }
    .main-content:has(.process-workspace) > .main-body {
        overflow: visible;
    }
    .process-workspace {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        grid-template-areas: "head" "viewer" "side";   /* FEAT-042: head first, as in the DOM */
        row-gap: var(--pd-pane-gap);
        height: auto;
    }
    .pd-side-header {
        border-radius: var(--radius-xl);
    }
    .pd-side {
        border-top: 1px solid var(--border-color);
        border-radius: var(--radius-xl);
    }
    /* Look 9d4bfe1 item 3: the fixed share belongs to the document, not to the whole card. With 70dvh on the card, a
       long source-email card and a wrapped toolbar left the document 0 px (process with three merged emails and four
       attachments at 375 px). The card grows with its header; the document keeps its share. */
    .pd-viewer {
        height: auto;
    }
    .pd-viewer-body {
        flex: none;
        height: 70vh;
        height: 70dvh;
    }
    .pd-side-body {
        overflow: visible;
    }
}

/* ==========================================================================
   PdfViewer component (FEAT-020)
   PDF.js-based inline viewer with version history rail.
   ========================================================================== */

.pd-pdfviewer {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    background: var(--color-gray-100);
}

/* ---- Version history rail (left on desktop, dropdown on mobile) ---- */
.pd-pdfviewer-versions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    padding: var(--spacing-2);
    border-right: 1px solid var(--border-color);
    background: var(--bg-card);
    overflow-y: auto;
    min-height: 0;
}

.pd-pdfviewer-versions-empty {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    padding: var(--spacing-3);
    text-align: center;
}

.pd-pdfviewer-version {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
        "dot label"
        ".   meta";
    align-items: start;
    gap: 2px var(--spacing-1);
    padding: var(--spacing-2);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: background var(--transition-fast), border-color var(--transition-fast);
    min-height: 44px;
}

.pd-pdfviewer-version:hover {
    background: var(--color-gray-100);
}

.pd-pdfviewer-version:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.pd-pdfviewer-version.selected {
    background: var(--color-primary-50, rgba(99, 102, 241, 0.08));
    border-color: var(--color-primary);
}

.pd-pdfviewer-version-dot {
    grid-area: dot;
    color: var(--color-primary);
    font-size: 14px;
    line-height: 1;
}

.pd-pdfviewer-version-label {
    grid-area: label;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-pdfviewer-version-meta {
    grid-area: meta;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Main column (toolbar + canvas) ---- */
.pd-pdfviewer-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

/* ---- Toolbar ---- */
.pd-pdfviewer-toolbar {
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
    padding: var(--spacing-2) var(--spacing-3);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.pd-pdfviewer-toolbar-spacer {
    flex: 1;
}

/* Look 5374281 item 2: the toolbar's button height is a token; the icon-only zoom buttons (.btn-icon.btn-sm) take it as
   their square, so they are not 28 px wide in a 36 px row. */
.pd-pdfviewer-toolbar .btn {
    min-height: var(--pd-toolbar-btn-height);
    --btn-icon-sm-size: var(--pd-toolbar-btn-height);
}

.pd-pdfviewer-tool-active {
    background: var(--color-primary);
    color: var(--text-on-primary, #fff);
}

.pd-pdfviewer-zoom {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    min-width: 48px;
    text-align: center;
}

/* FEAT-036 compact form (desktop detail page): no version column (the version is a select in the
   page toolbar), no toolbar row; the PDF gets the full pane width. */
.pd-pdfviewer--compact {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

/* pdf.js appends its measuring canvas to <body>. Root cause fixed in pdf-viewer.js (the vendor hiding rule
   stays unprefixed, BODY_LEVEL_SELECTORS); this is the second line of defence should a pdf.js update rename
   or move the rule — the canvas must never add a line below the app (FEAT-036: page scrollbar). */
body > canvas.hiddenCanvasElement {
    display: none;
}

.pd-pdfviewer--compact .pd-pdfviewer-main {
    position: relative;
}

/* Look 9d4bfe1 item 3: the stage holds the canvas and the floating zoom, below the read-only version banner. The zoom
   is positioned on the stage (not on the whole main column), and the stage keeps room for it: on a phone the document
   toolbar and the banner had taken the whole card, the canvas was 0 px high and the zoom covered the banner and its
   "Zu v2 wechseln" link. */
.pd-pdfviewer-stage {
    position: relative;
    display: grid;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    flex: 1;
    min-height: var(--pd-stage-min-height);
}

/* Look f1c1079 item 2: the canvas and the floating zoom share the stage's one grid cell, so the zoom overlays the
   document without taking a row of its own. */
.pd-pdfviewer-stage > .pd-pdfviewer-canvas-host {
    grid-area: 1 / 1;
}

/* Zoom floats over the bottom-right corner of the PDF; the percentage is a button = back to page width.
   Look 9d4bfe1 review: the icon-only zoom buttons are square at the control height (28 × 30 px before). */
.pd-zoom-float {
    --btn-icon-sm-size: var(--pd-control-height);
    position: absolute;
    right: var(--pd-zoom-float-inset-x);
    bottom: var(--pd-zoom-float-inset-y);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    padding: var(--spacing-1);
    background: var(--bg-card);
    border: var(--pd-float-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Look f1c1079 item 2: on process 596efae6 at 1163 × 900 the stacked 70dvh stage sat below a taller card header and the
   absolute zoom ended 19 px below the window (bottom 919). On the stage it sticks to the visible bottom of the stage:
   at the stage's corner when that is in view, else at the window's bottom edge. Sticky never leaves its containing
   block, so it stays on the stage (never over the version banner above it). */
.pd-pdfviewer-stage > .pd-zoom-float {
    grid-area: 1 / 1;
    position: sticky;
    right: auto;
    bottom: var(--pd-zoom-float-inset-y);
    align-self: end;
    justify-self: end;
    margin: 0 var(--pd-zoom-float-inset-x) var(--pd-zoom-float-inset-y) 0;
}

.pd-zoom-float .pd-pdfviewer-zoom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--pd-zoom-label-width);
    padding: 0;
    font: inherit;
    font-size: var(--font-size-xs);
    font-variant-numeric: tabular-nums;
    background: none;
    border: none;
    cursor: pointer;
}

/* Look 5829a87 item 6: the three zoom controls in one height (the percentage was 16.9 px between 25.5 px buttons). */
.pd-zoom-float .btn,
.pd-zoom-float .pd-pdfviewer-zoom {
    box-sizing: border-box;
    height: var(--pd-control-height);
    min-height: 0;
    padding-block: 0;
}

.pd-zoom-float .pd-pdfviewer-zoom:hover {
    color: var(--color-primary);
}

/* Opt-in page number after the zoom (PdfViewer.ShowPageIndicator, inbox quick view: "Seite 1 / 2"; its image view
   shows "Bild · 1200 × 1600" in the same place). */
.pd-zoom-float__sep {
    width: var(--pd-zoom-sep-width);
    align-self: stretch;
    margin: var(--spacing-1);
    background: var(--border-color);
}

.pd-zoom-float__page {
    padding: 0 var(--spacing-2);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The two scroll containers of the page: thin bars, space reserved so content does not jump. */
.pd-side-body,
.pd-pdfviewer--compact .pd-pdfviewer-canvas-host > .pd-pdfviewer-scope > div {
    scrollbar-width: thin;
    scrollbar-gutter: stable;
}

/* ---- Read-only banner (shown when viewing a non-latest version) ---- */
.pd-pdfviewer-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-3);
    background: var(--color-amber-50, #fef3c7);
    color: var(--color-amber-900, #78350f);
    border-bottom: 1px solid var(--color-amber-200, #fde68a);
    font-size: var(--font-size-sm);
}

.pd-pdfviewer-banner .btn-link {
    color: var(--color-amber-900, #78350f);
    text-decoration: underline;
    padding: 0;
    margin-left: auto;
}

/* ---- Canvas host (where PDFViewer renders pages) ---- */
.pd-pdfviewer-canvas-host {
    flex: 1;
    overflow: auto;
    background: var(--color-gray-200);
    min-height: 0;
    position: relative;
}

/* Inline error shown when PDF.js cannot render the bytes (corrupt / non-PDF) — replaces the
   former whole-page crash. */
.pd-pdfviewer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-6);
    text-align: center;
    color: var(--color-error-text);
    background: var(--color-error-light);
    border-radius: var(--radius-md);
    margin: var(--spacing-3);
}

/* The PDF rendering surface lives inside a Shadow DOM root attached to the canvas host —
   pdf_viewer.css is loaded inside that shadow and styles the .pdfViewer / .page elements
   without leaking to the rest of the app. No host-side rules needed for canvas pages. */

/* ---- Mobile breakpoint: collapse rail to a top dropdown disclosure ---- */
@media (max-width: 900px) {
    .pd-pdfviewer {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .pd-pdfviewer-versions {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: visible;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 64px;
        gap: var(--spacing-2);
    }

    .pd-pdfviewer-version {
        flex: 0 0 auto;
        min-width: 180px;
        min-height: 48px;
    }

    .pd-pdfviewer-toolbar {
        flex-wrap: wrap;
    }

    .pd-pdfviewer-toolbar .btn {
        --pd-toolbar-btn-height: var(--touch-target-size);
    }

    /* FEAT-036 (I1): the compact viewer has no rail, so the "auto / 1fr" rows above would put its only
       child into the auto row and collapse the canvas. It keeps one full-height row. */
    .pd-pdfviewer--compact {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
    }
}

/* ==========================================================================
   FEAT-021 Phase Segmented Control (Process Inbox)
   Pill-style toggle button group. See FEAT-021 §4.2.
   ========================================================================== */
/* Look 5829a87 item 6: the pill is one control of the list toolbar, as high as the search next to it (was 48 px next to
   44 px); the segments fill it. min-height: on a phone the segments may wrap onto a second line. */
.phase-segments {
    display: inline-flex;
    align-items: center;
    gap: var(--phase-segments-pad);
    box-sizing: border-box;
    min-height: var(--list-toolbar-control-height);
    padding: var(--phase-segments-pad);
    background-color: var(--color-gray-100);
    border-radius: 999px;
}

.phase-segment {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    height: calc(var(--list-toolbar-control-height) - 2 * var(--phase-segments-pad));
    padding: 0 var(--spacing-4);
    min-width: var(--touch-target-size); /* FEAT-021 §4.16 as refined by FEAT-035: tappable width; height: touch block */
    background: transparent;
    border: none;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
                color 150ms cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.phase-segment:hover:not(.phase-segment--active) {
    background-color: var(--color-gray-50);
    color: var(--text-primary);
}

.phase-segment:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.phase-segment--active {
    background-color: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.phase-segment-label {
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .phase-segment {
        transition: none;
    }
}

/* ==========================================================================
   FEAT-021 Process Inbox page
   Toolbar (phase control + search + My queue switch), row emphasis rules,
   action column hover behaviour.
   ========================================================================== */
.inbox-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-4);
    flex-wrap: wrap;
}

.inbox-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-4);
    flex: 1;
    justify-content: flex-end;
}

/* Look 861a82b item 7: 280px cut the placeholder ("…Datei suc"); the one flexible search width of the app. */
.inbox-search {
    --search-text-start: calc(var(--spacing-3) + var(--search-field-icon-slot));   /* where the field's text starts */
    container: search-field / inline-size;                 /* look 4a7ef94: the hint follows the field's width */
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 var(--search-field-width);
    min-width: var(--search-field-min-width);
    max-width: var(--search-field-width);
}

.inbox-search svg {
    position: absolute;
    left: var(--spacing-3);
    color: var(--text-muted);
    pointer-events: none;
}

.inbox-search .form-control {
    padding-left: var(--search-text-start);
    height: var(--list-toolbar-control-height); /* FEAT-035: compact on the desktop, the touch target on touch devices */
}

/* FEAT-035 "touch keeps 44 px" for controls that derive a smaller height from the token (see the touch block at the top
   for the detection). After the component rules on purpose: same specificity, the later rule wins. */
@media (pointer: coarse), (any-pointer: coarse) {
    /* The segments are what is tapped: the touch target on them, the pill around them without vertical padding, so the
       pill stays as high as the search next to it. */
    .phase-segments {
        padding-block: 0;
    }

    .phase-segment {
        height: var(--touch-target-size);
    }

    /* The floating zoom controls of the document (they take --pd-control-height on the desktop). */
    .pd-zoom-float .btn,
    .pd-zoom-float .pd-pdfviewer-zoom {
        height: var(--touch-target-size);
    }

    /* Look aeeee19: the card action buttons (service accounts, workflow configurations) were 26.4 px on a phone. */
    .account-actions .btn,
    .config-card-actions .btn {
        min-height: var(--touch-target-size);
        min-width: var(--touch-target-size);
    }

    /* Look c3d299b: the items of the avatar's user menu (my absence, About, sign out) were 32 px on a phone. */
    .nav-user-menu-item {
        height: auto;
        min-height: var(--touch-target-size);
    }
}
.inbox-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    min-height: var(--list-toolbar-control-height); /* the toolbar's one height; 44 px on touch devices */
    padding: 0 var(--spacing-2);
}

.inbox-switch input[type="checkbox"] {
    width: 36px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

/* On a phone the toolbar wraps (demo look 7de3354: "Needs Approval" cut at the right edge, the
   search 280 px wide beside nothing): the phase segments wrap onto a second line when needed and
   the search takes the full width of its own line. */
@media (max-width: 640px) {   /* --bp-sm */
    .phase-segments {
        flex-wrap: wrap;
        max-width: 100%;
        border-radius: var(--radius-xl);
    }

    /* Look 861a82b review: search and switch always take their own line below the segments (at 600 px they shared the
       segments' line and the search shrank to 234 px, cutting its placeholder). */
    .inbox-toolbar-right {
        flex: 1 1 100%;
    }

    .inbox-search {
        min-width: 0;
        max-width: none;   /* look 861a82b review: the full line, not the desktop cap of --search-field-width */
        flex: 1 1 100%;
    }
}

/* FEAT-021 §4.10 Rule 1: my-action rows have a 4px primary-color left border. */
.data-grid-table tr.process-row--mine {
    box-shadow: inset 4px 0 0 0 var(--color-primary);
}

/* FEAT-021 §4.10 Rule 3: aged rows progressively dim, but the tiebreaker in
   §4.10 says Rule 1 wins — mine rows never dim, regardless of age. */
.data-grid-table tr.process-row--aged-1:not(.process-row--mine) {
    opacity: 0.96;
}

.data-grid-table tr.process-row--aged-2:not(.process-row--mine) {
    opacity: 0.92;
}

/* FEAT-021 §4.1: Open button appears on row hover only (desktop).
   On touch, no hover fires, so the button stays invisible — users tap the
   process-number link in the first column to navigate. */
.data-grid-table tbody tr .open-on-hover {
    opacity: 0;
    transition: opacity 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.data-grid-table tbody tr:hover .open-on-hover,
.data-grid-table tbody tr:focus-within .open-on-hover {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .data-grid-table tbody tr .open-on-hover {
        transition: none;
    }
}

/* Approver pill size guard (§3.5) — long names get truncated at 200px with
   tooltip on hover. */
.approver-pill {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   FEAT-022 — Process Archive
   ========================================================================== */

.archive-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-4);
}

/* Look aeeee19: the app's one flexible search width (as .inbox-search, .data-grid-search). With 280 px as its basis it
   shared the filters' line at 768 px and shrank to 255.3 px of room for a 256 px placeholder; with the token basis
   it takes its own line when the filters leave less than its width. */
.archive-toolbar-search {
    --search-text-start: var(--spacing-10);   /* where the field's text starts (icon and its gap) */
    container: search-field / inline-size;     /* look 4a7ef94: the hint follows the field's width */
    position: relative;
    flex: 1 1 var(--search-field-width);
    min-width: var(--search-field-min-width);
    max-width: var(--search-field-width);
}

.archive-toolbar-search > :first-child {
    position: absolute;
    top: 50%;
    left: var(--spacing-3);
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.archive-toolbar-search input.form-control {
    padding-left: var(--search-text-start);
}

/* Look 4a7ef94 item 3: the search hint (SearchHint.razor) in place of the placeholder attribute. At 320 px the field is
   the full line and still 31.8 px too narrow for "Vorgang, Betreff, Absender, Datei suchen" (EN 1.3 px); a placeholder
   attribute cannot change its text by width, so the input carries placeholder=" " (for :placeholder-shown) and its
   name as aria-label, and the hint shows the long text, or the short one ("Suchen …") when the field is narrower than
   the long text needs. It starts where the field's text starts (border + --search-text-start), in the placeholder's
   colour, and disappears as soon as the field holds text — like a placeholder, without script. */
.search-hint {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--search-text-start) + var(--field-border-width));   /* + the field's border (.form-control) */
    right: calc(var(--spacing-3) + var(--field-border-width));
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    pointer-events: none;
}

.search-hint__long,
.search-hint__short {
    overflow: hidden;
    text-overflow: ellipsis;   /* last resort below the threshold; the measured cases all fit (harness 4a7ef94) */
}

.search-hint__short {
    display: none;
}

.form-control:not(:placeholder-shown) + .search-hint {
    display: none;
}

/* A high-contrast theme draws placeholders in the system grey; the hint is a span and follows explicitly. */
@media (forced-colors: active) {
    .search-hint {
        color: GrayText;
    }
}

/* The longest hint (de-CH, 256 px) + the text start (37/41 px) + the end padding (13 px) = 310 px: below 21rem (315 px)
   the field shows the short hint. Paired with the 40-character cap of *.SearchPlaceholder (ResxRules; the de-CH text has
   exactly 40) — LookFix4a7ef94Tests.Container_threshold_still_holds_the_longest_allowed_long_hint keeps them together. A container query, not a media query: the field's width depends on the sidebar and
   on what shares its line, not only on the viewport. */
@container search-field (max-width: 21rem) {
    .search-hint__long {
        display: none;
    }

    .search-hint__short {
        display: inline;
    }
}

/* One control height for the whole archive toolbar (look c4f9281: the Status and Zeitraum filters were
   ~43 px, the search and the export button 36.7 px). Touch devices: 44 px through the token. */
.archive-toolbar .status-filter-dropdown-trigger,
.archive-toolbar .date-range-dropdown-trigger,
.archive-toolbar-search input.form-control,
.archive-toolbar-export .btn {
    box-sizing: border-box;
    height: var(--list-toolbar-control-height);
    min-height: 0;
    padding-block: 0;
}

/* ERP CSV export controls, pinned to the end of the archive toolbar. */
.archive-toolbar-export {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    margin-left: auto;
}

.archive-export-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
}

/* The short export label is for phones only (640 px block). */
.archive-export-label--short {
    display: none;
}

.archive-toolbar-export .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    white-space: nowrap;
}

.archive-scope-hint {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-3);
    margin-bottom: var(--spacing-3);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    background: var(--bg-body);
    border-radius: var(--radius-md);
}

.archive-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-3);
    margin-top: var(--spacing-4);
    padding: var(--spacing-3) 0;
}

.archive-pagination-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* Status filter dropdown (multi-select) */
.status-filter-dropdown {
    position: relative;
}

.status-filter-dropdown[open] .status-filter-dropdown-body {
    display: flex;
}

.status-filter-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    min-height: 44px;
    padding: var(--spacing-2) var(--spacing-3);
    cursor: pointer;
    list-style: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    user-select: none;
}

.status-filter-dropdown-trigger::-webkit-details-marker {
    display: none;
}

.status-filter-dropdown-label {
    font-weight: 500;
}

.status-filter-dropdown-summary {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.status-filter-dropdown-body {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + var(--spacing-1));
    left: 0;
    min-width: 220px;
    padding: var(--spacing-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.status-filter-dropdown-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-height: 44px;
    padding: var(--spacing-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.status-filter-dropdown-option:hover {
    background: var(--bg-body);
}

.status-filter-dropdown-option-label {
    flex: 1 1 auto;
}

.status-filter-dropdown-option-count {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* Date range dropdown */
.date-range-dropdown {
    position: relative;
}

.date-range-dropdown[open] .date-range-dropdown-body {
    display: flex;
}

.date-range-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    min-height: 44px;
    padding: var(--spacing-2) var(--spacing-3);
    cursor: pointer;
    list-style: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    user-select: none;
}

.date-range-dropdown-trigger::-webkit-details-marker {
    display: none;
}

.date-range-dropdown-label {
    font-weight: 500;
}

.date-range-dropdown-summary {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.date-range-dropdown-body {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + var(--spacing-1));
    left: 0;
    min-width: 200px;
    padding: var(--spacing-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.date-range-dropdown-option {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.date-range-dropdown-option:hover,
.date-range-dropdown-option:focus-visible {
    background: var(--bg-body);
    outline: none;
}

.date-range-dropdown-option.is-selected {
    font-weight: 600;
    color: var(--color-primary);
}

.date-range-dropdown-custom {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    padding: var(--spacing-2);
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-1);
}

.date-range-dropdown-custom label {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    font-size: var(--font-size-sm);
}

.date-range-dropdown-custom input[type="date"] {
    min-height: 44px;
    padding: var(--spacing-1) var(--spacing-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font: inherit;
}

.date-range-dropdown-hint {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

/* ==========================================================================
   Mobile approver view (.m-*)
   ==========================================================================
   Scoped styles for /m/approvals and /m/process/{id}. Deliberately separate
   from the desktop .app-layout tree because the desktop UI isn't
   mobile-responsive and retrofitting it is out of scope for this iteration.
   Mobile-first; class prefixes prevent collisions with desktop rules.

   Design notes:
   - Tap targets sized for iOS HIG minimum (44x44) where actionable.
   - Type scale deliberately larger than the desktop default — thumb-distance
     readability on a 390px phone matters more than information density.
   - No horizontal scrollbars; every rule uses min-width:0 or word-break
     where overflow is plausible.
   ========================================================================== */

/* PWA shell — mirrors the contact-central pattern (mobile-shell /
   mobile-content / mobile-tab-bar). No top app-bar; the phone's status
   bar picks up theme-color, and each page supplies its own title as
   regular page content. A fixed bottom tab bar handles navigation and
   is offset for the iPhone home indicator via env(safe-area-inset-bottom). */
.m-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--color-gray-50);
    color: var(--text-primary);
}

.m-main {
    flex: 1;
    padding-top: env(safe-area-inset-top, 0);
    /* Leave room for the fixed bottom nav (64px + home indicator) so
       the last item in a list never sits behind it. */
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 8px));
    -webkit-overflow-scrolling: touch;
}

/* ---- Bottom tab bar ---- */
.m-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 8px;
    padding-bottom: env(safe-area-inset-bottom, 8px);
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    z-index: 20;
}

.m-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 64px;
    padding: 4px 8px;
    text-decoration: none;
    color: var(--text-muted, #6b7280);
    font-size: 11px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
}

.m-bottom-nav-item svg {
    transition: background-color 0.15s ease;
    border-radius: 14px;
    padding: 3px;
    box-sizing: content-box;
}

.m-bottom-nav-item.active {
    color: #2563eb;
}

.m-bottom-nav-item.active svg {
    background: #dbeafe;
    width: 32px;
    height: 22px;
    padding: 3px 12px;
}

.m-bottom-nav-item span {
    line-height: 1;
}

/* ---- Profile page ---- */
.m-profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
}
.m-profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}
.m-profile-identity { min-width: 0; }
.m-profile-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.m-profile-email {
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.m-profile-section {
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
}
.m-profile-section-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.m-profile-section-value {
    font-size: 14px;
    color: var(--text-primary);
}
/* Profile section that links somewhere (My absence): whole card is the tap target. */
.m-profile-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.m-profile-link .m-profile-section-value {
    color: var(--color-primary);
}

.m-page {
    padding: 16px;
    max-width: 640px;
    margin: 0 auto;
}

.m-page-title {
    margin: 8px 0 16px 0;
    font-size: 22px;
    font-weight: 600;
}

/* Review M-5: the back link's height from a token (it was 46.5 px from padding around the inherited line-height), and a
   slot of that height that stays in every state of the mobile detail, so the content below does not jump. */
.m-back {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    color: #2563eb;
    text-decoration: none;
    font-size: 15px;
    line-height: var(--line-height-tight);
    min-height: var(--m-back-height);
}

.m-back-slot {
    height: var(--m-back-height);
}

/* --- Inbox sections ----------------------------------------------------- */
.m-section { margin-bottom: 24px; }
.m-section:last-child { margin-bottom: 0; }

.m-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.m-section-count {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    background: #eff6ff;
    padding: 2px 10px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
}

/* --- Approvals list ----------------------------------------------------- */
.m-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.m-card {
    display: block;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.m-card:active { background: #f3f4f6; }

.m-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* One font family (look c7e4d4c): the number in the app font, figures of equal width. */
.m-card-number {
    font-variant-numeric: tabular-nums;
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
}

.m-card-step {
    font-size: 12px;
    color: var(--text-muted);
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 999px;
}

.m-card-main { margin-bottom: 8px; }

.m-card-amount {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}
.m-card-amount strong { font-weight: 700; }
.m-card-amount span { margin-left: 4px; color: var(--text-muted); font-weight: 500; font-size: 14px; }

.m-card-vendor {
    font-size: 15px;
    color: var(--text-primary);
    margin-top: 4px;
    word-break: break-word;
}

.m-card-subject {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    word-break: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.m-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    min-width: 0;
}
.m-card-foot span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Process detail ----------------------------------------------------- */
.m-detail-head { margin: 8px 0 16px 0; }

/* One font family (look c7e4d4c): the number in the app font, figures of equal width. */
.m-process-number {
    font-variant-numeric: tabular-nums;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.m-detail-step {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* One grid for every row (look c7e4d4c): the label column is as wide as the longest label of the language
   ("Rechnungsdatum" overflowed the fixed 90 px column by 17 px), the rows share it through subgrid. */
.m-meta {
    margin: 0 0 var(--spacing-3) 0;
    padding: var(--spacing-2) var(--spacing-3);
    background: var(--bg-card);
    border: var(--card-border);
    border-radius: var(--radius-xl);
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--spacing-2) var(--spacing-3);
}

.m-meta-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: baseline;
    font-size: var(--font-size-sm);
    min-width: 0;
}

.m-meta-row dt {
    color: var(--text-muted);
    font-weight: 500;
}

.m-meta-row dd {
    margin: 0;
    color: var(--text-primary);
    word-break: break-word;
    min-width: 0;
}

.m-meta-amount dd { font-size: 16px; }
.m-meta-amount dd strong { font-size: 20px; font-weight: 700; }

/* Source-email card (mobile). Mirrors the desktop .pd-email-card
   pattern: collapsed default with From + Subject + one-line preview,
   tap to expand full body. Replaces the old separate Subject/Sender
   rows in .m-meta to reclaim vertical space. */
.m-email-card {
    margin: 0 0 12px 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}
.m-email-toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary, #111827);
    font: inherit;
}
.m-email-toggle:active { background: #f9fafb; }
.m-email-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.m-email-line {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 8px;
    font-size: 14px;
    line-height: 1.35;
    min-width: 0;
}
.m-email-label {
    color: var(--text-muted, #6b7280);
    font-weight: 500;
}
.m-email-value {
    color: var(--text-primary, #111827);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.m-email-subject { font-weight: 600; }
.m-email-preview {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary, #4b5563);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.m-email-chevron {
    align-self: center;
    color: var(--text-muted, #6b7280);
    font-size: 12px;
    padding: 0 4px;
}
.m-email-body {
    padding: 10px 12px 12px;
    border-top: 1px dashed var(--border-color, #e5e7eb);
    background: #f9fafb;
}
.m-email-body-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary, #111827);
    line-height: 1.5;
    max-height: 40vh;
    overflow-y: auto;
}
.m-email-body-empty {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted, #6b7280);
    font-style: italic;
}

/* --- Buttons ------------------------------------------------------------ */
/* Look 5829a87 item 7: heights from tokens (48 / 52 / 44 px), the text centred by the box, not by padding around the
   font's line height. */
.m-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--spacing-1) 16px;
    line-height: var(--line-height-tight);
    margin-top: 12px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    min-height: var(--m-btn-height);
}

.m-btn-lg {
    padding-inline: 16px;
    font-size: 16px;
    min-height: var(--m-btn-lg-height);
}

.m-btn-secondary {
    background: #ffffff;
    color: #2563eb;
    border-color: #2563eb;
}

/* White on #059669 was 3.77:1 (review M-1): the AA success step, pressed one darker. */
.m-btn-approve {
    background: var(--color-success-text);
    color: var(--text-inverse);
    border-color: var(--color-success-text);
}
.m-btn-approve:active:not(:disabled) { background: var(--color-success-hover); }

.m-btn-reject {
    background: #ffffff;
    color: #dc2626;
    border-color: #dc2626;
}
.m-btn-reject:active:not(:disabled) { background: #fef2f2; }

.m-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
    min-height: var(--m-btn-ghost-height);
}

.m-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* A mobile button with an icon: icon and text centred on one line. */
.m-btn.m-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
}

/* --- Action panel ------------------------------------------------------- */
.m-action-panel {
    margin-top: 24px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.m-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.m-required { color: #dc2626; }

.m-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 72px;
    box-sizing: border-box;
}

.m-textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: -1px;
    border-color: #2563eb;
}

/* Approval-chain picker — vertical list of tappable options instead
   of a native <select>. Blazor Server + mobile <select> has a known
   DOM-state quirk where the picker doesn't repaint after selection;
   buttons sidestep that entirely and make the choice visible inline. */
.m-chain-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.m-chain-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary);
    font: inherit;
    min-height: 56px; /* generous touch target */
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.m-chain-option:active {
    background: #f9fafb;
}
.m-chain-option.selected {
    border-color: #2563eb;
    background: #eff6ff;
}
.m-chain-option-mark {
    font-size: 18px;
    line-height: 1;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 1px;
}
.m-chain-option.selected .m-chain-option-mark {
    color: #2563eb;
}
.m-chain-option-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
/* Look 4d6af57 item 6: the whole chain name, wrapped — "Management-Freigabe (>= CHF 1000)" ended in "…" at 375 px, and
   the name is what the person chooses by. The radio cards stay (bigger targets than a native select, the choice
   visible inline); the desktop dialog's select shows the full name in its list. */
.m-chain-option-name {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.m-chain-option-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.m-reject-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.m-error {
    margin-top: 12px;
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
}

/* Mobile inline PDF — renders the shared PdfViewer in a constrained
   viewport. The versions rail and annotation toolbar aren't useful on
   a phone, so we hide them and let the canvas host fill the card. */
.m-pdf-section {
    margin: 16px 0;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.m-pdf-title {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #111827);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-surface, #f9fafb);
}
.m-pdf-status {
    padding: 24px 16px;
    text-align: center;
    color: var(--color-text-muted, #6b7280);
    font-size: 14px;
}
.m-pdf-status-error {
    color: #991b1b;
    background: #fef2f2;
}
.m-pdf-host {
    /* Fixed-ish height so the PDF doesn't push the Approve/Reject
       buttons below the fold. 60vh leaves room for the action panel on
       most phones; users can scroll the PDF internally (PDF.js handles it). */
    height: 60vh;
    min-height: 360px;
    overflow: hidden;
    position: relative;
}
/* Override the default grid layout: with the versions rail hidden,
   CSS grid auto-placement puts .pd-pdfviewer-main in the auto-sized
   row 1 (not the 1fr row 2), collapsing the canvas host. Use flex
   column instead — toolbar + canvas naturally stack and the canvas
   gets flex: 1 of the 60vh container. */
.m-pdf-host .pd-pdfviewer {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.m-pdf-host .pd-pdfviewer-versions {
    display: none;
}
.m-pdf-host .pd-pdfviewer-main {
    flex: 1;
    min-height: 0;
    width: 100%;
}
.m-pdf-host .pd-pdfviewer-canvas-host {
    flex: 1;
    min-height: 0;
}

/* --- Empty / info states ------------------------------------------------ */
.m-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

.m-empty-ok .m-empty-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 999px;
    background: #d1fae5;
    color: #065f46;
    font-size: 32px;
    margin-bottom: 16px;
}

.m-empty-head {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.m-empty-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

.m-note {
    margin-top: 24px;
    padding: 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1e40af;
    font-size: 14px;
}
.m-note p { margin: 0; }

/* ==========================================================================
   Error fallback card (.err-*)
   ==========================================================================
   Rendered by <ErrorBoundary>'s ErrorContent whenever a component throws in
   render / lifecycle. Replaces the blank white screen Blazor shows by
   default. Scoped prefix prevents collisions.
   ========================================================================== */

.err-shell {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px;
    min-height: 320px;
}

.err-card {
    max-width: 560px;
    width: 100%;
    background: #ffffff;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.err-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    margin-bottom: 16px;
}

.err-title {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.err-message {
    font-size: 15px;
    color: #4b5563;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.err-corrid {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 12px;
    margin: 0 0 20px 0;
    font-size: 12px;
}

.err-corrid-label {
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.err-corrid-value {
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    user-select: all;
}

.err-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.err-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    min-height: 40px;
}

.err-btn-primary {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.err-btn-primary:hover { background: #1d4ed8; }

.err-btn-secondary {
    background: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.err-btn-secondary:hover { background: #f9fafb; }

.err-link {
    background: transparent;
    border: 0;
    color: #2563eb;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    padding: 8px;
}

.err-details {
    text-align: left;
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
}

.err-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    user-select: none;
}

.err-details-list {
    margin: 12px 0 0 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
}

.err-details-list dt {
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
}

.err-details-list dd {
    margin: 0;
    color: #111827;
    min-width: 0;
    word-break: break-word;
}

.err-pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-variant-numeric: tabular-nums;   /* one font (Chris 2026-12-03) */
    line-height: var(--line-height-normal);
    font-size: var(--font-size-xs);
    max-height: var(--err-pre-max-height);
    overflow: auto;
    background: var(--bg-card);
    border: var(--card-border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-2);
    margin: var(--spacing-1) 0 0 0;
    grid-column: 1 / -1;
}

/* ==========================================================================
   Workflow Map (.wm-*) — FEAT-025
   ==========================================================================
   /workflow-map page: header summary, legend, per-mailbox lane cards
   wrapping <MermaidDiagram>. Tokens in :root above (--wm-*).
   ========================================================================== */

.wm-summary {
    color: #64748b;
    font-size: 0.95rem;
    margin: 4px 0 0;
}

.wm-legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--wm-radius);
    padding: 12px 16px;
    margin: 6px 0 24px;
    font-size: 0.82rem;
    color: #64748b;
}

.wm-k {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wm-swatch {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    border: 1.5px solid;
    display: inline-block;
}

.wm-sw-config {
    background: var(--wm-accent-soft);
    border-color: var(--wm-accent-border);
}

.wm-sw-backbone {
    background: var(--wm-backbone-bg);
    border-color: var(--wm-backbone-br);
}

.wm-sw-gap {
    background: var(--wm-gap-bg);
    border-color: var(--wm-gap-br);
}

.wm-sw-term {
    background: var(--wm-term-bg);
    border-color: var(--wm-term-br);
}

.wm-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--wm-radius);
    padding: 18px 20px 8px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.wm-card h2 {
    font-size: 1.02rem;
    margin: 0 0 2px;
}

.wm-card .wm-meta {
    color: #64748b;
    font-size: 0.82rem;
    margin: 0 0 8px;
}

.wm-card.wm-inactive {
    opacity: 0.6;
}

.wm-card.wm-has-gap {
    border-left: 4px solid var(--wm-gap-br);
}

.wm-diagram {
    overflow-x: auto;
}

/* Fill the card at the diagram's natural size (readable); the container's
   overflow-x scrolls anything wider. The real "tiny diagram" bug was Mermaid's
   layout being poisoned by app.css during measurement — fixed by rendering in an
   isolated iframe (see wwwroot/js/mermaid-interop.js), not by capping the svg. */
.wm-diagram svg {
    display: block;
    width: 100%;
    height: auto;
}

.wm-error {
    background: var(--wm-gap-bg);
    border: 1px solid var(--wm-gap-br);
    border-radius: var(--wm-radius);
    padding: 16px;
    color: #991b1b;
}

/* ==========================================================================
   Event detail modal
   ========================================================================== */
.event-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-3);
}

.event-detail-summary {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-4);
}

.event-detail-rows {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--spacing-1) var(--spacing-3);
    font-size: var(--font-size-sm);
}

.event-detail-rows dt {
    color: var(--text-muted);
    font-weight: var(--font-weight-semibold);
}

.event-detail-rows dd {
    margin: 0;
    color: var(--text-primary);
    word-break: break-word;
}

.event-detail-rows dd.event-detail--error {
    color: var(--color-error-text);
}

/* ==========================================================================
   Email groups (FEAT-031)
   Shared by inbox, archive, process detail and the mobile pages. The page
   lanes add no CSS of their own — everything for grouped emails lives here.
   Row-level classes of the grid (.data-grid-group-*) are in the Data Grid block.
   ========================================================================== */

/* --- Group header: content of the subject cell of a group header row
       (subject, "n documents" badge, skipped-image notes). --- */
.email-group-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    min-width: 0;
}

.email-group-header__title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    min-width: 0;
}

.email-group-header__subject {
    font-weight: var(--font-weight-semibold);
    overflow-wrap: anywhere;
}

.email-group-header__badge {
    flex-shrink: 0;
    white-space: nowrap;
}

/* State of a collapsed group in the state column: view badge + one badge per state. */
.email-group-state {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-1);
}

/* "image001.png not imported (inline image)" — group header, mobile group card, detail email card. */
.email-group-note {
    display: block;
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--text-muted);
}

/* Child row of a group (inbox, archive): file icon + file name in the subject cell. */
.email-group-file {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
}

.email-group-file > svg {
    flex-shrink: 0;
}

.email-group-file__name {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* --- Hint row: "n more from this email in Approval →" --- */
.email-group-hints {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-4);
}

.email-group-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.email-group-hint--link {
    padding: var(--spacing-0);
    background: transparent;
    border: none;
    font-family: inherit;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
}

.email-group-hint--link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* --- Sibling strip, desktop: chips in the email card of the process detail.
       The chips reuse .pd-attachment-chip (+ .active for the current one). --- */
.email-sibling-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-4) var(--spacing-3);
}

.email-sibling-strip__label {
    margin-right: var(--spacing-1);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
}

.email-sibling-strip__more {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.email-sibling-chip {
    max-width: none;
    text-decoration: none;
}

.email-sibling-chip--current {
    cursor: default;
}

.email-sibling-chip__number {
    font-weight: var(--font-weight-semibold);
}

.email-sibling-chip__file {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Sibling strip, mobile: a card with one full-width row per document. --- */
.email-sibling-strip--mobile {
    display: block;
    margin-bottom: var(--spacing-3);
    padding: var(--spacing-0);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.email-sibling-list__title {
    margin: var(--spacing-0);
    padding: var(--spacing-3);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--border-color);
}

.email-sibling-list {
    list-style: none;
    margin: var(--spacing-0);
    padding: var(--spacing-0);
}

.email-sibling-list__item {
    border-bottom: 1px solid var(--color-gray-100);
}

.email-sibling-list__item:last-child {
    border-bottom: none;
}

.email-sibling-list__item--current {
    background: var(--color-primary-light);
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-primary);
}

.email-sibling-list__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--spacing-2);
    min-height: var(--spacing-12);
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--font-size-sm);
    color: inherit;
    text-decoration: none;
}

.email-sibling-list__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.email-sibling-list__number {
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
}

.email-sibling-list__item--current .email-sibling-list__number {
    color: var(--color-primary-dark);
}

.email-sibling-list__file {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-gray-600);
}

.email-sibling-strip--mobile .email-sibling-strip__more {
    margin: var(--spacing-0);
    padding: var(--spacing-2) var(--spacing-3);
}

/* --- Mobile inbox: group card. Modifier on .m-card (border, radius, shadow come
       from there): a head with subject and "n documents", then one row per document. --- */
.m-group-card {
    padding: var(--spacing-0);
    overflow: hidden;
}

/* The group card is not one press target: .m-card:active would tint the whole card
   while a single document row is pressed. Only the pressed row shows the tint. */
.m-group-card:active {
    background: var(--bg-card);
}

.m-group-card__head {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    padding: var(--spacing-3) var(--spacing-4);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--border-color);
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-accent);
}

.m-group-card__doc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--spacing-2);
    min-height: var(--spacing-12);
    padding: var(--spacing-2) var(--spacing-4);
    border-bottom: 1px solid var(--color-gray-100);
    color: inherit;
    text-decoration: none;
}

.m-group-card__doc:last-child {
    border-bottom: none;
}

.m-group-card__doc:active {
    background: var(--color-gray-100);
}

/* "n more ..." hints at the end of the card: plain text, not a document row
   (no row height, no columns, no press tint). */
.m-group-card__hints {
    padding: var(--spacing-2) var(--spacing-4);
}

/* ==========================================================================
   FEAT-034: mail blocks (inbox, archive, mobile inbox) and the list end
   (load-on-scroll). One block (card) per email: header with subject, document
   count, sender → recipient and received; one line per document below.
   Approved look: docs/mockups/2026-12-02-inbox-mail-grouping-A-*-v1 (variant A).
   ========================================================================== */

/* Layout tokens (--mail-doc-*, --mail-block-*, --row-menu-*) live in the :root token block. */

.mail-blocks {
    container: mail-blocks / inline-size;   /* the archive grid follows the list width (LOOK-F68-H1, see .mail-doc--archive) */
    display: flex;
    flex-direction: column;
}

.mail-blocks__list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.mail-blocks-loading {
    display: flex;
    justify-content: center;
    padding: var(--spacing-8) var(--spacing-4);
}

.mail-block {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* The bar that ties a mail together (FEAT-031 group bar); the caller's own work in primary. */
.mail-block::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--group-bar-width);
    background: var(--color-accent);
    z-index: 1;
}

.mail-block--mine::before {
    background: var(--color-primary);
}

.mail-block__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2) var(--spacing-4);
    padding: var(--spacing-3) var(--spacing-4);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-100);
}

.mail-block__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--spacing-8);
    height: var(--spacing-8);
    flex-shrink: 0;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.mail-block__main {
    flex: 1 1 var(--mail-block-main-basis);
    min-width: 0;
}

.mail-block__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-2);
}

.mail-block__subject {
    font-weight: var(--font-weight-semibold);
    overflow-wrap: anywhere;
}

.mail-block__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--spacing-3);
    margin-top: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.mail-block__side {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-3);
    margin-left: auto;
}

.mail-block__owner {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.mail-block__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-5);
    padding: var(--spacing-2) var(--spacing-4) var(--spacing-2) var(--mail-doc-indent);
    border-top: 1px solid var(--color-gray-100);
}

/* "1 more document of this email is in Approval (P-000024) – show →": said in place. */
.mail-block__other {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-2);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.mail-block__other > svg {
    color: var(--color-info-dark);
}

.mail-block__link {
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    white-space: nowrap;
    text-decoration: none;
}

.mail-block__link:hover {
    text-decoration: underline;
}

/* Inline images that were not imported: one quiet line, the names in the tooltip. */
.mail-block__images {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    cursor: help;
}

/* --- Document line (and the column labels above the blocks) --- */
.mail-doc {
    display: grid;
    grid-template-columns:
        var(--process-number-width) minmax(0, 1fr) var(--mail-doc-col-vendor)
        var(--mail-doc-col-amount) var(--mail-doc-col-date) var(--mail-doc-col-actions);
    gap: var(--spacing-4);
    align-items: center;
    padding: var(--spacing-2) var(--spacing-4) var(--spacing-2) var(--mail-doc-indent);
    font-size: var(--font-size-sm);
}

.mail-doc--archive {
    grid-template-columns:
        var(--process-number-width) minmax(0, 1fr) var(--mail-doc-col-vendor-archive)
        var(--mail-doc-col-amount) var(--mail-doc-col-status) var(--mail-doc-col-owner)
        var(--mail-doc-col-resolved);
}

/* Look f68ad07 round 3 (LOOK-F68-H1): the archive grid follows the width of the LIST (.mail-blocks is the size container,
   labels and lines alike), not of the screen — with the expanded navigation at 1163 px the card is 910 px and the fixed
   columns (750 px + gaps + padding) left 22.7 px for the file name. */
/* Step 1, below 1082 px (the width at which the file column would drop under 12rem = 180 px): owner and "Erledigt" share
   one column, one above the other, and the vendor column is narrower; every line is two text lines high, all alike. */
@container mail-blocks (max-width: 1082px) {
    .mail-doc--archive {
        grid-template-columns:
            var(--process-number-width) minmax(0, 1fr) var(--mail-doc-col-vendor-compact)
            var(--mail-doc-col-amount) var(--mail-doc-col-status) var(--mail-doc-col-owner);
        row-gap: 0;
    }

    .mail-doc--archive > :nth-child(-n + 5) {
        grid-row: 1 / span 2;
    }

    .mail-doc--archive > :nth-child(6) {
        grid-column: 6;
        grid-row: 1;
    }

    .mail-doc--archive > :nth-child(7) {
        grid-column: 6;
        grid-row: 2;
    }
}

.mail-block .mail-doc {
    cursor: pointer;
}

.mail-block .mail-doc + .mail-doc {
    border-top: 1px solid var(--color-gray-100);
}

.mail-block .mail-doc:hover {
    background: var(--color-gray-50);
}

/* Column labels: same grid and padding as a line; the 1px offset is the card border below. */
.mail-doc--labels {
    padding-top: 0;
    padding-bottom: var(--spacing-2);
    margin-left: 1px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--mail-doc-label-tracking);
}

.mail-doc__number {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
}

.mail-doc__file {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-3);
    min-width: 0;
}

.mail-doc__file-name {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    overflow-wrap: anywhere;
}

.mail-doc__file-name > svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

/* A mail whose documents differ in state: each line carries its own badge and owner. */
.mail-doc__state {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
}

/* FEAT-040 §9.1: the duplicate marker of a line (badge colours from badge-warning/-neutral);
   spacing comes from the gap of .mail-doc__state / .mail-doc__status. */
.mail-doc__dup {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* The lock of a blocked duplicate sits on the text line of the badge. */
.mail-doc__dup-icon {
    display: inline-flex;
    flex-shrink: 0;
}

/* Archive: "Duplikat von P-000123" as quiet text next to "Verworfen". */
.mail-doc__dup--text {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* Archive status cell: the status badge and, when dismissed as duplicate, the marker next to it;
   wraps below when narrow. */
.mail-doc__status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1);
    min-width: 0;
}

.mail-doc__amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mail-doc__due,
.mail-doc__resolved {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mail-doc__actions {
    display: flex;
    justify-content: flex-end;
}

/* Look f68ad07 round 4 (LOOK-F68-H2): the ONE line layout of the mail blocks, for every list (inbox and archive) and every
   screen — a step of the list container, not a phone media query: below 850 px of list width a grid would leave the file
   name under 8rem (inbox: 670 px of fixed columns, gaps and padding — 0 px at 700 px, 53 px at 768 px; archive: see
   step 1 above). The file name takes its own line, the facts follow, no column labels. These rules were in the phone
   block (max-width: 640px) and moved here; a phone list is always below 850 px. After the base line rules on purpose. */
@container mail-blocks (max-width: 850px) {
    /* Every line, the archive's included (.mail-doc--archive is always a .mail-doc). */
    .mail-doc {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--spacing-1) var(--spacing-3);
        padding-left: var(--spacing-5);
    }

    /* After the line layout above (same specificity): the column labels make no sense in it. */
    .mail-doc--labels {
        display: none;
    }

    .mail-doc__file {
        flex: 1 1 var(--flex-full-row);
        order: -1;
    }

    .mail-doc__vendor,
    .mail-doc__due,
    .mail-doc__owner,
    .mail-doc__resolved {
        font-size: var(--font-size-xs);
        color: var(--text-muted);
    }

    .mail-doc__amount {
        margin-left: auto;
    }

    .mail-doc__empty {
        display: none;
    }

    .mail-block__foot {
        padding-left: var(--spacing-5);
    }

    /* A line with a ⋯ menu keeps the trigger on the first line, right of the file name (it wrapped onto a third
       line at the left and the menu opened past the left screen edge). */
    .mail-doc:has(.row-menu) .mail-doc__actions {
        order: -1;
    }

    .mail-doc:has(.row-menu) .mail-doc__file {
        flex: 1 1 calc(var(--flex-full-row) - var(--mail-doc-col-actions) - var(--spacing-3));
    }
}
/* --- Row menu (⋯): native <details>, the per-document actions of a line --- */
.row-menu {
    position: relative;
}

/* Click outside the open menu: an invisible layer under the panel closes it. */
.row-menu__backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-fixed);          /* above sticky headers, below dialogs */
}

.row-menu__panel {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: calc(var(--z-fixed) + 1);
    min-width: var(--row-menu-min-width);
    margin-top: var(--spacing-1);
    padding: var(--spacing-1);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    /* FEAT-038: several items (claim + merge) stack with a small gap. */
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
}

.row-menu__item {
    display: block;
    width: 100%;
    padding: var(--spacing-2) var(--spacing-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-align: left;
    white-space: nowrap; /* FEAT-038: "Dieses Dokument übernehmen" wrapped in the panel once a second item came */
    cursor: pointer;
}

.row-menu__item:hover:not(:disabled) {
    background: var(--color-gray-50);
}

/* The menu of a document must not be clipped by its card. While it is open the card stops
   clipping, so the parts that relied on the clip take the card's corners themselves. */
.mail-block--menu-open {
    overflow: visible;
}

.mail-block--menu-open > .mail-block__head {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.mail-block--menu-open::before {
    border-top-left-radius: inherit;
    border-bottom-left-radius: inherit;
}

.mail-block--menu-open > .mail-doc:last-child,
.mail-block--menu-open > .mail-block__foot {
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

/* --- List end: load more on scroll (replaces the pager) --- */
.list-end__row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-4);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.data-grid .list-end__row {
    background: var(--color-gray-50);
    border-top: 1px solid var(--border-color);
}

/* --- Phone (--bp-sm): a document line becomes the file name with the facts below it --- */
@media (max-width: 640px) {   /* --bp-sm */
    .mail-block__avatar,
    .mail-block__recipient {
        display: none;
    }

    .mail-block__side {
        flex: 1 1 100%;
    }

    /* Look 9f072ea item 3: the export toggle and button wrap inside the toolbar instead of running
       past the screen edge (the page scrolled sideways). */
    .archive-toolbar-export {
        flex: 1 1 100%;
        flex-wrap: wrap;
        min-width: 0;
        margin-left: 0;
    }

    /* Look 11a47e8: one line at the toolbar height with the short label (the long one wrapped "(CSV)" and
       made the button 41.4 px next to 36.7 px filters). */
    .archive-toolbar-export .btn {
        white-space: nowrap;
        height: var(--list-toolbar-control-height);
        max-width: 100%;
    }

    .archive-export-label--long {
        display: none;
    }

    .archive-export-label--short {
        display: inline;
    }

    /* Look aeeee19: on a phone the search takes its full line, not the desktop cap (as .inbox-search). */
    .archive-toolbar-search {
        min-width: 0;
        max-width: none;
        flex: 1 1 100%;
    }

    /* Look c4f9281: on a phone the filters take the full width like the search field. */
    .archive-toolbar .status-filter-dropdown,
    .archive-toolbar .date-range-dropdown {
        flex: 1 1 100%;
        min-width: 0;
    }

    .archive-toolbar .status-filter-dropdown-trigger,
    .archive-toolbar .date-range-dropdown-trigger {
        width: 100%;
    }

    .archive-export-toggle {
        white-space: normal;
    }

}

/* FEAT-038 merge documents: begin */
/* ==========================================================================
   FEAT-038 merge documents (marker lines above and at the end of the section; MergeCssTests finds them).
   Spec docs/features/FEAT-038-Merge-Documents.md §9; binding mockups
   docs/mockups/2026-12-04-merge-documents-v2-a1/a2/a3 (Variant A) and v1-3/v1-4 (detail,
   archive) without the swap button. The mockups' "PROPOSAL for app.css" rules are taken over
   here; their mg-* classes became merge-dialog__*. Tokens only, the one font of the app, no
   cascade layer (app.css is unlayered: a layered rule would lose against every unlayered one).
   Lane F (detail page, desktop and mobile) uses the pd-supporting / merged-banner / m-supporting
   classes below. Touch targets: the coarse-pointer block at the end of this section.
   ========================================================================== */

/* --- Inbox (v2-a1): header action, row menu with several items, line chips --- */

/* "Zusammenführen …" left of "Übernehmen"/"Öffnen": one line, never squeezed. */
.mail-block__merge {
    white-space: nowrap;
}

/* Look f68ad07 F1: the header actions are one group at the right of the header; when the line is full the group wraps as
   a whole (it is never split: "Öffnen" wrapped alone to the left edge at 375 px). */
.mail-block__actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--spacing-3);
    margin-left: auto;
}

/* "1 Beilage" on the line of a merge target, after the file name (wraps below it when narrow). */
.mail-doc__supporting {
    flex-shrink: 0;
    white-space: nowrap;
}

/* F6 (Chris 2026-12-04, "Kurzer Status + Link"): "→ P-000007" after the file name of a merged source, the chip of
   "1 Beilage" (.mail-doc__supporting) as a link to the target; the status badge says only "Zusammengeführt". No height
   of its own: the row keeps its height. Keyboard focus: the global :focus-visible outline. On touch an invisible 44 px
   area takes the tap (touch block below). */
.mail-doc__merged-into {
    position: relative;
    /* The chip looks like "1 Beilage" but takes only the room of a text line of the row (negative block margin = half the
       difference between the chip and the line), so a merged source's row is as high as every other row. */
    margin-block: calc((var(--font-size-sm) - var(--font-size-xs)) * var(--line-height-normal) / 2 - var(--spacing-1));
    white-space: nowrap;
    color: var(--text-link);
    text-decoration: none;
}

/* The file name gives way to the link on the same line (ellipsis, full name in the tooltip): the link never wraps below
   it. */
.mail-doc__file:has(.mail-doc__merged-into) {
    flex-wrap: nowrap;
}

.mail-doc__file:has(.mail-doc__merged-into) .mail-doc__file-name > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Look 861a82b item 2: no "full name while the keyboard is in the row" here any more — the focus on "→ P-…" grew the row
   (+15/+20 px) and broke the name mid-word. A line keeps its layout under focus (LookFix861a82bTests guards it); the full
   name stays in the DOM (screen readers) and in the tooltip, and the process (Enter on its number) shows it. */

.mail-doc__merged-into:hover {
    text-decoration: underline;
}

/* B2: "keine Rechnungsdaten erkannt" in the vendor cell, quieter than a vendor name. */
.mail-doc__hint {
    font-size: var(--font-size-xs);
    overflow-wrap: anywhere;
}

/* --- Merge dialog (v2-a2, v2-a3) --- */
.merge-dialog {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.merge-dialog__intro {
    margin: 0 0 var(--spacing-4);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: var(--line-height-normal);
}

.merge-dialog__step {
    margin: 0 0 var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.merge-dialog__docs {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    min-width: 0;
    margin: 0 0 var(--spacing-5);
    padding: 0;
    border: none;
}

/* One document. Look 861a82b item 1: the name line (number, file name, role tag at its right end) spans the whole card;
   facts left and the choices right share the second line (all three stack on a phone). Before, the role tag and the two
   choices shared the name's line and left the file name 101–146 px of a 662 px card at 1440 px. */
.merge-dialog__doc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--spacing-2) var(--spacing-4);
    padding: var(--spacing-3) var(--spacing-4);
    background: var(--bg-card);
    border: var(--card-border);
    border-radius: var(--radius-lg);
}

/* Hauptdokument: border + accent bar on a white card (a blue fill would swallow the badge). */
.merge-dialog__doc--main {
    border-color: var(--color-primary);
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-primary);
}

/* Left out of the merge: stays a process of its own. */
.merge-dialog__doc--excluded {
    background: var(--color-gray-50);
}

/* Cannot be merged by the caller: greyed, with its reason in words. */
.merge-dialog__doc--disabled {
    background: var(--color-gray-50);
    color: var(--text-muted);
}

.merge-dialog__doc--excluded .merge-dialog__name,
.merge-dialog__doc--excluded .merge-dialog__facts,
.merge-dialog__doc--disabled .merge-dialog__name,
.merge-dialog__doc--disabled .merge-dialog__facts {
    color: var(--text-muted);
}

/* Look 861a82b item 1: a wrapper only — its name line and facts are items of the card's grid. */
.merge-dialog__doc-main {
    display: contents;
}

/* Look f68ad07 F3: one line on the desktop (the file name ends in an ellipsis, full name in the tooltip), so a card has
   one height and the loading skeleton takes exactly its room; on a phone it wraps again (the dialog has a fixed height
   there). */
.merge-dialog__name {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-2);
    min-width: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.merge-dialog__file {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    overflow: hidden;
}

.merge-dialog__file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Round 3, Minor 4: while the keyboard is on a document (its "Einbeziehen" or "Hauptdokument"), its name shows in full. */
.merge-dialog__doc:has(:focus-visible) .merge-dialog__name {
    flex-wrap: wrap;
}

.merge-dialog__doc:has(:focus-visible) .merge-dialog__file-name {
    white-space: normal;
    overflow-wrap: anywhere;
}

.merge-dialog__file > svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

/* Look f68ad07 F3: two lines in every card (and in the skeleton), so a card keeps its height when its facts need the
   second line. */
.merge-dialog__facts {
    min-height: calc(2 * var(--font-size-xs) * var(--line-height-normal));
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

/* Role tag of a document ("Hauptdokument" / "wird Beilage" / "bleibt eigener Vorgang"): one line, never squeezed, at the
   right end of the name line (look 861a82b item 1). */
.merge-dialog__role {
    flex-shrink: 0;
    margin-left: auto;
    white-space: nowrap;
}

/* Look f68ad07 F3 (review round): while the candidates load, the dialog shows the layout it will have (MergeDocumentsDialog
   LoadingBody: the real elements with placeholder texts) as grey bars; icons and inputs are hidden. */
.merge-dialog__skeleton {
    color: transparent;
    background: var(--color-gray-100);
    border-color: transparent;
    border-radius: var(--radius-sm);
}

.merge-dialog__skeleton svg,
.merge-dialog__skeleton input {
    visibility: hidden;
}

/* Look f68ad07 F3: the dialog sizes to its content, capped by the token and the screen; the body scrolls. */
.modal:has(.merge-dialog) {
    max-height: min(var(--merge-dialog-max-height), calc(100vh - 2 * var(--modal-offset-top-sm)));
    max-height: min(var(--merge-dialog-max-height), calc(100dvh - 2 * var(--modal-offset-top-sm)));
}

/* Look f68ad07 F4: fewer than two documents ticked - the hint takes the place of the intro, a little stronger. */
.merge-dialog__intro--hint {
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
}

/* Look f68ad07 (d): a fact line breaks between facts, never inside one; only a vendor name may break anywhere. */
.merge-dialog__fact {
    white-space: nowrap;
}

.merge-dialog__fact--wrap {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* "Von M. Giger übernommen", "Nicht in der Vorprüfung": where the role tag stands on a mergeable document. */
.merge-dialog__reason {
    flex-shrink: 0;
    margin-left: auto;
    white-space: nowrap;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

.merge-dialog__choices {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

/* A labelled checkbox or radio: the whole label is the hit area, at the control height (touch: 44 px). */
.merge-dialog__choice {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    min-height: var(--control-height);
    padding: 0 var(--spacing-3);
    border: var(--card-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--text-primary);
    white-space: nowrap;
    cursor: pointer;
}

.merge-dialog__choice:has(input:checked) {
    border-color: var(--color-primary);
}

.merge-dialog__choice:has(input:disabled) {
    color: var(--text-muted);
    background: var(--color-gray-50);
    cursor: not-allowed;
}

.merge-dialog__choice input {
    flex-shrink: 0;
}

/* Fixed target, two targets, manual invoice data, undo: the app's small alerts, icon on the first text line. */
.merge-dialog__note,
.merge-dialog__warning,
.merge-dialog__undo {
    align-items: flex-start;
    gap: var(--spacing-2);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

.merge-dialog__note > svg,
.merge-dialog__warning > svg,
.merge-dialog__undo > svg {
    flex-shrink: 0;
    margin-top: var(--spacing-1);
}

/* Preview of the result: the process as it will look after the merge. */
.merge-dialog__result {
    margin: 0 0 var(--spacing-4);
    border: var(--card-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.merge-dialog__result-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-4);
    background: var(--color-gray-50);
    border-bottom: var(--card-border);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-accent);
}

.merge-dialog__result-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.merge-dialog__result-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-4) var(--spacing-2) var(--mail-doc-indent);
    border-bottom: var(--merge-row-separator);
    font-size: var(--font-size-sm);
}

.merge-dialog__result-item:last-child {
    border-bottom: none;
}

.merge-dialog__result-item > svg {
    color: var(--text-muted);
}

/* One line on the desktop like the cards (look f68ad07 F3); full name in the tooltip. */
.merge-dialog__result-file {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.merge-dialog__result-after {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    padding: var(--spacing-2) var(--spacing-4);
    border-top: var(--card-border);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    background: var(--bg-card);
}

/* The footer buttons take the one control height (36.7 px with a mouse = their natural height; 44 px on touch). */
.modal:has(.merge-dialog) .modal-footer .btn {
    box-sizing: border-box;
    height: var(--control-height);
    padding-block: 0;
}

/* --- Detail page, target (v1-3 without swap; final markup of lane F, SupportingDocumentsSection.razor) --- */

/* The Beilagen section is a .pd-section of the side panel; it only keeps long names inside the panel. */
.pd-supporting {
    min-width: 0;
}

.pd-supporting__list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* One Beilage: the name (opens it in the viewer), the origin line, and the section's action in the same column. */
.pd-supporting__entry {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-1);
    min-width: 0;
    padding: var(--spacing-2) 0;
    border-bottom: var(--merge-row-separator);
}

.pd-supporting__entry:last-child {
    border-bottom: none;
}

/* FEAT-038b: the combined-document hint after the Beilagen list. Measured flush (0 px box gap, 7.5 px of the last
   entry's padding) at 320 and 1163 px; one spacing step makes it read as a note of its own, not as another entry. */
.pd-supporting__list + .pd-outputs-merged {
    margin-top: var(--spacing-2);
}

/* The name is a plain <button> that reads like a link (reset of the browser button). */
.pd-supporting__item {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    max-width: var(--flex-full-row);
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-link);
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.pd-supporting__item:hover {
    text-decoration: underline;
}

.pd-supporting__item > svg {
    flex-shrink: 0;
    color: var(--color-accent);
}

/* The Beilage shown in the viewer (like the active attachment chip). */
.pd-supporting__item--active {
    color: var(--color-primary-dark);
    font-weight: var(--font-weight-semibold);
}

/* "aus P-000032 · PDF, 296 KB · geht mit in Freigabe und Archiv" */
.pd-supporting__meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.pd-supporting__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
}

/* "Zusammenführung aufheben": one line, at the control height (touch: 44 px, below). */
.pd-supporting__undo {
    min-height: var(--control-height);
    white-space: nowrap;
}

/* "Am 04.12.2026 zusammengeführt aus P-000032": a line under the e-mail sub-line, in its rhythm. */
.pd-email-merged {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    padding: 0 var(--pd-bar-pad-x) var(--pd-bar-pad-y);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.pd-email-merged > svg {
    flex-shrink: 0;
}

/* Role badge on an attachment chip: "Beilage" in the accent family ("Hauptdokument" keeps the neutral badge). */
.pd-attachment-chip-badge--supporting {
    background: var(--color-accent-light);
    color: var(--color-accent-hover);
}

/* --- Detail page, merged source (v1-4, MergedSourceBanner.razor): used with "alert alert-info" --- */
.merged-banner {
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2) var(--spacing-3);
}

.merged-banner > svg {
    flex-shrink: 0;
}

.merged-banner__text {
    flex: 1 1 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* "Zu P-000031": the one way to the target, at the right end of the banner. */
.merged-banner .btn {
    margin-left: auto;
    white-space: nowrap;
}

/* --- Mobile detail (/m/process): Beilagen list under the viewer --- */
.m-supporting {
    margin: var(--spacing-4) 0;
}

/* Same look as the other section titles of the mobile pages. */
.m-supporting h3 {
    margin: 0 0 var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--mail-doc-label-tracking);
}

.m-supporting__list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* The button fills its list entry. */
.m-supporting__list > li {
    display: flex;
    flex-direction: column;
}

/* A document on the phone is tapped: always the touch target (also in desktop emulation without a coarse pointer). */
.m-supporting__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: var(--spacing-1);
    min-height: var(--touch-target-size);
    padding: var(--spacing-2) var(--spacing-3);
    background: var(--bg-card);
    border: var(--card-border);
    border-radius: var(--radius-lg);
    font: inherit;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.m-supporting__item:disabled {
    cursor: progress;
}

/* The document in the viewer: border + accent bar, like the Hauptdokument card of the merge dialog. */
.m-supporting__item--active {
    border-color: var(--color-primary);
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-primary);
}

.m-supporting__name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    overflow-wrap: anywhere;
}

.m-supporting__meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

/* "Hauptdokument" / "Beilage" per entry (lane F review round): quiet secondary text, like the meta line. */
.m-supporting__role {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

/* --- Phone (--bp-sm) --- */
@media (max-width: 640px) {   /* --bp-sm */
    /* The dialog keeps the app's phone pattern (full width, anchored top) and one height: the footer stays at the
       bottom of the screen. */
    .modal:has(.merge-dialog) {
        height: calc(100vh - 2 * var(--modal-offset-top-sm));
        height: calc(100dvh - 2 * var(--modal-offset-top-sm));
    }

    .merge-dialog__doc {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The dialog has a fixed height on a phone: names wrap here instead of ending in an ellipsis. */
    .merge-dialog__name {
        flex-wrap: wrap;
    }

    .merge-dialog__file-name,
    .merge-dialog__result-file {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .merge-dialog__choices {
        flex-wrap: wrap;
    }

    .merge-dialog__result-item {
        padding-left: var(--spacing-4);
    }

    /* The banner text takes the line next to its icon (icon 16 px + gap < --spacing-8); "Zu P-…" wraps below it, at the right. */
    .merged-banner__text {
        flex-basis: calc(var(--flex-full-row) - var(--spacing-8));
    }
}

/* --- Touch keeps 44 px (FEAT-035, spec §9.0 M1): every new control, measured on the tappable element --- */
@media (pointer: coarse), (any-pointer: coarse) {
    /* The ⋯ trigger and its grid column grow together. */
    :root {
        --mail-doc-col-actions: var(--touch-target-size);
    }

    .mail-block__actions > .btn,
    .mail-block__merge {
        min-height: var(--touch-target-size);
    }

    .mail-doc__actions .btn-icon.btn-sm {
        width: var(--touch-target-size);
        height: var(--touch-target-size);
    }

    .row-menu__item {
        min-height: var(--touch-target-size);
    }

    .merge-dialog__choice {
        min-height: var(--touch-target-size);
    }

    /* The dialog's close button (32 px) is tapped too. */
    .modal-close {
        width: var(--touch-target-size);
        height: var(--touch-target-size);
    }

    .pd-supporting__item {
        min-height: var(--touch-target-size);
    }

    .pd-supporting__undo {
        min-height: var(--touch-target-size);
        min-width: var(--touch-target-size);
    }

    .m-supporting__item {
        min-height: var(--touch-target-size);
    }

    .merged-banner .btn {
        min-height: var(--touch-target-size);
    }

    /* Round 3, Minor 4: a finger has no tooltip and no keyboard focus — on a touch device names are never cut: the merged
       source's file name wraps like every other file name of the list, and the merge dialog's names wrap as on a phone. */
    .merge-dialog__file-name,
    .merge-dialog__result-file {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* Look 861a82b item 2: the merged source's name breaks between words, never inside one. */
    .mail-doc__file:has(.mail-doc__merged-into) .mail-doc__file-name > span {
        white-space: normal;
        overflow-wrap: break-word;
    }

    .merge-dialog__name {
        flex-wrap: wrap;
    }

    /* F6: the link "→ P-…" keeps its chip size (the row keeps its height); a 44 px area centred on it takes the tap. */
    .mail-doc__merged-into::after {
        content: "";
        position: absolute;
        top: var(--hit-area-center);
        left: var(--hit-area-center);
        width: var(--hit-area-full);
        min-width: var(--touch-target-size);
        height: var(--touch-target-size);
        transform: translate(var(--hit-area-shift), var(--hit-area-shift));
    }
}

/* FEAT-038 merge documents: end */
/* Inbox quick view (Variant A, Chris 2026-12-05): start. Binding mockup docs/mockups/2026-12-05-quick-view-v1-a-modal.html.
   The trigger in the inbox line (file icon + name + magnifier = one button), the large dialog (the shared .modal in its own
   size, a full-screen sheet on a phone), the image view and the page number of the shared floating zoom. Tokens only;
   the sizes are the --qv-* tokens of the :root block. */

/* --- Trigger: the file name of an inbox line --- */
.qv-trigger {
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.qv-trigger__name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.qv-trigger__icon {
    transition: color var(--transition-fast);
}

.qv-trigger:hover .qv-trigger__name,
.qv-trigger:focus-visible .qv-trigger__name {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: var(--qv-underline-offset);
}

.qv-trigger:hover .qv-trigger__icon,
.qv-trigger:focus-visible .qv-trigger__icon {
    color: var(--color-primary);
}

.qv-trigger:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* --- The dialog: ~80vw × 86vh --- */
.modal.modal-quickview {
    width: var(--qv-modal-width);
    max-width: none;
    height: var(--qv-modal-height);
    max-height: var(--qv-modal-height);
    overflow: hidden; /* look c2af270 #2: a scroll container, so its overscroll-behavior (below) stops the wheel chain */
}

.modal-quickview .modal-header {
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-3) var(--spacing-4) var(--spacing-3) var(--spacing-5);
}

.qv-head__main {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    min-width: 0;
    flex: 1 1 auto;
}

.qv-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    font-size: var(--font-size-base);
    overflow-wrap: anywhere;
}

.qv-title > svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.qv-head__chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-2);
    font-size: var(--font-size-sm);
}

.qv-head__amount {
    font-variant-numeric: tabular-nums;
}

.qv-head__pos {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* The close button: a 44 px target on every device (the shared dialog's is 32 px with a mouse). */
.modal-quickview .modal-close {
    flex-shrink: 0;
    width: var(--qv-close-size);
    height: var(--qv-close-size);
    margin: calc(-1 * var(--spacing-1)) calc(-1 * var(--spacing-2)) 0 0;
}

.modal-quickview .modal-body {
    display: flex;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

/* --- The viewer area (PDF, image, loading, no preview) --- */
.qv-viewer {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    min-width: 0;
    min-height: 0;
    background: var(--color-gray-200);
}

.qv-viewer > .pd-pdfviewer {
    flex: 1 1 auto;
    min-width: 0;
    height: auto;
}

.qv-viewer__scroll {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-4);
    min-width: 0;
    padding: var(--spacing-4) var(--spacing-4) var(--spacing-16);
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
}

/* Look c2af270 #2: wheeling past the end of the PDF / image (or over the header and footer) scrolled the inbox behind
   the dialog — the wheel chained from the dialog to the page. The dialog and both scroll regions of its viewer (the image
   view, and the container pdf-viewer.js builds inside the canvas host) keep the scroll to themselves. Scoped to the quick
   view; the detail page's PdfViewer is unchanged. The app has no body scroll lock to reuse (Modal / modal-focus.js). */
.modal.modal-quickview,
.qv-viewer__scroll,
.qv-viewer .pd-pdfviewer-canvas-host > .pd-pdfviewer-scope > div {
    overscroll-behavior: contain;
}

/* Wider than the viewer: start at the left edge, so every part can be scrolled to. */
.qv-viewer__scroll--zoomed {
    align-items: flex-start;
}

/* The image at 100 % fits the viewer width (at most --qv-page-max); the zoom steps scale that width. The browser
   turns a photo by its EXIF orientation. */
.qv-page {
    display: block;
    flex-shrink: 0;
    width: calc(min(100%, var(--qv-page-max)) * var(--qv-zoom, 1));
    max-width: none;
    height: auto;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    image-orientation: from-image;
}

.qv-page[data-zoom="50"] { --qv-zoom: 0.5; }
.qv-page[data-zoom="75"] { --qv-zoom: 0.75; }
.qv-page[data-zoom="125"] { --qv-zoom: 1.25; }
.qv-page[data-zoom="150"] { --qv-zoom: 1.5; }
.qv-page[data-zoom="200"] { --qv-zoom: 2; }


/* Loading: the frame and the header are there at once, the document follows. */
.qv-loading {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-3);
    padding: var(--spacing-6);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.qv-skeleton {
    height: var(--qv-skeleton-height);
    max-width: 100%;
    aspect-ratio: 595 / 842;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--color-gray-100), var(--bg-card), var(--color-gray-100));
    background-size: 200% 100%;
    animation: qv-shimmer var(--qv-shimmer-duration) ease-in-out infinite;
    box-shadow: var(--shadow-sm);
}

@keyframes qv-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

/* The zoom while the document loads: in place, inactive. */
.qv-zoom--disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* No preview (TIFF and other files) and a failed load. */
.qv-empty {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-6);
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.qv-empty > svg {
    color: var(--text-muted);
}

.qv-empty__title {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.qv-empty__body {
    margin: 0;
    max-width: var(--qv-empty-max-width);
}

.qv-empty .btn {
    margin-top: var(--spacing-2);
}

.qv-error .qv-empty__title {
    color: var(--color-error-text);
}

/* --- Footer: step left (a navigation, not destructive), actions right, the primary rightmost --- */
.modal-quickview .modal-footer {
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-5);
}

.qv-foot__nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    margin-right: auto;
}

/* The shared icon set has no right arrow: the left one, mirrored. */
.qv-next > svg {
    transform: scaleX(-1);
}

.qv-foot__keys {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

kbd.qv-kbd {
    display: inline-block;
    min-width: var(--qv-kbd-min-width);
    padding: 0 var(--spacing-1);
    font: inherit;
    font-size: var(--font-size-xs);
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: var(--pd-float-border);
    border-radius: var(--radius-sm);
}

/* --- Phone (--bp-sm): a full-screen sheet, 44 px targets --- */
@media (max-width: 640px) {   /* --bp-sm */
    /* Only the quick view's own controls take the touch height here (a narrow mouse window keeps the rest of the app). */
    .modal-quickview {
        --control-height: var(--touch-target-size);
    }

    .modal.modal-quickview {
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        transform: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .modal.modal-quickview.show {
        transform: none;
    }

    .modal-quickview .modal-header {
        padding: var(--spacing-2) var(--spacing-2) var(--spacing-2) var(--spacing-4);
    }

    .modal-quickview .modal-close {
        margin: 0;
    }

    .qv-viewer__scroll {
        gap: var(--spacing-2);
        padding: var(--spacing-2) var(--spacing-2) var(--spacing-16);
    }

    .modal-quickview .modal-footer {
        padding: var(--spacing-2) var(--spacing-3);
        padding-bottom: calc(var(--spacing-2) + env(safe-area-inset-bottom, 0));
        border-radius: 0;
    }

    .qv-foot__keys,
    .qv-foot__label {
        display: none;
    }

    /* Herunterladen as a 44 px icon button. */
    .modal-quickview .qv-download {
        width: var(--control-height);
        padding: 0;
        justify-content: center;
    }

    .modal-quickview .pd-zoom-float {
        --pd-zoom-float-inset-x: var(--spacing-3);
        --pd-zoom-float-inset-y: var(--spacing-3);
    }

    .modal-quickview .pd-zoom-float .btn,
    .modal-quickview .pd-zoom-float .pd-pdfviewer-zoom {
        height: var(--touch-target-size);
    }

    .modal-quickview .pd-zoom-float .btn {
        min-width: var(--touch-target-size);
    }

    .qv-trigger {
        min-height: var(--touch-target-size);
    }
}

/* --- Touch with a wider screen: the same 44 px targets (FEAT-035) --- */
@media (pointer: coarse), (any-pointer: coarse) {
    .qv-trigger {
        min-height: var(--touch-target-size);
    }

    .modal-quickview .pd-zoom-float .btn {
        min-width: var(--touch-target-size);
    }
}

/* Inbox quick view: end */

/* FEAT-042: one section per lane (plan Task 1, hot file rule); each lane writes only between its own markers. */
/* FEAT-042 lane K: start */
/* Shared document pieces (plan Task 5; mockup 2026-12-05-intake-v1-assets/intake.css): type chip and type control, source
   tile, one-line file name, the action menus (title, separator, check mark, danger item) and the document dialogs. Values
   are tokens; the type colours are --ik-type-* tokens of the main :root block (lane Z: one token block). */

.ik-src {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ik-src-size);
    height: var(--ik-src-size);
    flex-shrink: 0;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.ik-src--upload { background: var(--color-success-light); color: var(--color-success-text); }
.ik-src--scan { background: var(--color-gray-100); color: var(--color-gray-700); }
.ik-src--sharepoint { background: var(--color-accent-light); color: var(--color-accent-hover); }
.ik-src--share { background: var(--color-warning-light); color: var(--color-warning-text); }
.ik-src--api { background: var(--color-gray-100); color: var(--color-gray-700); }

.ik-type {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    padding: var(--spacing-1) var(--spacing-2);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    white-space: nowrap;
    flex-shrink: 0;                       /* next to a P-number or file name the chip keeps its size */
    border-radius: var(--radius-full);
    background: var(--ik-type-other-bg);
    color: var(--ik-type-other-fg);
}

.ik-type--invoice { background: var(--ik-type-invoice-bg); color: var(--ik-type-invoice-fg); }
.ik-type--credit-note { background: var(--ik-type-credit-bg); color: var(--ik-type-credit-fg); }
.ik-type--timesheet { background: var(--ik-type-report-bg); color: var(--ik-type-report-fg); }
.ik-type--reminder { background: var(--ik-type-reminder-bg); color: var(--ik-type-reminder-fg); }
.ik-type--undetermined {
    background: var(--bg-card);
    color: var(--text-secondary);
    box-shadow: inset 0 0 0 var(--ik-hairline) var(--border-color-dark);
}

/* The type as a control: the chip, the source line under it. */
.ik-type-control {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-1);
    min-width: 0;
}

/* The type button: the chip with a chevron; one height with the small buttons of its row (44 px under a coarse pointer). */
.ik-type-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    box-sizing: border-box;
    min-height: var(--btn-sm-height);
    padding: 0 var(--spacing-1) 0 0;
    background: transparent;
    border: var(--ik-hairline) solid transparent;
    border-radius: var(--radius-full);
    font: inherit;
    color: var(--text-secondary);
    cursor: pointer;
}

.ik-type-btn:hover,
.ik-type-btn[aria-expanded="true"] {
    border-color: var(--border-color-dark);
    background: var(--bg-card);
}

.ik-type-btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.ik-type-src {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

/* A file name on one line: the stem shortens with "…", the extension stays visible (mockup fname). */
.ik-fname {
    display: inline-flex;
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow-wrap: normal;
    vertical-align: bottom;
}

.ik-fname__stem {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ik-fname__ext {
    flex-shrink: 0;
}

/* Action menus (ActionMenu.razor) on the RowMenu panel: title, separator, check mark, hint, danger item. */
.row-menu__item.ik-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.ik-menu-item__check {
    display: inline-flex;
    width: var(--ik-menu-check-size);
    flex-shrink: 0;
    color: var(--color-primary);
}

.ik-menu-item__hint {
    margin-left: auto;
    padding-left: var(--spacing-3);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.ik-menu-sep {
    height: var(--ik-hairline);
    margin: var(--spacing-1) 0;
    background: var(--border-color);
}

.ik-menu-title {
    padding: var(--spacing-1) var(--spacing-3);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--ik-label-tracking);
}

.row-menu__item.ik-menu-item--danger {
    color: var(--color-error-text);
}

.row-menu__item.ik-menu-item--danger:hover:not(:disabled) {
    background: var(--color-error-light);
}

.row-menu__panel.ik-menu--start {
    right: auto;
    left: 0;
}

/* Document dialogs: intro, note, the list of documents, the target list of «Als Beilage …», fields with the label above. */
.ik-dialog-intro {
    margin: 0 0 var(--spacing-3);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    color: var(--text-secondary);
    overflow-wrap: normal;
}

.ik-dialog-note {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-2);
    margin: var(--spacing-3) 0 0;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.ik-dialog-note > svg {
    flex-shrink: 0;
    margin-top: var(--ik-hairline);
}

.ik-doclist {
    margin: 0 0 var(--spacing-3);
    padding: var(--spacing-2) var(--spacing-3);
    list-style: none;
    border: var(--ik-hairline) solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--color-gray-50);
    font-size: var(--font-size-sm);
}

.ik-doclist li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-2);
    padding: var(--spacing-1) 0;
    overflow-wrap: anywhere;
}

.ik-doclist li .ik-fname {
    flex: 0 1 auto;
}

.ik-doclist__env {
    font-weight: var(--font-weight-medium);
}

.ik-doclist__env .ik-src {
    width: var(--spacing-6);
    height: var(--spacing-6);
}

.ik-doclist li.ik-doclist__doc {
    padding-left: calc(var(--spacing-6) + var(--spacing-2));
}

/* One fieldset per target group, its legend the group label, its list the radio items. */
.ik-pick {
    min-width: 0;
    margin: 0 0 var(--spacing-3);
    padding: 0;
    border: 0;
}

.ik-pick__list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ik-pick__group {
    margin-bottom: var(--spacing-2);
    padding: 0;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--ik-label-tracking);
}

.ik-pick__item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-2) var(--spacing-3);
    min-height: var(--control-height);
    box-sizing: border-box;
    border: var(--ik-hairline) solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.ik-pick__item--checked {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.ik-pick__item input {
    width: var(--form-check-size);
    height: var(--form-check-size);
    margin: 0;
    accent-color: var(--color-primary);
}

.ik-pick__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ik-pick__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--font-weight-medium);
}

.ik-pick__sub {
    display: flex;
    min-width: 0;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.ik-pick__amount {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ik-pick__empty {
    margin: 0 0 var(--spacing-3);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.ik-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    margin-bottom: var(--spacing-3);
}

.ik-field__empty {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.ik-field .form-label {
    margin-bottom: 0;
}

.ik-field .form-control {
    box-sizing: border-box;
    min-height: var(--control-height);
}
/* FEAT-042 lane K: end */

/* FEAT-042 lane R: start */
/* FEAT-042 lane R: end */

/* FEAT-042 lane C: start */
/* The inbox by Eingang (plan Task 7; spec §6.2–6.4, §9; mockup 2026-12-05-intake-v1-assets/intake.css, Variant A): the
   table of Eingänge, the compact list next to the reading pane, the pane with the envelope head, the document rows and
   the preview, the multi-select with its bar at the bottom, and the phone layout (list → tap → pane). Values are tokens;
   the --ik-* tokens are in the main :root block. */
@media (pointer: coarse), (any-pointer: coarse) {
    :root {
        --ik-select-size: var(--touch-target-size);
        --ik-col-check: 3.5rem;
    }
}

/* While the selection bar is shown the toast stands above it (lane 0 toast rules). */
:root:has(.ik-bulkbar) {
    --ik-bulkbar-height: var(--ik-bulkbar-reserve);
}

/* The bar never hides the last rows. */
.main-body:has(.ik-bulkbar) {
    padding-bottom: calc(var(--ik-bulkbar-reserve) + var(--spacing-5));
}

/* --- Page head, toolbar, filters --- */
.ik-toolbar {
    margin-top: var(--spacing-4);
    margin-bottom: var(--spacing-2);
}

.ik-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-4);
}

.ik-filterbar__end {
    display: flex;
    gap: var(--spacing-2);
    margin-left: auto;
}

.ik-filter {
    box-sizing: border-box;
    min-height: var(--list-toolbar-control-height);
    gap: var(--spacing-1);
    white-space: nowrap;
}

.ik-filter__value {
    font-weight: var(--font-weight-semibold);
}

.ik-filter--active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.ik-notice {
    margin-bottom: var(--spacing-3);
}

.ik-only-narrow {
    display: none;
}

.ik-label-short {
    display: none;
}

/* --- The table of Eingänge --- */
.ik-grid {
    background: var(--bg-card);
    border: var(--ik-hairline) solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.ik-grid .data-grid-body {
    border-radius: inherit;
}

.ik-table {
    table-layout: fixed;
    min-width: var(--ik-table-min-width);
}

.ik-table th,
.ik-table td {
    padding: var(--spacing-2) var(--spacing-3);
}

.ik-table th:first-child,
.ik-table td:first-child {
    padding-left: var(--spacing-4);
}

.ik-table col.ik-col-check { width: var(--ik-col-check); }
.ik-table col.ik-col-src { width: var(--ik-col-src); }
.ik-table col.ik-col-from { width: var(--ik-col-from); }
.ik-table col.ik-col-docs { width: var(--ik-col-docs); }
.ik-table col.ik-col-date { width: var(--ik-col-date); }
.ik-table col.ik-col-status { width: var(--ik-col-status); }
.ik-table col.ik-col-owner { width: var(--ik-col-owner); }

/* «Eingang» marks the fixed order (newest first) and is no sort button: no pointer and no hover. */
.ik-table th.ik-th-sorted {
    cursor: default;
    white-space: nowrap;
}

.ik-table th.ik-td-check,
.ik-table td.ik-td-check {
    padding-left: var(--spacing-2);
    padding-right: 0;
}

.ik-table tbody tr.ik-env {
    cursor: pointer;
}

/* The title is the row's keyboard target: a real button (Enter and Space open the Eingang, Space never scrolls). */
.ik-env__open {
    display: block;
    max-width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.ik-env__open:focus-visible {
    outline: var(--group-bar-width) solid var(--color-primary);
    outline-offset: var(--ik-hairline);
}

/* A whole Eingang dismissed here stays greyed «Verworfen» until another Eingang is chosen (mockup). */
.ik-table tbody tr.ik-env--dismissed,
.ik-crow--dismissed {
    opacity: var(--ik-dismissed-opacity);
}

.ik-table tbody tr.ik-env--unread .ik-from__name,
.ik-table tbody tr.ik-env--unread .ik-subject__text {
    font-weight: var(--font-weight-semibold);
}

.ik-table tbody tr.ik-env--selected,
.ik-table tbody tr.ik-env--selected:hover,
.ik-table tbody tr.ik-env--checked,
.ik-table tbody tr.ik-env--checked:hover {
    background: var(--ik-row-selected);
}

.ik-table tbody tr.ik-env--selected > td:first-child,
.ik-table tbody tr.ik-env--checked > td:first-child {
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-primary);
}

.ik-from,
.ik-subject {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ik-from__name,
.ik-subject__text,
.ik-owner {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ik-from__sub,
.ik-subject__sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.ik-dup-flag {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    margin-top: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--color-warning-text);
    white-space: nowrap;
}

.ik-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1);
    min-width: 0;
}

.ik-count {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.ik-date {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ik-date__time {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.ik-owner--none {
    color: var(--text-muted);
}

/* In a selected or checked row every type chip gets a thin outline, so no chip colour vanishes into the row. */
.ik-env--selected .ik-type,
.ik-env--checked .ik-type,
.ik-crow--selected .ik-type,
.ik-crow-wrap--checked .ik-type,
.ik-doc--active .ik-type {
    box-shadow: inset 0 0 0 var(--ik-hairline) var(--border-color-dark);
}

/* --- Multi-select: the label around the checkbox is the tap target --- */
.ik-select {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--ik-select-size);
    height: var(--ik-select-size);
    margin: 0;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.ik-select:hover {
    background: var(--color-gray-100);
}

.ik-select .form-check-input {
    pointer-events: none;
}

.ik-select--some .form-check-input {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

.ik-bulkbar {
    position: fixed;
    left: 50%;
    bottom: var(--spacing-5);
    z-index: var(--z-sticky);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2) var(--spacing-3);
    box-sizing: border-box;
    width: min(var(--ik-bulkbar-width), calc(100vw - 2 * var(--spacing-4)));
    padding: var(--spacing-2) var(--spacing-2) var(--spacing-2) var(--spacing-4);
    transform: translateX(-50%);
    background: var(--bg-card);
    border: var(--ik-hairline) solid var(--color-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

@media (min-width: 1024px) {   /* --bp-lg */
    .ik-bulkbar {
        left: calc(50% + var(--sidebar-width) / 2);
    }
}

.ik-bulkbar__count {
    display: flex;
    flex-direction: column;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
}

.ik-bulkbar__detail {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
    color: var(--text-secondary);
}

.ik-bulkbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    margin-left: auto;
}

.ik-bulkbar .btn {
    box-sizing: border-box;
    min-height: var(--control-height);
    white-space: nowrap;
}

/* --- Variant A: compact list + reading pane --- */
.ik-split {
    display: grid;
    grid-template-columns: var(--ik-list-width) minmax(0, 1fr);
    gap: var(--spacing-4);
    align-items: start;
}

.ik-split--full {
    grid-template-columns: minmax(0, 1fr);
}

.ik-split__list {
    min-width: 0;
}

.ik-clist {
    overflow: hidden;
    background: var(--bg-card);
    border: var(--ik-hairline) solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.ik-crow-wrap {
    border-bottom: var(--ik-hairline) solid var(--border-color);
}

.ik-crow-wrap:last-child {
    border-bottom: none;
}

.ik-clist--check .ik-crow-wrap {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    padding-left: var(--spacing-2);
}

.ik-clist--check .ik-crow-wrap > .ik-select {
    margin-top: var(--spacing-2);
}

.ik-clist--check .ik-crow {
    padding-left: var(--spacing-2);
}

.ik-crow-wrap--checked {
    background: var(--ik-row-selected);
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-primary);
}

.ik-crow {
    display: grid;
    grid-template-columns: var(--ik-src-size) minmax(0, 1fr);
    gap: var(--spacing-1) var(--spacing-3);
    width: 100%;
    padding: var(--spacing-3) var(--spacing-4);
    background: transparent;
    border: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.ik-crow:hover {
    background: var(--color-gray-50);
}

.ik-crow:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 var(--group-bar-width) var(--color-primary);
}

.ik-crow--selected,
.ik-crow--selected:hover {
    background: var(--ik-row-selected);
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-primary);
}

.ik-crow__body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    min-width: 0;
    font-size: var(--font-size-sm);
}

.ik-crow__line {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-2);
    min-width: 0;
}

.ik-crow__from,
.ik-crow__subject {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ik-crow__from {
    flex: 1 1 auto;
}

.ik-crow--unread .ik-crow__from,
.ik-crow--unread .ik-crow__subject {
    font-weight: var(--font-weight-semibold);
}

.ik-crow__date {
    flex-shrink: 0;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ik-crow__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-2);
}

.ik-crow__owner {
    margin-left: auto;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

/* The reading pane */
.ik-pane {
    min-width: 0;
    background: var(--bg-card);
    border: var(--ik-hairline) solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.ik-pane__back {
    display: none;
    align-items: center;
    gap: var(--spacing-2);
    box-sizing: border-box;
    width: 100%;
    min-height: var(--control-height);
    padding: 0 var(--spacing-4);
    background: transparent;
    border: none;
    border-bottom: var(--ik-hairline) solid var(--border-color);
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-link);
    text-align: left;
    cursor: pointer;
}

/* Pane «aus»: the Eingang full width with «Zurück zum Eingang». */
.ik-split--full .ik-pane__back {
    display: flex;
}

.ik-pane__state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-8) var(--spacing-4);
    text-align: center;
    color: var(--text-secondary);
}

.ik-pane__state--error {
    color: var(--color-error-text);
}

.ik-pane__state .btn {
    min-height: var(--control-height);
}

.ik-env-head {
    display: grid;
    grid-template-columns: var(--ik-src-size) minmax(0, 1fr);
    gap: var(--spacing-1) var(--spacing-3);
    padding: var(--spacing-4);
    border-bottom: var(--ik-hairline) solid var(--border-color);
}

.ik-env-head__main {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    min-width: 0;
}

.ik-env-head__subject {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    overflow-wrap: anywhere;
}

.ik-env-head__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--spacing-3);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.ik-env-head__meta strong {
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
}

.ik-env-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    margin-top: var(--spacing-2);
}

.ik-env-head__owner {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.ik-env-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    margin-left: auto;
}

.ik-env-head__actions .btn {
    box-sizing: border-box;
    min-height: var(--control-height);
}

.ik-env-head__actions .row-menu .btn-icon {
    width: var(--control-height);
    height: var(--control-height);
}

.ik-note {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-2);
    margin: var(--spacing-3) var(--spacing-4) 0;
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--font-size-sm);
    border-radius: var(--radius-md);
    background: var(--color-gray-50);
    border: var(--ik-hairline) solid var(--border-color);
}

.ik-note > svg {
    flex-shrink: 0;
}

.ik-note--info {
    background: var(--color-info-light);
    border-color: var(--color-info);
    color: var(--color-info-text);
}

.ik-note__body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    min-width: 0;
}

.ik-pane__dup {
    margin: var(--spacing-3) var(--spacing-4) 0;
}

/* Document rows of the pane: type | file (facts below) | actions */
.ik-docs {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ik-docs__labels,
.ik-doc {
    display: grid;
    grid-template-columns: var(--ik-doc-type-col) minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-3);
    padding: var(--spacing-2) var(--spacing-3);
}

.ik-docs__labels {
    padding-top: var(--spacing-3);
    padding-bottom: var(--spacing-1);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--ik-label-tracking);
}

.ik-docs__labels > :nth-child(3) {
    display: none;
}

.ik-doc {
    grid-template-areas:
        "type file actions"
        "type facts actions";
    border-top: var(--ik-hairline) solid var(--color-gray-100);
    cursor: pointer;
}

.ik-doc > .ik-doc__type { grid-area: type; }
.ik-doc > .ik-doc__file { grid-area: file; }
.ik-doc > .ik-doc__facts { grid-area: facts; }
.ik-doc > .ik-doc__actions { grid-area: actions; }

.ik-doc--active {
    background: var(--color-gray-50);
    box-shadow: inset var(--group-bar-width) 0 0 0 var(--color-primary);
}

.ik-doc--dismissed {
    opacity: var(--ik-dismissed-opacity);
}

.ik-doc--dismissed .ik-fname {
    text-decoration: line-through;
}

.ik-doc__type,
.ik-doc__file,
.ik-doc__facts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-1);
    min-width: 0;
}

.ik-doc__file,
.ik-doc__facts {
    font-size: var(--font-size-sm);
}

.ik-doc__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--spacing-2);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.ik-doc__num,
.ik-doc__amount {
    font-variant-numeric: tabular-nums;
}

.ik-doc__amount {
    font-weight: var(--font-weight-medium);
}

.ik-doc__facts-main {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ik-doc__hint,
.ik-doc__state {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.ik-doc__state {
    white-space: nowrap;
}

.ik-doc__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-2);
}

/* One height per document action row: the small button and the ⋯ icon button side by side. */
.ik-doc__actions .btn,
.ik-preview__bar .btn {
    box-sizing: border-box;
    min-height: var(--btn-icon-sm-size);
    white-space: nowrap;
}

.ik-docs__hidden {
    margin: 0;
    padding: var(--spacing-2) var(--spacing-4);
    border-top: var(--ik-hairline) solid var(--color-gray-100);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* The preview */
.ik-pane__section-title {
    margin: 0;
    padding: var(--spacing-3) var(--spacing-4) 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.ik-preview {
    margin: var(--spacing-3) var(--spacing-4) var(--spacing-4);
    overflow: hidden;
    border: var(--ik-hairline) solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--color-gray-200);
}

.ik-preview__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-3);
    background: var(--color-gray-50);
    border-bottom: var(--ik-hairline) solid var(--border-color);
    font-size: var(--font-size-sm);
}

.ik-preview__name {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    font-weight: var(--font-weight-medium);
}

.ik-preview__bar .btn {
    margin-left: auto;
}

.ik-preview__stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: var(--ik-preview-height);
    overflow: auto;
}

.ik-preview__img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    object-fit: contain;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.ik-preview__empty {
    margin: 0;
    padding: var(--spacing-4);
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

@media (max-width: 1280px) { /* --bp-xl */
    .ik-split {
        grid-template-columns: minmax(0, var(--ik-list-width-md)) minmax(0, 1fr);
    }

    .ik-split--full {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Touch (phone and tablet): 44 px targets. */
@media (pointer: coarse), (any-pointer: coarse) {
    .ik-pane__back,
    .ik-crow {
        min-height: var(--touch-target-size);
    }

    .ik-doc .row-menu .btn-icon,
    .ik-env-head .row-menu .btn-icon {
        width: var(--touch-target-size);
        height: var(--touch-target-size);
    }

    .ik-doc__actions .btn,
    .ik-preview__bar .btn {
        min-height: var(--touch-target-size);
    }
}

/* Phone (--bp-sm): the compact cards instead of the table; a tap shows the Eingang full screen with «Zurück zum
   Eingang»; head, toolbar and filters go with the list; selection bar and toast full width at the bottom. */
@media (max-width: 640px) {   /* --bp-sm */
    :root:has(.ik-bulkbar) {
        --ik-bulkbar-height: var(--ik-bulkbar-reserve-phone);
    }

    .main-body:has(.ik-bulkbar) {
        padding-bottom: calc(var(--ik-bulkbar-reserve-phone) + var(--spacing-4));
    }

    .ik-only-wide,
    .ik-only-wide-flex {
        display: none;
    }

    .ik-only-narrow {
        display: block;
    }

    .ik-label-long {
        display: none;
    }

    .ik-label-short {
        display: inline;
    }

    .ik-detail-mode .ik-page-head,
    .ik-detail-mode .ik-toolbar,
    .ik-detail-mode .ik-filterbar {
        display: none;
    }

    .ik-filterbar__end {
        margin-left: 0;
    }

    .ik-split {
        display: block;
    }

    .ik-split--detail .ik-split__list {
        display: none;
    }

    .ik-pane__back {
        display: flex;
        min-height: var(--touch-target-size);
    }

    .ik-env-head {
        padding: var(--spacing-3);
    }

    .ik-env-head__actions {
        width: 100%;
        margin-left: 0;
    }

    .ik-env-head__actions .btn:not(.btn-icon) {
        flex: 1 1 auto;
        justify-content: center;
    }

    .ik-docs__labels {
        display: none;
    }

    .ik-doc {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "type actions"
            "file file"
            "facts facts";
    }

    .ik-doc > .ik-doc__type {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .ik-doc__actions .ik-doc__primary {
        display: none;
    }

    .ik-note,
    .ik-pane__dup {
        margin: var(--spacing-3) var(--spacing-3) 0;
    }

    .ik-preview {
        margin: var(--spacing-3);
    }

    .ik-preview__stage {
        height: var(--ik-preview-height-phone);
    }

    .ik-bulkbar {
        left: var(--spacing-4);
        right: var(--spacing-4);
        bottom: var(--spacing-4);
        width: auto;
        transform: none;
    }

    .ik-bulkbar__actions {
        flex: 1 1 100%;
    }

    .ik-bulkbar__actions .btn {
        flex: 1 1 0;
        min-width: 0;
        justify-content: center;
        padding-left: var(--spacing-2);
        padding-right: var(--spacing-2);
    }
}
/* FEAT-042 lane C: end */

/* FEAT-042 lane D: start */
/* The Rechnung view and the document view on /process/{id} (plan Task 8; mockup 2026-12-05-intake-v1-rechnung.html,
   intake.css ik-crumb, ik-rd-head, ik-family, ik-choice): the path, the head per phase, the family block, the decision
   card, and the phone order (head first). Values are tokens. */
.ik-crumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1);
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    min-width: 0;
}

.ik-crumb a {
    display: inline-flex;   /* a box of its own, so it can take the touch height */
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
}

.ik-crumb a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.ik-crumb__current {
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ik-rd-head__title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ik-rd-head__facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-1) var(--spacing-3);
    margin: 0 0 var(--spacing-3) 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.ik-rd-head__facts strong {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* «Interne Nr. P-000041»: quiet, in the size of the facts; the P-number keeps an element of its own (ik-rd-head__number). */
.ik-rd-head__num {
    color: var(--text-muted);
}

/* The ⋯ of the head is an icon button, not a full action (the action row gives its buttons flex: 1). */
.pd-side-header-actions .row-menu > .btn-icon {
    flex: none;
    min-width: var(--control-height);
}

.pd-viewer-empty-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
}

.ik-family {
    display: flex;
    flex-direction: column;
    padding-block: var(--spacing-1);
}

.ik-family__row {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
    padding: var(--ik-family-pad);
}

.ik-family__label {
    flex: 0 0 var(--ik-family-label-width);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--ik-label-tracking);
    text-transform: uppercase;
    color: var(--text-muted);
}

.ik-family__row--intake .pd-email-card-toggle {
    flex: 1 1 0;
    min-width: 0;
}

.ik-family__title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ik-sib {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    max-width: 100%;
    padding: var(--spacing-1) var(--spacing-2);
    border: var(--ik-hairline) solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    text-decoration: none;
    min-width: 0;
}

a.ik-sib:hover {
    border-color: var(--color-primary);
}

.ik-sib--current {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.ik-sib__name {
    min-width: 0;
    overflow: hidden;
}

.ik-family__row--supporting {
    flex-wrap: wrap;   /* several Beilagen and «Beilage hinzufügen …» wrap; the documents row stays one line (look 9f072ea) */
}

.ik-family__beilage {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    min-width: 0;
}

.ik-family__empty,
.ik-family__more {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.ik-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--ik-choice-min-width), 1fr));
    gap: var(--spacing-3);
}

.ik-choice__card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-2);
    padding: var(--spacing-3);
    border: var(--ik-hairline) solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.ik-choice__card--rec {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.ik-choice__title {
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.ik-choice__reason {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    margin: 0 0 var(--spacing-3) 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.ik-origin__source {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.ik-choice__text {
    flex: 1 1 auto;
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* One control height for the head actions, the family block and the choices – 44 px under a coarse pointer
   (--control-height follows --touch-target-size there). */
.pd-side-header-actions .btn,
.ik-rd-head .ik-type-btn,
.ik-family .btn,
.ik-choice__card .btn {
    min-height: var(--control-height);
}

/* Touch (spec §9, Global Constraints): every control of the view is 44 px under a coarse pointer – also the links of the
   path, the document chips, the e-mail toggle and «Lösen». */
@media (pointer: coarse), (any-pointer: coarse) {
    .ik-crumb a,
    a.ik-sib,
    .pd-email-card-toggle,
    .ik-family__loesen {
        min-height: var(--touch-target-size);
    }
}

/* Phone (spec §9): the stack (head first, as in the DOM – see .process-workspace) needs only the wrapping title and the
   family labels on their own line. */
@media (max-width: 640px) {   /* --bp-sm */
    .ik-rd-head__title {
        white-space: normal;
    }

    .ik-family__row--intake,
    .ik-family__row--supporting {
        flex-wrap: wrap;
    }

    .ik-family__label {
        flex-basis: 100%;
    }
}
/* FEAT-042 lane D: end */

/* FEAT-042 lane E: start */
/* Archive (plan Task 9; spec §6.7; mockup archiv#archiv, ik-table--archive and ik-crow): one row per document in a
   bordered list – source, «Typ», «Dokument / Herkunft», «Betrag», «Status», «Erledigt», ⋯. The column widths are tokens; the
   document column takes the rest. On the phone (--bp-sm) the head row goes and each row becomes a block of three lines.
   No overflow on the list: the ⋯ menu of the last row opens below it. */
.archive-list {
    border: var(--archive-list-border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.archive-table {
    table-layout: fixed;
}

/* The grid's scroll container clips an open ⋯ menu of the last rows; while one is open it lets it out. */
.archive-list .data-grid-body:has(.row-menu--open) {
    overflow: visible;
}

.archive-table .archive-table__src { width: var(--archive-col-src); }
.archive-table .archive-table__type { width: var(--archive-col-type); }
.archive-table .archive-table__amount { width: var(--archive-col-amount); }
.archive-table .archive-table__status { width: var(--archive-col-status); }
.archive-table .archive-table__done { width: var(--archive-col-done); }
.archive-table .archive-table__actions { width: var(--archive-col-actions); }

.archive-row__doc {
    min-width: 0;
}

.archive-row__open,
.archive-row__vendor,
.archive-row__sub {
    display: block;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.archive-row__open {
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
}

.archive-row__open:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.archive-row__vendor {
    color: var(--text-secondary);
}

.archive-row__sub {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

.archive-row__origin::before {
    content: " · ";
}

.archive-row__done-date,
.archive-row__done-by {
    display: block;
    white-space: nowrap;
}

.archive-row__done-by {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

/* Touch (fix I2): the file name that opens the document is a full touch target (the app's one touch query). */
@media (pointer: coarse), (any-pointer: coarse) {
    .archive-row__open {
        display: flex;
        align-items: center;
        min-height: var(--touch-target-size);
    }
}

/* «Wiederhergestellt»: the row stays where it is, quiet, without a menu (mockup archiv#wiederhergestellt). */
.archive-row--restored td {
    color: var(--text-muted);
}

@media (max-width: 640px) { /* --bp-sm */
    .archive-table,
    .archive-table tbody {
        display: block;
    }

    .archive-table thead {
        display: none;
    }

    .archive-row {
        display: grid;
        grid-template-columns: var(--ik-src-size) auto auto minmax(0, 1fr) auto;
        grid-template-areas:
            "src doc doc doc actions"
            "src type status amount amount"
            "src done done done done";
        column-gap: var(--spacing-2);
        row-gap: var(--spacing-1);
        align-items: center;
        padding: var(--spacing-3);
        border-bottom: var(--archive-list-border);
    }

    .archive-row:last-child {
        border-bottom: none;
    }

    .archive-table .archive-row td {
        display: block;
        padding: 0;
        border-bottom: none;
        min-width: 0;
    }

    .archive-table .archive-row .archive-row__src { grid-area: src; align-self: start; }
    .archive-table .archive-row .archive-row__type { grid-area: type; }
    .archive-table .archive-row .archive-row__doc { grid-area: doc; }
    .archive-table .archive-row .archive-row__amount { grid-area: amount; }
    .archive-table .archive-row .archive-row__status { grid-area: status; }
    .archive-table .archive-row .archive-row__actions { grid-area: actions; align-self: start; }

    .archive-table .archive-row .archive-row__done {
        grid-area: done;
        display: flex;
        gap: var(--spacing-2);
        color: var(--text-muted);
        font-size: var(--font-size-xs);
    }
}
/* FEAT-042 lane E: end */
