/*
   TechWork.Components — DataGrid / DataTableCard responsive table styles.

   Self-contained: depends only on Bootstrap 5 being present (for .table, .card,
   .badge, .btn etc.). Reference from a Blazor host with:

     <link rel="stylesheet" href="_content/TechWork.Components/techwork-components.css" />

   The .rtable-* utility classes are part of the grid's responsive contract and are
   meant to be applied by consuming pages inside <TemplateColumn> markup:
     rtable-col-lg          hide on tablet & below
     rtable-col-mobile-hide hide on mobile
     rtable-col-actions     action cell (block on mobile)
     rtable-col-ref         secondary/reference text (muted on mobile)
     rtable-primary-line    flex row: primary text + trailing status
     rtable-mobile-status   status badge shown only on mobile

   Applied by DataGrid itself (not by consumers):
     td[data-label]         phone eyebrow label (DataGrid.MobileLabels / column MobileLabel)
     phone-list             table modifier when DataGrid.PhoneRowTemplate is set
     rtable-phone-row       the whole-row phone cell holding that template
     rtable-sticky          sticky header (DataGrid.StickyHeader)
     rtable-selectable      table modifier when DataGrid.SelectionMode is set
     rtable-select-cell     the leading select column (th / td holding a button.twc-check)
     rtable-row-selected    a selected row
     twc-bulk-bar(-count/-actions/-clear)  BulkActionBar (DataGrid.BulkActions) between toolbar and table
     twc-bulk-spacer        phone-only spacer after the grid while its bulk bar is fixed to the bottom
     twc-table-footer       DataTableCard footer (holds DataGrid's Pager)
     table-toolbar(-title/-meta)  DataTableCard header (shared with the theme's pattern)
     twc-table-flush        DataTableCard / DataGrid Flush outer element (no card chrome)

   Tokens: every colour, radius and font in this file is var(--twc-<token>, <literal>). The
   tokens come from the opt-in techwork-theme.css; the literal fallback is the 1.x value, so
   without the theme sheet the components look exactly as they did. The only bare literals
   left are tagged inline: the theme-independent rail palette ("rail palette"), white on a
   solid fill, black-alpha scrims, and Bootstrap-variable chains that end in a literal.

   Dark mode keys off [data-bs-theme="dark"]. Every such block is followed by an OS-dark
   mirror — the same rules under @media (prefers-color-scheme: dark), each selector prefixed
   :root:not([data-bs-theme]) — so a page that sets no attribute follows the OS, while an
   explicit data-bs-theme="light" stays light. Keep each mirror identical to its block;
   CssThemeMirrorTests fails the build when they drift.

   Stacking (z-index) scale — every value is var(--twc-z-<layer>, <literal>), so an app can
   re-slot a layer without !important. Lowest to highest:
     --twc-z-sticky          1    DataGrid sticky header (inside the table's scroll box)
                                  and DocumentActions' sticky phone bar (page level, after the lines)
     --twc-z-fab             9    TabSwitcher's floating button (≤900px) — under the drawer
     --twc-z-bulk-bar        9    BulkActionBar fixed to the bottom (≤767.98px); never shown with the
                                  TabSwitcher's button (selection grids are not in its workspace view)
     --twc-z-drawer-overlay  10   AppShell's scrim behind the open drawer (≤900px)
     --twc-z-popover         15   Combobox's / MultiSelect's / TokenInput's option panel without techwork-popover.js (with it the
                                  panel is in the top layer and this is moot); it closes on blur,
                                  so it never meets an open drawer
     --twc-z-drawer          20   AppShell's off-canvas .sidebar (≤900px)
     --twc-z-menu            20   TabStrip's overflow menu (desktop; never meets the drawer)
     --twc-z-dropdown-overlay 30  DropdownMenu's scrim while open (clear on desktop, dimmed under
                                  the ≤575.98px sheet) — above the drawer, under TabSwitcher's sheet
     --twc-z-dropdown        31   DropdownMenu's open menu / phone bottom sheet
                                  and KanbanBoard's drag ghost (never open together)
     --twc-z-sheet-overlay   40   TabSwitcher's scrim
     --twc-z-sheet           41   TabSwitcher's bottom sheet
     (Bootstrap's modal)    1055  Dialog / ConfirmDialog — above everything here
   Page content sits at auto/0. Keep new layers inside this order.
*/

/* ── Responsive list tables ── */
.rtable {
    table-layout: fixed;
}

/* Wide tables: keep the responsive mobile collapse but let columns size to content
   on desktop instead of the fixed equal-width layout. */
.rtable.rtable-auto {
    table-layout: auto;
}

.rtable th,
.rtable td {
    vertical-align: middle;
}

.rtable-row {
    min-height: 44px;
}

.rtable-row[role="button"] {
    cursor: pointer;
}

.rtable-row:focus-visible {
    outline: 2px solid var(--twc-color-primary, #0d6efd);
    outline-offset: -2px;
}

.rtable-mobile-status {
    display: none;
}

.rtable-primary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

/* Desktop counterpart of the mobile primary-line protection below: without this, a
   badge/pill after the first (name) child has the flexbox default flex-shrink:1, so a
   long name squeezes the badge below its own text width and .table .badge's
   overflow-wrap:anywhere (added for long enum badges) breaks it mid-word/character-wraps.
   Applies at every width; the mobile block re-states it (harmlessly) alongside its own
   layout tweaks. */
.rtable-primary-line > :not(:first-child) {
    flex-shrink: 0;
}

/* Sortable column header — plain button, no default button chrome, inherits header
   text styling so it reads identically to a non-sortable <th>. */
.rtable-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border: 0;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: inherit;
    color: inherit;
    cursor: pointer;
}

.rtable-sort-btn:focus-visible {
    outline: 2px solid var(--twc-color-primary, #0d6efd);
    outline-offset: 2px;
}

.rtable-sort-indicator {
    font-size: .75em;
    line-height: 1;
    opacity: .6;
}

th[aria-sort="ascending"] .rtable-sort-indicator,
th[aria-sort="descending"] .rtable-sort-indicator {
    opacity: 1;
}

/* Remove-row action column (edit mode) — keep the column as narrow as its content
   under the fixed table layout, instead of claiming an equal share of the width. */
.rtable-remove-cell {
    width: 1%;
    white-space: nowrap;
}

/* Under the fixed layout "1%" is taken literally (~14px on a desktop grid), so the 44px button
   overflowed the column and the card's overflow: hidden clipped it out of sight. Size the column
   to the button plus a slim gutter instead. Not on phones: there the cell is a stacked block. */
@media (min-width: 768px) {
    .rtable .rtable-remove-cell {
        width: calc(44px + 0.5rem);
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* Remove-row button — a quiet destructive icon button (.btn-quiet-danger, Material "close"):
   an 18px glyph, but a 44×44px hit area. Padding is zeroed so .btn's horizontal padding does not
   widen the action column. */
.rtable-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
}

.rtable-remove-btn .material-icons {
    font-size: 1.125rem;
    line-height: 1;
}

/* Add-row footer button — the dashed add pattern (.btn-dashed-add, styled below with the small
   components) at the 44px touch-target minimum. */
.rtable-addrow-btn {
    min-height: 44px;
}

/* Quiet destructive (R5) — DataGrid's remove-row button. The class ALSO ships in
   techwork-theme.css; same values here on var(--twc-…, <light literal>) so it is muted-until-
   hovered without the theme sheet too (dark literals below). */
.btn-quiet-danger {
    background: transparent;
    color: var(--twc-color-muted, #64748b);
    border-color: transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-quiet-danger:hover:not(:disabled),
.btn-quiet-danger:focus-visible {
    color: var(--twc-color-danger, #dc2626);
    background: color-mix(in srgb, var(--twc-color-danger, #dc2626) 10%, transparent);
    border-color: color-mix(in srgb, var(--twc-color-danger, #dc2626) 38%, transparent);
}

.btn-quiet-danger:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

[data-bs-theme="dark"] .btn-quiet-danger { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .btn-quiet-danger:hover:not(:disabled),
[data-bs-theme="dark"] .btn-quiet-danger:focus-visible {
    color: var(--twc-color-danger, #f87171);
    background: color-mix(in srgb, var(--twc-color-danger, #f87171) 10%, transparent);
    border-color: color-mix(in srgb, var(--twc-color-danger, #f87171) 38%, transparent);
}
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .btn-quiet-danger { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .btn-quiet-danger:hover:not(:disabled),
    :root:not([data-bs-theme]) .btn-quiet-danger:focus-visible {
        color: var(--twc-color-danger, #f87171);
        background: color-mix(in srgb, var(--twc-color-danger, #f87171) 10%, transparent);
        border-color: color-mix(in srgb, var(--twc-color-danger, #f87171) 38%, transparent);
    }
}

/* Sticky header (DataGrid.StickyHeader). Sticks within the nearest scrolling ancestor —
   the card's .table-responsive wrapper — so it only takes effect when that wrapper or the
   card has a bounded height. The opaque background stops rows showing through; it falls
   back to Bootstrap 5.3's body background (theme-aware) and finally to white. */
.rtable-sticky > thead > tr > th {
    position: sticky;
    top: var(--twc-sticky-top, 0);
    z-index: var(--twc-z-sticky, 1);
    background: var(--twc-color-card-bg, var(--bs-body-bg, #fff)); /* Bootstrap variable chain with a literal fallback */
}

/* Whole-row phone cell (DataGrid.PhoneRowTemplate) — hidden on desktop; the phone
   block below swaps it in for the regular cells. */
.rtable-phone-row {
    display: none;
}

/* DataTableCard header — the theme's .table-toolbar pattern (title at weight 500, a muted meta
   line, actions right). The .table-toolbar* rules ALSO ship in techwork-theme.css; these copies
   carry the same values on var(--twc-…, <light literal>), so the header looks the same with or
   without the theme sheet (dark literals below). The card's own header wraps its actions under
   the title on narrow widths. */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
    background: color-mix(in srgb, var(--twc-color-card-bg, #ffffff) 84%, var(--twc-color-bg, #f5f6f8));
}

.table-toolbar-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 500;
}

.table-toolbar-meta {
    color: var(--twc-color-muted, #64748b);
    font-size: var(--twc-font-size-xs, 0.8rem);
}

.data-table-card-header {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.data-table-card-heading {
    min-width: 0;
}

/* DataTableCard / DataGrid Flush — no card chrome: the table sits edge to edge inside the card
   that holds it. The outer element is not a .card, so there is no border, radius, shadow or
   margin to undo; only the footer needs its (theme: !important) rounded corners squared off. */
.twc-table-flush {
    margin: 0;
}

.twc-table-flush > .card-footer {
    border-radius: 0 !important;
}

[data-bs-theme="dark"] .table-toolbar {
    border-bottom-color: var(--twc-color-border, #3a424d);
    background: color-mix(in srgb, var(--twc-color-card-bg, #15191f) 84%, var(--twc-color-bg, #20262d));
}
[data-bs-theme="dark"] .table-toolbar-meta { color: var(--twc-color-muted, #a8b0bb); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .table-toolbar {
        border-bottom-color: var(--twc-color-border, #3a424d);
        background: color-mix(in srgb, var(--twc-color-card-bg, #15191f) 84%, var(--twc-color-bg, #20262d));
    }
    :root:not([data-bs-theme]) .table-toolbar-meta { color: var(--twc-color-muted, #a8b0bb); }
}

/* Pager — 44px touch targets (moved out of Stayant's inline style attributes). */
.twc-pager-btn {
    min-width: 44px;
    min-height: 44px;
}

.twc-pager-label {
    min-height: 44px;
}

@media (max-width: 991.98px) {
    .rtable-col-lg {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .rtable thead {
        display: none;
    }

    .rtable,
    .rtable tbody,
    .rtable tr,
    .rtable td {
        display: block;
        width: 100%;
    }

    .rtable .rtable-row {
        border-bottom: 1px solid var(--twc-color-row-rule, #e5e7eb);
        padding: .25rem 0;
    }

    .rtable .rtable-row td {
        border: 0;
        padding: 0.2rem 0.8rem;
    }

    .rtable .rtable-col-lg {
        display: none !important;
    }

    /* reset Bootstrap striped/hover colour on stacked cell blocks */
    .rtable .rtable-row td {
        --bs-table-bg-type: initial;
        --bs-table-color-type: initial;
        background-color: transparent !important;
    }

    .rtable .rtable-mobile-status {
        display: inline-flex;
    }

    .rtable .rtable-col-mobile-hide {
        display: none;
    }

    .rtable .rtable-col-ref {
        font-size: .78rem;
        color: var(--twc-color-muted, #6b7280);
    }

    .rtable .rtable-col-actions {
        display: block;
        padding-bottom: .55rem;
    }

    /* Column heading as an eyebrow above each stacked value (DataGrid.MobileLabels).
       The grid omits data-label for untitled / opted-out columns; action cells are
       guarded here too in case a consumer titles their actions column.
       The eyebrow is visual only: the `/ ""` alternative text keeps the generated label out
       of the cell's accessible name, so a cell reads (and is found by role + name) exactly as
       on desktop — "Pro", not "Name Pro". The first declaration is the fallback for a browser
       without content alt-text, which drops the second. */
    .rtable td[data-label]::before {
        content: attr(data-label);
        content: attr(data-label) / "";
        display: block;
        font-size: 0.66rem;
        letter-spacing: 0.09em;
        text-transform: uppercase;
        color: var(--twc-color-muted, #6b7280);
        margin-bottom: 0.15rem;
    }

    .rtable td.rtable-col-actions[data-label]::before {
        display: none;
    }

    /* A stacked cell is a label-above-value block, so its value starts at the label's edge.
       Column alignment (Align="end" money, "center" flags) is a desktop column concern; left
       on, it pushed the value to the far edge away from its eyebrow. Bootstrap's .text-end /
       .text-center are !important, hence !important here at higher specificity. */
    .rtable > tbody > tr > td.text-end,
    .rtable > tbody > tr > td.text-center {
        text-align: start !important;
    }

    /* Phone rows (DataGrid.PhoneRowTemplate): the whole-row cell replaces the regular
       cells. Scoped to .rtable-row so expanded detail rows stay visible. */
    .rtable.phone-list > tbody > tr.rtable-row > td:not(.rtable-phone-row):not(.rtable-select-cell) {
        display: none;
    }

    .rtable.phone-list > tbody > tr.rtable-row > td.rtable-phone-row {
        display: block;
        padding: 0;
    }
}

/* ── Mobile card anatomy (≤768px) — primary / secondary / meta / action ── */
.rtable-secondary { color: var(--twc-color-muted, #6b7280); }

@media (max-width: 767.98px) {
    /* Tighter stacked card — less wasted vertical space */
    .rtable .rtable-row { padding: .5rem 0; }
    .rtable .rtable-row td { padding: .12rem .85rem; }

    /* PRIMARY line: strong/larger value on the left, chip on the right.
       The name is the only flex item allowed to shrink/wrap (min-width:0 opts it
       in); status chips get flex-shrink:0 so a long name can never squeeze a short
       badge below its own text width — which forced .table .badge's
       overflow-wrap:anywhere (added for long enum badges) to break mid-word. */
    .rtable .rtable-primary-line { align-items: flex-start; }
    .rtable .rtable-primary-line > :first-child { font-weight: 600; font-size: 1.02rem; line-height: 1.25; min-width: 0; }
    .rtable .rtable-primary-line > :not(:first-child) { flex-shrink: 0; }

    /* SECONDARY: muted, smaller */
    .rtable .rtable-secondary { font-size: .82rem; color: var(--twc-color-muted, #6b7280); }

    /* META: small inline facts with "·" separators.
       The flex layout is mobile-only by design: on desktop these classes land on a
       <td>, and display:flex would pull the cell out of the table's row box and make
       its borders/baseline drift out of alignment with the row. */
    .rtable .rtable-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .55rem; font-size: .8rem; color: var(--twc-color-muted, #6b7280); }
    .rtable .rtable-meta .rtable-meta-item { display: inline-flex; align-items: baseline; }
    .rtable .rtable-meta .rtable-meta-item:not(:last-child)::after {
        content: "·"; margin-left: .55rem; color: var(--twc-color-subtle, #9ca3af);
    }

    /* ACTION: desktop-only actions hidden on mobile */
    .rtable .rtable-action-secondary,
    .rtable-action-secondary { display: none !important; }
}

/* Dark mode — keep muted text legible on the dark card. */
[data-bs-theme="dark"] .rtable-secondary,
[data-bs-theme="dark"] .rtable-meta { color: var(--twc-color-muted, #9aa4b2); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .rtable-secondary,
    :root:not([data-bs-theme]) .rtable-meta { color: var(--twc-color-muted, #9aa4b2); }
}

/* ── Dark mode — stacked-row rules and eyebrow labels stay legible on dark backgrounds ── */
@media (max-width: 767.98px) {
    [data-bs-theme="dark"] .rtable .rtable-row {
        border-bottom-color: var(--twc-color-row-rule, #2a2f3a);
    }

    [data-bs-theme="dark"] .rtable td[data-label]::before {
        color: var(--twc-color-muted, #9aa4b2);
    }

    [data-bs-theme="dark"] .rtable .rtable-col-ref {
        color: var(--twc-color-muted, #9aa4b2);
    }
}
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) and (max-width: 767.98px) {
    :root:not([data-bs-theme]) .rtable .rtable-row {
        border-bottom-color: var(--twc-color-row-rule, #2a2f3a);
    }

    :root:not([data-bs-theme]) .rtable td[data-label]::before {
        color: var(--twc-color-muted, #9aa4b2);
    }

    :root:not([data-bs-theme]) .rtable .rtable-col-ref {
        color: var(--twc-color-muted, #9aa4b2);
    }
}

/* ── AvailabilityCalendar (.twc-cal) — month-grid date-range picker ──
   Package tokens with today's literals as fallbacks, plus paired dark-mode blocks;
   depends only on Bootstrap being present for fonts. */
.twc-cal { max-width: 100%; }
.twc-cal-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.twc-cal-titles { flex: 1 1 auto; display: flex; justify-content: space-around; font-weight: 600; }
.twc-cal-nav {
    min-width: 44px; min-height: 44px; border: 1px solid var(--twc-color-border, #e5e7eb); background: transparent;
    border-radius: var(--twc-radius-sm, .375rem); font-size: 1.25rem; line-height: 1; cursor: pointer; color: inherit;
}
.twc-cal-nav:disabled { opacity: .4; cursor: default; }
.twc-cal-months { display: flex; gap: 1rem; }
.twc-cal-month { flex: 1 1 0; border-collapse: collapse; table-layout: fixed; width: 100%; }
.twc-cal-dow { text-align: center; font-size: .75rem; font-weight: 600; color: var(--twc-color-muted, #6b7280); padding: .25rem 0; }
.twc-cal-month td { padding: 1px; }
.twc-cal-day {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; min-height: 44px; gap: 1px; padding: 2px 0;
    border: 1px solid transparent; border-radius: var(--twc-radius-sm, .375rem); background: transparent;
    color: inherit; cursor: pointer; font-size: .875rem;
}
.twc-cal-day:focus-visible { outline: 2px solid var(--twc-color-primary, #0d6efd); outline-offset: -2px; }
.twc-cal-disabled { color: var(--twc-color-muted, #9ca3af); cursor: default; }
.twc-cal-disabled .twc-cal-daynum { text-decoration: line-through; }
.twc-cal-endable { cursor: pointer; }
.twc-cal-selected { background: var(--twc-color-primary, #0d6efd); color: var(--twc-color-on-primary, #fff); /* label ink on the solid primary fill: near-black over the dark theme's light primary (R10) */ }
.twc-cal-selected .twc-cal-daynum { text-decoration: none; }
.twc-cal-inrange { background: var(--twc-color-primary-tint, rgba(13, 110, 253, .15)); }
.twc-cal-badge { font-size: .6875rem; line-height: 1.1; font-weight: 600; color: var(--twc-color-subtle, #374151); }
.twc-cal-selected .twc-cal-badge { color: var(--twc-color-on-primary, #ffffff); font-weight: 600; }
.twc-cal-clear {
    border: 0; background: none; color: var(--twc-color-link, #0d6efd); font-size: .875rem;
    padding: .5rem 0; min-height: 44px; cursor: pointer;
}
/* Single month on phones */
@media (max-width: 767.98px) {
    .twc-cal-month-secondary, .twc-cal-title-secondary { display: none; }
}
/* Dark mode. In-range takes the strong tint: the light tint is too faint on a dark card. */
[data-bs-theme="dark"] .twc-cal-nav { border-color: var(--twc-color-border, #2a2f3a); }
[data-bs-theme="dark"] .twc-cal-dow { color: var(--twc-color-muted, #9aa4b2); }
[data-bs-theme="dark"] .twc-cal-disabled { color: var(--twc-color-muted, #6b7280); }
[data-bs-theme="dark"] .twc-cal-badge { color: var(--twc-color-subtle, #c7cdd6); }
[data-bs-theme="dark"] .twc-cal-inrange { background: var(--twc-color-primary-tint-strong, rgba(116, 143, 252, .25)); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-cal-nav { border-color: var(--twc-color-border, #2a2f3a); }
    :root:not([data-bs-theme]) .twc-cal-dow { color: var(--twc-color-muted, #9aa4b2); }
    :root:not([data-bs-theme]) .twc-cal-disabled { color: var(--twc-color-muted, #6b7280); }
    :root:not([data-bs-theme]) .twc-cal-badge { color: var(--twc-color-subtle, #c7cdd6); }
    :root:not([data-bs-theme]) .twc-cal-inrange { background: var(--twc-color-primary-tint-strong, rgba(116, 143, 252, .25)); }
}

/* ── PageHeader ──
   Title and actions share a wrapping flex row. The title block grows and may shrink
   (min-width: 0) so a long title wraps instead of overflowing; the actions hold their width.
   Below Bootstrap's sm breakpoint the actions drop onto their own full-width row. */
.twc-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.twc-page-header-main {
    flex: 1;
    min-width: 0;
}
.twc-page-title {
    font-size: 1.75rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0;
    min-width: 0;
    color: var(--twc-color-text, #111827);
}
/* Title + TitleAside: one wrapping row. The title may shrink and wrap; the aside (a status
   dot, chips) keeps its own width and drops under the title when the row runs out of room. */
.twc-page-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    min-width: 0;
}
.twc-page-title-aside {
    flex: none;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: var(--twc-font-size-sm, 0.875rem);
    color: var(--twc-color-subtle, #475569);
}
.twc-page-subtitle {
    color: var(--twc-color-subtle, #64748b);
    font-size: var(--twc-font-size-sm, 0.875rem);
    margin: 0.3rem 0 0;
}
.twc-page-header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
/* Tap targets: Bootstrap's .btn is ~38px tall, under the 44×44 floor (DESIGN-SYSTEM "Tap targets").
   Lift the header's actions wherever the user may be tapping — the ≤900px layouts and any coarse
   pointer (tablets, the native shells) — and leave the desktop mouse layout as it was. */
@media (max-width: 900px), (pointer: coarse) {
    .twc-page-header-actions .btn:not([hidden]) {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
@media (max-width: 575.98px) {
    .twc-page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .twc-page-header-actions {
        justify-content: flex-start;
        width: 100%;
    }
}

/* Dark mode */
[data-bs-theme="dark"] .twc-page-title { color: var(--twc-color-text, #f1f5f9); }
[data-bs-theme="dark"] .twc-page-subtitle { color: var(--twc-color-subtle, #9aa4b2); }
[data-bs-theme="dark"] .twc-page-title-aside { color: var(--twc-color-subtle, #d7dce3); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-page-title { color: var(--twc-color-text, #f1f5f9); }
    :root:not([data-bs-theme]) .twc-page-subtitle { color: var(--twc-color-subtle, #9aa4b2); }
    :root:not([data-bs-theme]) .twc-page-title-aside { color: var(--twc-color-subtle, #d7dce3); }
}

/* ── Dialog ─────────────────────────────────────────────────────────────────
   .modal/.modal-dialog/.modal-content come from Bootstrap; these rules only add
   the backdrop tint (Bootstrap's .modal is transparent without its JS plugin,
   which no consumer uses) and the scroll lock. The backdrop is a black-alpha scrim,
   which is not a theme colour, so it stays a literal (not a token). */
.twc-dialog {
    background: rgba(0, 0, 0, 0.5); /* exception: black-alpha backdrop, not a token */
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Applied to <body> by techwork-components.js while any dialog is open. */
body.twc-dialog-open {
    overflow: hidden;
}

/* Mobile-first: full-width dialogs below Bootstrap's sm breakpoint, and tap targets
   that satisfy the 44px minimum. A .modal-fullscreen dialog keeps Bootstrap's margin: 0 —
   this rule outranks it, and used to push a full-screen dialog 0.5rem right and down so it
   ran off the right and bottom edges of the viewport. */
@media (max-width: 575.98px) {
    .twc-dialog .modal-dialog:not(.modal-fullscreen) {
        margin: 0.5rem;
    }
    .twc-dialog .modal-footer .btn {
        min-height: 44px;
    }
}

.twc-dialog .btn-close {
    min-width: 44px;
    min-height: 44px;
}

/* Dark mode */
[data-bs-theme="dark"] .twc-dialog {
    background: rgba(0, 0, 0, 0.7); /* exception: black-alpha backdrop, not a token */
}
[data-bs-theme="dark"] .twc-dialog .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.75;
}
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-dialog {
        background: rgba(0, 0, 0, 0.7); /* exception: black-alpha backdrop, not a token */
    }
    :root:not([data-bs-theme]) .twc-dialog .btn-close {
        filter: invert(1) grayscale(100%) brightness(200%);
        opacity: 0.75;
    }
}

/* ── Small components (ConfirmDialog, EmptyState, status, StatCard, CopyButton, settings) ── */
/* Self-contained fallback for ConfirmDialog, EmptyState, StatusDot / StatusChip and
   SettingsShell / SettingsRailGroup / SettingsRailLink. The .status-*, .empty-panel,
   .btn-dashed-add and .settings-* classes ALSO ship in techwork-theme.css; the values here
   are kept identical to those (and to the Stayant redesign they came from) so the two agree
   and the components look right without the theme sheet. Every colour, radius and font is
   var(--twc-…, <light literal>); the dark literals sit under [data-bs-theme="dark"], with a
   prefers-color-scheme mirror scoped to :root:not([data-bs-theme]) for pages that set no
   attribute. With the theme loaded the tokens resolve and the literals never apply. */

/* ConfirmDialog — tap targets ≥44px; full-width buttons on the narrowest phones. */
.twc-confirm-btn {
    min-height: 44px;
    min-width: 88px;
}

.twc-confirm-dialog .twc-confirm-btn:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

@media (max-width: 400px) {
    .twc-confirm-btn {
        flex: 1 1 auto;
    }
}

/* Status dot + word. The word is always present; the pair never splits across a wrap. */
.status-word {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.status-dot {
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--twc-color-muted, #64748b);
}

.status-dot-primary { background: var(--twc-color-primary, #3b5bdb); }
.status-dot-muted { background: var(--twc-color-muted, #64748b); }
.status-dot-warning { background: var(--twc-color-warning, #92400e); }
.status-dot-success { background: var(--twc-color-success, #166534); }
.status-dot-danger { background: var(--twc-color-danger, #dc2626); }

/* Status chip (outlined). -pending: dashed, unfilled — a not-yet-true state.
   -danger: the one place a chip takes the danger colour — a state that IS a failure. */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 2px 9px;
    border-radius: var(--twc-radius-sm, 0.375rem);
    border: 1px solid color-mix(in srgb, var(--twc-color-primary, #3b5bdb) 45%, transparent);
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    color: var(--twc-color-primary-hover, #1e3a8a);
    font-size: 0.78rem;
    line-height: 1.4;
    white-space: nowrap;
}

.status-chip-pending {
    background: transparent;
    border-style: dashed;
}

.status-chip-danger {
    border-color: color-mix(in srgb, var(--twc-color-danger, #dc2626) 45%, transparent);
    background: color-mix(in srgb, var(--twc-color-danger, #dc2626) 10%, transparent);
    color: var(--twc-color-danger, #dc2626);
}

/* Empty state. .empty-panel is the shared pattern; .twc-empty-state (EmptyState only) stacks
   icon, text and action vertically, leaving hand-written .empty-panel markup untouched. */
.empty-panel {
    min-height: 12rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    color: var(--twc-color-muted, #64748b);
    background: color-mix(in srgb, var(--twc-color-card-bg, #ffffff) 88%, var(--twc-color-bg, #f5f6f8));
    border-radius: var(--twc-radius-card, 0.875rem);
    border: 1px dashed var(--twc-color-border, #e2e8f0);
}

.empty-panel strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--twc-color-text, #111827);
}

.twc-empty-state {
    flex-direction: column;
    gap: 0.75rem;
}

.empty-panel-icon {
    font-size: 2rem;
    line-height: 1;
    color: var(--twc-color-muted, #64748b);
}

.empty-panel-text {
    margin: 0;
    max-width: 40rem;
}

/* Dashed add — the action inside an empty state, and "Add …" buttons generally. */
.btn-dashed-add {
    background: transparent;
    color: var(--twc-color-primary-hover, #1e3a8a);
    border: 1px dashed var(--twc-color-primary, #3b5bdb);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-dashed-add:hover:not(:disabled) {
    border-style: solid;
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    color: var(--twc-color-primary-hover, #1e3a8a);
}

.btn-dashed-add:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.twc-empty-state .btn-dashed-add {
    min-height: 44px;
}

/* EmptyState Compact — one line inside a card: no 12rem minimum, card-header-like padding, the
   parts in a row and start-aligned. The action keeps its 44px target; the row wraps only when
   the sentence and the action cannot share a line. */
.twc-empty-state.twc-empty-state-compact {
    min-height: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    text-align: start;
    gap: 0.5rem 0.75rem;
    padding: 0.6rem 0.9rem;
    font-size: var(--twc-font-size-sm, 0.875rem);
    border-radius: var(--twc-radius-md, 0.5rem);
}

.twc-empty-state-compact .empty-panel-icon {
    font-size: 1.25rem;
}

.twc-empty-state-compact .empty-panel-text {
    flex: 0 1 auto;
    min-width: 0;
}

/* The action sits at the row's end, not wherever the sentence stops. */
.twc-empty-state-compact .btn-dashed-add {
    margin-left: auto;
}

/* StatCard — the .kpi pattern (R2: the figure in body ink, weight 500, tabular numerals; an
   eyebrow label; a muted meta line). The .kpi* classes ALSO ship in techwork-theme.css with the
   same values; these copies keep StatCard right without the theme sheet. A non-default Variant
   only draws a 3px accent rule on the leading edge — never a coloured figure. */
.kpi {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.kpi-large {
    padding: 0.9rem 1rem;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-card, 0.875rem);
    background: var(--twc-color-card-bg, #ffffff);
}

.kpi-label {
    font-size: 0.66rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--twc-color-subtle, #475569);
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--twc-color-text, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-meta {
    font-size: 0.78rem;
    color: var(--twc-color-subtle, #475569);
}

.kpi-small .kpi-value {
    font-size: 1.05rem;
}

.kpi-suffix {
    font-size: 0.8rem;
    color: var(--twc-color-subtle, #475569);
    font-weight: 400;
}

.twc-stat-card .kpi-value {
    font-variant-numeric: tabular-nums;
}

.twc-stat-card-accent-primary {
    box-shadow: inset 3px 0 0 var(--twc-color-primary, #3b5bdb);
}

.twc-stat-card-accent-success {
    box-shadow: inset 3px 0 0 var(--twc-color-success, #166534);
}

@media (max-width: 575.98px) {
    .kpi-value {
        font-size: 1.4rem;
    }
}

/* CopyButton — .copy-btn: a 16px glyph in a 44×44 tap target, muted until hovered. The class
   ALSO ships in techwork-theme.css with the same values. */
.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: transparent;
    color: var(--twc-color-muted, #64748b);
    cursor: pointer;
}

.copy-btn:hover,
.copy-btn:focus-visible {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

.copy-btn:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.copy-btn .material-icons {
    font-size: 1rem;
}

/* SettingsShell — a wrapping flex row: the content carries the dominant grow, so the rail
   keeps 14rem beside it on desktop and drops above it when it cannot fit. */
.settings-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
    align-items: flex-start;
}

.settings-rail {
    flex: 1 1 14rem;
    max-width: 14rem;
    position: sticky;
    top: 5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-rail-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
    break-inside: avoid;
}

.settings-rail-heading {
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--twc-color-muted, #64748b);
    padding: 0 0.525rem 0.25rem;
}

.settings-rail-link {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--twc-color-text, #111827);
    text-decoration: none;
    padding: 0.375rem 0.525rem;
    border-radius: var(--twc-radius-sm, 0.375rem);
    font-size: 0.845rem;
    font-weight: 400;
    line-height: 1.3;
    transition: background 0.12s, color 0.12s;
    cursor: pointer;
    outline: none;
}

.settings-rail-link:hover,
.settings-rail-link:focus-visible {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

/* Active: primary tint with an inset marker, not a filled block. */
.settings-rail-link.active,
.settings-rail-link.active:hover {
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    color: var(--twc-color-primary, #3b5bdb);
    box-shadow: inset 2px 0 0 var(--twc-color-primary, #3b5bdb);
}

.settings-rail-link:focus-visible {
    box-shadow: 0 0 0 2px var(--twc-color-primary, #3b5bdb);
}

.settings-rail-icon {
    font-size: 1.1rem;
    line-height: 1;
    vertical-align: -0.2em;
    margin-right: 0.5rem;
}

.settings-content {
    flex: 100 1 32rem;
    min-width: 0;
    max-width: 56rem;
}

/* SinglePanel's back link — rendered only when a section is selected, shown only on phones. */
.settings-back {
    display: none;
}

@media (max-width: 767.98px) {
    .settings-layout {
        gap: 1rem;
    }

    /* Stacked (default): the rail becomes a short multi-column block above the content. */
    .settings-rail {
        position: static;
        display: block;
        max-width: none;
        columns: 10.5rem;
        column-gap: 1.25rem;
    }

    .settings-rail-group {
        margin-bottom: 0.8rem;
    }

    .settings-rail-heading {
        padding: 0;
    }

    .settings-rail-link {
        padding: 0.625rem 0.75rem;
        font-size: var(--twc-font-size-base, 1rem);
    }

    /* SinglePanel: one panel at a time. The rail is the whole screen, so it is a single
       full-width list of ≥44px rows rather than columns. */
    .twc-settings-singlepanel .settings-rail {
        flex-basis: 100%;
        columns: auto;
    }

    .twc-settings-singlepanel .settings-rail-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .twc-settings-singlepanel:not(.twc-settings-section) .settings-content {
        display: none;
    }

    .twc-settings-singlepanel.twc-settings-section .settings-rail {
        display: none;
    }

    .twc-settings-singlepanel .settings-back {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        min-height: 44px;
        margin-bottom: 0.5rem;
        color: var(--twc-color-primary, #3b5bdb);
        text-decoration: none;
    }

    .twc-settings-singlepanel .settings-back:focus-visible {
        outline: 2px solid var(--twc-color-primary, #3b5bdb);
        outline-offset: 2px;
        border-radius: var(--twc-radius-sm, 0.375rem);
    }
}

/* Dark mode — dark literals as the fallbacks; the OS-preference mirror follows the block. */
[data-bs-theme="dark"] .twc-confirm-dialog .twc-confirm-btn:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .status-dot { background: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .status-dot-primary { background: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .status-dot-muted { background: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .status-dot-warning { background: var(--twc-color-warning, #fbbf24); }
[data-bs-theme="dark"] .status-dot-success { background: var(--twc-color-success, #86efac); }
[data-bs-theme="dark"] .status-dot-danger { background: var(--twc-color-danger, #f87171); }
[data-bs-theme="dark"] .status-chip {
    border-color: color-mix(in srgb, var(--twc-color-primary, #748ffc) 45%, transparent);
    background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
    color: var(--twc-color-primary-hover, #a3b4ff);
}
[data-bs-theme="dark"] .status-chip-pending { background: transparent; }
[data-bs-theme="dark"] .status-chip-danger {
    border-color: color-mix(in srgb, var(--twc-color-danger, #f87171) 45%, transparent);
    background: color-mix(in srgb, var(--twc-color-danger, #f87171) 10%, transparent);
    color: var(--twc-color-danger, #f87171);
}
[data-bs-theme="dark"] .empty-panel {
    color: var(--twc-color-muted, #a8b0bb);
    background: color-mix(in srgb, var(--twc-color-card-bg, #15191f) 88%, var(--twc-color-bg, #20262d));
    border-color: var(--twc-color-border, #3a424d);
}
[data-bs-theme="dark"] .empty-panel strong { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .empty-panel-icon { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .btn-dashed-add {
    color: var(--twc-color-primary-hover, #a3b4ff);
    border-color: var(--twc-color-primary, #748ffc);
}
[data-bs-theme="dark"] .btn-dashed-add:hover:not(:disabled) {
    background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
    color: var(--twc-color-primary-hover, #a3b4ff);
}
[data-bs-theme="dark"] .btn-dashed-add:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .kpi-large {
    border-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-card-bg, #15191f);
}
[data-bs-theme="dark"] .kpi-label,
[data-bs-theme="dark"] .kpi-meta,
[data-bs-theme="dark"] .kpi-suffix { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .kpi-value { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-stat-card-accent-primary { box-shadow: inset 3px 0 0 var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-stat-card-accent-success { box-shadow: inset 3px 0 0 var(--twc-color-success, #86efac); }
[data-bs-theme="dark"] .copy-btn { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .copy-btn:hover,
[data-bs-theme="dark"] .copy-btn:focus-visible {
    background: var(--twc-color-hover, #232a33);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .copy-btn:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .settings-rail-heading { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .settings-rail-link { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .settings-rail-link:hover,
[data-bs-theme="dark"] .settings-rail-link:focus-visible {
    background: var(--twc-color-hover, #232a33);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .settings-rail-link.active,
[data-bs-theme="dark"] .settings-rail-link.active:hover {
    background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
    color: var(--twc-color-primary, #748ffc);
    box-shadow: inset 2px 0 0 var(--twc-color-primary, #748ffc);
}
[data-bs-theme="dark"] .settings-rail-link:focus-visible { box-shadow: 0 0 0 2px var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-settings-singlepanel .settings-back { color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-settings-singlepanel .settings-back:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-confirm-dialog .twc-confirm-btn:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .status-dot { background: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .status-dot-primary { background: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .status-dot-muted { background: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .status-dot-warning { background: var(--twc-color-warning, #fbbf24); }
    :root:not([data-bs-theme]) .status-dot-success { background: var(--twc-color-success, #86efac); }
    :root:not([data-bs-theme]) .status-dot-danger { background: var(--twc-color-danger, #f87171); }
    :root:not([data-bs-theme]) .status-chip {
        border-color: color-mix(in srgb, var(--twc-color-primary, #748ffc) 45%, transparent);
        background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
        color: var(--twc-color-primary-hover, #a3b4ff);
    }
    :root:not([data-bs-theme]) .status-chip-pending { background: transparent; }
    :root:not([data-bs-theme]) .status-chip-danger {
        border-color: color-mix(in srgb, var(--twc-color-danger, #f87171) 45%, transparent);
        background: color-mix(in srgb, var(--twc-color-danger, #f87171) 10%, transparent);
        color: var(--twc-color-danger, #f87171);
    }
    :root:not([data-bs-theme]) .empty-panel {
        color: var(--twc-color-muted, #a8b0bb);
        background: color-mix(in srgb, var(--twc-color-card-bg, #15191f) 88%, var(--twc-color-bg, #20262d));
        border-color: var(--twc-color-border, #3a424d);
    }
    :root:not([data-bs-theme]) .empty-panel strong { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .empty-panel-icon { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .btn-dashed-add {
        color: var(--twc-color-primary-hover, #a3b4ff);
        border-color: var(--twc-color-primary, #748ffc);
    }
    :root:not([data-bs-theme]) .btn-dashed-add:hover:not(:disabled) {
        background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
        color: var(--twc-color-primary-hover, #a3b4ff);
    }
    :root:not([data-bs-theme]) .btn-dashed-add:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .kpi-large {
        border-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-card-bg, #15191f);
    }
    :root:not([data-bs-theme]) .kpi-label,
    :root:not([data-bs-theme]) .kpi-meta,
    :root:not([data-bs-theme]) .kpi-suffix { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .kpi-value { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-stat-card-accent-primary { box-shadow: inset 3px 0 0 var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-stat-card-accent-success { box-shadow: inset 3px 0 0 var(--twc-color-success, #86efac); }
    :root:not([data-bs-theme]) .copy-btn { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .copy-btn:hover,
    :root:not([data-bs-theme]) .copy-btn:focus-visible {
        background: var(--twc-color-hover, #232a33);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .copy-btn:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .settings-rail-heading { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .settings-rail-link { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .settings-rail-link:hover,
    :root:not([data-bs-theme]) .settings-rail-link:focus-visible {
        background: var(--twc-color-hover, #232a33);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .settings-rail-link.active,
    :root:not([data-bs-theme]) .settings-rail-link.active:hover {
        background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
        color: var(--twc-color-primary, #748ffc);
        box-shadow: inset 2px 0 0 var(--twc-color-primary, #748ffc);
    }
    :root:not([data-bs-theme]) .settings-rail-link:focus-visible { box-shadow: 0 0 0 2px var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-settings-singlepanel .settings-back { color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-settings-singlepanel .settings-back:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}

/* ── Banner ──────────────────────────────────────────────────────────────────
   A notice strip above a page (AppShell's Banners slot) or at the top of a card. The tone pairs
   are the theme's .alert-* pairs (background, ink, a 30% tone border, radius-md), so a Banner
   and an .alert look alike. In flow — no z-index. Icon top-aligned; at ≤575.98px the actions
   drop onto their own full row under the text while the ✕ stays top-right. Every action and the
   ✕ is a 44px target. */
.twc-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid color-mix(in srgb, var(--twc-color-primary, #3b5bdb) 30%, transparent);
    border-radius: var(--twc-radius-md, 0.5rem);
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    color: var(--twc-color-primary-hover, #1e3a8a);
    line-height: 1.5;
}

.twc-banner-warning {
    border-color: color-mix(in srgb, var(--twc-color-warning, #92400e) 30%, transparent);
    background: var(--twc-color-warning-bg, #fef3c7);
    color: var(--twc-color-warning, #92400e);
}

.twc-banner-danger {
    border-color: color-mix(in srgb, var(--twc-color-danger, #dc2626) 30%, transparent);
    background: var(--twc-color-danger-bg, #fef2f2);
    color: var(--twc-color-danger-hover, #b91c1c);
}

.twc-banner-success {
    border-color: color-mix(in srgb, var(--twc-color-success, #166534) 30%, transparent);
    background: var(--twc-color-success-bg, #dcfce7);
    color: var(--twc-color-success, #166534);
}

.twc-banner-icon {
    flex: none;
    font-size: 1.25rem;
    line-height: 1.5rem;
}

.twc-banner-body {
    flex: 1 1 0;
    min-width: 0;
    align-self: center;
    overflow-wrap: anywhere;
}

.twc-banner-title {
    font-weight: 500;
    margin-right: 0.25rem;
}

.twc-banner-actions {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.twc-banner-actions .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.twc-banner-dismiss {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -0.625rem -0.75rem -0.625rem 0;
    padding: 0;
    border: 0;
    border-radius: var(--twc-radius-md, 0.5rem);
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.twc-banner-dismiss .material-icons {
    font-size: 1.125rem;
}

.twc-banner-dismiss:hover {
    background: color-mix(in srgb, currentColor 10%, transparent);
}

.twc-banner-dismiss:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .twc-banner {
        flex-wrap: wrap;
    }

    .twc-banner-actions {
        order: 1;
        flex-basis: 100%;
    }
}

/* BannerStack: the banners above a page, highest priority first. No colours of its own. */
.twc-banner-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Banner, dark mode — dark literals as the fallbacks; the OS-preference mirror follows. */
[data-bs-theme="dark"] .twc-banner {
    border-color: color-mix(in srgb, var(--twc-color-primary, #748ffc) 30%, transparent);
    background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
    color: var(--twc-color-primary-hover, #a3b4ff);
}
[data-bs-theme="dark"] .twc-banner-warning {
    border-color: color-mix(in srgb, var(--twc-color-warning, #fbbf24) 30%, transparent);
    background: var(--twc-color-warning-bg, #451a03);
    color: var(--twc-color-warning, #fbbf24);
}
[data-bs-theme="dark"] .twc-banner-danger {
    border-color: color-mix(in srgb, var(--twc-color-danger, #f87171) 30%, transparent);
    background: var(--twc-color-danger-bg, #2d1515);
    color: var(--twc-color-danger-hover, #fca5a5);
}
[data-bs-theme="dark"] .twc-banner-success {
    border-color: color-mix(in srgb, var(--twc-color-success, #86efac) 30%, transparent);
    background: var(--twc-color-success-bg, #14532d);
    color: var(--twc-color-success, #86efac);
}
[data-bs-theme="dark"] .twc-banner-dismiss:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }

/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-banner {
        border-color: color-mix(in srgb, var(--twc-color-primary, #748ffc) 30%, transparent);
        background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
        color: var(--twc-color-primary-hover, #a3b4ff);
    }
    :root:not([data-bs-theme]) .twc-banner-warning {
        border-color: color-mix(in srgb, var(--twc-color-warning, #fbbf24) 30%, transparent);
        background: var(--twc-color-warning-bg, #451a03);
        color: var(--twc-color-warning, #fbbf24);
    }
    :root:not([data-bs-theme]) .twc-banner-danger {
        border-color: color-mix(in srgb, var(--twc-color-danger, #f87171) 30%, transparent);
        background: var(--twc-color-danger-bg, #2d1515);
        color: var(--twc-color-danger-hover, #fca5a5);
    }
    :root:not([data-bs-theme]) .twc-banner-success {
        border-color: color-mix(in srgb, var(--twc-color-success, #86efac) 30%, transparent);
        background: var(--twc-color-success-bg, #14532d);
        color: var(--twc-color-success, #86efac);
    }
    :root:not([data-bs-theme]) .twc-banner-dismiss:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}

/* ── App shell ──────────────────────────────────────────────────────────────
   AppShell · SideNav · NavItem · ThemeToggle. Ported from Stayant's MainLayout.razor.css +
   NavMenu.razor.css with the redesign's values (224px rail, 56px topbar, 44px nav rows, inset
   active marker). The class names are a contract consumers' CSS and E2E selectors rely on.

   THE RAIL IS DARK IN BOTH THEMES. Its background reads --twc-color-sidebar-bg (dark in both
   themes by definition); the rest of its palette (hover, active, row/heading/footer text, the
   hairline borders) is theme-independent literals on purpose, each tagged "rail palette": a
   light/dark token would flip it with the theme. Everything else is var(--twc-…, literal), so
   the shell is complete without techwork-theme.css.

   Breakpoints (the app's, not Bootstrap's): ≤900px the rail becomes an off-canvas drawer;
   ≤640px the topbar declutters; ≤575.98px the content padding tightens.

   Nav rules are scoped under .nav-items so Bootstrap's own .nav-item (tabs, pills, navbar)
   elsewhere on the page is never restyled as a rail row. */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--twc-color-bg, #f5f6f8);
    color: var(--twc-color-text, #111827);
}

.app-shell .sidebar {
    width: var(--twc-sidebar-width, 224px);
    flex-shrink: 0;
    background: var(--twc-color-sidebar-bg, #17212d);
    color: #f1f5f9; /* rail palette */
    padding: 1rem 0.7rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08); /* rail palette */
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
}

.app-shell .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-shell .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: inherit;
    text-decoration: none;
}

.app-shell .brand:hover,
.app-shell .brand:focus-visible {
    color: #ffffff; /* rail palette */
}

.app-shell .brand-logo {
    display: block;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

/* Hamburger and ✕ — hidden above 900px. 44×44 tap targets (touch is first-class). */
.app-shell .menu-toggle,
.app-shell .sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.app-shell .sidebar-close {
    color: #f1f5f9; /* rail palette */
    font-size: 1.5rem;
}

.app-shell .menu-toggle {
    font-size: 1.4rem;
}

.app-shell .shell-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-shell .topbar {
    min-height: var(--twc-topbar-height, 56px);
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
    background: var(--twc-color-card-bg, #ffffff);
    color: inherit;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Grows to fill the bar and truncates, instead of pushing .topbar-end off-screen. */
.app-shell .topbar-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--twc-color-subtle, #475569);
    min-width: 0;
    flex: 1 1 auto;
}

.app-shell .topbar-title .material-icons {
    flex-shrink: 0;
}

/* Optional helper for the title's text span: ellipsis instead of wrapping. */
.app-shell .topbar-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.app-shell .topbar-end {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.app-shell .content-area {
    padding: var(--twc-content-padding, 1.5rem);
}

.app-shell .sidebar-overlay {
    display: none;
}

/* ── Rail navigation ── */
.nav-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.nav-items .nav-item {
    color: #cbd5e1; /* rail palette */
    text-decoration: none;
    padding: 0.4rem 0.55rem;
    min-height: 44px;
    border-radius: var(--twc-radius-md, 0.5rem);
    font-size: 0.85rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    transition: background 0.12s, color 0.12s;
}

.nav-items .nav-item:hover {
    background: #213040; /* rail palette */
    color: #ffffff; /* rail palette */
}

/* Redesign D3: a 2px inset marker so the active row reads at a glance on the dark rail.
   Neutral slate, not a primary tint. */
.nav-items .nav-item.active {
    background: #2a3644; /* rail palette */
    color: #ffffff; /* rail palette */
    box-shadow: inset 2px 0 0 #ffffff; /* rail palette */
}

/* Push a row (e.g. Profile/Settings) to the bottom of the rail. */
.nav-items .nav-item-settings {
    margin-top: auto;
}

/* Indented child row. */
.nav-items .nav-item-sub {
    padding-left: 1.5rem;
}

.nav-items .nav-icon {
    font-size: 1rem;
    margin-right: 0.6rem;
    opacity: 0.8;
    flex-shrink: 0;
}

.nav-items .nav-label {
    min-width: 0;
}

/* Unread count, flush right whatever the label length. */
.nav-items .nav-badge {
    margin-left: auto;
    background-color: var(--bs-danger, #dc3545); /* Bootstrap chain, not --twc-color-danger: white must stay legible on it in both themes */
    color: #ffffff; /* exception: white on the solid danger badge */
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.2rem 0.45rem;
    min-width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Rail footer ── */
.app-shell .sidebar-footer {
    margin-top: auto;
    padding: 0.7rem 0.5rem 0.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08); /* rail palette */
    font-size: 0.7rem;
    text-align: left;
    color: #94a3b8; /* rail palette */
    flex-shrink: 0;
}

.app-shell .sidebar-footer-links {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.2rem;
}

.app-shell .sidebar-footer a {
    color: #cbd5e1; /* rail palette */
    text-decoration: none;
}

.app-shell .sidebar-footer a:hover {
    color: #ffffff; /* rail palette */
    text-decoration: underline;
}

.app-shell .sidebar-footer-copy {
    color: #64748b; /* rail palette */
}

/* ── ThemeToggle — 44×44 icon button ── */
.twc-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--twc-color-subtle, #475569);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--twc-radius-md, 0.5rem);
    padding: 0.25rem;
    transition: background 0.15s, color 0.15s;
}

.twc-theme-toggle:hover,
.twc-theme-toggle:focus-visible {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

.twc-theme-toggle:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 1px;
}

/* ── ≤900px: the rail becomes an off-canvas drawer ── */
@media (max-width: 900px) {
    .app-shell .menu-toggle,
    .app-shell .sidebar-close {
        display: inline-flex;
    }

    .app-shell .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: var(--twc-z-drawer, 20);
        transform: translateX(-100%);
        transition: transform 0.2s ease-in-out;
    }

    .app-shell .sidebar.open {
        transform: translateX(0);
    }

    .app-shell .sidebar-overlay.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35); /* exception: black-alpha scrim, not a token */
        z-index: var(--twc-z-drawer-overlay, 10);
    }
}

/* ── ≤640px: declutter the topbar so the title has room ── */
@media (max-width: 640px) {
    .app-shell .topbar {
        padding: 0 0.5rem;
        gap: 0.25rem;
    }
}

@media (max-width: 575.98px) {
    .app-shell .content-area {
        padding: var(--twc-content-padding, 1rem);
    }
}

/* ── App shell, dark mode ──
   Keyed on [data-bs-theme="dark"] — the attribute techwork-theme.js and the boot script
   write (stored choice wins, else the OS) — with the usual OS-preference mirror after it for a
   page that sets no attribute (e.g. before the boot script has run). With techwork-theme.css
   loaded the tokens already carry dark values; the fallbacks here are the dark literals, so the
   shell is right without it. The rail stays dark but moves onto the card surface, matching the topbar. */
[data-bs-theme="dark"] .app-shell {
    background: var(--twc-color-bg, #20262d);
    color: var(--twc-color-text, #f1f5f9);
}

[data-bs-theme="dark"] .app-shell .sidebar {
    background: var(--twc-color-card-bg, #15191f);
}

/* border-style: none mirrors the source shell: in dark the topbar sits flush on the content. */
[data-bs-theme="dark"] .app-shell .topbar {
    background: var(--twc-color-card-bg, #15191f);
    border-bottom-color: var(--twc-color-border, #343b46);
    border-style: none;
    color: var(--twc-color-text, #f1f5f9);
}

[data-bs-theme="dark"] .app-shell .topbar-title {
    color: var(--twc-color-muted, #a8b0bb);
}

[data-bs-theme="dark"] .app-shell .content-area {
    background: var(--twc-color-bg, #20262d);
    color: var(--twc-color-text, #f1f5f9);
}

[data-bs-theme="dark"] .nav-items .nav-item:hover,
[data-bs-theme="dark"] .nav-items .nav-item.active {
    background: var(--twc-color-hover, #252c35);
    color: #ffffff; /* rail palette */
}

[data-bs-theme="dark"] .nav-items .nav-item.active {
    box-shadow: inset 2px 0 0 #ffffff; /* rail palette */
}

[data-bs-theme="dark"] .app-shell .sidebar-footer {
    border-top-color: var(--twc-color-border, #343b46);
    color: var(--twc-color-muted, rgba(222, 226, 230, 0.75));
}

[data-bs-theme="dark"] .app-shell .sidebar-footer a {
    color: var(--twc-color-text, #f3f6fb);
}

[data-bs-theme="dark"] .app-shell .sidebar-footer a:hover {
    color: #ffffff; /* rail palette */
}

[data-bs-theme="dark"] .app-shell .sidebar-footer-copy {
    color: var(--twc-color-muted, rgba(222, 226, 230, 0.75));
}

[data-bs-theme="dark"] .twc-theme-toggle {
    color: var(--twc-color-muted, #a8b0bb);
}

[data-bs-theme="dark"] .twc-theme-toggle:hover,
[data-bs-theme="dark"] .twc-theme-toggle:focus-visible {
    background: var(--twc-color-hover, #252c35);
    color: var(--twc-color-text, #f1f5f9);
}
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .app-shell {
        background: var(--twc-color-bg, #20262d);
        color: var(--twc-color-text, #f1f5f9);
    }

    :root:not([data-bs-theme]) .app-shell .sidebar {
        background: var(--twc-color-card-bg, #15191f);
    }

    /* border-style: none mirrors the source shell: in dark the topbar sits flush on the content. */
    :root:not([data-bs-theme]) .app-shell .topbar {
        background: var(--twc-color-card-bg, #15191f);
        border-bottom-color: var(--twc-color-border, #343b46);
        border-style: none;
        color: var(--twc-color-text, #f1f5f9);
    }

    :root:not([data-bs-theme]) .app-shell .topbar-title {
        color: var(--twc-color-muted, #a8b0bb);
    }

    :root:not([data-bs-theme]) .app-shell .content-area {
        background: var(--twc-color-bg, #20262d);
        color: var(--twc-color-text, #f1f5f9);
    }

    :root:not([data-bs-theme]) .nav-items .nav-item:hover,
    :root:not([data-bs-theme]) .nav-items .nav-item.active {
        background: var(--twc-color-hover, #252c35);
        color: #ffffff; /* rail palette */
    }

    :root:not([data-bs-theme]) .nav-items .nav-item.active {
        box-shadow: inset 2px 0 0 #ffffff; /* rail palette */
    }

    :root:not([data-bs-theme]) .app-shell .sidebar-footer {
        border-top-color: var(--twc-color-border, #343b46);
        color: var(--twc-color-muted, rgba(222, 226, 230, 0.75));
    }

    :root:not([data-bs-theme]) .app-shell .sidebar-footer a {
        color: var(--twc-color-text, #f3f6fb);
    }

    :root:not([data-bs-theme]) .app-shell .sidebar-footer a:hover {
        color: #ffffff; /* rail palette */
    }

    :root:not([data-bs-theme]) .app-shell .sidebar-footer-copy {
        color: var(--twc-color-muted, rgba(222, 226, 230, 0.75));
    }

    :root:not([data-bs-theme]) .twc-theme-toggle {
        color: var(--twc-color-muted, #a8b0bb);
    }

    :root:not([data-bs-theme]) .twc-theme-toggle:hover,
    :root:not([data-bs-theme]) .twc-theme-toggle:focus-visible {
        background: var(--twc-color-hover, #252c35);
        color: var(--twc-color-text, #f1f5f9);
    }
}

/* ── TabWorkspace (TabStrip, TabSwitcher) ──────────────────────────────────
   A row of open tabs on wide screens and, at ≤900px, a floating switcher button that opens a
   bottom sheet instead. Ported from Taskant's workspace with every value as var(--twc-…, literal),
   so it is complete without techwork-theme.css.

   Markup contract (consumers' E2E selectors target it): .tab-strip (role="tablist") holds one
   .tab-strip-item per tab (.active when focused, data-testid="tab-{route}"), each holding the
   role="tab" .twc-tab-label (.tab-icon + .tab-title) and a sibling .tab-close; tabs past
   VisibleCount go in .tab-overflow (.tab-overflow-toggle + .tab-overflow-menu). The switcher is
   .tab-switcher-fab (+ .tab-switcher-count), .tab-switcher-scrim and .tab-switcher-sheet of
   .tab-switcher-row (.tab-switcher-select + .tab-switcher-close).

   Sizing follows the input: a coarse (touch) pointer keeps 44px targets; a fine (mouse) pointer
   gets a compact, browser-like 30px strip. The page layout around the strip (the panels, which
   one is visible) is the consumer's. */
.tab-strip {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
    overflow-x: auto;
}

.tab-strip-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    white-space: nowrap;
    color: var(--twc-color-muted, #64748b);
}

.tab-strip-item.active {
    background: var(--twc-color-card-bg, #ffffff);
    color: var(--twc-color-text, #111827);
    border-color: var(--twc-color-border, #e2e8f0);
}

.tab-strip .twc-tab-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    align-self: stretch;
    border-radius: var(--twc-radius-sm, 0.375rem);
}

.tab-strip .twc-tab-label:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 1px;
}

.tab-strip .tab-close,
.tab-overflow-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.tab-strip .tab-close {
    color: inherit;
}

.tab-overflow-toggle {
    color: var(--twc-color-muted, #64748b);
}

.tab-overflow {
    position: relative;
    display: flex;
    align-items: center;
}

.tab-overflow-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: var(--twc-z-menu, 20);
    min-width: 12rem;
    list-style: none;
    margin: 0;
    padding: 0.25rem;
    background: var(--twc-color-card-bg, #ffffff);
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-sm, 0.375rem);
}

.tab-overflow-menu button {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: transparent;
    color: var(--twc-color-text, #111827);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.tab-overflow-menu button.active {
    font-weight: 600;
}

.tab-overflow-menu button:hover,
.tab-overflow-menu button:focus-visible {
    background: var(--twc-color-hover, #eef1f6);
}

/* Compact the strip for precise (mouse) pointers only; touch keeps the 44px targets above. */
@media (pointer: fine) {
    .tab-strip {
        gap: 1px;
    }

    .tab-strip-item {
        min-height: 30px;
        padding: 0.15rem 0.5rem;
        gap: 0.3rem;
        font-size: 0.8rem;
    }

    .tab-strip .twc-tab-label {
        gap: 0.3rem;
    }

    .tab-strip-item .tab-icon {
        font-size: 1rem;
    }

    .tab-strip .tab-close {
        min-width: 22px;
        min-height: 22px;
        font-size: 1rem;
    }

    .tab-overflow-toggle {
        min-width: 30px;
        min-height: 30px;
        font-size: 1rem;
    }

    .tab-overflow-menu button {
        min-height: 30px;
        font-size: 0.85rem;
    }
}

/* The switcher exists only at ≤900px; above it the strip is the way in. */
.tab-switcher-fab,
.tab-switcher-scrim,
.tab-switcher-sheet {
    display: none;
}

/* ── ≤900px: the strip gives way to the switcher button + bottom sheet ── */
@media (max-width: 900px) {
    .tab-strip {
        display: none;
    }

    .tab-switcher-fab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        position: fixed;
        right: 1rem;
        bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        z-index: var(--twc-z-fab, 9); /* below the drawer overlay: an open drawer covers it */
        min-width: 44px;
        min-height: 44px;
        padding: 0 0.75rem;
        border-radius: 999px;
        border: 1px solid var(--twc-color-border, #e2e8f0);
        background: var(--twc-color-card-bg, #ffffff);
        color: var(--twc-color-text, #111827);
        cursor: pointer;
    }

    .tab-switcher-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4); /* exception: black-alpha scrim, not a token */
        z-index: var(--twc-z-sheet-overlay, 40);
    }

    .tab-switcher-sheet {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: var(--twc-z-sheet, 41);
        max-height: 60vh;
        overflow-y: auto;
        padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
        background: var(--twc-color-card-bg, #ffffff);
        border-top: 1px solid var(--twc-color-border, #e2e8f0);
        color: var(--twc-color-text, #111827);
    }

    .tab-switcher-row {
        display: flex;
        align-items: center;
        color: var(--twc-color-text, #111827);
    }

    .tab-switcher-row.active {
        font-weight: 600;
    }

    .tab-switcher-select {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 0.4rem;
        min-height: 44px;
        border: none;
        background: transparent;
        color: inherit;
        font: inherit;
        text-align: left;
        cursor: pointer;
    }

    .twc-tab-switcher-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tab-switcher-close {
        min-width: 44px;
        min-height: 44px;
        border: none;
        background: transparent;
        color: var(--twc-color-muted, #64748b);
        font-size: 1.25rem;
        line-height: 1;
        cursor: pointer;
    }
}

/* ── TabWorkspace, dark mode ──
   Keyed on [data-bs-theme="dark"], with the OS-preference mirror after it for a page that sets
   no attribute. The fallbacks are the dark literals, so it is right without techwork-theme.css. */
[data-bs-theme="dark"] .tab-strip {
    border-bottom-color: var(--twc-color-border, #3a424d);
}

[data-bs-theme="dark"] .tab-strip-item {
    color: var(--twc-color-muted, #a8b0bb);
}

[data-bs-theme="dark"] .tab-strip-item.active {
    background: var(--twc-color-card-bg, #15191f);
    color: var(--twc-color-text, #f3f6fb);
    border-color: var(--twc-color-border, #3a424d);
}

[data-bs-theme="dark"] .tab-strip .twc-tab-label:focus-visible {
    outline-color: var(--twc-color-primary, #748ffc);
}

[data-bs-theme="dark"] .tab-overflow-toggle {
    color: var(--twc-color-muted, #a8b0bb);
}

[data-bs-theme="dark"] .tab-overflow-menu {
    background: var(--twc-color-card-bg, #15191f);
    border-color: var(--twc-color-border, #3a424d);
}

[data-bs-theme="dark"] .tab-overflow-menu button {
    color: var(--twc-color-text, #f3f6fb);
}

[data-bs-theme="dark"] .tab-overflow-menu button:hover,
[data-bs-theme="dark"] .tab-overflow-menu button:focus-visible {
    background: var(--twc-color-hover, #232a33);
}

[data-bs-theme="dark"] .tab-switcher-fab {
    border-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-card-bg, #15191f);
    color: var(--twc-color-text, #f3f6fb);
}

[data-bs-theme="dark"] .tab-switcher-sheet {
    background: var(--twc-color-card-bg, #15191f);
    border-top-color: var(--twc-color-border, #3a424d);
    color: var(--twc-color-text, #f3f6fb);
}

[data-bs-theme="dark"] .tab-switcher-row {
    color: var(--twc-color-text, #f3f6fb);
}

[data-bs-theme="dark"] .tab-switcher-close {
    color: var(--twc-color-muted, #a8b0bb);
}
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .tab-strip {
        border-bottom-color: var(--twc-color-border, #3a424d);
    }

    :root:not([data-bs-theme]) .tab-strip-item {
        color: var(--twc-color-muted, #a8b0bb);
    }

    :root:not([data-bs-theme]) .tab-strip-item.active {
        background: var(--twc-color-card-bg, #15191f);
        color: var(--twc-color-text, #f3f6fb);
        border-color: var(--twc-color-border, #3a424d);
    }

    :root:not([data-bs-theme]) .tab-strip .twc-tab-label:focus-visible {
        outline-color: var(--twc-color-primary, #748ffc);
    }

    :root:not([data-bs-theme]) .tab-overflow-toggle {
        color: var(--twc-color-muted, #a8b0bb);
    }

    :root:not([data-bs-theme]) .tab-overflow-menu {
        background: var(--twc-color-card-bg, #15191f);
        border-color: var(--twc-color-border, #3a424d);
    }

    :root:not([data-bs-theme]) .tab-overflow-menu button {
        color: var(--twc-color-text, #f3f6fb);
    }

    :root:not([data-bs-theme]) .tab-overflow-menu button:hover,
    :root:not([data-bs-theme]) .tab-overflow-menu button:focus-visible {
        background: var(--twc-color-hover, #232a33);
    }

    :root:not([data-bs-theme]) .tab-switcher-fab {
        border-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-card-bg, #15191f);
        color: var(--twc-color-text, #f3f6fb);
    }

    :root:not([data-bs-theme]) .tab-switcher-sheet {
        background: var(--twc-color-card-bg, #15191f);
        border-top-color: var(--twc-color-border, #3a424d);
        color: var(--twc-color-text, #f3f6fb);
    }

    :root:not([data-bs-theme]) .tab-switcher-row {
        color: var(--twc-color-text, #f3f6fb);
    }

    :root:not([data-bs-theme]) .tab-switcher-close {
        color: var(--twc-color-muted, #a8b0bb);
    }
}

/* ── Loading (LoadingIndicator, LoadingBar) ────────────────────────────────
   LoadingIndicator: a spinner + label where content will appear. LoadingBar: a thin
   indeterminate bar pinned to the top of the viewport, revealed only after ~200ms of being
   active so quick requests never flash it. Both pure CSS; prefers-reduced-motion slows the
   spinner and swaps the sliding bar for a gentle pulse. */
.twc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.5rem 1rem;
    color: var(--twc-color-muted, #64748b);
    font-size: 0.9375rem;
}

.twc-loading-inline {
    display: inline-flex;
    gap: 0.4rem;
    padding: 0;
    font-size: inherit;
    vertical-align: middle;
}

.twc-spinner {
    flex: none;
    display: inline-block;
    width: 1.375rem;
    height: 1.375rem;
    border: 0.18rem solid var(--twc-color-border, #e2e8f0);
    border-top-color: var(--twc-color-primary, #3b5bdb);
    border-radius: 50%;
    animation: twc-spin 0.75s linear infinite;
}

.twc-loading-inline .twc-spinner {
    width: 1em;
    height: 1em;
    border-width: 0.14em;
}

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

.twc-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    height: 3px;
    overflow: hidden;
    pointer-events: none;
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.15));
    opacity: 0;
    animation: twc-loading-bar-reveal 0.15s ease-out 0.2s forwards;
}

.twc-loading-bar-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    background: var(--twc-color-primary, #3b5bdb);
    animation: twc-loading-bar-slide 1.1s ease-in-out infinite;
}

@keyframes twc-loading-bar-reveal {
    to { opacity: 1; }
}

@keyframes twc-loading-bar-slide {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

@keyframes twc-loading-bar-pulse {
    50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
    .twc-spinner {
        animation-duration: 1.6s;
    }

    .twc-loading-bar-fill {
        width: 100%;
        animation: twc-loading-bar-pulse 1.6s ease-in-out infinite;
    }
}

/* ── Loading, dark mode ── */
[data-bs-theme="dark"] .twc-loading {
    color: var(--twc-color-muted, #a8b0bb);
}

[data-bs-theme="dark"] .twc-spinner {
    border-color: var(--twc-color-border, #3a424d);
    border-top-color: var(--twc-color-primary, #748ffc);
}

[data-bs-theme="dark"] .twc-loading-bar {
    background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.18));
}

[data-bs-theme="dark"] .twc-loading-bar-fill {
    background: var(--twc-color-primary, #748ffc);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-loading {
        color: var(--twc-color-muted, #a8b0bb);
    }

    :root:not([data-bs-theme]) .twc-spinner {
        border-color: var(--twc-color-border, #3a424d);
        border-top-color: var(--twc-color-primary, #748ffc);
    }

    :root:not([data-bs-theme]) .twc-loading-bar {
        background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.18));
    }

    :root:not([data-bs-theme]) .twc-loading-bar-fill {
        background: var(--twc-color-primary, #748ffc);
    }
}

/* ── Stepper ─────────────────────────────────────────────────────────────────────────────
   A step indicator (generalised from Stayant's onboarding rail): progress bar (one hue, R4),
   then an ordered list of steps. State classes on .twc-stepper-step — .is-current /
   .is-complete / .is-skipped / .is-error / .is-todo (+ .is-optional / .is-disabled) — are a
   contract consumers' E2E selectors target. Links (a / button) and plain steps (div) share
   .twc-stepper-link; only links take the hover. Every step is ≥44px tall. */
.twc-stepper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.twc-stepper-progress {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.twc-stepper-track {
    flex: 1 1 auto;
    height: 3px;
    border-radius: 2px;
    background: var(--twc-color-border, #e2e8f0);
    overflow: hidden;
}

.twc-stepper-fill {
    height: 100%;
    background: var(--twc-color-primary, #3b5bdb);
}

.twc-stepper-progress-text {
    font-size: 0.72rem;
    color: var(--twc-color-subtle, #475569);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.twc-stepper-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.twc-stepper-link {
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 0.7rem;
    border: 0;
    border-radius: var(--twc-radius-md, 0.5rem);
    background: transparent;
    color: var(--twc-color-subtle, #475569);
    font: inherit;
    text-align: left;
    text-decoration: none;
}

a.twc-stepper-link,
button.twc-stepper-link {
    cursor: pointer;
}

a.twc-stepper-link:hover,
button.twc-stepper-link:hover {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

a.twc-stepper-link:focus-visible,
button.twc-stepper-link:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: -2px;
}

.twc-stepper-step.is-complete .twc-stepper-link,
.twc-stepper-step.is-skipped .twc-stepper-link,
.twc-stepper-step.is-error .twc-stepper-link {
    color: var(--twc-color-text, #111827);
}

.twc-stepper-step.is-current .twc-stepper-link {
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    box-shadow: inset 2px 0 0 var(--twc-color-primary, #3b5bdb);
    color: var(--twc-color-primary-hover, #1e3a8a);
}

.twc-stepper-step.is-disabled .twc-stepper-link {
    color: var(--twc-color-muted, #64748b);
}

.twc-stepper-marker {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border-radius: 50%;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    line-height: 1;
    color: var(--twc-color-subtle, #475569);
    font-variant-numeric: tabular-nums;
}

.twc-stepper-marker .material-icons {
    font-size: 18px;
}

.twc-stepper-step.is-current .twc-stepper-marker {
    border-color: var(--twc-color-primary, #3b5bdb);
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    color: var(--twc-color-primary, #3b5bdb);
}

.twc-stepper-step.is-complete .twc-stepper-marker,
.twc-stepper-step.is-skipped .twc-stepper-marker,
.twc-stepper-step.is-error .twc-stepper-marker {
    border: 0;
}

.twc-stepper-step.is-complete .twc-stepper-marker { color: var(--twc-color-primary, #3b5bdb); }
.twc-stepper-step.is-skipped .twc-stepper-marker { color: var(--twc-color-muted, #64748b); }
.twc-stepper-step.is-error .twc-stepper-marker { color: var(--twc-color-danger, #dc2626); }

.twc-stepper-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.twc-stepper-title {
    font-size: 0.845rem;
    overflow-wrap: anywhere;
}

.twc-stepper-meta {
    font-size: 0.72rem;
    color: var(--twc-color-subtle, #475569);
}

/* Compact form: a segmented strip (aria-hidden; the progressbar keeps the numbers, visually
   hidden here) and a ≥44px toggle disclosing the same list. Shown ≤767.98px for Auto and at
   every width for Horizontal; the list then shows only while the nav is .is-expanded. */
.twc-stepper-compact {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
}

.twc-stepper-strip {
    display: flex;
    gap: 3px;
}

.twc-stepper-segment {
    flex: 1 1 0;
    height: 4px;
    border-radius: 2px;
    background: var(--twc-color-border, #e2e8f0);
}

.twc-stepper-segment.is-complete,
.twc-stepper-segment.is-skipped { background: var(--twc-color-primary, #3b5bdb); }
.twc-stepper-segment.is-current { background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12)); }

.twc-stepper-toggle {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: var(--twc-radius-md, 0.5rem);
    background: var(--twc-color-card-bg, #ffffff);
    color: var(--twc-color-text, #111827);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.twc-stepper-toggle:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.twc-stepper-toggle-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.845rem;
}

.twc-stepper-toggle-hint {
    flex: none;
    font-size: 0.72rem;
    color: var(--twc-color-subtle, #475569);
}

.twc-stepper-toggle .material-icons {
    flex: none;
    font-size: 20px;
    color: var(--twc-color-subtle, #475569);
}

.twc-stepper-toggle[aria-expanded="true"] .material-icons { transform: rotate(180deg); }

.twc-stepper-horizontal .twc-stepper-compact { display: flex; }
.twc-stepper-horizontal:not(.is-expanded) .twc-stepper-list { display: none; }
.twc-stepper-horizontal .twc-stepper-progress {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .twc-stepper-auto .twc-stepper-compact { display: flex; }
    .twc-stepper-auto:not(.is-expanded) .twc-stepper-list { display: none; }
    .twc-stepper-auto .twc-stepper-progress {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

[data-bs-theme="dark"] .twc-stepper-track { background: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-stepper-fill { background: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-stepper-progress-text,
[data-bs-theme="dark"] .twc-stepper-meta,
[data-bs-theme="dark"] .twc-stepper-link { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] a.twc-stepper-link:hover,
[data-bs-theme="dark"] button.twc-stepper-link:hover {
    background: var(--twc-color-hover, #232a33);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] a.twc-stepper-link:focus-visible,
[data-bs-theme="dark"] button.twc-stepper-link:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-stepper-step.is-complete .twc-stepper-link,
[data-bs-theme="dark"] .twc-stepper-step.is-skipped .twc-stepper-link,
[data-bs-theme="dark"] .twc-stepper-step.is-error .twc-stepper-link { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-stepper-step.is-current .twc-stepper-link {
    background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
    box-shadow: inset 2px 0 0 var(--twc-color-primary, #748ffc);
    color: var(--twc-color-primary-hover, #a3b4ff);
}
[data-bs-theme="dark"] .twc-stepper-step.is-disabled .twc-stepper-link { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-stepper-marker {
    border-color: var(--twc-color-border-input, #4c5663);
    color: var(--twc-color-subtle, #d7dce3);
}
[data-bs-theme="dark"] .twc-stepper-step.is-current .twc-stepper-marker {
    border-color: var(--twc-color-primary, #748ffc);
    background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
    color: var(--twc-color-primary, #748ffc);
}
[data-bs-theme="dark"] .twc-stepper-step.is-complete .twc-stepper-marker { color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-stepper-step.is-skipped .twc-stepper-marker { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-stepper-step.is-error .twc-stepper-marker { color: var(--twc-color-danger, #f87171); }
[data-bs-theme="dark"] .twc-stepper-segment { background: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-stepper-segment.is-complete,
[data-bs-theme="dark"] .twc-stepper-segment.is-skipped { background: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-stepper-segment.is-current { background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
[data-bs-theme="dark"] .twc-stepper-toggle {
    border-color: var(--twc-color-border-input, #4c5663);
    background: var(--twc-color-card-bg, #15191f);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-stepper-toggle:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-stepper-toggle-hint,
[data-bs-theme="dark"] .twc-stepper-toggle .material-icons { color: var(--twc-color-subtle, #d7dce3); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-stepper-track { background: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-stepper-fill { background: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-stepper-progress-text,
    :root:not([data-bs-theme]) .twc-stepper-meta,
    :root:not([data-bs-theme]) .twc-stepper-link { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) a.twc-stepper-link:hover,
    :root:not([data-bs-theme]) button.twc-stepper-link:hover {
        background: var(--twc-color-hover, #232a33);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) a.twc-stepper-link:focus-visible,
    :root:not([data-bs-theme]) button.twc-stepper-link:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-stepper-step.is-complete .twc-stepper-link,
    :root:not([data-bs-theme]) .twc-stepper-step.is-skipped .twc-stepper-link,
    :root:not([data-bs-theme]) .twc-stepper-step.is-error .twc-stepper-link { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-stepper-step.is-current .twc-stepper-link {
        background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
        box-shadow: inset 2px 0 0 var(--twc-color-primary, #748ffc);
        color: var(--twc-color-primary-hover, #a3b4ff);
    }
    :root:not([data-bs-theme]) .twc-stepper-step.is-disabled .twc-stepper-link { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-stepper-marker {
        border-color: var(--twc-color-border-input, #4c5663);
        color: var(--twc-color-subtle, #d7dce3);
    }
    :root:not([data-bs-theme]) .twc-stepper-step.is-current .twc-stepper-marker {
        border-color: var(--twc-color-primary, #748ffc);
        background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
        color: var(--twc-color-primary, #748ffc);
    }
    :root:not([data-bs-theme]) .twc-stepper-step.is-complete .twc-stepper-marker { color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-stepper-step.is-skipped .twc-stepper-marker { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-stepper-step.is-error .twc-stepper-marker { color: var(--twc-color-danger, #f87171); }
    :root:not([data-bs-theme]) .twc-stepper-segment { background: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-stepper-segment.is-complete,
    :root:not([data-bs-theme]) .twc-stepper-segment.is-skipped { background: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-stepper-segment.is-current { background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
    :root:not([data-bs-theme]) .twc-stepper-toggle {
        border-color: var(--twc-color-border-input, #4c5663);
        background: var(--twc-color-card-bg, #15191f);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-stepper-toggle:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-stepper-toggle-hint,
    :root:not([data-bs-theme]) .twc-stepper-toggle .material-icons { color: var(--twc-color-subtle, #d7dce3); }
}

/* ── WizardLayout / WizardRail ───────────────────────────────────────────────────────────
   Full-page wizard frame (archetype C, generalised from Stayant's onboarding layout): slim
   header, then a body grid of the step rail beside the content column (eyebrow, step, footer).
   The grid forms only when the rail renders content (:has(); an empty aside is hidden), so a
   landing or done page stays one centred column. ≤767.98px the rail stacks above the step and
   its foot hides. The footer is sticky by default (.twc-wizard-footer-sticky) and clears the
   home indicator; in a native shell it stops above the tab bar instead (--shell-bottom-inset
   already holds the home indicator, so env() is not added twice). The eyebrow, step and footer
   actions share one readable measure, --twc-wizard-content-max (set inline from ContentMaxWidth). */
.twc-wizard {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--twc-color-bg, #f5f6f8);
}

.twc-wizard-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 44px;
    padding: 1rem 1.75rem;
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-wizard-body {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.twc-wizard-body:has(> .twc-wizard-rail > *) {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
}

.twc-wizard-rail {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    min-width: 0;
    padding: 1.75rem;
    border-right: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-wizard-rail:empty {
    display: none;
}

.twc-wizard-title {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.twc-wizard-lead {
    margin: 0;
    font-size: 0.845rem;
    color: var(--twc-color-subtle, #475569);
    text-wrap: pretty;
}

.twc-wizard-rail-foot {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
    font-size: 0.75rem;
}

.twc-wizard-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.twc-wizard-eyebrow,
.twc-wizard-content,
.twc-wizard-actions {
    box-sizing: content-box;
    max-width: var(--twc-wizard-content-max, 45rem);
}

/* One centred column when there is no rail (or it is empty). */
.twc-wizard-body:not(:has(> .twc-wizard-rail > *)) .twc-wizard-eyebrow,
.twc-wizard-body:not(:has(> .twc-wizard-rail > *)) .twc-wizard-content,
.twc-wizard-body:not(:has(> .twc-wizard-rail > *)) .twc-wizard-actions {
    margin-inline: auto;
}

/* Self-contained eyebrow type (the theme's .eyebrow is optional); subtle, not muted, because it
   sits on the page ground (R10). */
.twc-wizard .twc-wizard-eyebrow {
    display: block;
    margin-bottom: 0;
    padding: 1.25rem 1.75rem 0;
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--twc-color-subtle, #475569);
}

.twc-wizard-content {
    flex: 1 0 auto;
    padding: 1.75rem;
}

.twc-wizard-eyebrow + .twc-wizard-content {
    padding-top: 0.75rem;
}

.twc-wizard-footer {
    padding: 0.75rem 1.75rem;
    background: var(--twc-color-card-bg, #ffffff);
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-wizard-footer-sticky {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

.twc-wizard-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.twc-wizard-actions-start,
.twc-wizard-actions-end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.twc-wizard-actions-end {
    margin-left: auto;
}

.twc-wizard-actions-start:empty,
.twc-wizard-actions-end:empty {
    display: none;
}

@media (max-width: 767.98px) {
    .twc-wizard-header {
        padding: 0.75rem 1rem;
    }

    .twc-wizard-body:has(> .twc-wizard-rail > *) {
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
    }

    .twc-wizard-rail {
        gap: 0.9rem;
        padding: 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
    }

    .twc-wizard-rail-foot {
        display: none;
    }

    .twc-wizard .twc-wizard-eyebrow {
        padding: 0.85rem 1rem 0;
    }

    .twc-wizard-content {
        padding: 1rem;
    }

    .twc-wizard-eyebrow + .twc-wizard-content {
        padding-top: 0.5rem;
    }

    .twc-wizard-footer {
        padding-inline: 1rem;
    }
}

/* Native shell: no AppShell content-area here, so the frame clears the translucent top bar and
   the tab bar itself; the sticky footer stops on top of the tab bar. */
html.native-shell .twc-wizard {
    padding-top: var(--shell-top-inset, var(--shell-top-height, 0px));
    padding-bottom: var(--shell-bottom-inset, calc(env(safe-area-inset-bottom, 0px) + 49px));
}

html.native-shell .twc-wizard-footer-sticky {
    bottom: var(--shell-bottom-inset, calc(env(safe-area-inset-bottom, 0px) + 49px));
    padding-bottom: 0.75rem;
}

[data-bs-theme="dark"] .twc-wizard { background: var(--twc-color-bg, #20262d); }
[data-bs-theme="dark"] .twc-wizard-header,
[data-bs-theme="dark"] .twc-wizard-rail,
[data-bs-theme="dark"] .twc-wizard-rail-foot { border-color: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-wizard-lead,
[data-bs-theme="dark"] .twc-wizard .twc-wizard-eyebrow { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-wizard-footer {
    background: var(--twc-color-card-bg, #15191f);
    border-top-color: var(--twc-color-border, #3a424d);
}
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-wizard { background: var(--twc-color-bg, #20262d); }
    :root:not([data-bs-theme]) .twc-wizard-header,
    :root:not([data-bs-theme]) .twc-wizard-rail,
    :root:not([data-bs-theme]) .twc-wizard-rail-foot { border-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-wizard-lead,
    :root:not([data-bs-theme]) .twc-wizard .twc-wizard-eyebrow { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-wizard-footer {
        background: var(--twc-color-card-bg, #15191f);
        border-top-color: var(--twc-color-border, #3a424d);
    }
}

/* ── Combobox — the typeahead input and the popup panel (.twc-popover) ──────────────────────
   The panel is absolutely positioned under the input; techwork-popover.js, when it loads, moves
   it into the top layer (or position: fixed) and owns its inline style while open. Options are
   ≥44px on coarse pointers; the active option (aria-activedescendant) is marked by background
   and an inset bar, never by hover alone. Class names are a contract consumers' E2E selectors
   target: .twc-option.is-active, [aria-selected="true"], .twc-option-create. */
.twc-combobox {
    position: relative;
    min-width: 0;
}

.twc-combobox.has-clear > input {
    padding-right: 2.75rem;
}

.twc-combobox-clear {
    position: absolute;
    top: 50%;
    right: 0;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--twc-radius-btn, 0.5rem);
    background: transparent;
    color: var(--twc-color-subtle, #475569);
    transition: background-color 0.12s, color 0.12s;
}

.twc-combobox-clear .material-icons {
    font-size: 1rem;
}

.twc-combobox-clear:hover,
.twc-combobox-clear:focus-visible {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

.twc-combobox-clear:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: -2px;
}

.twc-popover {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--twc-z-popover, 15);
    box-sizing: border-box;
    max-height: min(18rem, 40vh);
    margin: 0.25rem 0 0;
    padding: 0.25rem 0;
    overflow-y: auto;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-md, 0.5rem);
    background: var(--twc-color-card-bg, #ffffff);
    box-shadow: var(--twc-shadow-modal, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
    color: var(--twc-color-text, #111827);
    font-size: var(--twc-font-size-sm, 0.9rem);
}

.twc-listbox {
    margin: 0;
    padding: 0;
    list-style: none;
}

.twc-option {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.25rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

@media (pointer: coarse) {
    .twc-option {
        min-height: 44px;
    }
}

.twc-option-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.twc-option:hover,
.twc-option.is-active {
    background: var(--twc-color-hover, #eef1f6);
}

.twc-option.is-active {
    box-shadow: inset 2px 0 0 var(--twc-color-primary, #3b5bdb);
}

.twc-option[aria-selected="true"] {
    color: var(--twc-color-primary-hover, #1e3a8a);
}

.twc-option-check,
.twc-option-create .material-icons {
    flex: none;
    font-size: 1.1rem;
}

.twc-option[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}

.twc-option-create {
    border-top: 1px solid var(--twc-color-row-rule, #eef1f6);
    color: var(--twc-color-primary-hover, #1e3a8a);
}

.twc-popover-status {
    padding: 0.5rem 0.75rem;
    color: var(--twc-color-subtle, #475569);
}

/* Virtualised list (more options than VirtualizeThreshold): every row is exactly 44px on every
   pointer — Virtualize's ItemSize and the module's scrollToIndex both assume it — and the rows
   start at the very top of the panel's scroll content, so the panel drops its vertical padding.
   Option text keeps to one line. */
.twc-popover.is-virtual {
    padding-block: 0;
}

.twc-popover.is-virtual .twc-option {
    height: 44px;
    min-height: 44px;
    padding-block: 0;
}

.twc-popover.is-virtual .twc-option-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

[data-bs-theme="dark"] .twc-combobox-clear { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-combobox-clear:hover,
[data-bs-theme="dark"] .twc-combobox-clear:focus-visible {
    background: var(--twc-color-hover, #232a33);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-combobox-clear:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-popover {
    border-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-card-bg, #15191f);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-option:hover,
[data-bs-theme="dark"] .twc-option.is-active { background: var(--twc-color-hover, #232a33); }
[data-bs-theme="dark"] .twc-option.is-active { box-shadow: inset 2px 0 0 var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-option[aria-selected="true"] { color: var(--twc-color-primary-hover, #a3b4ff); }
[data-bs-theme="dark"] .twc-option-create {
    border-top-color: var(--twc-color-row-rule, #2c333c);
    color: var(--twc-color-primary-hover, #a3b4ff);
}
[data-bs-theme="dark"] .twc-popover-status { color: var(--twc-color-subtle, #d7dce3); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-combobox-clear { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-combobox-clear:hover,
    :root:not([data-bs-theme]) .twc-combobox-clear:focus-visible {
        background: var(--twc-color-hover, #232a33);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-combobox-clear:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-popover {
        border-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-card-bg, #15191f);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-option:hover,
    :root:not([data-bs-theme]) .twc-option.is-active { background: var(--twc-color-hover, #232a33); }
    :root:not([data-bs-theme]) .twc-option.is-active { box-shadow: inset 2px 0 0 var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-option[aria-selected="true"] { color: var(--twc-color-primary-hover, #a3b4ff); }
    :root:not([data-bs-theme]) .twc-option-create {
        border-top-color: var(--twc-color-row-rule, #2c333c);
        color: var(--twc-color-primary-hover, #a3b4ff);
    }
    :root:not([data-bs-theme]) .twc-popover-status { color: var(--twc-color-subtle, #d7dce3); }
}

/* ── MultiSelect and TokenInput — chips (.twc-token) and the input in a box drawn like a form control ──
   The input comes first in the DOM (so the chips' remove buttons follow it in tab order) and is
   drawn last with flex order. The option panel is Combobox's .twc-popover, placed under the
   whole box. Remove buttons are 24px glyphs with a 44px hit area on coarse pointers. Class names
   are a contract consumers' E2E selectors target: .twc-token, .twc-token-remove, .twc-token-more. */
.twc-multiselect,
.twc-tokeninput {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 2.35rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: var(--twc-radius-btn, 0.5rem);
    background: var(--twc-color-input-bg, #ffffff);
    color: var(--twc-color-text, #111827);
    font-size: var(--twc-font-size-sm, 0.9rem);
    cursor: text;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.twc-multiselect:focus-within,
.twc-tokeninput:focus-within {
    border-color: var(--twc-color-primary, #3b5bdb);
    box-shadow: 0 0 0 3px var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
}

.twc-multiselect.invalid,
.twc-tokeninput.invalid {
    border-color: var(--twc-color-danger, #dc2626);
}

.twc-multiselect.is-disabled,
.twc-tokeninput.is-disabled {
    background: var(--twc-color-surface-subtle, #f8fafc);
    cursor: not-allowed;
    opacity: 0.7;
}

.twc-multiselect-input,
.twc-tokeninput-input {
    order: 1;
    flex: 1 1 6rem;
    min-width: 6rem;
    min-height: 1.75rem;
    margin: 0;
    padding: 0.125rem 0.25rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.twc-multiselect-input::placeholder,
.twc-tokeninput-input::placeholder {
    color: var(--twc-color-muted, #64748b);
}

.twc-multiselect-input:disabled,
.twc-tokeninput-input:disabled {
    cursor: not-allowed;
}

.twc-token {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    box-sizing: border-box;
    max-width: 100%;
    min-height: 1.75rem;
    padding: 0.125rem 0.25rem 0.125rem 0.5rem;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: var(--twc-color-surface-subtle, #f8fafc);
    color: var(--twc-color-text, #111827);
    font-size: var(--twc-font-size-sm, 0.9rem);
    line-height: 1.25;
    cursor: default;
}

.twc-token-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.twc-token-remove {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: transparent;
    color: var(--twc-color-subtle, #475569);
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

.twc-token-remove .material-icons {
    font-size: 1rem;
}

.twc-token-remove:hover,
.twc-token-remove:focus-visible {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

.twc-token-remove:focus-visible,
.twc-token-more:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 1px;
}

/* "+n more": a chip-shaped button in the primary ink. */
.twc-token-more {
    position: relative;
    padding-right: 0.5rem;
    color: var(--twc-color-primary-hover, #1e3a8a);
    font-family: inherit;
    cursor: pointer;
}

.twc-token-more:hover {
    background: var(--twc-color-hover, #eef1f6);
}

@media (pointer: coarse) {
    .twc-token-remove::before,
    .twc-token-more::before {
        content: "";
        position: absolute;
        inset: -10px;
    }
}

[data-bs-theme="dark"] .twc-multiselect,
[data-bs-theme="dark"] .twc-tokeninput {
    border-color: var(--twc-color-border-input, #4c5663);
    background: var(--twc-color-input-bg, #20262d);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-multiselect:focus-within,
[data-bs-theme="dark"] .twc-tokeninput:focus-within {
    border-color: var(--twc-color-primary, #748ffc);
    box-shadow: 0 0 0 3px var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
}
[data-bs-theme="dark"] .twc-multiselect.invalid,
[data-bs-theme="dark"] .twc-tokeninput.invalid { border-color: var(--twc-color-danger, #f87171); }
[data-bs-theme="dark"] .twc-multiselect.is-disabled,
[data-bs-theme="dark"] .twc-tokeninput.is-disabled { background: var(--twc-color-surface-subtle, #1b222b); }
[data-bs-theme="dark"] .twc-multiselect-input::placeholder,
[data-bs-theme="dark"] .twc-tokeninput-input::placeholder { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-token {
    border-color: var(--twc-color-border-input, #3a424d);
    background: var(--twc-color-surface-subtle, #1b222b);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-token-remove { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-token-remove:hover,
[data-bs-theme="dark"] .twc-token-remove:focus-visible {
    background: var(--twc-color-hover, #232a33);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-token-remove:focus-visible,
[data-bs-theme="dark"] .twc-token-more:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-token-more { color: var(--twc-color-primary-hover, #a3b4ff); }
[data-bs-theme="dark"] .twc-token-more:hover { background: var(--twc-color-hover, #232a33); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-multiselect,
    :root:not([data-bs-theme]) .twc-tokeninput {
        border-color: var(--twc-color-border-input, #4c5663);
        background: var(--twc-color-input-bg, #20262d);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-multiselect:focus-within,
    :root:not([data-bs-theme]) .twc-tokeninput:focus-within {
        border-color: var(--twc-color-primary, #748ffc);
        box-shadow: 0 0 0 3px var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14));
    }
    :root:not([data-bs-theme]) .twc-multiselect.invalid,
    :root:not([data-bs-theme]) .twc-tokeninput.invalid { border-color: var(--twc-color-danger, #f87171); }
    :root:not([data-bs-theme]) .twc-multiselect.is-disabled,
    :root:not([data-bs-theme]) .twc-tokeninput.is-disabled { background: var(--twc-color-surface-subtle, #1b222b); }
    :root:not([data-bs-theme]) .twc-multiselect-input::placeholder,
    :root:not([data-bs-theme]) .twc-tokeninput-input::placeholder { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-token {
        border-color: var(--twc-color-border-input, #3a424d);
        background: var(--twc-color-surface-subtle, #1b222b);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-token-remove { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-token-remove:hover,
    :root:not([data-bs-theme]) .twc-token-remove:focus-visible {
        background: var(--twc-color-hover, #232a33);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-token-remove:focus-visible,
    :root:not([data-bs-theme]) .twc-token-more:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-token-more { color: var(--twc-color-primary-hover, #a3b4ff); }
    :root:not([data-bs-theme]) .twc-token-more:hover { background: var(--twc-color-hover, #232a33); }
}

/* ── TokenInput — free-text chips on MultiSelect's box and .twc-token ──
   An invalid token (Validate returned a message) keeps its place with a danger border; its text
   is a button that takes it back into the input. The messages are listed under the box in
   .twc-tokeninput-feedback (the input's aria-describedby), empty and hidden while all is well.
   The suggestion panel is Combobox's .twc-popover. */
.twc-token.is-invalid {
    border-color: var(--twc-color-danger, #dc2626);
}

.twc-token-edit {
    position: relative;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.twc-token-edit:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 1px;
}

/* A 44px-tall hit area on coarse pointers, as the remove button's (not over it: no side inset). */
@media (pointer: coarse) {
    .twc-token-edit::before {
        content: "";
        position: absolute;
        inset: -10px 0;
    }
}

.twc-tokeninput-feedback {
    margin-top: 0.25rem;
    color: var(--twc-color-danger, #dc2626);
    font-size: var(--twc-font-size-sm, 0.9rem);
}

.twc-tokeninput-feedback:empty {
    display: none;
}

.twc-tokeninput-error-token {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.twc-tokeninput-limit {
    color: var(--twc-color-subtle, #475569);
}

[data-bs-theme="dark"] .twc-token.is-invalid { border-color: var(--twc-color-danger, #f87171); }
[data-bs-theme="dark"] .twc-token-edit:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-tokeninput-feedback { color: var(--twc-color-danger, #f87171); }
[data-bs-theme="dark"] .twc-tokeninput-limit { color: var(--twc-color-subtle, #d7dce3); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-token.is-invalid { border-color: var(--twc-color-danger, #f87171); }
    :root:not([data-bs-theme]) .twc-token-edit:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-tokeninput-feedback { color: var(--twc-color-danger, #f87171); }
    :root:not([data-bs-theme]) .twc-tokeninput-limit { color: var(--twc-color-subtle, #d7dce3); }
}

/* ── MoneyInput / PercentInput — an amount or a percentage in a Bootstrap .input-group ──
   Layout and sizes only: the prefix (MoneyInput's currency) or suffix (PercentInput's %) is the
   theme's .input-group-text, the toggle its .btn-neutral
   and the invalid state its .invalid/.validation-message, which already carry their dark look —
   so this block needs no dark rule. The amount is right-aligned (.is-align-start for a lone field
   in a narrow form) in tabular numerals, set here too because the theme's .tabular is optional. */
.twc-money,
.twc-percent {
    flex-wrap: nowrap;
}

.twc-money > .form-control,
.twc-percent > .form-control {
    min-width: 6.5rem;
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.twc-money.is-align-start > .form-control,
.twc-percent.is-align-start > .form-control {
    text-align: start;
}

/* The ± toggle: 44×44 (the iOS decimal pad has no minus key). */
.twc-sign-toggle {
    display: inline-grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 0.5rem;
    font-variant-numeric: tabular-nums;
}

/* Small (grid cells): the toggle follows the row's height for mouse pointers... */
.twc-money.input-group-sm > .twc-sign-toggle,
.twc-percent.input-group-sm > .twc-sign-toggle {
    min-width: 2.25rem;
    min-height: 0;
}

/* ...and touch keeps 44px targets whatever the size. */
@media (pointer: coarse) {
    .twc-money.input-group-sm > .form-control,
    .twc-money.input-group-sm > .input-group-text,
    .twc-percent.input-group-sm > .form-control,
    .twc-percent.input-group-sm > .input-group-text {
        min-height: 44px;
    }

    .twc-money.input-group-sm > .twc-sign-toggle,
    .twc-percent.input-group-sm > .twc-sign-toggle {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ── NumberStepper — − / + buttons either side of a spinbutton field ──
   Layout and sizes only: the buttons are the theme's .btn-neutral, the field its .form-control and
   the invalid state its .invalid, which already carry their dark look — so this block needs no dark
   rule. Separate controls with a gap (not a joined .input-group), so each button is a clear target. */
.twc-number-stepper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    vertical-align: middle;
}

.twc-number-stepper-btn {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
}

.twc-number-stepper-field {
    position: relative;
    flex: 0 0 auto;
    width: 5.5rem;
}

.twc-number-stepper-field > .form-control {
    width: 100%;
    min-height: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* The unit sits inside the field's right edge; the figure stays centred in the space left. */
.twc-number-stepper-field.has-suffix > .form-control {
    padding-inline-end: 1.75rem;
}

.twc-number-stepper-suffix {
    position: absolute;
    inset-block: 0;
    inset-inline-end: 0.625rem;
    display: flex;
    align-items: center;
    pointer-events: none;
    opacity: 0.7;
}

/* Large: 64px buttons and a 52px field, for one-action-per-screen phone forms. */
.twc-number-stepper-large .twc-number-stepper-btn {
    width: 64px;
    height: 64px;
}

.twc-number-stepper-large .twc-number-stepper-btn > .material-icons {
    font-size: 2rem;
}

.twc-number-stepper-large .twc-number-stepper-field {
    width: 7rem;
}

.twc-number-stepper-large .twc-number-stepper-field > .form-control {
    min-height: 52px;
    font-size: 1.5rem;
    font-weight: 500;
}

.twc-number-stepper-large .twc-number-stepper-field.has-suffix > .form-control {
    padding-inline-end: 2.25rem;
}

/* ── DateRangeInput — presets above two native date inputs ──
   Layout and sizes only: the chips take their look from the theme's .tag-quiet / .tag-quiet-active,
   the inputs from .form-control and the invalid state from .invalid / .validation-message, which
   already carry their dark look — so this block needs no dark rule. The :where() rule is a
   zero-specificity base for a page without the theme sheet (no grey UA button face); the theme's
   chip rules win over it whatever the load order. */
.twc-daterange {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 1rem;
}

.twc-daterange-presets {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.twc-daterange-period {
    flex: 1 1 100%;
    max-width: 18rem;
}

.twc-daterange-field {
    display: flex;
    flex: 1 1 9.5rem;
    flex-direction: column;
    min-width: 0;
    max-width: 14rem;
}

.twc-daterange-field > .form-label,
.twc-daterange-period > .form-label {
    margin-bottom: 0.25rem;
}

.twc-daterange-field > .form-control {
    min-height: 44px;
    font-variant-numeric: tabular-nums;
}

.twc-daterange-message {
    flex: 1 1 100%;
}

:where(.twc-daterange-preset) {
    border: 1px solid;
    border-radius: 5px;
    background: transparent;
    color: inherit;
}

.twc-daterange-presets > .twc-daterange-preset {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    cursor: pointer;
}

.twc-daterange-presets > .twc-daterange-preset:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (pointer: coarse) {
    .twc-daterange-presets > .twc-daterange-preset {
        min-height: 44px;
        padding-inline: 0.75rem;
    }
}

/* ── Tabs, disclosure, dropdown ──
   DropdownMenu (+ DropdownItem, DropdownDivider, DropdownHeader): Bootstrap's .dropdown-* class
   names, which the theme restyles and the native shell's toolbar mirror reads, placed here
   because there is no Bootstrap JS or Popper. The ul is always in the DOM; only .show displays
   it. At ≤575.98px the open menu is a bottom sheet over a dimmed scrim that clears a native tab
   bar (--shell-bottom-inset, set by techwork-shell.css) or the home indicator. */
.twc-dropdown {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.twc-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.twc-dropdown-toggle .material-icons {
    font-size: 1.25rem;
    line-height: 1;
}

.twc-dropdown-toggle.twc-dropdown-icon-only::after {
    display: none; /* no caret beside the ⋯ glyph */
}

.twc-dropdown > .twc-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    z-index: var(--twc-z-dropdown, 31);
    box-sizing: border-box;
    min-width: 12rem;
    margin: 0.25rem 0 0;
    padding: 0.25rem;
    list-style: none;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-md, 0.5rem);
    background: var(--twc-color-card-bg, #ffffff);
    box-shadow: var(--twc-shadow-modal, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
    color: var(--twc-color-text, #111827);
    font-size: var(--twc-font-size-sm, 0.9rem);
    text-align: left;
}

.twc-dropdown > .twc-dropdown-menu:not(.show) {
    display: none;
}

.twc-dropdown > .twc-dropdown-menu.show {
    display: block;
}

.twc-dropdown > .twc-dropdown-menu.dropdown-menu-end {
    left: auto;
    right: 0;
}

.twc-dropdown-menu .twc-dropdown-item {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.25rem;
    padding: 0.375rem 0.75rem;
    border: 0;
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: transparent;
    color: var(--twc-color-text, #111827);
    font: inherit;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

.twc-dropdown-menu .twc-dropdown-item .material-icons {
    font-size: 1.125rem;
    color: var(--twc-color-muted, #64748b);
}

.twc-dropdown-menu .twc-dropdown-item:hover,
.twc-dropdown-menu .twc-dropdown-item:focus,
.twc-dropdown-menu .twc-dropdown-item:active {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

.twc-dropdown-menu .twc-dropdown-item:focus {
    outline: none;
}

.twc-dropdown-menu .twc-dropdown-item:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: -2px;
}

/* R5: a destructive entry is muted at rest and takes the danger colour only on hover/focus. */
.twc-dropdown-menu .twc-dropdown-item-danger,
.twc-dropdown-menu .twc-dropdown-item-danger .material-icons {
    color: var(--twc-color-muted, #64748b);
}

.twc-dropdown-menu .twc-dropdown-item-danger:hover,
.twc-dropdown-menu .twc-dropdown-item-danger:focus,
.twc-dropdown-menu .twc-dropdown-item-danger:active {
    background: color-mix(in srgb, var(--twc-color-danger, #dc2626) 10%, transparent);
    color: var(--twc-color-danger, #dc2626);
}

.twc-dropdown-menu .twc-dropdown-item-danger:hover .material-icons,
.twc-dropdown-menu .twc-dropdown-item-danger:focus .material-icons {
    color: var(--twc-color-danger, #dc2626);
}

.twc-dropdown-menu .twc-dropdown-item.disabled,
.twc-dropdown-menu .twc-dropdown-item:disabled {
    background: transparent;
    opacity: 0.6;
    cursor: not-allowed;
}

.twc-dropdown-menu .dropdown-header {
    margin: 0;
    padding: 0.5rem 0.75rem 0.25rem;
    color: var(--twc-color-muted, #64748b);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.twc-dropdown-menu .dropdown-divider {
    height: 0;
    margin: 0.25rem 0;
    border: 0;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
    opacity: 1;
}

.twc-dropdown-scrim {
    position: fixed;
    inset: 0;
    z-index: var(--twc-z-dropdown-overlay, 30);
    background: transparent;
}

/* Wherever the user may be tapping: 44px toggle and rows. */
@media (max-width: 900px), (pointer: coarse) {
    .twc-dropdown-toggle {
        min-height: 44px;
    }

    .twc-dropdown-toggle.twc-dropdown-icon-only {
        min-width: 44px;
    }

    .twc-dropdown-menu .twc-dropdown-item {
        min-height: 44px;
    }
}

@media (max-width: 575.98px) {
    .twc-dropdown > .twc-dropdown-menu.show {
        position: fixed;
        inset: auto 0 0 0;
        min-width: 0;
        max-height: 70vh;
        margin: 0;
        padding: 0.5rem 0.5rem calc(0.5rem + var(--shell-bottom-inset, env(safe-area-inset-bottom, 0px)));
        overflow-y: auto;
        border-width: 1px 0 0;
        border-radius: var(--twc-radius-lg, 0.5rem) var(--twc-radius-lg, 0.5rem) 0 0;
    }

    .twc-dropdown-scrim {
        background: rgba(0, 0, 0, 0.4); /* exception: black-alpha scrim, not a token */
    }

    .twc-dropdown-menu .twc-dropdown-item {
        min-height: 48px;
    }
}

/* SplitButton: a main button joined to a DropdownMenu caret toggle. Joined here rather than by
   Bootstrap's .btn-group rules, which do not reach the toggle inside div.twc-dropdown. The group
   is the menu's anchor, so Start/End line up with the whole button, not just the caret. */
.twc-split-button {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.twc-split-button > .twc-split-button-menu {
    position: static;
}

.twc-split-button > .twc-split-button-main {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Positioned like Bootstrap's .btn-group > .btn so its divider paints over the main button's
   overlapped right border; the menu still anchors to the group (a sibling, not a child). */
.twc-split-button .twc-split-button-toggle {
    position: relative;
    margin-left: -1px;
    padding-inline: 0.25rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left-color: color-mix(in srgb, currentColor 35%, transparent);
}

/* Busy: the spinner draws in the button's own text colour, so it shows on a filled primary. The
   extra .twc-split-button in the selector outranks the theme-keyed .twc-spinner rules. */
.twc-split-button .twc-split-button-main .twc-loading-inline {
    color: inherit;
}

.twc-split-button .twc-split-button-main .twc-spinner {
    border-color: color-mix(in srgb, currentColor 35%, transparent);
    border-top-color: currentColor;
}

@media (max-width: 900px), (pointer: coarse) {
    .twc-split-button > .twc-split-button-main {
        min-height: 44px;
    }
}

/* Tabs (+ TabPanel): the theme's underline .nav-tabs rules repeated with fallbacks, scoped to
   .twc-tabs-list, so the tabs look the same without techwork-theme.css. Focus is the 2px primary
   outline (the theme drops the outline on .nav-tabs; keyboard users need it). At ≤575.98px the list
   stacks one row each and the current tab moves its rule to the left edge. */
.twc-tabs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-tabs-list > .nav-item {
    display: flex;
}

.twc-tabs .twc-tabs-list .twc-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: -1px;
    padding: 0.5rem 1rem 0.375rem;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--twc-color-muted, #64748b);
    font-size: var(--twc-font-size-sm, 0.9rem);
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.twc-tabs .twc-tabs-list .twc-tab:hover {
    border-bottom-color: var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-sm, 0.375rem) var(--twc-radius-sm, 0.375rem) 0 0;
    background: var(--twc-color-bg, #f5f6f8);
    color: var(--twc-color-text, #111827);
}

.twc-tabs .twc-tabs-list .twc-tab.active,
.twc-tabs .twc-tabs-list .twc-tab.active:hover {
    border-bottom-color: var(--twc-color-primary, #3b5bdb);
    border-radius: 0;
    background: transparent;
    color: var(--twc-color-primary, #3b5bdb);
    font-weight: 600;
}

.twc-tabs .twc-tabs-list .twc-tab:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: -2px;
    box-shadow: none;
}

.twc-tabs .twc-tabs-list .twc-tab.disabled,
.twc-tabs .twc-tabs-list .twc-tab:disabled {
    border-bottom-color: transparent;
    background: transparent;
    color: var(--twc-color-muted, #64748b);
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.twc-tabs .twc-tabs-list .twc-tab .material-icons {
    font-size: 1.125rem;
    line-height: 1;
}

.twc-tab-count {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-muted, #64748b);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-align: center;
}

.twc-tab.active .twc-tab-count {
    background: color-mix(in srgb, var(--twc-color-primary, #3b5bdb) 12%, transparent);
    color: var(--twc-color-primary, #3b5bdb);
}

.twc-tab-panel:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

@media (max-width: 900px), (pointer: coarse) {
    .twc-tabs .twc-tabs-list .twc-tab {
        min-height: 44px;
    }
}

@media (max-width: 575.98px) {
    .twc-tabs-list {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
        border-bottom: 0;
    }

    .twc-tabs-list > .nav-item {
        width: 100%;
    }

    .twc-tabs .twc-tabs-list .twc-tab,
    .twc-tabs .twc-tabs-list .twc-tab:hover {
        width: 100%;
        margin-bottom: 0;
        padding: 0.625rem 0.75rem;
        border: 0;
        border-left: 3px solid transparent;
        border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
        border-radius: 0;
        text-align: left;
        white-space: normal;
    }

    .twc-tabs .twc-tabs-list .twc-tab.active,
    .twc-tabs .twc-tabs-list .twc-tab.active:hover {
        border-left-color: var(--twc-color-primary, #3b5bdb);
        border-bottom-color: var(--twc-color-border, #e2e8f0);
        background: var(--twc-color-bg, #f5f6f8);
    }
}

[data-bs-theme="dark"] .twc-tabs-list { border-bottom-color: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab:hover {
    border-bottom-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-bg, #20262d);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab.active,
[data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab.active:hover {
    border-bottom-color: var(--twc-color-primary, #748ffc);
    background: transparent;
    color: var(--twc-color-primary, #748ffc);
}
[data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-tab-count {
    background: var(--twc-color-hover, #232a33);
    color: var(--twc-color-muted, #a8b0bb);
}
[data-bs-theme="dark"] .twc-tab.active .twc-tab-count {
    background: color-mix(in srgb, var(--twc-color-primary, #748ffc) 16%, transparent);
    color: var(--twc-color-primary, #748ffc);
}
[data-bs-theme="dark"] .twc-tab-panel:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
@media (max-width: 575.98px) {
    [data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab,
    [data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab:hover { border-bottom-color: var(--twc-color-border, #3a424d); }
    [data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab.active,
    [data-bs-theme="dark"] .twc-tabs .twc-tabs-list .twc-tab.active:hover {
        border-left-color: var(--twc-color-primary, #748ffc);
        background: var(--twc-color-bg, #20262d);
    }
}
/* OS-dark mirror of the tabs block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-tabs-list { border-bottom-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab:hover {
        border-bottom-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-bg, #20262d);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab.active,
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab.active:hover {
        border-bottom-color: var(--twc-color-primary, #748ffc);
        background: transparent;
        color: var(--twc-color-primary, #748ffc);
    }
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-tab-count {
        background: var(--twc-color-hover, #232a33);
        color: var(--twc-color-muted, #a8b0bb);
    }
    :root:not([data-bs-theme]) .twc-tab.active .twc-tab-count {
        background: color-mix(in srgb, var(--twc-color-primary, #748ffc) 16%, transparent);
        color: var(--twc-color-primary, #748ffc);
    }
    :root:not([data-bs-theme]) .twc-tab-panel:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}
@media (prefers-color-scheme: dark) and (max-width: 575.98px) {
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab,
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab:hover { border-bottom-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab.active,
    :root:not([data-bs-theme]) .twc-tabs .twc-tabs-list .twc-tab.active:hover {
        border-left-color: var(--twc-color-primary, #748ffc);
        background: var(--twc-color-bg, #20262d);
    }
}

[data-bs-theme="dark"] .twc-dropdown > .twc-dropdown-menu {
    border-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-card-bg, #15191f);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item .material-icons { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item:hover,
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item:focus,
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item:active {
    background: var(--twc-color-hover, #232a33);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item-danger,
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item-danger .material-icons { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item-danger:hover,
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item-danger:focus,
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item-danger:active {
    background: color-mix(in srgb, var(--twc-color-danger, #f87171) 10%, transparent);
    color: var(--twc-color-danger, #f87171);
}
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item-danger:hover .material-icons,
[data-bs-theme="dark"] .twc-dropdown-menu .twc-dropdown-item-danger:focus .material-icons { color: var(--twc-color-danger, #f87171); }
[data-bs-theme="dark"] .twc-dropdown-menu .dropdown-header { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-dropdown-menu .dropdown-divider { border-top-color: var(--twc-color-border, #3a424d); }
/* OS-dark mirror of the block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-dropdown > .twc-dropdown-menu {
        border-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-card-bg, #15191f);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item .material-icons { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item:hover,
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item:focus,
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item:active {
        background: var(--twc-color-hover, #232a33);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item-danger,
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item-danger .material-icons { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item-danger:hover,
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item-danger:focus,
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item-danger:active {
        background: color-mix(in srgb, var(--twc-color-danger, #f87171) 10%, transparent);
        color: var(--twc-color-danger, #f87171);
    }
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item-danger:hover .material-icons,
    :root:not([data-bs-theme]) .twc-dropdown-menu .twc-dropdown-item-danger:focus .material-icons { color: var(--twc-color-danger, #f87171); }
    :root:not([data-bs-theme]) .twc-dropdown-menu .dropdown-header { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-dropdown-menu .dropdown-divider { border-top-color: var(--twc-color-border, #3a424d); }
}

/* Disclosure (+ Accordion): a header row whose native button toggles the body. Section = header over
   a rule; Card = its own card (also .page-card for the theme); Row = the R6 expandable item row, its
   open body on the page ground. The whole toggle is the ≥44px target; the chevron turns with no
   transition (no animation in the design system). Actions sit beside the toggle, never inside it. */
.twc-disclosure-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.twc-disclosure-heading {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.twc-disclosure-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0;
    border: 0;
    background: transparent;
    color: var(--twc-color-text, #111827);
    font: inherit;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

.twc-disclosure-toggle:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.twc-disclosure-toggle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.twc-disclosure-chevron {
    flex: none;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--twc-color-muted, #64748b);
}

.twc-disclosure.is-open > .twc-disclosure-header .twc-disclosure-chevron {
    transform: rotate(90deg);
}

.twc-disclosure-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.twc-disclosure-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.375rem;
    margin-left: auto;
    color: var(--twc-color-muted, #64748b);
    font-size: 0.85rem;
    font-weight: 400;
}

.twc-disclosure-actions {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 0.5rem;
}

.twc-disclosure-body {
    padding: 0.25rem 0 1rem;
}

.twc-disclosure-section {
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-disclosure.twc-disclosure-card {
    padding: 0 1.25rem;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-card, 0.875rem);
    background: var(--twc-color-card-bg, #ffffff);
    box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04));
    color: var(--twc-color-text, #111827);
}

.twc-disclosure-card > .twc-disclosure-header .twc-disclosure-toggle {
    padding: 0.75rem 0;
    font-size: 1rem;
}

.twc-disclosure-card > .twc-disclosure-body {
    padding: 0 0 1.25rem;
}

.twc-disclosure-row {
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-disclosure-row > .twc-disclosure-header {
    padding: 0 0.75rem;
    transition: background-color 0.12s;
}

.twc-disclosure-row > .twc-disclosure-header:hover {
    background: var(--twc-color-hover, #eef1f6);
}

.twc-disclosure-row > .twc-disclosure-body {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
    background: var(--twc-color-bg, #f5f6f8);
}

[data-bs-theme="dark"] .twc-disclosure-toggle { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-disclosure-toggle:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-disclosure-chevron { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-disclosure-meta { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-disclosure-section { border-bottom-color: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-disclosure.twc-disclosure-card {
    border-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-card-bg, #15191f);
    box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3));
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-disclosure-row { border-bottom-color: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-disclosure-row > .twc-disclosure-header:hover { background: var(--twc-color-hover, #232a33); }
[data-bs-theme="dark"] .twc-disclosure-row > .twc-disclosure-body {
    border-top-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-bg, #20262d);
}
/* OS-dark mirror of the disclosure block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-disclosure-toggle { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-disclosure-toggle:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-disclosure-chevron { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-disclosure-meta { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-disclosure-section { border-bottom-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-disclosure.twc-disclosure-card {
        border-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-card-bg, #15191f);
        box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3));
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-disclosure-row { border-bottom-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-disclosure-row > .twc-disclosure-header:hover { background: var(--twc-color-hover, #232a33); }
    :root:not([data-bs-theme]) .twc-disclosure-row > .twc-disclosure-body {
        border-top-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-bg, #20262d);
    }
}

/* FormSection: archetype C groups — an eyebrow heading (R8), an optional muted lead and right-aligned
   actions over the fields, with a 1px rule between consecutive sections. Collapsible sections are a
   Section Disclosure carrying the same classes: their toggle text takes the eyebrow look and their
   own bottom rule gives way to the shared between-sections rule. */
.twc-form-section + .twc-form-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-form-section + .twc-form-section.twc-form-section-collapsible {
    padding-top: 0.25rem;
}

.twc-form-section-collapsible + .twc-form-section {
    margin-top: 0.25rem;
}

.twc-form-section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.75rem;
    align-items: start;
    margin-bottom: 0.75rem;
}

.twc-form-section-head > .twc-form-section-title {
    grid-column: 1;
    margin: 0;
}

.twc-form-section-title,
.twc-form-section-collapsible > .twc-disclosure-header .twc-disclosure-title {
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--twc-color-muted, #64748b);
}

.twc-form-section-collapsible > .twc-disclosure-header .twc-disclosure-toggle {
    font-weight: 400;
}

.twc-form-section-lead {
    grid-column: 1;
    margin: 0.25rem 0 0;
    color: var(--twc-color-muted, #64748b);
    font-size: 0.875rem;
}

.twc-form-section-collapsible > .twc-disclosure-body > .twc-form-section-lead {
    margin: 0 0 0.75rem;
}

.twc-form-section-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.twc-form-section.twc-disclosure-section {
    border-bottom: 0;
}

[data-bs-theme="dark"] .twc-form-section + .twc-form-section { border-top-color: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-form-section-title,
[data-bs-theme="dark"] .twc-form-section-collapsible > .twc-disclosure-header .twc-disclosure-title,
[data-bs-theme="dark"] .twc-form-section-lead { color: var(--twc-color-muted, #a8b0bb); }
/* OS-dark mirror of the form-section block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-form-section + .twc-form-section { border-top-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-form-section-title,
    :root:not([data-bs-theme]) .twc-form-section-collapsible > .twc-disclosure-header .twc-disclosure-title,
    :root:not([data-bs-theme]) .twc-form-section-lead { color: var(--twc-color-muted, #a8b0bb); }
}

/* ── Activity, avatar, reason ──
   Avatar: a person as coloured initials on a circle, 24 / 32 / 40px. The fill is one of the four
   categorical hues (R4 — identity is a category, not a status), chosen in C# by AvatarColor
   (.twc-avatar-cat-1..4). Light ink is white (every light hue clears 4.5:1 against it); the dark
   hues are light, so dark mode switches to the dark on-primary ink. No new z-layer. */
.twc-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2rem;
    height: 2rem;
    overflow: hidden;
    border-radius: 50%;
    background: var(--twc-color-category-1, #3b5bdb);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    vertical-align: middle;
    white-space: nowrap;
    user-select: none;
}

.twc-avatar-sm {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.6875rem;
    letter-spacing: 0;
}

.twc-avatar-lg {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
}

.twc-avatar-cat-1 { background: var(--twc-color-category-1, #3b5bdb); }
.twc-avatar-cat-2 { background: var(--twc-color-category-2, #b45309); }
.twc-avatar-cat-3 { background: var(--twc-color-category-3, #0f766e); }
.twc-avatar-cat-4 { background: var(--twc-color-category-4, #6d28d9); }

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

/* Avatar, dark mode — dark literals as the fallbacks; the OS-preference mirror follows. */
[data-bs-theme="dark"] .twc-avatar { color: var(--twc-color-on-primary, #15191f); }
[data-bs-theme="dark"] .twc-avatar-cat-1 { background: var(--twc-color-category-1, #748ffc); }
[data-bs-theme="dark"] .twc-avatar-cat-2 { background: var(--twc-color-category-2, #fbbf24); }
[data-bs-theme="dark"] .twc-avatar-cat-3 { background: var(--twc-color-category-3, #34d399); }
[data-bs-theme="dark"] .twc-avatar-cat-4 { background: var(--twc-color-category-4, #c4b5fd); }
/* OS-dark mirror of the avatar block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-avatar { color: var(--twc-color-on-primary, #15191f); }
    :root:not([data-bs-theme]) .twc-avatar-cat-1 { background: var(--twc-color-category-1, #748ffc); }
    :root:not([data-bs-theme]) .twc-avatar-cat-2 { background: var(--twc-color-category-2, #fbbf24); }
    :root:not([data-bs-theme]) .twc-avatar-cat-3 { background: var(--twc-color-category-3, #34d399); }
    :root:not([data-bs-theme]) .twc-avatar-cat-4 { background: var(--twc-color-category-4, #c4b5fd); }
}

/* ActivityFeed: day-grouped entries for a card. Each day is an eyebrow heading over a list whose
   entries are split by the row rule; an entry is marker | summary + subtle meta line | toggle, and
   its expanded changes take the full width beneath on the page-ground tint. Meta and the day label
   are subtle, not muted (R10 holds on the page ground too). The dot + word pair never splits (R7). */
.twc-activity-error {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.twc-activity-error-text {
    flex: 1 1 auto;
    min-width: 0;
}

.twc-activity-retry {
    min-height: 44px;
}

/* A reload keeps the entries in place and dims them, rather than blanking to a spinner. */
.twc-activity-dim {
    opacity: 0.55;
    transition: opacity 120ms ease;
}

.twc-activity-day + .twc-activity-day {
    margin-top: 1.1rem;
}

/* Self-contained eyebrow type (the theme's .eyebrow is optional). */
.twc-activity .twc-activity-day-label {
    margin: 0 0 0.25rem;
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--twc-color-subtle, #475569);
}

.twc-activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.twc-activity-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.65rem 0;
}

.twc-activity-entry + .twc-activity-entry {
    border-top: 1px solid var(--twc-color-row-rule, #eef1f6);
}

.twc-activity-marker {
    display: inline-flex;
    flex: none;
    align-self: flex-start;
}

.twc-activity-marker-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--twc-color-bg, #f5f6f8);
    color: var(--twc-color-subtle, #475569);
    font-size: 1.1rem;
}

.twc-activity-compact .twc-activity-marker-icon {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.9rem;
}

.twc-activity-compact .twc-activity-entry {
    padding: 0.5rem 0;
}

.twc-activity-main {
    flex: 1 1 0;
    min-width: 0;
}

.twc-activity-summary {
    font-size: 0.9rem;
    color: var(--twc-color-text, #111827);
    overflow-wrap: anywhere;
}

/* One subtle line: time · dot + kind · actor. Wraps between items, never inside the pair. */
.twc-activity-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.45rem;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--twc-color-subtle, #475569);
}

.twc-activity-meta .status-word {
    flex: none;
}

.twc-activity-actor {
    min-width: 0;
    overflow-wrap: anywhere;
}

.twc-activity-sep {
    color: var(--twc-color-muted, #64748b);
}

/* Always visible and 44px: the only route to an entry's field changes, so never hover-only. */
.twc-activity-toggle {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    min-height: 44px;
}

.twc-activity-toggle .material-icons {
    font-size: 1.1rem;
}

.twc-activity-changes {
    flex: 1 0 100%;
    margin-top: 0.15rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: var(--twc-color-bg, #f5f6f8);
    color: var(--twc-color-text, #111827);
}

.twc-activity-change-list {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(7rem, max-content) 1fr;
    gap: 0.35rem 1rem;
    font-size: 0.82rem;
}

/* Each change is a label → value pair (R8); display: contents lets the pair share the grid. */
.twc-activity-change {
    display: contents;
}

.twc-activity-change dt {
    font-weight: 400;
    color: var(--twc-color-subtle, #475569);
}

.twc-activity-change dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.twc-activity-old {
    color: var(--twc-color-subtle, #475569);
    text-decoration: line-through;
    text-decoration-color: var(--twc-color-muted, #64748b);
}

.twc-activity-arrow {
    margin: 0 0.35rem;
    color: var(--twc-color-muted, #64748b);
}

.twc-activity-new {
    color: var(--twc-color-text, #111827);
}

.twc-activity-pager {
    margin-top: 0.75rem;
}

/* A phone: the toggle shrinks to a 44px chevron beside the summary (its words stay as the
   accessible name), and a change's label goes above its value. */
@media (max-width: 575.98px) {
    .twc-activity-toggle {
        width: 44px;
        justify-content: center;
        padding: 0;
    }

    .twc-activity-toggle-text {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .twc-activity-change-list {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .twc-activity-change + .twc-activity-change dt {
        margin-top: 0.45rem;
    }
}

/* ActivityFeed, dark mode — dark literals as the fallbacks; the OS-preference mirror follows. */
[data-bs-theme="dark"] .twc-activity-entry + .twc-activity-entry { border-top-color: var(--twc-color-row-rule, #2c333c); }
[data-bs-theme="dark"] .twc-activity .twc-activity-day-label,
[data-bs-theme="dark"] .twc-activity-meta,
[data-bs-theme="dark"] .twc-activity-change dt,
[data-bs-theme="dark"] .twc-activity-old { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-activity-sep,
[data-bs-theme="dark"] .twc-activity-arrow { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-activity-old { text-decoration-color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-activity-marker-icon { background: var(--twc-color-bg, #20262d); color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-activity-changes { background: var(--twc-color-bg, #20262d); color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-activity-summary,
[data-bs-theme="dark"] .twc-activity-new { color: var(--twc-color-text, #f3f6fb); }
/* OS-dark mirror of the ActivityFeed block above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-activity-entry + .twc-activity-entry { border-top-color: var(--twc-color-row-rule, #2c333c); }
    :root:not([data-bs-theme]) .twc-activity .twc-activity-day-label,
    :root:not([data-bs-theme]) .twc-activity-meta,
    :root:not([data-bs-theme]) .twc-activity-change dt,
    :root:not([data-bs-theme]) .twc-activity-old { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-activity-sep,
    :root:not([data-bs-theme]) .twc-activity-arrow { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-activity-old { text-decoration-color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-activity-marker-icon { background: var(--twc-color-bg, #20262d); color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-activity-changes { background: var(--twc-color-bg, #20262d); color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-activity-summary,
    :root:not([data-bs-theme]) .twc-activity-new { color: var(--twc-color-text, #f3f6fb); }
}

/* ReasonDialog: ConfirmDialog's buttons (.twc-confirm-btn) under a labelled textarea, optional
   preset chips (btn-sm; 44px on a coarse pointer), and one form-text line holding the hint and the
   "120 / 500" counter. The invalid state is the shared .invalid / .validation-message, which
   carries its own dark look, so this needs no dark block. */
.twc-reason-body {
    margin-bottom: 1rem;
}

.twc-reason-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.twc-reason-presets > .twc-reason-preset {
    display: inline-flex;
    align-items: center;
}

.twc-reason-input {
    resize: vertical;
    min-height: 5.5rem;
}

.twc-reason-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 1rem;
}

.twc-reason-counter {
    margin-left: auto;
    white-space: nowrap;
}

.twc-reason-dialog .twc-confirm-btn:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .twc-reason-presets > .twc-reason-preset {
        min-height: 44px;
        padding-inline: 0.75rem;
    }
}

[data-bs-theme="dark"] .twc-reason-dialog .twc-confirm-btn:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
/* OS-dark mirror of the ReasonDialog rule above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-reason-dialog .twc-confirm-btn:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}

/* StatCard additions: the delta line, the link card and the centred variant. The glyph, figure
   and DeltaLabel are one inline-flex, flex: none group, so the meta line wraps around the group and
   never between the figure and its delta (R7). The delta is subtle ink unless a TrendTone is set
   (R3). A link card shows its chevron at rest — never hover-only — and is at least 44px tall. */
.twc-stat-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.1rem 0.5rem;
}

.twc-stat-delta {
    display: inline-flex;
    flex: none;
    align-items: baseline;
    gap: 0.25rem;
    max-width: 100%;
    color: var(--twc-color-subtle, #475569);
}

.twc-stat-delta-glyph {
    font-size: 0.7em;
}

.twc-stat-delta .tabular {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.twc-stat-delta-label {
    min-width: 0;
    font-weight: 400;
}

.twc-stat-delta-tone-primary > .twc-stat-delta-glyph,
.twc-stat-delta-tone-primary > .tabular { color: var(--twc-color-primary, #3b5bdb); }
.twc-stat-delta-tone-muted > .twc-stat-delta-glyph,
.twc-stat-delta-tone-muted > .tabular { color: var(--twc-color-muted, #64748b); }
.twc-stat-delta-tone-warning > .twc-stat-delta-glyph,
.twc-stat-delta-tone-warning > .tabular { color: var(--twc-color-warning, #92400e); }
.twc-stat-delta-tone-success > .twc-stat-delta-glyph,
.twc-stat-delta-tone-success > .tabular { color: var(--twc-color-success, #166534); }
.twc-stat-delta-tone-danger > .twc-stat-delta-glyph,
.twc-stat-delta-tone-danger > .tabular { color: var(--twc-color-danger, #dc2626); }

.twc-stat-card-centered {
    align-items: center;
    text-align: center;
}

.twc-stat-card-centered .twc-stat-meta {
    justify-content: center;
}

.twc-stat-card-link {
    position: relative;
    min-height: 44px;
    padding-right: 2.5rem;
    color: inherit;
    text-decoration: none;
    transition: background-color 120ms ease;
}

.twc-stat-card-link:hover {
    background: var(--twc-color-hover, #eef1f6);
    color: inherit;
}

.twc-stat-card-link:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.twc-stat-card-chevron {
    position: absolute;
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--twc-color-muted, #64748b);
}

/* StatCard additions, dark mode — dark literals as the fallbacks; the OS-preference mirror follows. */
[data-bs-theme="dark"] .twc-stat-delta { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-stat-delta-tone-primary > .twc-stat-delta-glyph,
[data-bs-theme="dark"] .twc-stat-delta-tone-primary > .tabular { color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-stat-delta-tone-muted > .twc-stat-delta-glyph,
[data-bs-theme="dark"] .twc-stat-delta-tone-muted > .tabular { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-stat-delta-tone-warning > .twc-stat-delta-glyph,
[data-bs-theme="dark"] .twc-stat-delta-tone-warning > .tabular { color: var(--twc-color-warning, #fbbf24); }
[data-bs-theme="dark"] .twc-stat-delta-tone-success > .twc-stat-delta-glyph,
[data-bs-theme="dark"] .twc-stat-delta-tone-success > .tabular { color: var(--twc-color-success, #86efac); }
[data-bs-theme="dark"] .twc-stat-delta-tone-danger > .twc-stat-delta-glyph,
[data-bs-theme="dark"] .twc-stat-delta-tone-danger > .tabular { color: var(--twc-color-danger, #f87171); }
[data-bs-theme="dark"] .twc-stat-card-link:hover { background: var(--twc-color-hover, #232a33); }
[data-bs-theme="dark"] .twc-stat-card-link:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-stat-card-chevron { color: var(--twc-color-muted, #a8b0bb); }
/* OS-dark mirror of the StatCard additions above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-stat-delta { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-stat-delta-tone-primary > .twc-stat-delta-glyph,
    :root:not([data-bs-theme]) .twc-stat-delta-tone-primary > .tabular { color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-stat-delta-tone-muted > .twc-stat-delta-glyph,
    :root:not([data-bs-theme]) .twc-stat-delta-tone-muted > .tabular { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-stat-delta-tone-warning > .twc-stat-delta-glyph,
    :root:not([data-bs-theme]) .twc-stat-delta-tone-warning > .tabular { color: var(--twc-color-warning, #fbbf24); }
    :root:not([data-bs-theme]) .twc-stat-delta-tone-success > .twc-stat-delta-glyph,
    :root:not([data-bs-theme]) .twc-stat-delta-tone-success > .tabular { color: var(--twc-color-success, #86efac); }
    :root:not([data-bs-theme]) .twc-stat-delta-tone-danger > .twc-stat-delta-glyph,
    :root:not([data-bs-theme]) .twc-stat-delta-tone-danger > .tabular { color: var(--twc-color-danger, #f87171); }
    :root:not([data-bs-theme]) .twc-stat-card-link:hover { background: var(--twc-color-hover, #232a33); }
    :root:not([data-bs-theme]) .twc-stat-card-link:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-stat-card-chevron { color: var(--twc-color-muted, #a8b0bb); }
}

/* ── Release notes ──
   ReleaseNotesDialog and ReleaseNotesList. The class names are Stayant's (its Playwright specs
   target them). The kind chips take their look from the theme's .tag-quiet (qualifiers, not
   statuses — R3/R4); only their placement is here. The dialog is capped to the viewport (above
   a native shell's tab bar) and its body scrolls, so the header and Got it stay reachable. */
.release-notes-dialog > .modal-dialog,
.release-notes-dialog > .modal-dialog > .modal-content {
    max-height: calc(100vh - 3.5rem - var(--shell-bottom-inset, 0px));
}

.release-notes-dialog > .modal-dialog > .modal-content > .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.release-notes-lede,
.release-notes-empty {
    color: var(--twc-color-muted, #64748b);
}

.release-notes-lede {
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

.release-notes-release + .release-notes-release {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
}

.release-notes-release-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.release-notes-release-date {
    font-weight: 600;
    color: var(--twc-color-text, #111827);
}

.release-notes-release-version {
    font-weight: 400;
    color: var(--twc-color-muted, #64748b);
}

.release-notes-entry + .release-notes-entry {
    margin-top: 1.5rem;
}

.release-notes-entry-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.release-notes-entry-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.release-notes-entry-summary {
    margin: 0 0 0.6rem;
    color: var(--twc-color-muted, #64748b);
}

.release-notes-badge {
    flex: none;
}

/* The entry HTML: authored screenshots and long URLs must not widen the dialog at 375px. */
.release-notes-entry-body > :last-child {
    margin-bottom: 0;
}

.release-notes-entry-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0.75rem 0;
    border-radius: var(--twc-radius-md, 0.5rem);
    border: 1px solid var(--twc-color-border, #e2e8f0);
}

.release-notes-entry-body ul,
.release-notes-entry-body ol {
    padding-left: 1.25rem;
}

.release-notes-entry-body a,
.release-notes-entry-body code {
    overflow-wrap: anywhere;
}

.release-notes-minor {
    margin-top: 1.5rem;
}

/* ≥44px. Stays display: list-item — flex would drop the native disclosure triangle. */
.release-notes-minor-toggle {
    display: list-item;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0.65rem 0;
    cursor: pointer;
    font-weight: 600;
    color: var(--twc-color-text, #111827);
}

.release-notes-minor-toggle:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
    border-radius: var(--twc-radius-sm, 0.375rem);
}

.release-notes-minor-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.release-notes-minor-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
}

.release-notes-minor-item > .release-notes-badge {
    margin-top: 0.1rem;
}

.release-notes-minor-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.release-notes-minor-title {
    font-weight: 600;
}

.release-notes-minor-summary {
    color: var(--twc-color-muted, #64748b);
    font-size: 0.9rem;
}

.release-notes-dismiss {
    min-height: 44px;
    min-width: 96px;
}

@media (max-width: 575.98px) {
    .release-notes-dismiss {
        width: 100%;
    }

    .release-notes-entry-title {
        font-size: 1rem;
    }
}

/* Release notes, dark mode — dark literals as the fallbacks; the OS-preference mirror follows. */
[data-bs-theme="dark"] .release-notes-lede,
[data-bs-theme="dark"] .release-notes-empty,
[data-bs-theme="dark"] .release-notes-release-version,
[data-bs-theme="dark"] .release-notes-entry-summary,
[data-bs-theme="dark"] .release-notes-minor-summary { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .release-notes-release-date,
[data-bs-theme="dark"] .release-notes-minor-toggle { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .release-notes-release + .release-notes-release,
[data-bs-theme="dark"] .release-notes-minor-item,
[data-bs-theme="dark"] .release-notes-entry-body img { border-color: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .release-notes-minor-toggle:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
/* OS-dark mirror of the release-notes rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .release-notes-lede,
    :root:not([data-bs-theme]) .release-notes-empty,
    :root:not([data-bs-theme]) .release-notes-release-version,
    :root:not([data-bs-theme]) .release-notes-entry-summary,
    :root:not([data-bs-theme]) .release-notes-minor-summary { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .release-notes-release-date,
    :root:not([data-bs-theme]) .release-notes-minor-toggle { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .release-notes-release + .release-notes-release,
    :root:not([data-bs-theme]) .release-notes-minor-item,
    :root:not([data-bs-theme]) .release-notes-entry-body img { border-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .release-notes-minor-toggle:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}

/* ── Subscription presets ──
   TrialChip, SubscriptionBanner and UpgradePrompt (TechWork.Components.Shell). The chip's class
   names are Stayant's (its Playwright specs target them). The linked chip is a .btn-tinted; its
   tint is repeated here with fallbacks so it is right without the theme sheet. 44px tall for
   touch; ≤640px the short "12d left" form keeps the topbar's room. SubscriptionBanner is a plain
   Banner and needs nothing here. */
.trial-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0 0.75rem;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 999px;
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    color: var(--twc-color-primary-hover, #1e3a8a);
}

a.trial-chip {
    border: 1px solid color-mix(in srgb, var(--twc-color-primary, #3b5bdb) 45%, transparent);
    text-decoration: none;
}

a.trial-chip:hover {
    background: var(--twc-color-primary-tint-strong, rgba(59, 91, 219, 0.22));
    border-color: var(--twc-color-primary, #3b5bdb);
    color: var(--twc-color-primary-hover, #1e3a8a);
}

a.trial-chip:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.trial-chip-icon {
    font-size: 1rem;
}

.trial-chip-cta {
    font-weight: 600;
    padding-left: 0.4rem;
    border-left: 1px solid color-mix(in srgb, var(--twc-color-primary, #3b5bdb) 45%, transparent);
}

.trial-chip-short {
    display: none;
}

@media (max-width: 640px) {
    .trial-chip {
        padding: 0 0.5rem;
    }

    .trial-chip-long,
    .trial-chip-cta {
        display: none;
    }

    .trial-chip-short {
        display: inline;
    }
}

/* UpgradePrompt: an EmptyState-shaped panel; the title sits inline before the message when compact. */
.twc-upgrade-prompt-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.twc-upgrade-prompt.twc-empty-state-compact .twc-upgrade-prompt-title {
    display: inline;
    margin: 0 0.35rem 0 0;
}

.twc-upgrade-prompt.twc-empty-state-compact .twc-upgrade-prompt-action {
    margin-left: auto;
}

/* Subscription presets, dark mode — dark literals as the fallbacks; the OS-preference mirror follows. */
[data-bs-theme="dark"] .trial-chip { background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); color: var(--twc-color-primary-hover, #a3b4ff); }
[data-bs-theme="dark"] a.trial-chip,
[data-bs-theme="dark"] .trial-chip-cta { border-color: color-mix(in srgb, var(--twc-color-primary, #748ffc) 45%, transparent); }
[data-bs-theme="dark"] a.trial-chip:hover { background: var(--twc-color-primary-tint-strong, rgba(116, 143, 252, 0.24)); border-color: var(--twc-color-primary, #748ffc); color: var(--twc-color-primary-hover, #a3b4ff); }
[data-bs-theme="dark"] a.trial-chip:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
/* OS-dark mirror of the subscription-preset rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .trial-chip { background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); color: var(--twc-color-primary-hover, #a3b4ff); }
    :root:not([data-bs-theme]) a.trial-chip,
    :root:not([data-bs-theme]) .trial-chip-cta { border-color: color-mix(in srgb, var(--twc-color-primary, #748ffc) 45%, transparent); }
    :root:not([data-bs-theme]) a.trial-chip:hover { background: var(--twc-color-primary-tint-strong, rgba(116, 143, 252, 0.24)); border-color: var(--twc-color-primary, #748ffc); color: var(--twc-color-primary-hover, #a3b4ff); }
    :root:not([data-bs-theme]) a.trial-chip:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}

/* ChartComponent: the canvas in a fixed-height positioned box (Chart.js sizes a responsive canvas to
   its parent, so a parent that grows with it resizes without end), the figures as a table, and the
   44px "Show as table" toggle. Chart colours come from techwork-chart.js, not from here. */
.twc-chart {
    margin: 0;
    min-width: 0;
}

.twc-chart-box {
    position: relative;
    width: 100%;
}

.twc-chart-box > canvas {
    display: block;
}

.twc-chart-toggle {
    min-height: 44px;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    text-decoration: none;
}

.twc-chart-unavailable {
    margin: 0 0 0.5rem;
    color: var(--twc-color-subtle, #475569);
    font-size: 0.875rem;
}

.twc-chart-table {
    overflow-x: auto;
}

.twc-chart-data {
    margin-bottom: 0;
    font-variant-numeric: tabular-nums;
}

.twc-chart-data caption {
    caption-side: top;
    padding-top: 0.5rem;
    color: var(--twc-color-subtle, #475569);
    font-size: 0.8125rem;
}

/* ChartComponent, dark mode — dark literals as the fallbacks; the OS-preference mirror follows. */
[data-bs-theme="dark"] .twc-chart-unavailable,
[data-bs-theme="dark"] .twc-chart-data caption { color: var(--twc-color-subtle, #d7dce3); }
/* OS-dark mirror of the ChartComponent rule above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-chart-unavailable,
    :root:not([data-bs-theme]) .twc-chart-data caption { color: var(--twc-color-subtle, #d7dce3); }
}

/* ── Selection, bulk bar, filter chips ──
   DataGrid.SelectionMode: a leading .rtable-select-cell holding a button.twc-check — role=checkbox
   (aria-checked true/false/mixed) or role=radio — with a Material glyph and a 44×44 target.
   Unchecked glyphs are muted, checked/mixed are primary; a selected row takes the primary tint. */
@media (min-width: 768px) {
    .rtable .rtable-select-cell {
        width: calc(44px + 0.5rem);
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

.twc-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--twc-radius-btn, 8px);
    background: transparent;
    color: var(--twc-color-muted, #64748b);
    transition: color 0.15s, background 0.15s;
}

.twc-check .material-icons {
    font-size: 1.375rem;
    line-height: 1;
}

.twc-check[aria-checked="true"],
.twc-check[aria-checked="mixed"] {
    color: var(--twc-color-primary, #3b5bdb);
}

.twc-check:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.twc-check:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* The row's tint is painted by the cells, through Bootstrap's table state layer (which wins over
   the hover layer here); on phones, where the cells are stacked blocks, by the row instead. */
.rtable > tbody > tr.rtable-row-selected > td {
    --bs-table-bg-state: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
}

/* Phones: the box sits top-left of the stacked row (and beside a PhoneRowTemplate cell), the
   rest of the row's cells to its right. */
@media (max-width: 767.98px) {
    .rtable.rtable-selectable > tbody > tr.rtable-row {
        position: relative;
        padding-left: calc(44px + 0.5rem);
    }

    .rtable.rtable-selectable > tbody > tr.rtable-row > td.rtable-select-cell {
        position: absolute;
        top: 0.25rem;
        left: 0.25rem;
        width: auto;
        padding: 0;
    }

    /* The stacked row carries the tint alone; the cells' state layer would paint it twice. */
    .rtable.rtable-selectable > tbody > tr.rtable-row-selected {
        background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    }

    .rtable.rtable-selectable > tbody > tr.rtable-row-selected > td {
        box-shadow: none;
    }
}

[data-bs-theme="dark"] .twc-check { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-check[aria-checked="true"],
[data-bs-theme="dark"] .twc-check[aria-checked="mixed"] { color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-check:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .rtable > tbody > tr.rtable-row-selected > td { --bs-table-bg-state: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
/* OS-dark mirror of the selection rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-check { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-check[aria-checked="true"],
    :root:not([data-bs-theme]) .twc-check[aria-checked="mixed"] { color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-check:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .rtable > tbody > tr.rtable-row-selected > td { --bs-table-bg-state: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
}
@media (max-width: 767.98px) {
    [data-bs-theme="dark"] .rtable.rtable-selectable > tbody > tr.rtable-row-selected { background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
}
/* OS-dark mirror of the phone rule above (keep in step). */
@media (prefers-color-scheme: dark) and (max-width: 767.98px) {
    :root:not([data-bs-theme]) .rtable.rtable-selectable > tbody > tr.rtable-row-selected { background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
}

/* BulkActionBar: "N selected", the actions and "Clear selection". Desktop: in flow — inside a
   DataGrid between the toolbar and the table, on the card ground with a rule under it.
   ≤767.98px: fixed to the viewport bottom on the card ground with a top rule and a shadow, padded
   clear of the home indicator in a browser and of the tab bar in a native shell (the shell sets
   --shell-bottom-inset; it already holds the home indicator). Two fixed-height rows there — count
   and clear, then the actions scrolling sideways — so .twc-bulk-spacer can match its height. */
.twc-bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
    background: var(--twc-color-card-bg, #ffffff);
}

.twc-bulk-bar[hidden] {
    display: none;
}

.twc-bulk-count {
    font-size: var(--twc-font-size-sm, 0.875rem);
    font-weight: 500;
    color: var(--twc-color-text, #111827);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.twc-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.twc-bulk-actions:empty {
    display: none;
}

.twc-bulk-actions .btn,
.twc-bulk-clear {
    min-height: 44px;
}

.twc-bulk-clear {
    margin-left: auto;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    white-space: nowrap;
}

.twc-bulk-spacer {
    display: none;
}

@media (max-width: 767.98px) {
    .twc-bulk-bar {
        position: fixed;
        inset: auto 0 0 0;
        z-index: var(--twc-z-bulk-bar, 9);
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.25rem 0.5rem;
        padding: 0.5rem 1rem calc(0.5rem + var(--shell-bottom-inset, env(safe-area-inset-bottom, 0px)));
        border-top: 1px solid var(--twc-color-border, #e2e8f0);
        border-bottom: 0;
        background: var(--twc-color-card-bg, #ffffff);
        box-shadow: var(--twc-shadow-modal, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04));
    }

    .twc-bulk-count {
        align-self: center;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .twc-bulk-clear {
        grid-column: 2;
        grid-row: 1;
    }

    .twc-bulk-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .twc-bulk-actions .btn {
        flex: none;
    }

    /* Both rows (44px each), the row gap and the padding; the shell's content area already pads
       for the tab bar, a browser page does not pad for the home indicator. */
    .twc-bulk-spacer {
        display: block;
        height: calc(88px + 0.25rem + 1rem + env(safe-area-inset-bottom, 0px));
    }

    html.native-shell .twc-bulk-spacer {
        height: calc(88px + 0.25rem + 1rem);
    }
}

[data-bs-theme="dark"] .twc-bulk-bar { background: var(--twc-color-card-bg, #15191f); border-color: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-bulk-count { color: var(--twc-color-text, #f3f6fb); }
/* OS-dark mirror of the bulk bar rules above (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-bulk-bar { background: var(--twc-color-card-bg, #15191f); border-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-bulk-count { color: var(--twc-color-text, #f3f6fb); }
}

/* FilterChips: the applied filters as neutral outlined chips (like .tag-quiet, but sentence case
   and readable — a filter is neither a category nor a status, R3/R4), wrapping, then "Clear all".
   Label in subtle ink, value in body ink. The ✕ is a 24px glyph with a 44×44 hit area on a coarse
   pointer, as is "Clear all". Class names are a contract consumers' E2E selectors target. */
.twc-filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 0.75rem;
    min-width: 0;
}

.twc-filter-chips > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.twc-filter-chips > ul > li {
    display: flex;
    min-width: 0;
    max-width: 100%;
}

.twc-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    box-sizing: border-box;
    max-width: 100%;
    min-height: 1.75rem;
    padding: 0.125rem 0.125rem 0.125rem 0.5rem;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: transparent;
    color: var(--twc-color-subtle, #475569);
    font-size: var(--twc-font-size-sm, 0.875rem);
    line-height: 1.25;
}

.twc-filter-chip-label,
.twc-filter-chip-value {
    min-width: 0;
    overflow-wrap: anywhere;
}

.twc-filter-chip-value {
    color: var(--twc-color-text, #111827);
}

.twc-filter-chip-remove {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: transparent;
    color: var(--twc-color-subtle, #475569);
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

.twc-filter-chip-remove .material-icons {
    font-size: 1rem;
}

.twc-filter-chip-remove:hover,
.twc-filter-chip-remove:focus-visible {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

.twc-filter-chip-remove:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 1px;
}

.twc-filter-clear {
    padding: 0.125rem 0.25rem;
    font-size: var(--twc-font-size-sm, 0.875rem);
    white-space: nowrap;
}

@media (pointer: coarse) {
    .twc-filter-chip-remove::before {
        content: "";
        position: absolute;
        inset: -10px;
    }

    .twc-filter-clear {
        min-height: 44px;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

[data-bs-theme="dark"] .twc-filter-chip { border-color: var(--twc-color-border-input, #4c5663); color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-filter-chip-value { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-filter-chip-remove { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-filter-chip-remove:hover,
[data-bs-theme="dark"] .twc-filter-chip-remove:focus-visible { background: var(--twc-color-hover, #232a33); color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-filter-chip-remove:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
/* OS-dark mirror of the filter chip rules above (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-filter-chip { border-color: var(--twc-color-border-input, #4c5663); color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-filter-chip-value { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-filter-chip-remove { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-filter-chip-remove:hover,
    :root:not([data-bs-theme]) .twc-filter-chip-remove:focus-visible { background: var(--twc-color-hover, #232a33); color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-filter-chip-remove:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}

/* ColumnMappingTable: one row per column of an uploaded file — the header over its muted sample
   values (one line each, R9), the "Imports into" select, a StatusDot. The "Still to match" line
   under the grid is the theme's .form-error. Phones: the PhoneRowTemplate stacks header + samples
   (status beside them) over a full-width select. Class names are a contract consumers' E2E
   selectors target. */
.twc-column-mapping .twc-mapping-source-col { width: 40%; }
.twc-column-mapping .twc-mapping-target-col { width: 35%; }
.twc-column-mapping .twc-mapping-status-col { width: 25%; }

.twc-mapping-source,
.twc-mapping-target {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.twc-mapping-header {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.twc-mapping-sample,
.twc-mapping-hint {
    overflow: hidden;
    color: var(--twc-color-muted, #64748b);
    font-size: var(--twc-font-size-sm, 0.875rem);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twc-mapping-select {
    width: 100%;
    min-height: 44px;
}

.twc-mapping-missing {
    margin-top: 0.75rem;
}

.twc-mapping-phone {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.7rem 1rem; /* the theme's .phone-row inset; the grid pads phone cells 0 */
}

.twc-mapping-phone-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.twc-mapping-phone-head > .twc-mapping-status {
    flex: none;
}

[data-bs-theme="dark"] .twc-mapping-sample,
[data-bs-theme="dark"] .twc-mapping-hint { color: var(--twc-color-muted, #a8b0bb); }
/* OS-dark mirror of the mapping rule above (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-mapping-sample,
    :root:not([data-bs-theme]) .twc-mapping-hint { color: var(--twc-color-muted, #a8b0bb); }
}

/* ImportSummary: the theme's .kpi-strip of four small figures (repeated here with fallbacks so the
   strip is complete without techwork-theme.css), the failed cell's Danger dot inside its eyebrow
   label, then the errors grid or a compact empty state. Class names are a contract consumers' E2E
   selectors target. */
.twc-import-summary-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-card, 0.875rem);
    background: var(--twc-color-border, #e2e8f0);
}

.twc-import-summary-strip > .kpi {
    padding: 0.7rem 1rem;
    background: var(--twc-color-card-bg, #ffffff);
}

.twc-import-summary-errors {
    margin-top: 1rem;
}

.twc-import-summary .twc-import-error-row {
    width: 5rem;
    white-space: nowrap;
}

.twc-import-summary .twc-import-error-column {
    overflow-wrap: anywhere;
}

[data-bs-theme="dark"] .twc-import-summary-strip {
    border-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-border, #3a424d);
}
[data-bs-theme="dark"] .twc-import-summary-strip > .kpi { background: var(--twc-color-card-bg, #15191f); }
/* OS-dark mirror of the import summary rules above (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-import-summary-strip {
        border-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-border, #3a424d);
    }
    :root:not([data-bs-theme]) .twc-import-summary-strip > .kpi { background: var(--twc-color-card-bg, #15191f); }
}

/* PublicLayout + PublicBrand: the frame of a customer-facing page (no AppShell). A card-band
   header (brand left, header-end right), the page in a centred column (--twc-public-width,
   760px; .twc-public-narrow for a 420px card such as a sign-in), a footer of company details and
   a small "Powered by" line, both on the page ground so they use --twc-color-subtle (R10). A
   section wrapper whose outlet is unfilled is :empty and hidden; the footer goes when both of
   its sections are. The brand colour arrives as PublicBrand's token <style>, not here. Class
   names are a contract consumers' E2E selectors target. */
.twc-public {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--twc-color-bg, #f5f6f8);
    color: var(--twc-color-text, #111827);
}

/* Bootstrap's .visually-hidden-focusable, repeated so the link stays hidden until focused
   without Bootstrap's CSS. */
.twc-skip-link:not(:focus):not(:focus-within) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.twc-skip-link:focus,
.twc-skip-link:focus-visible {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1100;
    padding: 0.5rem 1rem;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-btn, 0.5rem);
    background: var(--twc-color-card-bg, #ffffff);
    color: var(--twc-color-link, #3b5bdb);
}

.twc-public-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--twc-color-border, #e2e8f0);
    background: var(--twc-color-card-bg, #ffffff);
}

.twc-public-brand {
    min-width: 0;
}

.twc-public-header-end {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.twc-public-header-end:empty,
.twc-public-footer-content:empty,
.twc-public-powered:empty,
.twc-public-footer:has(> .twc-public-footer-content:empty):has(> .twc-public-powered:empty) {
    display: none;
}

.twc-public-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    min-height: 44px;
    color: var(--twc-color-text, #111827);
    text-decoration: none;
}

a.twc-public-brand-link:hover .twc-public-brand-name,
a.twc-public-brand-link:focus-visible .twc-public-brand-name {
    text-decoration: underline;
}

.twc-public-logo {
    flex: none;
    max-height: 40px;
    max-width: 10rem;
    width: auto;
    object-fit: contain;
}

.twc-public-brand-name {
    overflow-wrap: anywhere;
    font-size: 1rem;
    font-weight: 500;
}

.twc-public-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--twc-public-width, 47.5rem);
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
}

.twc-public-main:focus {
    outline: none;
}

.twc-public-narrow {
    max-width: 26.25rem;
    margin-inline: auto;
}

.twc-public-footer {
    width: 100%;
    max-width: var(--twc-public-width, 47.5rem);
    margin: 0 auto;
    padding: 0 1rem 1.5rem;
}

.twc-public-footer,
.twc-public-powered {
    color: var(--twc-color-subtle, #475569);
    font-size: var(--twc-font-size-xs, 0.8rem);
}

.twc-public-footer-content + .twc-public-powered {
    margin-top: 0.5rem;
}

@media (max-width: 575.98px) {
    .twc-public-main {
        padding: 1rem;
    }
}

[data-bs-theme="dark"] .twc-public {
    background: var(--twc-color-bg, #20262d);
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] .twc-public-header {
    border-bottom-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-card-bg, #15191f);
}
[data-bs-theme="dark"] .twc-skip-link:focus,
[data-bs-theme="dark"] .twc-skip-link:focus-visible {
    border-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-card-bg, #15191f);
    color: var(--twc-color-link, #748ffc);
}
[data-bs-theme="dark"] .twc-public-brand-link { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-public-footer,
[data-bs-theme="dark"] .twc-public-powered { color: var(--twc-color-subtle, #d7dce3); }
/* OS-dark mirror of the public frame rules above (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-public {
        background: var(--twc-color-bg, #20262d);
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) .twc-public-header {
        border-bottom-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-card-bg, #15191f);
    }
    :root:not([data-bs-theme]) .twc-skip-link:focus,
    :root:not([data-bs-theme]) .twc-skip-link:focus-visible {
        border-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-card-bg, #15191f);
        color: var(--twc-color-link, #748ffc);
    }
    :root:not([data-bs-theme]) .twc-public-brand-link { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-public-footer,
    :root:not([data-bs-theme]) .twc-public-powered { color: var(--twc-color-subtle, #d7dce3); }
}

/* ── DocumentHeader: the head of a customer-facing document on a PublicLayout page ──
   A card (the theme's .page-card look, repeated with fallbacks): the kind as an eyebrow inside
   the h1 above the number (28px/500), an optional title, the status and the desktop-only header
   actions at the right, the dates as a wrapping dl of eyebrow labels over tabular values, an
   optional hero figure (R1) and the two parties under a rule. The header actions are hidden on
   phones, where DocumentActions carries them. Class names are a contract consumers' E2E selectors
   target. */
.twc-doc-header {
    margin-bottom: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-card, 0.875rem);
    background: var(--twc-color-card-bg, #ffffff);
    box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04));
    color: var(--twc-color-text, #111827);
}

.twc-doc-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 1rem;
}

.twc-doc-heading {
    flex: 1 1 16rem;
    min-width: 0;
}

h1.twc-doc-number {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--twc-color-text, #111827);
    font-size: 1.75rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.twc-doc-kind,
.twc-doc-fact > dt,
.twc-doc-hero-label {
    display: block;
    margin: 0 0 0.25rem;
    color: var(--twc-color-muted, #64748b);
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.09em;
    line-height: 1.4;
    text-transform: uppercase;
}

.twc-doc-version {
    color: var(--twc-color-subtle, #475569);
    font-weight: 400;
}

.twc-doc-title {
    margin: 0.25rem 0 0;
    color: var(--twc-color-subtle, #475569);
}

.twc-doc-status {
    flex: none;
}

.twc-doc-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.twc-doc-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin: 1rem 0 0;
}

.twc-doc-fact > dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.twc-doc-hero {
    margin-top: 1rem;
}

.twc-doc-hero-value {
    display: block;
    font-size: 1.7rem;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.twc-doc-parties {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-doc-party {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
    .twc-doc-header-actions {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .twc-doc-header {
        padding: 1rem;
    }
}

[data-bs-theme="dark"] .twc-doc-header {
    border-color: var(--twc-color-border, #3a424d);
    background: var(--twc-color-card-bg, #15191f);
    box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3));
    color: var(--twc-color-text, #f3f6fb);
}
[data-bs-theme="dark"] h1.twc-doc-number { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-doc-kind,
[data-bs-theme="dark"] .twc-doc-fact > dt,
[data-bs-theme="dark"] .twc-doc-hero-label { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-doc-version,
[data-bs-theme="dark"] .twc-doc-title { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-doc-parties { border-top-color: var(--twc-color-border, #3a424d); }

/* OS-dark mirror of the DocumentHeader rules above (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-doc-header {
        border-color: var(--twc-color-border, #3a424d);
        background: var(--twc-color-card-bg, #15191f);
        box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3));
        color: var(--twc-color-text, #f3f6fb);
    }
    :root:not([data-bs-theme]) h1.twc-doc-number { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-doc-kind,
    :root:not([data-bs-theme]) .twc-doc-fact > dt,
    :root:not([data-bs-theme]) .twc-doc-hero-label { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-doc-version,
    :root:not([data-bs-theme]) .twc-doc-title { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-doc-parties { border-top-color: var(--twc-color-border, #3a424d); }
}

/* ── DocumentLinesTable: the read-only lines of a customer-facing document ──
   The theme's .table (eyebrow headings, row rules) with tabular, right-aligned figures. Optional
   lines carry a quiet tag (the theme's .tag-quiet look, repeated with fallbacks) and the consumer's
   include control; an excluded optional line is set in the subtle ink. At ≤575.98px each row folds
   (R9) to the description and amount with a meta line under the description; the Qty, Unit price
   and VAT cells are not displayed, and the header row collapses to nothing visible but stays in
   the table for screen readers (no display change on table parts, so it stays a table). Class
   names are a contract consumers' E2E selectors target. */
.twc-doc-lines-wrap {
    overflow-x: auto;
}

table.twc-doc-lines {
    width: 100%;
    margin-bottom: 0;
}

table.twc-doc-lines > tbody > tr > td {
    vertical-align: top;
}

table.twc-doc-lines > thead > tr > th.text-end,
table.twc-doc-lines > tbody > tr > td.text-end {
    white-space: nowrap;
}

table.twc-doc-lines .tabular {
    font-variant-numeric: tabular-nums;
}

.twc-doc-line-description {
    overflow-wrap: anywhere;
}

.twc-doc-line-optional-tag {
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: 5px;
    color: var(--twc-color-subtle, #475569);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.twc-doc-line-detail,
.twc-doc-line-meta {
    display: block;
    margin-top: 0.15rem;
    color: var(--twc-color-subtle, #475569);
    font-size: 0.8125rem;
}

.twc-doc-line-detail {
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.twc-doc-line-meta {
    display: none;
}

.twc-doc-line-option {
    margin-top: 0.5rem;
}

table.twc-doc-lines > tbody > tr.twc-doc-line-excluded > td {
    color: var(--twc-color-subtle, #475569);
}

.twc-doc-lines-empty {
    margin: 0;
    padding: 0.75rem 0;
    color: var(--twc-color-subtle, #475569);
}

@media (max-width: 575.98px) {
    table.twc-doc-lines > thead > tr > th {
        height: 0;
        padding: 0;
        border: 0;
        font-size: 0;
        line-height: 0;
    }

    table.twc-doc-lines .twc-doc-col-quantity,
    table.twc-doc-lines .twc-doc-col-unit-price,
    table.twc-doc-lines .twc-doc-col-vat,
    table.twc-doc-lines .twc-doc-line-quantity,
    table.twc-doc-lines .twc-doc-line-unit-price,
    table.twc-doc-lines .twc-doc-line-vat {
        display: none;
    }

    .twc-doc-line-meta {
        display: block;
    }
}

/* ── DocumentTotals: the ledger, VAT summary and footnote under the lines ──
   The theme's .ledger look (label left, figure right, a rule above the total), repeated with
   fallbacks on the dl so it is complete without the theme sheet; the Grand row is set at hero
   weight. Right-aligned in a 22rem column on wider screens, full width on phones. */
.twc-doc-totals {
    max-width: 22rem;
    margin: 1rem 0 0 auto;
}

dl.twc-doc-ledger {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    font-size: 0.875rem;
}

dl.twc-doc-ledger > .ledger-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

dl.twc-doc-ledger > .ledger-row > dt {
    font-weight: inherit;
}

dl.twc-doc-ledger > .ledger-row > dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

dl.twc-doc-ledger > .ledger-row-muted {
    color: var(--twc-color-subtle, #475569);
    font-size: 0.8125rem;
}

dl.twc-doc-ledger > .twc-doc-total-grand {
    margin-top: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
    font-size: 1.125rem;
    font-weight: 500;
}

dl.twc-doc-ledger > .twc-doc-total-grand > dd {
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

table.twc-doc-vat {
    width: 100%;
    margin: 1rem 0 0;
    font-size: 0.8125rem;
}

table.twc-doc-vat .tabular {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.twc-doc-vat-title {
    caption-side: top;
    padding: 0 0 0.25rem;
    color: var(--twc-color-subtle, #475569);
    font-size: 0.6875rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

table.twc-doc-vat > tbody > tr > th.twc-doc-vat-label {
    font-weight: 400;
}

table.twc-doc-vat > tbody > tr:last-child > * {
    border-bottom-width: 0;
}

.twc-doc-footnote {
    margin-top: 1rem;
    color: var(--twc-color-subtle, #475569);
    font-size: 0.8125rem;
}

.twc-doc-footnote > :last-child {
    margin-bottom: 0;
}

@media (max-width: 575.98px) {
    .twc-doc-totals {
        max-width: none;
    }
}

[data-bs-theme="dark"] .twc-doc-line-optional-tag {
    border-color: var(--twc-color-border-input, #4c5663);
    color: var(--twc-color-subtle, #d7dce3);
}
[data-bs-theme="dark"] .twc-doc-line-detail,
[data-bs-theme="dark"] .twc-doc-line-meta,
[data-bs-theme="dark"] table.twc-doc-lines > tbody > tr.twc-doc-line-excluded > td,
[data-bs-theme="dark"] .twc-doc-lines-empty,
[data-bs-theme="dark"] dl.twc-doc-ledger > .ledger-row-muted,
[data-bs-theme="dark"] .twc-doc-vat-title,
[data-bs-theme="dark"] .twc-doc-footnote { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] dl.twc-doc-ledger > .twc-doc-total-grand { border-top-color: var(--twc-color-border, #3a424d); }

/* OS-dark mirror of the DocumentLinesTable / DocumentTotals rules above (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-doc-line-optional-tag {
        border-color: var(--twc-color-border-input, #4c5663);
        color: var(--twc-color-subtle, #d7dce3);
    }
    :root:not([data-bs-theme]) .twc-doc-line-detail,
    :root:not([data-bs-theme]) .twc-doc-line-meta,
    :root:not([data-bs-theme]) table.twc-doc-lines > tbody > tr.twc-doc-line-excluded > td,
    :root:not([data-bs-theme]) .twc-doc-lines-empty,
    :root:not([data-bs-theme]) dl.twc-doc-ledger > .ledger-row-muted,
    :root:not([data-bs-theme]) .twc-doc-vat-title,
    :root:not([data-bs-theme]) .twc-doc-footnote { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) dl.twc-doc-ledger > .twc-doc-total-grand { border-top-color: var(--twc-color-border, #3a424d); }
}

/* ── DocumentActions: the actions at the end of a customer-facing document ──
   Desktop: an end-aligned row, the document's last block (archetype C: not floating); the
   summary is hidden there (the figure is already in the totals, R1). ≤767.98px with
   .twc-doc-actions-sticky: a card-coloured bar stuck to the bottom of the viewport, bleeding over
   PublicLayout's 1rem column padding, the secondaries on a line of their own, then the summary
   with the one primary filling the rest of the line (all of it without a summary); padded clear of the home indicator in a browser and stopped on
   top of the tab bar in a native shell (--shell-bottom-inset already holds the home indicator, so
   env() is not added twice). Every button is ≥44px. Class names are a contract consumers' E2E
   selectors target. */
.twc-doc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.twc-doc-actions-summary {
    display: none;
    min-width: 0;
    font-size: 1.125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.twc-doc-actions-secondary,
.twc-doc-actions-primary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.twc-doc-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

@media (max-width: 767.98px) {
    .twc-doc-actions {
        justify-content: flex-start;
    }

    .twc-doc-actions-summary {
        display: block;
        flex: 0 1 auto;
    }

    .twc-doc-actions-secondary {
        flex: 1 0 100%;
        justify-content: flex-end;
    }

    .twc-doc-actions-primary {
        flex: 1 1 10rem;
    }

    .twc-doc-actions-primary > .btn {
        flex: 1 1 auto;
    }

    .twc-doc-actions-sticky {
        position: sticky;
        bottom: 0;
        z-index: var(--twc-z-sticky, 1);
        margin-inline: -1rem;
        padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
        background: var(--twc-color-card-bg, #ffffff);
        border-top: 1px solid var(--twc-color-border, #e2e8f0);
    }

    html.native-shell .twc-doc-actions-sticky {
        bottom: var(--shell-bottom-inset, calc(env(safe-area-inset-bottom, 0px) + 49px));
        padding-bottom: 0.75rem;
    }
}

/* The bar's fill exists only on phones, so its dark colours are scoped there too. */
@media (max-width: 767.98px) {
    [data-bs-theme="dark"] .twc-doc-actions-sticky {
        background: var(--twc-color-card-bg, #15191f);
        border-top-color: var(--twc-color-border, #3a424d);
    }
    [data-bs-theme="dark"] .twc-doc-actions-summary { color: var(--twc-color-text, #f3f6fb); }
}

/* OS-dark mirror of the DocumentActions rules above (keep in step). */
@media (prefers-color-scheme: dark) and (max-width: 767.98px) {
    :root:not([data-bs-theme]) .twc-doc-actions-sticky {
        background: var(--twc-color-card-bg, #15191f);
        border-top-color: var(--twc-color-border, #3a424d);
    }
    :root:not([data-bs-theme]) .twc-doc-actions-summary { color: var(--twc-color-text, #f3f6fb); }
}

/* ── Print: a customer-facing page prints as its document ──
   Hidden: anything marked data-print-hide (the DocumentHeader's actions, DocumentActions), the
   actions bar, PublicLayout's header band (the brand, header-end link), the "Powered by" line and
   the skip link. The frame drops its ground, width cap and padding so the document fills the
   page; cards lose their shadows; a line, the totals block and the document header never split
   across pages, and the lines' header row repeats on each page. Links inside the frame print as
   their text. Colours are the theme sheet's business: its print section flips a dark page's
   tokens to the light values, so a page printed from dark mode prints dark ink on white. No
   [data-bs-theme] selectors here, so nothing needs an OS-dark mirror. */
@media print {
    [data-print-hide],
    .twc-doc-actions,
    .twc-public-header,
    .twc-public-powered,
    .twc-skip-link {
        display: none !important;
    }

    .twc-public {
        display: block;
        min-height: 0;
        background: none;
    }

    .twc-public-main,
    .twc-public-footer {
        width: auto;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .twc-public-footer {
        margin-top: 1.5rem;
    }

    .twc-public *,
    .twc-doc-header {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .twc-doc-lines-wrap {
        overflow: visible;
    }

    table.twc-doc-lines > thead {
        display: table-header-group;
    }

    table.twc-doc-lines tr,
    .twc-doc-totals,
    .twc-doc-header {
        break-inside: avoid;
    }

    .twc-public a {
        color: inherit;
        text-decoration: none;
    }
}

/* ── SignaturePad: a drawn-signature field ──
   The pad is paper — white in both themes, so the ink reads the same on screen and in a PDF; only
   its frame follows the theme. The three --twc-signature-* tokens are read here, never defined by
   the theme, so an app can override them. touch-action:none sits on the pad alone, so a finger
   landing beside it still scrolls the page; the pad's children take no pointer events, so the
   pointer offsets are always the pad's. The guide is a baseline at 72% of the height with the
   placeholder on it (#64748b is 4.76:1 on white). Buttons are ≥44px; Clear is quiet until hover
   or focus (R5). Class names are a contract consumers' E2E selectors target. */
.twc-signature {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.twc-signature-pad {
    position: relative;
    height: var(--twc-signature-height, 200px);
    overflow: hidden;
    background: var(--twc-signature-paper, #ffffff);
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: var(--twc-radius-btn, 0.5rem);
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: contain;
}

.twc-signature-pad > * {
    pointer-events: none;
}

.twc-signature-canvas,
svg.twc-signature-svg,
.twc-signature-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.twc-signature-preview {
    object-fit: contain;
}

.twc-signature-guide {
    position: absolute;
    top: 72%;
    left: 16px;
    right: 16px;
    border-top: 1px solid var(--twc-signature-guide, #64748b);
}

.twc-signature-placeholder {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.25rem);
    font-size: var(--twc-font-size-xs, 0.8rem);
    line-height: 1.2;
    color: var(--twc-signature-guide, #64748b);
}

.twc-signature.is-disabled .twc-signature-pad {
    opacity: 0.6;
    cursor: not-allowed;
}

.twc-signature.is-preview .twc-signature-pad {
    cursor: default;
}

.twc-signature-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* First in the tab order (the keyboard path), last on the row. */
.twc-signature-toggle {
    order: 1;
    margin-inline-start: auto;
}

.twc-signature-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 44px;
    min-height: 44px;
}

.twc-signature-btn .material-icons {
    font-size: 1.125rem;
}

.twc-signature-btn:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

/* SignaturePad, dark mode: the pad stays paper; its frame takes the dark input border. */
[data-bs-theme="dark"] .twc-signature-pad { border-color: var(--twc-color-border-input, #4c5663); }

/* OS-dark mirror of the SignaturePad rule above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-signature-pad { border-color: var(--twc-color-border-input, #4c5663); }
}

/* An invalid field (EditContext messages) — after the dark rules so it wins in both themes. */
.twc-signature .twc-signature-pad.invalid {
    border-color: var(--twc-color-danger, #dc2626);
}

/* ── PhotoPicker: "Take photo" / "Choose from library" and the preparing status ──
   Each button is a <label for> drawn by the consumer's classes (CameraClass / LibraryClass); its
   input is visually hidden but stays focusable, so the keyboard opens the picker from the input and
   the label shows the focus ring. With Sources = CameraAndLibrary the camera is hidden on a fine
   pointer with hover (a desktop: a camera input there is just a file picker). The status line is a
   quantity (R4: the theme's one-hue .progress) under subtle text; failures are danger text (R3).
   Class names are a contract consumers' E2E selectors target. */
.twc-photo-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.twc-photo-picker-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.twc-photo-picker-source {
    position: relative;
    display: inline-flex;
}

.twc-photo-picker-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
    opacity: 0;
}

.twc-photo-picker-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    cursor: pointer;
}

.twc-photo-picker-btn .material-icons {
    font-size: 1.25rem;
}

.twc-photo-picker-btn.disabled {
    cursor: not-allowed;
}

.twc-photo-picker-input:focus-visible + .twc-photo-picker-btn {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .twc-photo-picker-source-touch {
        display: none;
    }
}

.twc-photo-picker-status {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: var(--twc-font-size-sm, 0.875rem);
    color: var(--twc-color-subtle, #475569);
}

.twc-photo-picker-status .progress {
    height: 0.375rem;
}

.twc-photo-picker-failed {
    margin: 0;
    padding-inline-start: 1.25rem;
    font-size: var(--twc-font-size-sm, 0.875rem);
    color: var(--twc-color-danger, #dc2626);
}

.twc-photo-picker-failed-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* PhotoPicker, dark mode: status and failure text on a dark page without the theme sheet. */
[data-bs-theme="dark"] .twc-photo-picker-status { color: var(--twc-color-subtle, #9aa4b2); }
[data-bs-theme="dark"] .twc-photo-picker-failed { color: var(--twc-color-danger, #f87171); }

/* OS-dark mirror of the PhotoPicker rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-photo-picker-status { color: var(--twc-color-subtle, #9aa4b2); }
    :root:not([data-bs-theme]) .twc-photo-picker-failed { color: var(--twc-color-danger, #f87171); }
}

/* ── ThumbnailGrid: a responsive grid of photo tiles ──
   ul.twc-thumb-grid of li.twc-thumb; each tile is a .twc-thumb-frame holding the square
   .twc-thumb-open button (the photo, object-fit cover, or a placeholder glyph; the category chip
   bottom-left), the selection .twc-thumb-check top-left and the quiet-danger .twc-thumb-delete
   top-right — both on a card-ground plate so they stay legible on any photo, both 44×44 — and an
   optional .twc-thumb-overlay. A one-line .twc-thumb-caption sits under the frame. Three columns
   at ≤575.98px; --twc-thumb-min sets the smallest tile above that. Class names are a contract
   consumers' E2E selectors target. */
.twc-thumb-group + .twc-thumb-group {
    margin-top: 1rem;
}

.twc-thumb-group-heading {
    margin: 0 0 0.5rem;
}

.twc-thumb-group-count {
    font-variant-numeric: tabular-nums;
}

ul.twc-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--twc-thumb-min, 7rem), 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 575.98px) {
    ul.twc-thumb-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

li.twc-thumb {
    min-width: 0;
}

.twc-thumb-frame {
    position: relative;
}

.twc-thumb-open {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-md, 0.5rem);
    background: var(--twc-color-bg, #f5f6f8);
    color: var(--twc-color-text, #111827);
    font: inherit;
}

button.twc-thumb-open {
    cursor: pointer;
}

button.twc-thumb-open:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.twc-thumb-open img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.twc-thumb-placeholder .material-icons {
    font-size: 2rem;
    color: var(--twc-color-muted, #64748b);
}

.twc-thumb.is-selected .twc-thumb-open {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 0;
}

.twc-thumb-category {
    position: absolute;
    left: 0.375rem;
    bottom: 0.375rem;
    max-width: calc(100% - 0.75rem);
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: 5px;
    background: var(--twc-color-card-bg, #ffffff);
    color: var(--twc-color-subtle, #475569);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.twc-thumb-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    border-radius: var(--twc-radius-md, 0.5rem);
    pointer-events: none;
}

.twc-thumb-overlay > * {
    pointer-events: auto;
}

/* Both corner buttons keep a 44×44 hit area flush with the tile's corners (so two fit a 3-column
   phone tile), with only a small card-ground plate behind the glyph. */
.twc-thumb .twc-thumb-check,
.twc-thumb .twc-thumb-delete {
    position: absolute;
    top: 0;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--twc-radius-btn, 8px);
    background: transparent;
}

.twc-thumb .twc-thumb-check {
    left: 0;
}

.twc-thumb .twc-thumb-delete {
    right: 0;
}

.twc-thumb .twc-thumb-check .material-icons,
.twc-thumb .twc-thumb-delete .material-icons {
    padding: 3px;
    border-radius: 6px;
    background: var(--twc-color-card-bg, #ffffff);
    font-size: 1.25rem;
    line-height: 1;
}

.twc-thumb .twc-thumb-check .material-icons {
    font-size: 1.375rem;
}

/* Quiet until hovered (R5): the button stays transparent over the photo; the danger tint is mixed
   into the plate so the photo never shows through. */
.twc-thumb .twc-thumb-delete:hover:not(:disabled),
.twc-thumb .twc-thumb-delete:focus-visible {
    background: transparent;
}

.twc-thumb .twc-thumb-delete:hover:not(:disabled) .material-icons,
.twc-thumb .twc-thumb-delete:focus-visible .material-icons {
    background: color-mix(in srgb, var(--twc-color-danger, #dc2626) 12%, var(--twc-color-card-bg, #ffffff));
}

.twc-thumb-caption {
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--twc-color-subtle, #475569);
}

.twc-thumb-more-btn {
    padding: 0.5rem;
    font-size: var(--twc-font-size-sm, 0.875rem);
    font-weight: 500;
    text-align: center;
}

/* ThumbnailGrid, dark mode: tile borders, plates and text on a dark page without the theme sheet.
   The photos themselves are not themed. */
[data-bs-theme="dark"] .twc-thumb-open { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-bg, #20262d); color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-thumb-placeholder .material-icons { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-thumb.is-selected .twc-thumb-open,
[data-bs-theme="dark"] button.twc-thumb-open:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-thumb-category { border-color: var(--twc-color-border-input, #4c5663); background: var(--twc-color-card-bg, #15191f); color: var(--twc-color-subtle, #9aa4b2); }
[data-bs-theme="dark"] .twc-thumb .twc-thumb-check .material-icons,
[data-bs-theme="dark"] .twc-thumb .twc-thumb-delete .material-icons { background: var(--twc-color-card-bg, #15191f); }
[data-bs-theme="dark"] .twc-thumb .twc-thumb-delete:hover:not(:disabled) .material-icons,
[data-bs-theme="dark"] .twc-thumb .twc-thumb-delete:focus-visible .material-icons { background: color-mix(in srgb, var(--twc-color-danger, #f87171) 12%, var(--twc-color-card-bg, #15191f)); }
[data-bs-theme="dark"] .twc-thumb-caption { color: var(--twc-color-subtle, #9aa4b2); }

/* OS-dark mirror of the ThumbnailGrid rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-thumb-open { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-bg, #20262d); color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-thumb-placeholder .material-icons { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-thumb.is-selected .twc-thumb-open,
    :root:not([data-bs-theme]) button.twc-thumb-open:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-thumb-category { border-color: var(--twc-color-border-input, #4c5663); background: var(--twc-color-card-bg, #15191f); color: var(--twc-color-subtle, #9aa4b2); }
    :root:not([data-bs-theme]) .twc-thumb .twc-thumb-check .material-icons,
    :root:not([data-bs-theme]) .twc-thumb .twc-thumb-delete .material-icons { background: var(--twc-color-card-bg, #15191f); }
    :root:not([data-bs-theme]) .twc-thumb .twc-thumb-delete:hover:not(:disabled) .material-icons,
    :root:not([data-bs-theme]) .twc-thumb .twc-thumb-delete:focus-visible .material-icons { background: color-mix(in srgb, var(--twc-color-danger, #f87171) 12%, var(--twc-color-card-bg, #15191f)); }
    :root:not([data-bs-theme]) .twc-thumb-caption { color: var(--twc-color-subtle, #9aa4b2); }
}

/* ── Lightbox: a full-screen photo viewer on Dialog Size="Fullscreen" ──
   .twc-lightbox on the dialog root; .twc-lightbox-body (the modal body, unpadded) holds
   .twc-lightbox-layout: .twc-lightbox-main (the .twc-lightbox-stage with the photo and the round
   .twc-lightbox-nav buttons at mid-height, then the .twc-lightbox-info caption/meta) and the
   optional .twc-lightbox-details panel — beside the photo at ≥900px, below it on phones. The stage
   is dark in both themes (literals tagged "photo stage": photos read best on near-black, like the
   rail palette). The footer starts with the .twc-lightbox-counter. Class names are a contract
   consumers' E2E selectors target. */
.twc-lightbox .twc-lightbox-body {
    display: flex;
    flex-direction: column;
    padding: 0;
}

.twc-lightbox-layout {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    min-height: 0;
}

.twc-lightbox-main {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    min-width: 0;
    min-height: 0;
}

.twc-lightbox-stage {
    position: relative;
    flex: 1 0 auto;
    min-height: 60vh;
    overflow: hidden;
    background: #0b0d10; /* photo stage */
    touch-action: pan-y;
    user-select: none;
}

.twc-lightbox-stage:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: -2px;
}

.twc-lightbox-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.twc-lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
    transform: translateY(-50%);
}

.twc-lightbox-prev {
    left: 0.5rem;
}

.twc-lightbox-next {
    right: 0.5rem;
}

.twc-lightbox-nav .material-icons {
    font-size: 1.5rem;
    line-height: 1;
}

.twc-lightbox-info {
    padding: 0.75rem 1rem;
}

.twc-lightbox-caption {
    margin: 0;
    color: var(--twc-color-text, #111827);
}

.twc-lightbox-meta {
    margin: 0;
    font-size: var(--twc-font-size-sm, 0.875rem);
    color: var(--twc-color-subtle, #475569);
}

.twc-lightbox-caption + .twc-lightbox-meta {
    margin-top: 0.125rem;
}

.twc-lightbox-details {
    padding: 1rem;
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
    background: var(--twc-color-card-bg, #ffffff);
}

.twc-lightbox-counter {
    margin-right: auto;
    font-variant-numeric: tabular-nums;
    color: var(--twc-color-subtle, #475569);
}

.twc-lightbox-download .material-icons,
.twc-lightbox-delete .material-icons {
    font-size: 1.125rem;
    line-height: 1;
    vertical-align: -0.2em;
}

@media (min-width: 900px) {
    .twc-lightbox-layout {
        flex-direction: row;
        flex: 1 1 auto;
    }

    .twc-lightbox-main {
        flex: 1 1 auto;
    }

    .twc-lightbox-stage {
        flex: 1 1 auto;
        min-height: 0;
    }

    .twc-lightbox-details {
        flex: 0 0 22rem;
        width: 22rem;
        overflow-y: auto;
        border-top: 0;
        border-left: 1px solid var(--twc-color-border, #e2e8f0);
    }
}

/* Lightbox, dark mode: the panels and text around the stage on a dark page without the theme
   sheet. The stage is already dark. */
[data-bs-theme="dark"] .twc-lightbox-stage:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-lightbox-caption { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-lightbox-meta,
[data-bs-theme="dark"] .twc-lightbox-counter { color: var(--twc-color-subtle, #9aa4b2); }
[data-bs-theme="dark"] .twc-lightbox-details { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-card-bg, #15191f); }

/* OS-dark mirror of the Lightbox rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-lightbox-stage:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-lightbox-caption { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-lightbox-meta,
    :root:not([data-bs-theme]) .twc-lightbox-counter { color: var(--twc-color-subtle, #9aa4b2); }
    :root:not([data-bs-theme]) .twc-lightbox-details { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-card-bg, #15191f); }
}

/* ── UploadQueue: the per-file list behind a multi-file upload ──
   A .card whose .table-toolbar header holds the summary (role=status), a determinate finished/total
   .progress while busy and Clear done; then ul.twc-upload-rows of li.twc-upload-row: an optional
   40px .twc-upload-thumb, .twc-upload-body (one-line .twc-upload-name over the .twc-upload-meta line:
   size · StatusDot word (R4) · spinner · danger error text) and .twc-upload-actions, each a 44×44
   .twc-upload-action — Retry and Cancel the theme's .btn-neutral, Remove .btn-quiet-danger (R5).
   ≤575.98px the row wraps: the actions drop under the name (right-aligned) once the name would
   get narrower than 9rem. Class names are a contract consumers' E2E selectors
   target. */
.twc-upload-queue {
    overflow: hidden;
}

.twc-upload-queue-header {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    min-height: calc(44px + 1rem);
}

.twc-upload-summary {
    flex: 1 1 12rem;
    min-width: 0;
    font-size: var(--twc-font-size-sm, 0.875rem);
    font-weight: 500;
}

.twc-upload-queue-progress {
    flex: 0 1 8rem;
    height: 0.375rem;
}

.twc-upload-clear {
    min-height: 44px;
}

.twc-upload-rows {
    margin: 0;
    padding: 0;
    list-style: none;
}

.twc-upload-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    min-height: calc(44px + 1rem);
}

.twc-upload-row + .twc-upload-row {
    border-top: 1px solid var(--twc-color-border, #e2e8f0);
}

.twc-upload-thumb {
    flex: 0 0 40px;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: var(--twc-radius-sm, 0.375rem);
    background: var(--twc-color-surface-subtle, #f8fafc);
    color: var(--twc-color-muted, #64748b);
}

.twc-upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.twc-upload-thumb .material-icons {
    font-size: 1.25rem;
}

.twc-upload-body {
    flex: 1 1 auto;
    min-width: 0;
}

.twc-upload-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.twc-upload-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.375rem;
    font-size: var(--twc-font-size-sm, 0.875rem);
    color: var(--twc-color-subtle, #475569);
}

.twc-upload-size {
    font-variant-numeric: tabular-nums;
}

.twc-upload-spinner .twc-loading-text:empty {
    display: none;
}

.twc-upload-error {
    color: var(--twc-color-danger, #dc2626);
    overflow-wrap: anywhere;
}

.twc-upload-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 0.25rem;
}

.twc-upload-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.twc-upload-action .material-icons {
    font-size: 1.125rem;
    line-height: 1;
}

.twc-upload-cancel,
.twc-upload-remove {
    padding: 0;
}

@media (max-width: 575.98px) {
    .twc-upload-row {
        flex-wrap: wrap;
    }

    .twc-upload-body {
        flex-basis: 9rem;
    }

    .twc-upload-actions {
        margin-inline-start: auto;
    }
}

/* UploadQueue, dark mode: row rules, thumbnail plate and text on a dark page without the theme sheet. */
[data-bs-theme="dark"] .twc-upload-row + .twc-upload-row { border-top-color: var(--twc-color-border, #3a424d); }
[data-bs-theme="dark"] .twc-upload-thumb { background: var(--twc-color-surface-subtle, #1b222b); color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-upload-meta { color: var(--twc-color-subtle, #9aa4b2); }
[data-bs-theme="dark"] .twc-upload-error { color: var(--twc-color-danger, #f87171); }

/* OS-dark mirror of the UploadQueue rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-upload-row + .twc-upload-row { border-top-color: var(--twc-color-border, #3a424d); }
    :root:not([data-bs-theme]) .twc-upload-thumb { background: var(--twc-color-surface-subtle, #1b222b); color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-upload-meta { color: var(--twc-color-subtle, #9aa4b2); }
    :root:not([data-bs-theme]) .twc-upload-error { color: var(--twc-color-danger, #f87171); }
}

/* ── DropZone: click-to-browse or drag-and-drop file picking ──
   A dashed .twc-dropzone holding a decorative .twc-dropzone-icon, the .twc-dropzone-prompt (500
   weight) or, on a touch screen (hover: none, where nothing is dragged), the .twc-dropzone-touch-
   prompt, and an optional .twc-dropzone-hint. The real control is the .twc-dropzone-input laid over
   the whole zone at opacity 0, so a click, tap or keypress anywhere opens the picker; earlier pick
   generations stay in the DOM, hidden and inert. techwork-dropzone.js toggles .is-dragover while
   files are dragged over it. Hover and focus only recolour the border (nothing is hover-only); the
   focused input draws the primary outline round the zone. .twc-dropzone-compact is one 44px line
   for dialogs. Class names are a contract consumers' E2E selectors target. */
.twc-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 7rem;
    padding: 1.5rem 1rem;
    border: 2px dashed var(--twc-color-border-input, #cbd5e1);
    border-radius: var(--twc-radius-card, 0.875rem);
    background: var(--twc-color-surface-subtle, #f8fafc);
    text-align: center;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.twc-dropzone:hover,
.twc-dropzone:focus-within {
    border-color: var(--twc-color-primary, #3b5bdb);
}

.twc-dropzone:focus-within {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.twc-dropzone.is-dragover {
    border-style: solid;
    border-color: var(--twc-color-primary, #3b5bdb);
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
}

.twc-dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.twc-dropzone-input[hidden] {
    display: none;
}

.twc-dropzone-icon {
    font-size: 2rem;
    line-height: 1;
    color: var(--twc-color-muted, #64748b);
}

.twc-dropzone-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    min-width: 0;
}

.twc-dropzone-prompt,
.twc-dropzone-touch-prompt {
    font-weight: 500;
}

.twc-dropzone-touch-prompt {
    display: none;
}

@media (hover: none) {
    .twc-dropzone-prompt {
        display: none;
    }

    .twc-dropzone-touch-prompt {
        display: inline;
    }
}

.twc-dropzone-hint {
    font-size: var(--twc-font-size-xs, 0.8rem);
    color: var(--twc-color-subtle, #475569);
}

.twc-dropzone-compact {
    flex-direction: row;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.25rem 0.75rem;
}

.twc-dropzone-compact .twc-dropzone-icon {
    font-size: 1.25rem;
}

.twc-dropzone-compact .twc-dropzone-text {
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
}

.twc-dropzone-compact .twc-dropzone-prompt,
.twc-dropzone-compact .twc-dropzone-touch-prompt,
.twc-dropzone-compact .twc-dropzone-hint {
    overflow: hidden;
    text-overflow: ellipsis;
}

.twc-dropzone.is-disabled {
    opacity: 0.6;
    border-color: var(--twc-color-border-input, #cbd5e1);
}

.twc-dropzone.is-disabled .twc-dropzone-input {
    cursor: not-allowed;
}

/* DropZone, dark mode: the plate, its dashed border and the muted text on a dark page without the
   theme sheet; hover/focus/drag-over restated so the plate rule does not win over them. */
[data-bs-theme="dark"] .twc-dropzone { background: var(--twc-color-surface-subtle, #1b222b); border-color: var(--twc-color-border-input, #4c5663); }
[data-bs-theme="dark"] .twc-dropzone:hover,
[data-bs-theme="dark"] .twc-dropzone:focus-within { border-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-dropzone:focus-within { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-dropzone.is-dragover { border-color: var(--twc-color-primary, #748ffc); background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
[data-bs-theme="dark"] .twc-dropzone.is-disabled { border-color: var(--twc-color-border-input, #4c5663); }
[data-bs-theme="dark"] .twc-dropzone-icon { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-dropzone-hint { color: var(--twc-color-subtle, #9aa4b2); }

/* OS-dark mirror of the DropZone rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-dropzone { background: var(--twc-color-surface-subtle, #1b222b); border-color: var(--twc-color-border-input, #4c5663); }
    :root:not([data-bs-theme]) .twc-dropzone:hover,
    :root:not([data-bs-theme]) .twc-dropzone:focus-within { border-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-dropzone:focus-within { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-dropzone.is-dragover { border-color: var(--twc-color-primary, #748ffc); background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
    :root:not([data-bs-theme]) .twc-dropzone.is-disabled { border-color: var(--twc-color-border-input, #4c5663); }
    :root:not([data-bs-theme]) .twc-dropzone-icon { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-dropzone-hint { color: var(--twc-color-subtle, #9aa4b2); }
}

/* ── KanbanBoard: a stage board ──
   section.twc-kanban > (div.twc-kanban-picker.segmented, phones only) + div.twc-kanban-columns of
   section.twc-kanban-column[data-kanban-column]: a header (h3 title with an optional tone dot, a
   quiet .twc-kanban-count, a Warning "Over limit" dot past the WIP limit, a tabular
   .twc-kanban-summary pushed right, an optional description), ol.twc-kanban-cards of
   li.twc-kanban-card[data-kanban-item] (body + a 44px .twc-kanban-move menu toggle), the empty line
   and an optional footer. Desktop and tablet: columns side by side on the subtle ground, the strip
   scrolling sideways inside the board, never the page. While a Move menu is open the strip makes
   room below, so the menu is not clipped by the strip's overflow. ≤767.98px: .twc-kanban-phone-
   picker shows the picker and only the .is-active column as a plain list; .twc-kanban-phone-scroll
   snaps 85vw columns with the next one's edge in view. .twc-kanban-drop-target,
   .twc-kanban-dragging, [data-kanban-drag] and the .twc-kanban-ghost clone belong to the optional
   drag module (techwork-kanban.js). No animation. Class names are a
   contract consumers' E2E selectors target. */
.twc-kanban {
    position: relative;
    min-width: 0;
}

.twc-kanban .twc-kanban-picker {
    display: none;
}

.twc-kanban-columns {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 0.25rem;
}

@media (min-width: 576px) {
    .twc-kanban-columns:has(.twc-dropdown.is-open) {
        padding-bottom: 22rem;
    }
}

.twc-kanban-column {
    display: flex;
    flex: 1 0 15rem;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 15rem;
    padding: 0.75rem;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-card, 0.875rem);
    background: var(--twc-color-surface-subtle, #f8fafc);
}

.twc-kanban-column-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    min-height: 1.75rem;
}

.twc-kanban-column-title {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--twc-color-text, #111827);
}

/* The theme's .tag-quiet look, repeated with fallbacks; a count, so tabular. */
.twc-kanban-count {
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: 5px;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--twc-color-subtle, #475569);
    white-space: nowrap;
}

.twc-kanban-over {
    font-size: var(--twc-font-size-xs, 0.8rem);
    white-space: nowrap;
}

.twc-kanban-summary {
    margin-left: auto;
    font-size: var(--twc-font-size-xs, 0.8rem);
    font-variant-numeric: tabular-nums;
    color: var(--twc-color-subtle, #475569);
    white-space: nowrap;
}

.twc-kanban-column-desc {
    flex-basis: 100%;
    margin: 0;
    font-size: var(--twc-font-size-xs, 0.8rem);
    color: var(--twc-color-subtle, #475569);
}

.twc-kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.twc-kanban-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.5rem 0.25rem 0.5rem 0.75rem;
    border: 1px solid var(--twc-color-border, #e2e8f0);
    border-radius: var(--twc-radius-md, 0.5rem);
    background: var(--twc-color-card-bg, #ffffff);
    box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04));
    color: var(--twc-color-text, #111827);
    transition: border-color 0.15s ease;
}

.twc-kanban-card[role="button"] {
    cursor: pointer;
}

.twc-kanban-card[role="button"]:hover {
    border-color: var(--twc-color-border-input, #cbd5e1);
}

.twc-kanban-card:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 2px;
}

.twc-kanban-card-body {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.25rem 0;
    overflow-wrap: anywhere;
}

.twc-kanban-card-actions {
    flex: none;
}

.twc-kanban-move-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--twc-color-muted, #64748b);
}

.twc-kanban-move-toggle:hover:not(:disabled),
.twc-kanban-move-toggle[aria-expanded="true"] {
    background: var(--twc-color-hover, #eef1f6);
    color: var(--twc-color-text, #111827);
}

.twc-kanban-move-toggle:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 0;
}

.twc-kanban-move-toggle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.twc-kanban-empty {
    padding: 0.25rem;
    font-size: var(--twc-font-size-xs, 0.8rem);
    color: var(--twc-color-subtle, #475569);
}

.twc-kanban-column.twc-kanban-drop-target {
    outline: 2px dashed var(--twc-color-primary, #3b5bdb);
    outline-offset: -2px;
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
}

.twc-kanban-card.twc-kanban-dragging {
    opacity: 0.6;
}

/* While the drag module is attached a long press must start a drag, not a text selection or the
   iOS callout. */
.twc-kanban[data-kanban-drag] .twc-kanban-card {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* The drag module's ghost: a clone of the card in <body>, following the pointer by transform. On
   the dropdown layer (no new z-index); never a hit target. */
.twc-kanban-ghost {
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--twc-z-dropdown, 31);
    margin: 0;
    list-style: none;
    pointer-events: none;
    box-shadow: var(--twc-shadow-modal, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
    cursor: grabbing;
}

/* The stage picker: the theme's .segmented look, repeated with fallbacks, scrolling sideways. */
.twc-kanban-picker {
    width: fit-content;
    max-width: 100%;
    margin-bottom: 0.75rem;
    overflow-x: auto;
    border: 1px solid var(--twc-color-border-input, #cbd5e1);
    border-radius: var(--twc-radius-btn, 0.5rem);
}

.twc-kanban-picker-option {
    flex: none;
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    border: 0;
    background: transparent;
    color: var(--twc-color-subtle, #475569);
    font: inherit;
    font-size: var(--twc-font-size-sm, 0.9rem);
    white-space: nowrap;
    cursor: pointer;
}

.twc-kanban-picker-option + .twc-kanban-picker-option {
    border-left: 1px solid var(--twc-color-border-input, #cbd5e1);
}

.twc-kanban-picker-option[aria-pressed="true"] {
    background: var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12));
    color: var(--twc-color-primary-hover, #1e3a8a);
}

.twc-kanban-picker-option:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: -2px;
}

.twc-kanban-picker-count {
    margin-left: 0.25rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 767.98px) {
    .twc-kanban.twc-kanban-phone-picker .twc-kanban-picker {
        display: flex;
        overflow-x: auto; /* over the theme's .segmented overflow: hidden */
    }

    .twc-kanban-phone-picker .twc-kanban-columns {
        display: block;
        overflow: visible;
        padding-bottom: 0;
    }

    .twc-kanban-phone-picker .twc-kanban-column {
        min-width: 0;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .twc-kanban-phone-picker .twc-kanban-column:not(.is-active) {
        display: none;
    }

    .twc-kanban-phone-scroll .twc-kanban-columns {
        scroll-snap-type: x mandatory;
    }

    .twc-kanban-phone-scroll .twc-kanban-column {
        flex: 0 0 85vw;
        min-width: 0;
        scroll-snap-align: start;
    }
}

/* KanbanBoard, dark mode: column ground, cards, counts and muted text on a dark page without the
   theme sheet; the phone-picker column stays transparent (restated so the ground rule loses). */
[data-bs-theme="dark"] .twc-kanban-column { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-surface-subtle, #1b222b); }
[data-bs-theme="dark"] .twc-kanban-column-title { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-kanban-count { border-color: var(--twc-color-border-input, #4c5663); color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-kanban-summary,
[data-bs-theme="dark"] .twc-kanban-column-desc,
[data-bs-theme="dark"] .twc-kanban-empty { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-kanban-card { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-card-bg, #15191f); box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3)); color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-kanban-card[role="button"]:hover { border-color: var(--twc-color-border-input, #4c5663); }
[data-bs-theme="dark"] .twc-kanban-card:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-kanban-move-toggle { color: var(--twc-color-muted, #a8b0bb); }
[data-bs-theme="dark"] .twc-kanban-move-toggle:hover:not(:disabled),
[data-bs-theme="dark"] .twc-kanban-move-toggle[aria-expanded="true"] { background: var(--twc-color-hover, #232a33); color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-kanban-move-toggle:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-kanban-column.twc-kanban-drop-target { outline-color: var(--twc-color-primary, #748ffc); background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
[data-bs-theme="dark"] .twc-kanban-picker { border-color: var(--twc-color-border-input, #4c5663); }
[data-bs-theme="dark"] .twc-kanban-picker-option { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-kanban-picker-option + .twc-kanban-picker-option { border-left-color: var(--twc-color-border-input, #4c5663); }
[data-bs-theme="dark"] .twc-kanban-picker-option[aria-pressed="true"] { background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); color: var(--twc-color-primary-hover, #a3b4ff); }
[data-bs-theme="dark"] .twc-kanban-picker-option:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }

@media (max-width: 767.98px) {
    [data-bs-theme="dark"] .twc-kanban-phone-picker .twc-kanban-column { background: transparent; }
}

/* OS-dark mirror of the KanbanBoard rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-kanban-column { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-surface-subtle, #1b222b); }
    :root:not([data-bs-theme]) .twc-kanban-column-title { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-kanban-count { border-color: var(--twc-color-border-input, #4c5663); color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-kanban-summary,
    :root:not([data-bs-theme]) .twc-kanban-column-desc,
    :root:not([data-bs-theme]) .twc-kanban-empty { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-kanban-card { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-card-bg, #15191f); box-shadow: var(--twc-shadow-card, 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3)); color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-kanban-card[role="button"]:hover { border-color: var(--twc-color-border-input, #4c5663); }
    :root:not([data-bs-theme]) .twc-kanban-card:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-kanban-move-toggle { color: var(--twc-color-muted, #a8b0bb); }
    :root:not([data-bs-theme]) .twc-kanban-move-toggle:hover:not(:disabled),
    :root:not([data-bs-theme]) .twc-kanban-move-toggle[aria-expanded="true"] { background: var(--twc-color-hover, #232a33); color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-kanban-move-toggle:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-kanban-column.twc-kanban-drop-target { outline-color: var(--twc-color-primary, #748ffc); background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); }
    :root:not([data-bs-theme]) .twc-kanban-picker { border-color: var(--twc-color-border-input, #4c5663); }
    :root:not([data-bs-theme]) .twc-kanban-picker-option { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-kanban-picker-option + .twc-kanban-picker-option { border-left-color: var(--twc-color-border-input, #4c5663); }
    :root:not([data-bs-theme]) .twc-kanban-picker-option[aria-pressed="true"] { background: var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14)); color: var(--twc-color-primary-hover, #a3b4ff); }
    :root:not([data-bs-theme]) .twc-kanban-picker-option:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}

@media (prefers-color-scheme: dark) and (max-width: 767.98px) {
    :root:not([data-bs-theme]) .twc-kanban-phone-picker .twc-kanban-column { background: transparent; }
}

/* ── Date strip and time slots ──
   DateStrip: div.twc-datestrip > div.twc-datestrip-head (span.twc-datestrip-title, a polite live
   region, and two 44px .twc-datestrip-nav paging controls) + ul.twc-datestrip-days, a horizontal
   scroller of li.twc-datestrip-cell, each 100% / --twc-datestrip-page of its width (set inline from
   PageSize) so exactly one page shows at every width, snapping per day; overscroll-behavior-x
   keeps a swipe at the end from reaching the browser's or a native shell's back gesture. Each day
   (.twc-datestrip-day, a button or, in link mode, an a / span) stacks .twc-datestrip-dow,
   .twc-datestrip-num and a .twc-datestrip-badge, .twc-datestrip-dot or the loading
   .twc-datestrip-skeleton; states .is-today, .is-selected, .is-empty, .is-disabled.
   Component tokens, read but never defined here (a host that does not load the app theme, e.g. a
   tenant site, maps them to its brand): --twc-slot-accent, --twc-slot-on-accent,
   --twc-slot-accent-tint, --twc-slot-surface, --twc-slot-border, --twc-slot-text,
   --twc-slot-subtle, --twc-slot-muted, --twc-slot-radius; each falls back to the theme token and
   then a literal. No animation. Class names are a contract consumers' E2E selectors target. */
.twc-datestrip {
    display: grid;
    gap: 0.5rem;
    min-width: 0;
}

.twc-datestrip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.twc-datestrip-title {
    font-weight: 500;
    color: var(--twc-slot-text, var(--twc-color-text, #111827));
}

.twc-datestrip-navs {
    display: inline-flex;
    gap: 0.25rem;
}

/* The theme's .btn-icon-quiet look, repeated with fallbacks so the strip is complete without it. */
.twc-datestrip-nav {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--twc-slot-radius, var(--twc-radius-btn, 0.5rem));
    background: transparent;
    color: var(--twc-slot-subtle, var(--twc-color-subtle, #475569));
}

.twc-datestrip-nav .material-icons {
    font-size: 1.25rem;
}

.twc-datestrip-nav:disabled,
.twc-datestrip-nav.is-disabled {
    opacity: 0.35;
    border-color: transparent;
    background: transparent;
    cursor: default;
    pointer-events: none;
}

.twc-datestrip-days {
    display: flex;
    gap: 0;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.twc-datestrip-days::-webkit-scrollbar {
    display: none;
}

.twc-datestrip-cell {
    display: flex;
    flex: 0 0 calc(100% / var(--twc-datestrip-page, 7));
    min-width: 44px;
    /* 2px each side, shrinking towards 0 when a page is narrow, so the 44px day never spills out of
       its cell (a padding percentage is of the scroller's width): seven days fit down to 308px, e.g.
       a Dialog at 375px (327px). Narrower than 44px a day, the strip scrolls a part day. */
    padding: 0 max(0px, min(2px, calc((100% / var(--twc-datestrip-page, 7) - 44px) / 2)));
    scroll-snap-align: start;
}

.twc-datestrip-day {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    min-width: 44px;
    min-height: 64px;
    padding: 0.375rem 0.125rem;
    border: 1px solid transparent;
    border-radius: var(--twc-slot-radius, var(--twc-radius-btn, 0.5rem));
    background: transparent;
    color: var(--twc-slot-text, var(--twc-color-text, #111827));
    font: inherit;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.twc-datestrip-dow {
    font-size: var(--twc-font-size-xs, 0.8rem);
    white-space: nowrap;
}

.twc-datestrip-num {
    font-size: 1.125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.twc-datestrip-badge {
    max-width: 100%;
    overflow: hidden;
    font-size: var(--twc-font-size-xs, 0.8rem);
    font-variant-numeric: tabular-nums;
    color: var(--twc-slot-subtle, var(--twc-color-subtle, #475569));
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twc-datestrip-dot {
    width: 6px;
    height: 6px;
    margin-top: 0.25rem;
    border-radius: 50%;
    background: var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
}

.twc-datestrip-skeleton {
    width: 60%;
    height: 0.5rem;
    margin-top: 0.25rem;
    border-radius: 2px;
    background: var(--twc-slot-border, var(--twc-color-border, #e2e8f0));
}

a.twc-datestrip-day:hover {
    color: var(--twc-slot-text, var(--twc-color-text, #111827));
}

.twc-datestrip-day:hover:not(.is-disabled):not(.is-selected) {
    background: var(--twc-slot-accent-tint, var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12)));
}

.twc-datestrip-day.is-today .twc-datestrip-num {
    text-decoration: underline;
    text-decoration-color: var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.twc-datestrip-day.is-empty,
.twc-datestrip-day.is-disabled {
    color: var(--twc-slot-muted, var(--twc-color-muted, #64748b));
}

.twc-datestrip-day.is-disabled {
    cursor: default;
}

.twc-datestrip-day.is-disabled .twc-datestrip-num {
    text-decoration: line-through;
}

.twc-datestrip-day.is-selected {
    background: var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
    color: var(--twc-slot-on-accent, var(--twc-color-on-primary, #ffffff));
}

.twc-datestrip-day.is-selected .twc-datestrip-badge {
    color: inherit;
}

.twc-datestrip-day.is-selected .twc-datestrip-dot {
    background: currentColor;
}

.twc-datestrip-day.is-selected.is-today .twc-datestrip-num {
    text-decoration-color: currentColor;
}

.twc-datestrip-day:focus-visible,
.twc-datestrip-nav:focus-visible {
    outline: 2px solid var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
    outline-offset: 2px;
}

/* Date strip, dark mode: day ink, badge, muted days and the selected fill (#15191f on #748ffc, 5.9:1). */
[data-bs-theme="dark"] .twc-datestrip-title,
[data-bs-theme="dark"] .twc-datestrip-day { color: var(--twc-slot-text, var(--twc-color-text, #f3f6fb)); }
[data-bs-theme="dark"] .twc-datestrip-nav,
[data-bs-theme="dark"] .twc-datestrip-badge { color: var(--twc-slot-subtle, var(--twc-color-subtle, #d7dce3)); }
[data-bs-theme="dark"] .twc-datestrip-day.is-empty,
[data-bs-theme="dark"] .twc-datestrip-day.is-disabled { color: var(--twc-slot-muted, var(--twc-color-muted, #a8b0bb)); }
[data-bs-theme="dark"] .twc-datestrip-day:hover:not(.is-disabled):not(.is-selected) { background: var(--twc-slot-accent-tint, var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14))); }
[data-bs-theme="dark"] .twc-datestrip-day.is-selected { background: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); color: var(--twc-slot-on-accent, var(--twc-color-on-primary, #15191f)); }
[data-bs-theme="dark"] .twc-datestrip-dot { background: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
[data-bs-theme="dark"] .twc-datestrip-day.is-today .twc-datestrip-num { text-decoration-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
[data-bs-theme="dark"] .twc-datestrip-day.is-selected.is-today .twc-datestrip-num { text-decoration-color: currentColor; }
[data-bs-theme="dark"] .twc-datestrip-skeleton { background: var(--twc-slot-border, var(--twc-color-border, #3a424d)); }
[data-bs-theme="dark"] .twc-datestrip-day:focus-visible,
[data-bs-theme="dark"] .twc-datestrip-nav:focus-visible { outline-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }

/* OS-dark mirror of the date strip rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-datestrip-title,
    :root:not([data-bs-theme]) .twc-datestrip-day { color: var(--twc-slot-text, var(--twc-color-text, #f3f6fb)); }
    :root:not([data-bs-theme]) .twc-datestrip-nav,
    :root:not([data-bs-theme]) .twc-datestrip-badge { color: var(--twc-slot-subtle, var(--twc-color-subtle, #d7dce3)); }
    :root:not([data-bs-theme]) .twc-datestrip-day.is-empty,
    :root:not([data-bs-theme]) .twc-datestrip-day.is-disabled { color: var(--twc-slot-muted, var(--twc-color-muted, #a8b0bb)); }
    :root:not([data-bs-theme]) .twc-datestrip-day:hover:not(.is-disabled):not(.is-selected) { background: var(--twc-slot-accent-tint, var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14))); }
    :root:not([data-bs-theme]) .twc-datestrip-day.is-selected { background: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); color: var(--twc-slot-on-accent, var(--twc-color-on-primary, #15191f)); }
    :root:not([data-bs-theme]) .twc-datestrip-dot { background: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
    :root:not([data-bs-theme]) .twc-datestrip-day.is-today .twc-datestrip-num { text-decoration-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
    :root:not([data-bs-theme]) .twc-datestrip-day.is-selected.is-today .twc-datestrip-num { text-decoration-color: currentColor; }
    :root:not([data-bs-theme]) .twc-datestrip-skeleton { background: var(--twc-slot-border, var(--twc-color-border, #3a424d)); }
    :root:not([data-bs-theme]) .twc-datestrip-day:focus-visible,
    :root:not([data-bs-theme]) .twc-datestrip-nav:focus-visible { outline-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
}

/* Time slots: div.twc-slots (TimeSlotPicker root) > div.twc-slots-list (the listbox; no role in
   form mode) of div.twc-slot-group (SlotGroup: an h2–h6 .twc-slot-group-title with an aria-hidden
   .twc-slot-group-count, then div.twc-slot-grid of .twc-slot options), plus a visually hidden
   role="status". Each .twc-slot (a button: role="option", or type="submit" in form mode) stacks
   .twc-slot-time, .twc-slot-price, .twc-slot-detail, .twc-slot-note and the .twc-slot-flag marker
   (a dot and a word, R4: no filled pill); states .is-highlight, .is-selected, .is-disabled.
   Loading: .twc-slots-loading of static .twc-slots-skeleton chips; empty: .twc-slots-empty.
   Columns: auto-fill, minmax(6.5rem, 1fr), three per row at 375px, never a horizontal scroll.
   Same component tokens as the date strip above. No animation. */
.twc-slots,
.twc-slots-list {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.twc-slot-group {
    display: grid;
    gap: 0.5rem;
    min-width: 0;
}

.twc-slot-group-title {
    margin: 0;
    font-size: var(--twc-font-size-sm, 0.875rem);
    font-weight: 500;
    line-height: 1.4;
    color: var(--twc-slot-subtle, var(--twc-color-subtle, #475569));
}

.twc-slot-group-count {
    font-weight: 400;
    color: var(--twc-slot-muted, var(--twc-color-muted, #64748b));
}

.twc-slot-group-count::before {
    content: "\00b7";
    margin: 0 0.375rem;
}

.twc-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
    gap: 0.5rem;
    min-width: 0;
}

.twc-slot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--twc-slot-border, var(--twc-color-border, #e2e8f0));
    border-radius: var(--twc-slot-radius, var(--twc-radius-btn, 0.5rem));
    background: var(--twc-slot-surface, var(--twc-color-card-bg, #ffffff));
    color: var(--twc-slot-text, var(--twc-color-text, #111827));
    font: inherit;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.twc-slot-time {
    font-size: 1rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.twc-slot-price,
.twc-slot-detail,
.twc-slot-note {
    max-width: 100%;
    font-size: var(--twc-font-size-xs, 0.8rem);
    color: var(--twc-slot-subtle, var(--twc-color-subtle, #475569));
    overflow-wrap: anywhere;
}

.twc-slot-flag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--twc-font-size-xs, 0.8rem);
    font-weight: 500;
    color: var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
}

.twc-slot-flag-dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.twc-slot.is-highlight {
    border-color: var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
    background: var(--twc-slot-accent-tint, var(--twc-color-primary-tint, rgba(59, 91, 219, 0.12)));
}

.twc-slot:hover:not(.is-disabled):not(.is-selected) {
    border-color: var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
}

.twc-slot.is-selected {
    border-color: var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
    background: var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
    color: var(--twc-slot-on-accent, var(--twc-color-on-primary, #ffffff));
}

.twc-slot.is-selected .twc-slot-price,
.twc-slot.is-selected .twc-slot-detail,
.twc-slot.is-selected .twc-slot-note,
.twc-slot.is-selected .twc-slot-flag {
    color: inherit;
}

.twc-slot.is-disabled,
.twc-slot:disabled {
    color: var(--twc-slot-muted, var(--twc-color-muted, #64748b));
    cursor: default;
}

.twc-slot.is-disabled .twc-slot-time {
    text-decoration: line-through;
}

.twc-slot:focus-visible {
    outline: 2px solid var(--twc-slot-accent, var(--twc-color-primary, #3b5bdb));
    outline-offset: 2px;
}

.twc-slots-skeleton {
    display: block;
    height: 44px;
    border-radius: var(--twc-slot-radius, var(--twc-radius-btn, 0.5rem));
    background: var(--twc-color-surface-subtle, #f1f5f9);
}

.twc-slots-empty {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 0;
    color: var(--twc-slot-subtle, var(--twc-color-subtle, #475569));
}

.twc-slots-empty .material-icons {
    font-size: 1.25rem;
    line-height: 1.25;
}

/* Time slots, dark mode: surface, border, ink and subtle lines; the selected fill (#15191f on #748ffc, 5.9:1). */
[data-bs-theme="dark"] .twc-slot { border-color: var(--twc-slot-border, var(--twc-color-border, #3a424d)); background: var(--twc-slot-surface, var(--twc-color-card-bg, #15191f)); color: var(--twc-slot-text, var(--twc-color-text, #f3f6fb)); }
[data-bs-theme="dark"] .twc-slot-group-title,
[data-bs-theme="dark"] .twc-slot-price,
[data-bs-theme="dark"] .twc-slot-detail,
[data-bs-theme="dark"] .twc-slot-note,
[data-bs-theme="dark"] .twc-slots-empty { color: var(--twc-slot-subtle, var(--twc-color-subtle, #d7dce3)); }
[data-bs-theme="dark"] .twc-slot-group-count,
[data-bs-theme="dark"] .twc-slot.is-disabled,
[data-bs-theme="dark"] .twc-slot:disabled { color: var(--twc-slot-muted, var(--twc-color-muted, #a8b0bb)); }
[data-bs-theme="dark"] .twc-slot-flag { color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
[data-bs-theme="dark"] .twc-slot.is-highlight { border-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); background: var(--twc-slot-accent-tint, var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14))); }
[data-bs-theme="dark"] .twc-slot:hover:not(.is-disabled):not(.is-selected) { border-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
[data-bs-theme="dark"] .twc-slot.is-selected { border-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); background: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); color: var(--twc-slot-on-accent, var(--twc-color-on-primary, #15191f)); }
[data-bs-theme="dark"] .twc-slot.is-selected .twc-slot-price,
[data-bs-theme="dark"] .twc-slot.is-selected .twc-slot-detail,
[data-bs-theme="dark"] .twc-slot.is-selected .twc-slot-note,
[data-bs-theme="dark"] .twc-slot.is-selected .twc-slot-flag { color: inherit; }
[data-bs-theme="dark"] .twc-slot:focus-visible { outline-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
[data-bs-theme="dark"] .twc-slots-skeleton { background: var(--twc-color-surface-subtle, #1b222b); }

/* OS-dark mirror of the time slot rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-slot { border-color: var(--twc-slot-border, var(--twc-color-border, #3a424d)); background: var(--twc-slot-surface, var(--twc-color-card-bg, #15191f)); color: var(--twc-slot-text, var(--twc-color-text, #f3f6fb)); }
    :root:not([data-bs-theme]) .twc-slot-group-title,
    :root:not([data-bs-theme]) .twc-slot-price,
    :root:not([data-bs-theme]) .twc-slot-detail,
    :root:not([data-bs-theme]) .twc-slot-note,
    :root:not([data-bs-theme]) .twc-slots-empty { color: var(--twc-slot-subtle, var(--twc-color-subtle, #d7dce3)); }
    :root:not([data-bs-theme]) .twc-slot-group-count,
    :root:not([data-bs-theme]) .twc-slot.is-disabled,
    :root:not([data-bs-theme]) .twc-slot:disabled { color: var(--twc-slot-muted, var(--twc-color-muted, #a8b0bb)); }
    :root:not([data-bs-theme]) .twc-slot-flag { color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
    :root:not([data-bs-theme]) .twc-slot.is-highlight { border-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); background: var(--twc-slot-accent-tint, var(--twc-color-primary-tint, rgba(116, 143, 252, 0.14))); }
    :root:not([data-bs-theme]) .twc-slot:hover:not(.is-disabled):not(.is-selected) { border-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
    :root:not([data-bs-theme]) .twc-slot.is-selected { border-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); background: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); color: var(--twc-slot-on-accent, var(--twc-color-on-primary, #15191f)); }
    :root:not([data-bs-theme]) .twc-slot.is-selected .twc-slot-price,
    :root:not([data-bs-theme]) .twc-slot.is-selected .twc-slot-detail,
    :root:not([data-bs-theme]) .twc-slot.is-selected .twc-slot-note,
    :root:not([data-bs-theme]) .twc-slot.is-selected .twc-slot-flag { color: inherit; }
    :root:not([data-bs-theme]) .twc-slot:focus-visible { outline-color: var(--twc-slot-accent, var(--twc-color-primary, #748ffc)); }
    :root:not([data-bs-theme]) .twc-slots-skeleton { background: var(--twc-color-surface-subtle, #1b222b); }
}

/* Day agenda: section.twc-agenda (DayAgenda root; .is-busy dims a reload) > ol.twc-agenda-list of
   li rows on one three-column grid — time | rail | content:
   .twc-agenda-node (start/end: a 28px icon circle on the rail, label, muted subtitle),
   .twc-agenda-stop (.twc-agenda-time: two <time>s, start over a subtle end with a "+1" day shift;
   .twc-agenda-rail: the line and a 10px dot; .twc-agenda-card: a .page-card look holding the
   .twc-agenda-stop-main control, a chrome-less 44px button; .is-selected, .is-muted) and
   .twc-agenda-segment (-drive / -gap / -dead, .is-late: an 18px icon on the rail and 13px text).
   Dead time and late drives are the one warning tone (R3): text, a tint and a dashed rail.
   Component tokens, read-only with literal fallbacks: --twc-agenda-time-width (3.5rem),
   --twc-agenda-rail-color, --twc-agenda-now-color, --twc-agenda-dead-color, --twc-agenda-dead-bg.
   Warning ink #92400e on white is 7.0:1; #fbbf24 on the dark surface is above 8:1. No animation. */
.twc-agenda {
    min-width: 0;
}

.twc-agenda.is-busy .twc-agenda-list {
    opacity: 0.55;
}

.twc-agenda-list {
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.twc-agenda-node,
.twc-agenda-stop,
.twc-agenda-segment {
    display: grid;
    grid-template-columns: var(--twc-agenda-time-width, 3.5rem) 16px minmax(0, 1fr);
    column-gap: 0.625rem;
    min-width: 0;
}

.twc-agenda-node {
    align-items: center;
    padding: 0.25rem 0;
}

.twc-agenda-node-icon {
    grid-column: 2;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--twc-agenda-rail-color, var(--twc-color-border, #e5e7eb));
    border-radius: 50%;
    background: var(--twc-color-card-bg, #ffffff);
    color: var(--twc-color-subtle, #475569);
}

.twc-agenda-node-icon .material-icons {
    font-size: 16px;
}

.twc-agenda-node-text {
    grid-column: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.5rem;
    min-width: 0;
}

.twc-agenda-node-label {
    font-size: var(--twc-font-size-sm, 0.875rem);
    font-weight: 500;
    color: var(--twc-color-text, #111827);
}

.twc-agenda-node-subtitle {
    font-size: 0.8125rem;
    color: var(--twc-color-subtle, #475569);
}

/* The rail: a 2px line through every stop and segment row, centred in the 16px column. */
.twc-agenda-rail,
.twc-agenda-segment-icon {
    grid-column: 2;
    position: relative;
    display: flex;
    justify-content: center;
    align-self: stretch;
}

.twc-agenda-rail::before,
.twc-agenda-segment-icon::before,
.twc-agenda-segment-icon::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 1px);
    border-left: 2px solid var(--twc-agenda-rail-color, var(--twc-color-border, #e5e7eb));
}

/* A segment's rail stops short of its icon (no mask, so any ground shows through). */
.twc-agenda-segment-icon::before {
    bottom: calc(50% + 12px);
}

.twc-agenda-segment-icon::after {
    top: calc(50% + 12px);
}

.twc-agenda-dot {
    position: relative;
    width: 10px;
    height: 10px;
    margin-top: 1.0625rem;
    border: 2px solid var(--twc-color-subtle, #475569);
    border-radius: 50%;
    background: var(--twc-color-card-bg, #ffffff);
}

.twc-agenda-stop {
    padding: 0.25rem 0;
}

.twc-agenda-time {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 0.8125rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    white-space: nowrap;
}

.twc-agenda-time-start {
    font-size: var(--twc-font-size-sm, 0.875rem);
    font-weight: 500;
    color: var(--twc-color-text, #111827);
}

.twc-agenda-time-end {
    font-size: 0.75rem;
    color: var(--twc-color-subtle, #475569);
}

.twc-agenda-dayshift {
    margin-left: 2px;
    font-size: 0.6875rem;
}

.twc-agenda-card {
    grid-column: 3;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--twc-color-border, #e5e7eb);
    border-radius: var(--twc-radius-card, 14px);
    background: var(--twc-color-card-bg, #ffffff);
    color: var(--twc-color-text, #111827);
}

.twc-agenda-stop.is-selected .twc-agenda-card {
    border-color: var(--twc-color-primary, #3b5bdb);
    box-shadow: inset 0 0 0 1px var(--twc-color-primary, #3b5bdb);
}

.twc-agenda-stop-main {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0.375rem;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.twc-agenda-stop-main:focus-visible {
    outline: 2px solid var(--twc-color-primary, #3b5bdb);
    outline-offset: 4px;
}

.twc-agenda-stop-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.twc-agenda-stop-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.twc-agenda-title {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.3;
}

.twc-agenda-stop.is-muted .twc-agenda-title {
    color: var(--twc-color-subtle, #475569);
}

.twc-agenda-meta {
    flex: none;
    font-size: var(--twc-font-size-sm, 0.875rem);
    font-variant-numeric: tabular-nums;
}

.twc-agenda-subtitle,
.twc-agenda-location {
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--twc-color-subtle, #475569);
    overflow-wrap: anywhere;
}

.twc-agenda-status {
    align-self: flex-start;
    font-size: 0.8125rem;
    color: var(--twc-color-subtle, #475569);
}

.twc-agenda-segment {
    min-height: 32px;
    align-items: center;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--twc-color-subtle, #475569);
}

.twc-agenda-segment-icon {
    align-items: center;
}

.twc-agenda-segment-icon .material-icons {
    font-size: 18px;
}

.twc-agenda-segment-text {
    grid-column: 3;
    min-width: 0;
    padding: 0.25rem 0;
}

.twc-agenda-segment-distance {
    font-variant-numeric: tabular-nums;
}

.twc-agenda-segment-dead .twc-agenda-segment-text,
.twc-agenda-segment.is-late .twc-agenda-segment-text {
    justify-self: start;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: var(--twc-agenda-dead-bg, rgba(146, 64, 14, 0.08));
    color: var(--twc-agenda-dead-color, var(--twc-color-warning, #92400e));
}

.twc-agenda-segment-dead .twc-agenda-segment-icon,
.twc-agenda-segment.is-late .twc-agenda-segment-icon {
    color: var(--twc-agenda-dead-color, var(--twc-color-warning, #92400e));
}

.twc-agenda-segment-dead .twc-agenda-segment-icon::before,
.twc-agenda-segment-dead .twc-agenda-segment-icon::after {
    border-left-style: dashed;
}

.twc-agenda-error {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.twc-agenda-error-text {
    flex: 1 1 auto;
    min-width: 0;
}

.twc-agenda-retry {
    min-height: 44px;
}

/* Today: the stop under way (.is-current: a filled dot in the now colour, "Now" in its time column),
   ended stops (.is-past: a subtle time column, content untouched) and the now row between stops
   (li.twc-agenda-now: a 2px line across the card column led by a "Now 10:05" label). */
.twc-agenda-stop.is-current .twc-agenda-dot {
    border-color: var(--twc-agenda-now-color, var(--twc-color-primary, #3b5bdb));
    background: var(--twc-agenda-now-color, var(--twc-color-primary, #3b5bdb));
}

.twc-agenda-time-now {
    font-size: var(--twc-font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--twc-agenda-now-color, var(--twc-color-primary, #3b5bdb));
}

.twc-agenda-stop.is-past .twc-agenda-time-start {
    color: var(--twc-color-subtle, #475569);
}

.twc-agenda-now {
    display: grid;
    grid-template-columns: var(--twc-agenda-time-width, 3.5rem) 16px minmax(0, 1fr);
    column-gap: 0.625rem;
    align-items: center;
    min-width: 0;
    min-height: 24px;
}

.twc-agenda-now-rail {
    grid-column: 2;
    position: relative;
    align-self: stretch;
}

.twc-agenda-now-rail::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 1px);
    border-left: 2px solid var(--twc-agenda-rail-color, var(--twc-color-border, #e5e7eb));
}

.twc-agenda-now-line {
    grid-column: 3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    color: var(--twc-agenda-now-color, var(--twc-color-primary, #3b5bdb));
}

.twc-agenda-now-label {
    flex: none;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.twc-agenda-now-line::after {
    content: "";
    flex: 1 1 auto;
    border-top: 2px solid var(--twc-agenda-now-color, var(--twc-color-primary, #3b5bdb));
}

/* A stop's actions: consumer buttons and the Directions link, outside the main control, 44px targets. */
.twc-agenda-stop-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.twc-agenda-stop-actions > * {
    min-height: 44px;
}

.twc-agenda-directions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.twc-agenda-directions .material-icons {
    font-size: 20px;
}

/* Compact (.twc-agenda.is-compact: week columns and dashboards, works from 130px): no rail or time
   column. A stop is one bordered line inside its 44px main control — start time (never wraps) · title
   (ellipsis) · meta, the status as a bare dot; a segment is one 12px line with a 14px icon, dead time
   and late drives keeping the warning tone; the now row is the 2px line and its label. Nodes and
   actions are not rendered. */
.twc-agenda.is-compact .twc-agenda-stop,
.twc-agenda.is-compact .twc-agenda-segment,
.twc-agenda.is-compact .twc-agenda-now {
    display: block;
    min-width: 0;
}

.twc-agenda.is-compact .twc-agenda-stop {
    padding: 2px 0;
}

.twc-agenda.is-compact .twc-agenda-stop-main {
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    border: 1px solid var(--twc-color-border, #e5e7eb);
    border-radius: 0.5rem;
    background: var(--twc-color-card-bg, #ffffff);
    color: var(--twc-color-text, #111827);
}

.twc-agenda.is-compact .twc-agenda-stop-main:focus-visible {
    outline-offset: 2px;
}

.twc-agenda.is-compact .twc-agenda-stop.is-selected .twc-agenda-stop-main {
    border-color: var(--twc-color-primary, #3b5bdb);
    box-shadow: inset 0 0 0 1px var(--twc-color-primary, #3b5bdb);
}

.twc-agenda.is-compact .twc-agenda-stop.is-current .twc-agenda-stop-main {
    border-left: 3px solid var(--twc-agenda-now-color, var(--twc-color-primary, #3b5bdb));
}

.twc-agenda.is-compact .twc-agenda-stop-body {
    flex-direction: row;
    align-items: baseline;
    gap: 0.375rem;
    width: 100%;
    font-size: 0.8125rem;
    line-height: 1.3;
}

.twc-agenda.is-compact .twc-agenda-time-start,
.twc-agenda.is-compact .twc-agenda-time-now {
    flex: none;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.twc-agenda.is-compact .twc-agenda-title,
.twc-agenda.is-compact .twc-agenda-stop-template {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
}

.twc-agenda.is-compact .twc-agenda-meta {
    font-size: 0.8125rem;
    white-space: nowrap;
}

.twc-agenda.is-compact .twc-agenda-status-dot {
    flex: none;
    align-self: center;
}

.twc-agenda.is-compact .twc-agenda-segment {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 0;
    padding: 1px 0 1px 0.5rem;
    font-size: 0.75rem;
    line-height: 1.3;
}

.twc-agenda.is-compact .twc-agenda-segment-icon {
    flex: none;
    display: inline-flex;
    width: 14px;
    overflow: hidden;
}

.twc-agenda.is-compact .twc-agenda-segment-icon::before,
.twc-agenda.is-compact .twc-agenda-segment-icon::after {
    content: none;
}

.twc-agenda.is-compact .twc-agenda-segment-icon .material-icons {
    font-size: 14px;
}

.twc-agenda.is-compact .twc-agenda-segment-text {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twc-agenda.is-compact .twc-agenda-segment-dead .twc-agenda-segment-text,
.twc-agenda.is-compact .twc-agenda-segment.is-late .twc-agenda-segment-text {
    padding: 0 0.25rem;
    border-radius: 0.25rem;
}

.twc-agenda.is-compact .twc-agenda-now {
    min-height: 16px;
    padding: 2px 0;
}

.twc-agenda.is-compact .twc-agenda-now-rail {
    display: none;
}

a.twc-agenda-stop-main:hover .twc-agenda-title {
    text-decoration: underline;
}

/* Day agenda, dark mode: the component tokens, then surfaces and inks with dark literal fallbacks. */
[data-bs-theme="dark"] .twc-agenda { --twc-agenda-rail-color: var(--twc-color-border, #374151); --twc-agenda-now-color: var(--twc-color-primary, #748ffc); --twc-agenda-dead-color: var(--twc-color-warning, #fbbf24); --twc-agenda-dead-bg: rgba(251, 191, 36, 0.12); }
[data-bs-theme="dark"] .twc-agenda-card,
[data-bs-theme="dark"] .twc-agenda.is-compact .twc-agenda-stop-main { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-card-bg, #15191f); color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-agenda-node-icon,
[data-bs-theme="dark"] .twc-agenda-dot { background: var(--twc-color-card-bg, #15191f); }
[data-bs-theme="dark"] .twc-agenda-node-label,
[data-bs-theme="dark"] .twc-agenda-time-start { color: var(--twc-color-text, #f3f6fb); }
[data-bs-theme="dark"] .twc-agenda-node-icon,
[data-bs-theme="dark"] .twc-agenda-node-subtitle,
[data-bs-theme="dark"] .twc-agenda-time-end,
[data-bs-theme="dark"] .twc-agenda-stop.is-muted .twc-agenda-title,
[data-bs-theme="dark"] .twc-agenda-subtitle,
[data-bs-theme="dark"] .twc-agenda-location,
[data-bs-theme="dark"] .twc-agenda-status,
[data-bs-theme="dark"] .twc-agenda-stop.is-past .twc-agenda-time-start,
[data-bs-theme="dark"] .twc-agenda-segment { color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-agenda-dot { border-color: var(--twc-color-subtle, #d7dce3); }
[data-bs-theme="dark"] .twc-agenda-stop.is-selected .twc-agenda-card,
[data-bs-theme="dark"] .twc-agenda.is-compact .twc-agenda-stop.is-selected .twc-agenda-stop-main { border-color: var(--twc-color-primary, #748ffc); box-shadow: inset 0 0 0 1px var(--twc-color-primary, #748ffc); }
[data-bs-theme="dark"] .twc-agenda-stop-main:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }

/* OS-dark mirror of the day agenda rules above, for a page that sets no data-bs-theme (keep in step). */
@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme]) .twc-agenda { --twc-agenda-rail-color: var(--twc-color-border, #374151); --twc-agenda-now-color: var(--twc-color-primary, #748ffc); --twc-agenda-dead-color: var(--twc-color-warning, #fbbf24); --twc-agenda-dead-bg: rgba(251, 191, 36, 0.12); }
    :root:not([data-bs-theme]) .twc-agenda-card,
    :root:not([data-bs-theme]) .twc-agenda.is-compact .twc-agenda-stop-main { border-color: var(--twc-color-border, #3a424d); background: var(--twc-color-card-bg, #15191f); color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-agenda-node-icon,
    :root:not([data-bs-theme]) .twc-agenda-dot { background: var(--twc-color-card-bg, #15191f); }
    :root:not([data-bs-theme]) .twc-agenda-node-label,
    :root:not([data-bs-theme]) .twc-agenda-time-start { color: var(--twc-color-text, #f3f6fb); }
    :root:not([data-bs-theme]) .twc-agenda-node-icon,
    :root:not([data-bs-theme]) .twc-agenda-node-subtitle,
    :root:not([data-bs-theme]) .twc-agenda-time-end,
    :root:not([data-bs-theme]) .twc-agenda-stop.is-muted .twc-agenda-title,
    :root:not([data-bs-theme]) .twc-agenda-subtitle,
    :root:not([data-bs-theme]) .twc-agenda-location,
    :root:not([data-bs-theme]) .twc-agenda-status,
    :root:not([data-bs-theme]) .twc-agenda-stop.is-past .twc-agenda-time-start,
    :root:not([data-bs-theme]) .twc-agenda-segment { color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-agenda-dot { border-color: var(--twc-color-subtle, #d7dce3); }
    :root:not([data-bs-theme]) .twc-agenda-stop.is-selected .twc-agenda-card,
    :root:not([data-bs-theme]) .twc-agenda.is-compact .twc-agenda-stop.is-selected .twc-agenda-stop-main { border-color: var(--twc-color-primary, #748ffc); box-shadow: inset 0 0 0 1px var(--twc-color-primary, #748ffc); }
    :root:not([data-bs-theme]) .twc-agenda-stop-main:focus-visible { outline-color: var(--twc-color-primary, #748ffc); }
}
