/* Wye HVAC web app. The company's brand color is applied through --brand (set per page from the tenant).

   Themes (docs/design/theme.md): Bootstrap 5.3's data-bs-theme on <html>, light or dark (System resolves it in the head
   script). Components use only the variables below and Bootstrap's semantic classes, never literal colours. Customer
   documents (the proposal, the job sheet) carry data-bs-theme="light" and print resets to light. */

:root, [data-bs-theme=light] {
    --page: #f4f6f9;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #e1e5eb;
    --text-muted: #667085;
    --input-border: #848c98;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-strong: rgba(0, 0, 0, 0.18);
    --warn-line: #f59e0b;
    --flag-text: #92400e;
    --flag-bg: #fef3c7;
    --positive-text: #15803d;
    --selected: #16a34a;
    --selected-ring: rgba(22, 163, 74, 0.2);
    --internal-bg: #fff7ed;
    --tier-default: #94a3b8;
    --tier-good: #64748b;
    --tier-best: #b45309;
    --logo-chip: #ffffff;
    /* Report charts (reports.md, Q5): the Okabe-Ito colour-blind-safe palette, each series also told apart by a line style,
       point shape or bar pattern (js/wye-charts.js). */
    --chart-1: #0072b2;
    --chart-2: #d55e00;
    --chart-3: #009e73;
    --chart-4: #cc79a7;
    --chart-5: #e69f00;
    --chart-6: #56b4e9;
    color: var(--bs-body-color);
}

/* Dark: a cool blue-grey ramp. --page is the darkest; panels (--surface, also Bootstrap's body background, so inputs and
   tables sit on the panel colour) and raised layers (popovers, drawers) step lighter. The brand variants are computed
   against these three backgrounds (BrandColors.DarkBackgrounds); keep them in step. */
[data-bs-theme=dark] {
    --page: #12161c;
    --surface: #1b2129;
    --surface-raised: #232a33;
    --border: #2f3843;
    --text-muted: #9ca3af;
    --input-border: #6b7685;
    --shadow: rgba(0, 0, 0, 0.35);
    --shadow-strong: rgba(0, 0, 0, 0.55);
    --warn-line: #fbbf24;
    --flag-text: #fcd34d;
    --flag-bg: #3a2c0b;
    --positive-text: #4ade80;
    --selected: #22c55e;
    --selected-ring: rgba(34, 197, 94, 0.3);
    --internal-bg: #2a2116;
    --tier-default: #64748b;
    --tier-good: #94a3b8;
    --tier-best: #f59e0b;
    --logo-chip: #ffffff;
    --chart-1: #56b4e9;
    --chart-2: #e69f00;
    --chart-3: #2fbf8f;
    --chart-4: #e19bc4;
    --chart-5: #f0e442;
    --chart-6: #f08a4b;
    --bs-body-bg: #1b2129;
    --bs-body-bg-rgb: 27, 33, 41;
    --bs-secondary-bg: #232a33;
    --bs-secondary-bg-rgb: 35, 42, 51;
    --bs-tertiary-bg: #1f262e;
    --bs-tertiary-bg-rgb: 31, 38, 46;
    --bs-border-color: #2f3843;
    color: var(--bs-body-color);
}

/* Dark: Bootstrap 5.3 keeps .text-danger and the outline buttons at their light-theme colours (about 3.6:1 on the
   panel). They take Bootstrap's own dark *-text-emphasis colours instead (5.7:1 or more on --surface-raised, 6.3:1 on
   --surface) for text and border; hover and pressed keep Bootstrap's solid fill with white text (4.5:1 or more). */
[data-bs-theme=dark] .text-danger { color: var(--bs-danger-text-emphasis) !important; }
[data-bs-theme=dark] .btn-outline-primary { --bs-btn-color: var(--bs-primary-text-emphasis); --bs-btn-border-color: var(--bs-primary-text-emphasis); }
[data-bs-theme=dark] .btn-outline-secondary { --bs-btn-color: var(--bs-secondary-text-emphasis); --bs-btn-border-color: var(--bs-secondary-text-emphasis); }
[data-bs-theme=dark] .btn-outline-success { --bs-btn-color: var(--bs-success-text-emphasis); --bs-btn-border-color: var(--bs-success-text-emphasis); }
[data-bs-theme=dark] .btn-outline-danger { --bs-btn-color: var(--bs-danger-text-emphasis); --bs-btn-border-color: var(--bs-danger-text-emphasis); }

/* The brand: --brand and --brand-contrast (the text on a brand fill: white or near-black, by WCAG contrast) are the
   company's, set inline per page (BrandColors.Style). Where the brand is text or a line on the page, the theme's variant
   is used: --brand-on-page reaches 4.5:1 (text) and --brand-line 3:1 (borders, WCAG 1.4.11) on that theme's page and
   panels. The variants resolve on every element, so the inline values of the nearest branded ancestor apply, and a
   nested light document inside a dark page gets the light ones. The defaults are for #1f6feb. */
:root {
    --brand: #1f6feb;
    --brand-contrast: #ffffff;
    --brand-hover: #1a5ec8;
    --brand-active: #1753b0;
    --brand-text-light: #1d69df;
    --brand-line-light: #1f6feb;
    --brand-text-dark: #5793f0;
    --brand-line-dark: #1f6feb;
}
* { --brand-on-page: var(--brand-text-light); --brand-line: var(--brand-line-light); }
[data-bs-theme=dark], [data-bs-theme=dark] * { --brand-on-page: var(--brand-text-dark); --brand-line: var(--brand-line-dark); }
[data-bs-theme=light], [data-bs-theme=light] * { --brand-on-page: var(--brand-text-light); --brand-line: var(--brand-line-light); }

html, body {
    background: var(--page);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--brand-on-page); }

/* "Skip to content" (WCAG 2.4.1) on the public pages: off screen until it has keyboard focus, then a visible, high-contrast link. */
.skip-link {
    position: absolute; left: -10000px; top: 0.5rem; padding: 0.5rem 0.75rem; border-radius: 6px;
    background: var(--surface); color: var(--brand-on-page); font-weight: 600; text-decoration: underline;
}
.skip-link:focus, .skip-link:focus-visible { left: 0.5rem; z-index: 2000; outline: 3px solid var(--brand-on-page); outline-offset: 2px; }

/* Form fields: a border that reaches 3:1 on the page and panels in both themes (WCAG 1.4.11; Bootstrap's is 1.3:1 in
   light and about 2:1 in dark). Only the fields: table and panel lines keep the lighter --bs-border-color. The same
   specificity as Bootstrap's base rule, so focus, valid, invalid and checked borders still win. */
.form-control, .form-select, .form-check-input { border-color: var(--input-border); }

/* A company logo on dark sits on a light chip, so dark logos stay visible. */
[data-bs-theme=dark] .brand-logo { background: var(--logo-chip); border-radius: 6px; padding: 3px 6px; }

/* Buttons in the brand color. The border is the theme's line variant, so a fill close to the page colour (a near-black
   brand on dark, a pale one on light) keeps a visible edge (WCAG 1.4.11); it is the brand itself when that reaches 3:1. */
.btn-brand {
    --bs-btn-color: var(--brand-contrast);
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand-line);
    --bs-btn-hover-color: var(--brand-contrast);
    --bs-btn-hover-bg: var(--brand-hover);
    --bs-btn-hover-border-color: var(--brand-line);
    --bs-btn-active-bg: var(--brand-active);
    --bs-btn-active-color: var(--brand-contrast);
    --bs-btn-active-border-color: var(--brand-line);
}

/* A visible focus ring on brand buttons (WCAG 2.4.7, 2.4.11): Bootstrap draws its ring from variables this button never sets,
   so it showed none. 2px in the company's colour as darkened for text (4.5:1 on the page), 2px off the button. */
.btn.btn-brand:focus-visible {
    outline: 2px solid var(--brand-on-page);
    outline-offset: 2px;
    box-shadow: none;
}

/* Bootstrap's secondary outline text (#6c757d) is 4.33:1 on the page grey (WCAG 1.4.3); the muted-text token reaches 4.5:1 on
   both page colours in both themes. */
.btn-outline-secondary {
    --bs-btn-color: var(--text-muted);
    --bs-btn-border-color: var(--text-muted);
    --bs-btn-hover-bg: var(--text-muted);
    --bs-btn-hover-border-color: var(--text-muted);
    --bs-btn-active-bg: var(--text-muted);
    --bs-btn-active-border-color: var(--text-muted);
}

/* Links inside an alert: the alert's own strong text colour (at least 4.5:1 on its background), underlined; the brand link colour
   is 3.79:1 on the danger alert. */
.alert a:not(.btn) { color: var(--bs-danger-text-emphasis); text-decoration: underline; }
.alert-info a:not(.btn) { color: var(--bs-info-text-emphasis); }
.alert-warning a:not(.btn) { color: var(--bs-warning-text-emphasis); }
.alert-success a:not(.btn) { color: var(--bs-success-text-emphasis); }

.btn-outline-brand {
    --bs-btn-color: var(--brand-on-page);
    --bs-btn-border-color: var(--brand-line);
    --bs-btn-hover-color: var(--brand-contrast);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand-line);
    --bs-btn-active-color: var(--brand-contrast);
    --bs-btn-active-bg: var(--brand-active);
    --bs-btn-active-border-color: var(--brand-line);
}

/* App header */
.app-header {
    background: var(--brand);
    color: var(--brand-contrast);
    padding: 0.6rem 0;
    box-shadow: 0 1px 3px var(--shadow-strong);
}
[data-bs-theme=dark] .app-header { border-bottom: 1px solid var(--border); }

.app-brand { color: inherit; text-decoration: none; display: flex; align-items: center; min-height: 40px; }
.app-brand .brand-logo { max-height: 40px; max-width: 180px; background: var(--logo-chip); border-radius: 6px; padding: 3px 6px; }
.app-brand .brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em; }

/* Text on the brand fill is always --brand-contrast at full strength (4.5:1 or more for every brand, BrandColors) and
   never sits on a tint: hover underlines, the current page is semibold with a solid bar under it. */
.app-pin {
    color: var(--brand-contrast);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-weight: 500;
    white-space: nowrap;
}
.app-pin:hover { color: var(--brand-contrast); text-decoration: underline; text-underline-offset: 0.25em; }
.app-pin.active { color: var(--brand-contrast); font-weight: 600; box-shadow: inset 0 -2px 0 var(--brand-contrast); border-radius: 0; }
.app-pin:focus-visible { outline: 2px solid var(--brand-contrast); outline-offset: 1px; }
.app-pin-icon { width: 1.1rem; height: 1.1rem; flex: none; }

/* Header buttons, in the colour that reads on the brand fill. Only two colours ever meet: --brand and --brand-contrast
   (4.5:1 or more), so outlines, text and the focus ring all reach 3:1 or 4.5:1. Outlined: contrast text and a solid
   contrast border; hover underlines, pressed fills with the contrast colour. Filled (Sign out): the contrast fill in every
   state; hover underlines, pressed adds an inset brand ring. The focus ring is a brand gap then a solid contrast ring. */
.btn-header {
    --bs-btn-color: var(--brand-contrast);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--brand-contrast);
    --bs-btn-hover-color: var(--brand-contrast);
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: var(--brand-contrast);
    --bs-btn-active-color: var(--brand);
    --bs-btn-active-bg: var(--brand-contrast);
    --bs-btn-active-border-color: var(--brand-contrast);
    --bs-btn-focus-box-shadow: 0 0 0 2px var(--brand), 0 0 0 4px var(--brand-contrast);
}
.btn-header-solid {
    --bs-btn-color: var(--brand);
    --bs-btn-bg: var(--brand-contrast);
    --bs-btn-border-color: var(--brand-contrast);
    --bs-btn-hover-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-contrast);
    --bs-btn-hover-border-color: var(--brand-contrast);
    --bs-btn-active-color: var(--brand);
    --bs-btn-active-bg: var(--brand-contrast);
    --bs-btn-active-border-color: var(--brand-contrast);
    --bs-btn-focus-box-shadow: 0 0 0 2px var(--brand), 0 0 0 4px var(--brand-contrast);
}
.btn-header:hover, .btn-header-solid:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.btn-header-solid:active { box-shadow: inset 0 0 0 2px var(--brand); }

/* The theme toggle: icons on the wide header, icons and words in the phone Menu. The pressed choice is filled. */
.theme-toggle { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.theme-toggle-label { font-size: 0.85rem; }
.theme-choice { display: inline-flex; align-items: center; gap: 0.3rem; }
.btn-header.theme-choice[aria-pressed=true] { color: var(--brand); background: var(--brand-contrast); border-color: var(--brand-contrast); }
.theme-icon { width: 1rem; height: 1rem; flex: none; }
@media (min-width: 1200px) {
    .theme-toggle-label, .theme-choice-text {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        clip-path: inset(50%) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }
}

/* The toggle on the page background (sign-in and invitation pages): body text and the field border on the page colour,
   the pressed choice inverted (body colour fill, panel-coloured icon); icons only, the words stay for screen readers. */
.btn-theme-page {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--input-border);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: var(--surface);
    --bs-btn-hover-border-color: var(--bs-body-color);
    --bs-btn-active-color: var(--surface);
    --bs-btn-active-bg: var(--bs-body-color);
    --bs-btn-active-border-color: var(--bs-body-color);
    --bs-btn-focus-box-shadow: 0 0 0 2px var(--page), 0 0 0 4px var(--bs-body-color);
}
.btn-theme-page.theme-choice[aria-pressed=true] { color: var(--surface); background: var(--bs-body-color); border-color: var(--bs-body-color); }
.theme-toggle-page .theme-toggle-label, .theme-toggle-page .theme-choice-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.app-user { font-size: 0.9rem; }

/* Header layout, the same at every width: the hamburger, the brand, the section you are in, the pinned pages and the account
   menu, in one row that never wraps. The brand and the section name truncate with an ellipsis; the pins take the room
   left over, show icon and label while they fit and the icon alone when they don't (a container query, no script),
   and hide below 576 px (they stay in the menu). */
.app-header-bar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: nowrap; min-width: 0; }
.app-menu-button { display: inline-flex; align-items: center; gap: 0.4rem; flex: none; }
.app-menu-icon, .app-menu-icon::before, .app-menu-icon::after {
    display: block;
    width: 14px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}
.app-menu-icon { position: relative; }
.app-menu-icon::before, .app-menu-icon::after { content: ""; position: absolute; left: 0; }
.app-menu-icon::before { top: -5px; }
.app-menu-icon::after { top: 5px; }
.app-brand { flex: 0 1 auto; min-width: 2.5rem; overflow: hidden; }
.app-brand .brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-brand .brand-logo { max-width: min(180px, 40vw); }
.app-section {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 0.75rem;
    border-left: 1px solid var(--brand-contrast);
    font-weight: 600;
}
.app-pins { flex: 1 1 0; min-width: 0; overflow-x: auto; scrollbar-width: thin; container-type: inline-size; container-name: app-pins; }
.app-pin { flex: none; white-space: nowrap; min-height: 1.5rem; }
.app-pins-list { display: flex; flex-wrap: nowrap; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
@container app-pins (max-width: 560px) {
    .app-pin-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}
.app-account { flex: none; margin-left: auto; }
.app-pins ~ .app-account { margin-left: 0; }
/* The Ask button (ai-help.md section 5) sits just before the account menu and takes over its push to the right. */
.app-ask-button { flex: none; margin-left: auto; white-space: nowrap; }
.app-pins ~ .app-ask-button, .app-ask-button ~ .app-account { margin-left: 0; }
.app-account .btn { white-space: nowrap; }
.app-account-menu { min-width: 14rem; max-width: min(22rem, calc(100vw - 1.5rem)); }
.app-account-menu .dropdown-item-text { font-size: 0.9rem; }
@media (max-width: 575.98px) {
    .app-pins { display: none; }
    .app-menu-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .app-section { max-width: 6rem; }
}
@media (max-width: 399.98px) { .app-section { display: none; } }

/* The menu: an offcanvas panel from the left, the same at every width. Pages in sections under small headings, a pin toggle
   at the end of each row. The current page is semibold with a bar at its side. */
.app-offcanvas { --bs-offcanvas-width: min(340px, 90vw); }
.app-menu-heading {
    margin: 1rem 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.app-menu-heading:first-child { margin-top: 0; }
.app-menu-list { margin: 0 0 0.25rem; }
.app-menu-row { display: flex; align-items: center; gap: 0.25rem; }
.app-menu-link {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    color: var(--bs-body-color);
    text-decoration: none;
    border-left: 3px solid transparent;
}
.app-menu-link:hover { background: var(--bs-tertiary-bg); }
.app-menu-link.active { font-weight: 600; border-left-color: var(--brand-line); background: var(--bs-tertiary-bg); }
.app-menu-btn { flex: none; line-height: 1; padding: 0.3rem 0.45rem; }
.app-menu-btn[aria-pressed=true] { background: var(--bs-body-color); color: var(--bs-body-bg); border-color: var(--bs-body-color); }

/* Page width (docs/design/layout-width.md). The header bar and main are fluid with one gutter, so they line up at every width;
   nothing makes the page itself scroll sideways (wide tables scroll in .table-responsive). Lists, boards and dashboards fill
   the width with no wrapper; forms and detail pages use .form-flow (or .form-narrow); reading text uses .reading. */
:root {
    --app-gutter: 16px;
    --flow-gap: 1.5rem;
    /* A field-group card's narrowest width: two columns from about 1150 px wide, three from about 1700 px. */
    --flow-min: 33rem;
}
@media (min-width: 992px) { :root { --app-gutter: 24px; } }
@media (min-width: 1400px) { :root { --app-gutter: 32px; } }
.app-gutter { padding-inline: var(--app-gutter); }
.app-main { min-width: 0; }

/* Field-group cards in a grid of at most three columns (a column is never narrower than a third of the row); one column on
   phones and tablets. Bootstrap rows inside a card keep working. Cards space by the gap, not their own margins. */
.form-flow {
    display: grid;
    gap: var(--flow-gap);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, max(var(--flow-min), (100% - 2 * var(--flow-gap)) / 3)), 1fr));
    align-items: start;
}
.form-flow > * { min-width: 0; margin-block: 0; }
/* A stack of cards (a page's former column) is one item of the flow. */
.flow-stack { min-width: 0; }
.form-narrow { max-width: 40rem; }
.reading { max-width: 75ch; }

/* No single field stretches across a wide screen: text-like inputs and selects stop at 40rem, text areas at 60rem. Fields in
   tables, the DataTables controls and Editor, and the dispatch board keep their own sizing; an input group is capped as a whole. */
.app-main :is(input.form-control, .form-select):not(.form-control-color) { max-width: 40rem; }
.app-main textarea.form-control { max-width: 60rem; }
.app-main :is(table, .input-group, .dt-container, .DTE, .dispatch-board) :is(input.form-control, textarea.form-control, .form-select) { max-width: none; }
.app-main .input-group:not(:is(table, .dt-container, .DTE, .dispatch-board) .input-group) { max-width: 40rem; }

/* Muted intro and description paragraphs keep a reading line length (tables and centred empty states excepted). */
.app-main p.text-muted:not(.text-center):not(:is(table, .dt-container) p) { max-width: 75ch; }

/* The job sheet is a customer document: centred, at the width the old Bootstrap container gave it at each breakpoint (and so in
   print, which uses the same width queries). */
.job-sheet { max-width: 100%; margin-inline: auto; }
@media (min-width: 576px) { .job-sheet { max-width: 516px; } }
@media (min-width: 768px) { .job-sheet { max-width: 696px; } }
@media (min-width: 992px) { .job-sheet { max-width: 936px; } }
@media (min-width: 1200px) { .job-sheet { max-width: 1116px; } }
@media (min-width: 1400px) { .job-sheet { max-width: 1296px; } }

/* Panels and cards */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
}
.panel.p-0 { padding: 0; overflow: hidden; }
.panel .table { margin-bottom: 0; }

.stat-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand-line);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    color: inherit;
    text-decoration: none;
}
a.stat-card:hover { box-shadow: 0 2px 8px var(--shadow); }

/* Reports (docs/design/reports.md section 7): the headline cards in a row that wraps (one column on a phone), the charts two
   abreast where they fit, and the range picker. Tables scroll inside their own box; the page never scrolls sideways. */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: 0.75rem; }
.report-cards .stat-card { min-width: 0; padding: 0.85rem 1rem; }
.report-cards .stat-value { font-size: 1.5rem; overflow-wrap: anywhere; }
.report-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.report-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr)); gap: 1rem; }
.report-charts:not(:has(.report-chart:not([hidden]))) { display: none; }
.report-chart { margin: 0; min-width: 0; }
.report-chart[hidden] { display: none; }
.report-chart-box { position: relative; height: 16rem; }
.report-range-custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem; }
.report-range-custom > div { min-width: 0; }
.report-table { min-width: 0; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--text-muted); }

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 2.5rem;
    text-align: center;
    color: var(--text-muted);
}

.address-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.logo-preview {
    background: var(--brand);
    color: var(--brand-contrast);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    min-height: 64px;
}
.logo-preview .brand-logo { max-height: 48px; max-width: 220px; background: var(--logo-chip); border-radius: 6px; padding: 4px 8px; }
.logo-preview .brand-name { font-weight: 700; font-size: 1.2rem; }

.tenant-list .list-group-item { padding: 0.9rem 1rem; }

/* Comfortable touch targets on tablets */
@media (pointer: coarse) {
    .btn, .form-control, .form-select { min-height: 44px; }
    .btn-sm { min-height: 36px; }
}

/* Anonymous pages: sign-in, invitations */
.auth-shell {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem 1.5rem; /* room for the theme toggle in the corner */
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 6px 24px var(--shadow);
}
.auth-brand {
    margin: -2rem -2rem 1.5rem;
    padding: 1.25rem 2rem;
    border-radius: 12px 12px 0 0;
    background: var(--brand);
    color: var(--brand-contrast);
    display: flex;
    justify-content: center;
}
.auth-brand .brand-logo { max-height: 56px; max-width: 260px; background: var(--logo-chip); border-radius: 8px; padding: 6px 10px; }
.auth-brand .brand-name { font-weight: 700; font-size: 1.35rem; }
.auth-theme { position: absolute; top: 1rem; right: 1rem; }
.auth-footer { margin-top: 1rem; color: var(--text-muted); font-size: 0.85rem; }

/* The public booking page (docs/design/online-booking.md section 2): the sign-in card, wider, in the company's colours. At
   phone width the card fills the screen and nothing scrolls sideways; typed text that won't break wraps anywhere. */
.booking-card { max-width: 680px; overflow-wrap: anywhere; }
.booking-card fieldset legend { float: none; margin-bottom: 0.5rem; }
.booking-note { white-space: pre-line; border-left: 3px solid var(--brand-line-light, var(--border)); padding-left: 0.75rem; }
[data-bs-theme="dark"] .booking-note { border-left-color: var(--brand-line-dark, var(--border)); }
.booking-card .cf-turnstile { min-height: 65px; }
@media (max-width: 575.98px) {
    .booking-shell { padding: 3.5rem 0.5rem 1rem; }
    .booking-card { padding: 1.25rem; border-radius: 10px; }
    .booking-card .booking-brand { margin: -1.25rem -1.25rem 1.25rem; padding: 1rem 1.25rem; border-radius: 10px 10px 0 0; }
}

/* The embedded booking page (online-booking.md section 8, O4): the card fills the company's iframe, with no shell around it. */
.booking-embed { padding: 0.5rem; }
.booking-embed .booking-card { max-width: none; box-shadow: none; }
@media (max-width: 575.98px) {
    .booking-embed { padding: 0; }
    .booking-embed .booking-card { border-radius: 0; border: 0; }
    .booking-embed .booking-card .booking-brand { border-radius: 0; }
}

/* Booking fields: Bootstrap's focus border (#86b7fe) is 2.06:1 on white, under the 3:1 of WCAG 1.4.11. The focused border is
   the theme's text-strength link colour (at least 4.5:1 on the page) and the glow stays. */
.booking-card .form-control:focus, .booking-card .form-select:focus, .booking-card .form-check-input:focus {
    border-color: var(--brand-on-page);
}
.booking-card .form-check-input:focus { outline: 2px solid var(--brand-on-page); outline-offset: 1px; }

/* Per-field error text on the booking page (WCAG 3.3.1): the invalid-feedback colour, always shown, with the field's border. */
.booking-card .field-error { color: var(--bs-form-invalid-color); font-size: 0.875rem; margin-top: 0.25rem; }
.booking-card [aria-invalid="true"] { border-color: var(--bs-form-invalid-border-color); }
.booking-card #booking-error:focus { outline: 2px solid var(--bs-form-invalid-color); outline-offset: 2px; }

/* The Requests queue (online-booking.md, O1): typed by visitors, so long text wraps. */
.booking-cell { max-width: 22rem; overflow-wrap: anywhere; white-space: pre-line; }

/* Blazor */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--bs-form-valid-border-color); }
.invalid { outline: 1px solid var(--bs-form-invalid-border-color); }
.validation-message { color: var(--bs-form-invalid-color); font-size: 0.875rem; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #212529;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

h1:focus { outline: none; }

/* ---------- Estimate builder ---------- */

.summary-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--brand-line);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    box-shadow: 0 2px 8px var(--shadow);
}
.summary-bar.summary-preview { border-top-color: var(--warn-line); }
.summary-item { display: flex; flex-direction: column; }
.summary-value { font-size: 1.5rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.summary-label { color: var(--text-muted); font-size: 0.85rem; }
.summary-flag {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: var(--flag-text);
    background: var(--flag-bg);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    justify-self: start;
}

.room-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    margin-top: 0.6rem;
    min-height: 64px;
}
.room-card:hover:not(:disabled) { border-color: var(--brand-line); }
.room-card.selected { border: 2px solid var(--brand-line); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.room-card:disabled { opacity: 0.55; }
.room-card-title { font-weight: 600; }
.room-card-size { color: var(--text-muted); font-size: 0.85rem; }
.room-card-loads { display: flex; gap: 1rem; margin-top: 0.25rem; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.room-editor .room-name { font-weight: 600; }
.room-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
    background: var(--page);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.room-results > div { display: flex; flex-direction: column; }
.rr-value { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.rr-label { color: var(--text-muted); font-size: 0.8rem; }

.editor-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1.25rem 0 0.5rem;
    font-weight: 600;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem 0.75rem;
}
.num-field { display: flex; flex-direction: column; gap: 0.2rem; margin: 0; }
.num-label { font-size: 0.8rem; color: var(--text-muted); }
.num-input { position: relative; display: block; }
/* Shown on blur when the box holds text that isn't a number (nothing was committed). */
.num-hint { font-size: 0.8rem; color: var(--flag-text); }
.num-input .form-control { padding-right: 2.6rem; font-variant-numeric: tabular-nums; }
.num-unit {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.toggle-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 0.75rem; }
.toggle-row .form-check-input { width: 2.6em; height: 1.4em; }
.toggle-row .form-check-label { padding-left: 0.4rem; line-height: 1.6; }

.opening-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(70px, 1fr)) minmax(130px, 1.6fr) minmax(90px, 1fr) auto auto;
    gap: 0.5rem;
    align-items: end;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.opening-check { margin-bottom: 0.6rem; white-space: nowrap; }
.opening-remove { margin-bottom: 0.25rem; }
@media (max-width: 900px) {
    .opening-row { grid-template-columns: repeat(3, 1fr); }
    .opening-select, .opening-dir { grid-column: span 3; }
}

.advanced summary { cursor: pointer; color: var(--brand-on-page); font-weight: 500; padding: 0.4rem 0; }

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.estimate-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}
.estimate-row:hover { color: var(--brand-on-page); }

/* ---------- Estimate tabs ---------- */

.estimate-tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--border); overflow-x: auto; }
.estimate-tabs a {
    flex: none;
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}
.estimate-tabs a:hover { color: var(--brand-on-page); }
.estimate-tabs a.active { color: var(--brand-on-page); border-bottom-color: var(--brand-line); }
/* Inset, so the strip's own scrolling never clips it. */
.estimate-tabs a:focus-visible { outline: 3px solid var(--brand-on-page); outline-offset: -3px; }

/* ---------- Options ---------- */

.package-group { padding: 0.5rem; border-radius: 8px; margin-bottom: 0.4rem; }
.package-group.recommended { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    align-items: start;
}
.option-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 5px solid var(--tier-default);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.option-card.tier-good { border-top-color: var(--tier-good); }
.option-card.tier-better { border-top-color: var(--brand-line); }
.option-card.tier-best { border-top-color: var(--tier-best); }
.option-card.selected { box-shadow: 0 0 0 3px var(--selected-ring); border-color: var(--selected); }
.option-head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.option-tier { background: var(--page); color: inherit; border: 1px solid var(--border); }
.option-name { font-weight: 600; border-color: transparent; padding-left: 0; }
.option-name:focus { border-color: var(--border); padding-left: 0.5rem; }

.option-lines { list-style: none; padding: 0; margin: 0; }
.option-lines li { padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.option-lines li.incentive .line-name, .option-lines li.incentive .line-price { color: var(--positive-text); }
.line-main { display: flex; justify-content: space-between; gap: 0.5rem; }
.line-name { font-size: 0.92rem; }
.line-eff { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.line-controls { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.2rem; }
.qty-btn { min-width: 34px; padding: 0.1rem 0.4rem; }
.qty { min-width: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.line-price { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 500; }

.option-totals { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.75rem; margin: 0; }
.option-totals dt { font-weight: 400; color: var(--text-muted); }
.option-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.option-totals .total { color: inherit; font-weight: 700; font-size: 1.15rem; border-top: 1px solid var(--border); padding-top: 0.3rem; }
.option-totals .monthly { font-weight: 600; color: var(--brand-on-page); }
.option-totals.internal { background: var(--internal-bg); border-radius: 8px; padding: 0.5rem 0.6rem; font-size: 0.85rem; }
.option-foot { margin-top: auto; }
.qty-input { width: 4.5rem; text-align: center; font-variant-numeric: tabular-nums; padding-left: 0.25rem; padding-right: 0.25rem; }
.margin-input { width: 5rem; font-variant-numeric: tabular-nums; }
.line-margin { display: flex; align-items: center; gap: 0.35rem; margin: 0.3rem 0 0; }
.line-cost { margin-top: 0.15rem; }
.rate-list { display: flex; flex-direction: column; gap: 0.6rem; }
/* Options & pricing: rates typed but not saved (same colour as the builder's unsaved-preview flag). */
.unsaved-cue { color: var(--flag-text); font-weight: 600; }
.unsaved-cue:empty { display: none; }
.rate-source { font-size: 0.78rem; margin-top: 0.15rem; }
.rates-readonly { font-size: 0.9rem; }
.rates-readonly .rate-note { grid-column: 1 / -1; font-size: 0.75rem; color: var(--text-muted); margin-top: -0.2rem; }

/* ---------- Catalog ---------- */

.catalog-search { max-width: 22rem; }
.catalog-kind { max-width: 11rem; }
.tabular { font-variant-numeric: tabular-nums; }
.inactive-row { opacity: 0.6; }
.category-row { display: flex; gap: 0.35rem; align-items: center; margin-bottom: 0.35rem; }
.kit-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.kit-qty { width: 5rem; }
.category-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.category-column { width: auto; }
.location-input { min-width: 7rem; max-width: 12rem; }
.feature-sort { width: 5.5rem; }
.feature-checks { columns: 2 14rem; }
.option-recommend { display: flex; align-items: center; margin: 0.25rem 0; }
.line-location { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.25rem; }
.package-item-select { flex: 1 1 16rem; max-width: 28rem; }
/* Tier badges are fills with their own text colour, the same in both themes. */
.tier-badge { --tier-badge-good: #64748b; --tier-badge-best: #b45309; --tier-badge-custom: #6b5f8a; min-width: 4.5rem; background: var(--tier-badge-good); }
.tier-badge.tier-better { background: var(--brand); color: var(--brand-contrast); }
.tier-badge.tier-best { background: var(--tier-badge-best); }
.tier-badge.tier-custom { background: var(--tier-badge-custom); }

/* A soft neutral badge that follows the theme (in place of text-bg-light). */
.badge-soft { color: var(--bs-emphasis-color); background: var(--bs-secondary-bg); }

/* ---------- Lists: DataTables (docs/design/datatables.md section 10) ---------- */

/* js/wye-tables.js builds each list in a .wye-dt container next to the hidden server table. The Bootstrap 5 styling
   follows data-bs-theme; these keep the controls on the portal's tokens and stack them at phone width. */
.wye-dt .dt-container .row { --bs-gutter-x: 0.75rem; }
.wye-dt .dt-search label, .wye-dt .dt-length label, .wye-dt .dt-info { color: var(--text-muted); }
.wye-dt .dt-search input, .wye-dt .dt-length select { background-color: var(--surface); border-color: var(--input-border); }
.wye-dt .dt-paging .page-link { --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); --bs-pagination-disabled-bg: var(--surface); }
.wye-dt .dt-paging .page-item.active .page-link { background-color: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.wye-dt .dt-paging .page-link:focus-visible, .wye-dt .dt-buttons .btn:focus-visible, .wye-dt th.dt-orderable-asc:focus-visible, .wye-dt th.dt-orderable-desc:focus-visible {
    outline: 2px solid var(--brand-line); outline-offset: 1px;
}
@media (max-width: 767.98px) {
    .wye-dt div.dt-container div.dt-search, .wye-dt div.dt-container div.dt-info, .wye-dt div.dt-container div.dt-length { text-align: left; }
    .wye-dt div.dt-container div.dt-search label { display: block; margin-bottom: 0.25rem; }
    .wye-dt div.dt-container div.dt-search input { margin-left: 0; width: 100%; }
    .wye-dt div.dt-container .dt-layout-cell > * + * { margin-top: 0.5rem; }
}

/* ---------- Print: always light ---------- */

/* Printouts are light whatever the theme (docs/design/theme.md). theme.js also switches the attribute while printing;
   this resets the variables for browsers that print without running it. The Bootstrap values are its light ones. */
@media print {
    [data-bs-theme=dark] {
        color-scheme: light;
        --page: #ffffff;
        --surface: #ffffff;
        --surface-raised: #ffffff;
        --border: #e1e5eb;
        --text-muted: #667085;
        --input-border: #848c98;
        --shadow: transparent;
        --shadow-strong: transparent;
        --warn-line: #f59e0b;
        --flag-text: #92400e;
        --flag-bg: #fef3c7;
        --positive-text: #15803d;
        --selected: #16a34a;
        --selected-ring: rgba(22, 163, 74, 0.2);
        --internal-bg: #fff7ed;
        --tier-default: #94a3b8;
        --tier-good: #64748b;
        --tier-best: #b45309;
        --bs-body-color: #212529; --bs-body-color-rgb: 33, 37, 41; --bs-body-bg: #fff; --bs-body-bg-rgb: 255, 255, 255;
        --bs-emphasis-color: #000; --bs-emphasis-color-rgb: 0, 0, 0;
        --bs-secondary-color: rgba(33, 37, 41, 0.75); --bs-secondary-color-rgb: 33, 37, 41; --bs-secondary-bg: #e9ecef; --bs-secondary-bg-rgb: 233, 236, 239;
        --bs-tertiary-color: rgba(33, 37, 41, 0.5); --bs-tertiary-color-rgb: 33, 37, 41; --bs-tertiary-bg: #f8f9fa; --bs-tertiary-bg-rgb: 248, 249, 250;
        --bs-primary-text-emphasis: #052c65; --bs-secondary-text-emphasis: #2b2f32; --bs-success-text-emphasis: #0a3622; --bs-info-text-emphasis: #055160;
        --bs-warning-text-emphasis: #664d03; --bs-danger-text-emphasis: #58151c; --bs-light-text-emphasis: #495057; --bs-dark-text-emphasis: #495057;
        --bs-primary-bg-subtle: #cfe2ff; --bs-secondary-bg-subtle: #e2e3e5; --bs-success-bg-subtle: #d1e7dd; --bs-info-bg-subtle: #cff4fc;
        --bs-warning-bg-subtle: #fff3cd; --bs-danger-bg-subtle: #f8d7da; --bs-light-bg-subtle: #fcfcfd; --bs-dark-bg-subtle: #ced4da;
        --bs-primary-border-subtle: #9ec5fe; --bs-secondary-border-subtle: #c4c8cb; --bs-success-border-subtle: #a3cfbb; --bs-info-border-subtle: #9eeaf9;
        --bs-warning-border-subtle: #ffe69c; --bs-danger-border-subtle: #f1aeb5; --bs-light-border-subtle: #e9ecef; --bs-dark-border-subtle: #adb5bd;
        --bs-heading-color: inherit; --bs-link-color: #0d6efd; --bs-link-hover-color: #0a58ca; --bs-link-color-rgb: 13, 110, 253; --bs-link-hover-color-rgb: 10, 88, 202;
        --bs-code-color: #d63384; --bs-highlight-color: #212529; --bs-highlight-bg: #fff3cd;
        --bs-border-color: #dee2e6; --bs-border-color-translucent: rgba(0, 0, 0, 0.175);
        --bs-form-valid-color: #198754; --bs-form-valid-border-color: #198754; --bs-form-invalid-color: #dc3545; --bs-form-invalid-border-color: #dc3545;
    }
    [data-bs-theme], [data-bs-theme] * { --brand-on-page: var(--brand-text-light); --brand-line: var(--brand-line-light); }
    html, body { background: #ffffff; }
}

/* ---------- Message log (docs/design/messages.md section 5) ---------- */
.message-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 0.9rem;
    margin: 0;
}
/* The email as sent is a customer document: always light, like the stored proposal (theme.md). */
.message-frame {
    display: block;
    width: 100%;
    min-height: 32rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: #ffffff;
    color-scheme: light;
}

/* The small "?" link to a help article (HelpLink.razor, docs/design/help.md section 8). */
.help-link {
    display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; flex: none; margin-left: .4rem;
    border: 1px solid var(--input-border); border-radius: 50%; font-size: .75rem; font-weight: 700; line-height: 1;
    text-decoration: none; vertical-align: middle; color: var(--text-muted); background: var(--surface);
}
.help-link:hover, .help-link:focus-visible { color: var(--brand-on-page); border-color: var(--brand-line); }

/* Support tickets (docs/design/support-tickets.md section 6): submitted text is untrusted and may be one very long word. */
.support-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.support-cell { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
/* The contact form's trap field: out of sight and out of the tab order for people. */
.support-trap { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Installers' collections (garage-door/m2b): at phone width nothing scrolls sideways, and the buttons are touch sized. */
.collection-card { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.collection-form .form-control, .collection-form .form-select, .touch-target { min-height: 44px; }

/* Ask, the AI help panel (AskPanel.razor, js/ask.js; ai-help.md section 5): a side panel on the right without a backdrop,
   the full screen below 576 px. The conversation scrolls; the question box stays at the bottom. Theme variables only. */
.ask-panel { --bs-offcanvas-width: min(420px, 100vw); background: var(--surface); color: var(--bs-body-color); border-left: 1px solid var(--border); }
@media (max-width: 575.98px) { .ask-panel { --bs-offcanvas-width: 100vw; border-left: 0; } }
.ask-panel .offcanvas-header { border-bottom: 1px solid var(--border); }
.ask-body { display: flex; flex-direction: column; gap: 0.75rem; overflow: hidden; }
.ask-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 0.75rem; }
.ask-turn { border-top: 1px solid var(--border); padding-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.ask-turn:first-child { border-top: 0; padding-top: 0; }
.ask-question { font-weight: 600; margin: 0; white-space: pre-wrap; }
.ask-answer p { margin-bottom: 0.5rem; }
.ask-answer p:last-child { margin-bottom: 0; }
.ask-sources ul { padding-left: 1.1rem; }
.ask-sources a, .ask-help a { color: var(--brand-on-page); }
.ask-thumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.ask-thumb { display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; min-height: 2.25rem; }
.ask-thumb[aria-pressed=true] { background: var(--bs-body-color); color: var(--bs-body-bg); border-color: var(--bs-body-color); }
.ask-thumb-icon { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask-note { flex-basis: 100%; }
.ask-form { flex: none; border-top: 1px solid var(--border); padding-top: 0.75rem; }
.ask-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.ask-actions .form-text { margin: 0 auto 0 0; }

/* Menu and width sweep fixes (docs/qa/menu-width-qa-2026-11-17.md). */
/* L1: DataTables sort indicator: a 24px target (the whole header cell sorts; this is its visible part), arrows centred in it. */
.wye-dt table.dataTable thead > tr > th .dt-column-order.dt-column-order { min-width: 1.5rem; min-height: 1.5rem; }
.wye-dt table.dataTable thead > tr > th .dt-column-order.dt-column-order:before,
.wye-dt table.dataTable thead > tr > th .dt-column-order.dt-column-order:after { left: calc(50% - var(--dt-order-arrow-width) / 2); }
.wye-dt table.dataTable thead > tr > th.dt-orderable-asc, .wye-dt table.dataTable thead > tr > th.dt-orderable-desc { min-height: 1.5rem; }
/* M3: long account names and emails wrap. */
.account-list a, .account-list span { overflow-wrap: anywhere; }
/* M5: a heading's link and its help link wrap onto separate lines. */
.import-kind { display: flex; flex-wrap: wrap; align-items: center; column-gap: .5rem; row-gap: .25rem; }
/* L2: a plain-button link of at least 24px. */
.btn-link-small { min-height: 1.5rem; min-width: 1.5rem; }

/* ---------- Collapsible sections (page density item 5, 2026-11-19) ----------
   details.collapsible on Catalog/ItemEdit, Catalog/PackageEdit and Capacity/ChecklistTemplate. The summary is native, so it is
   keyboard operable; it gets a visible focus outline and a target of at least 24px (WCAG 2.4.7, 2.5.8). Colors are tokens, so
   both themes work. A panel's summary reads as its heading. */
details.collapsible > summary {
    display: list-item;
    min-height: 1.5rem;
    padding: 0.4rem 0;
    cursor: pointer;
    color: var(--brand-on-page);
    font-weight: 500;
}
details.collapsible > summary:focus-visible { outline: 3px solid var(--brand-on-page); outline-offset: 2px; border-radius: 4px; }
details.collapsible[open] > summary { margin-bottom: 0.75rem; }
details.panel.collapsible > summary { padding: 0; min-height: 1.5rem; line-height: 1.5rem; }
/* ---------- End of collapsible sections ---------- */

/* Toast messages (docs/design/toasts.md): fixed under the header, top right on wide screens and full width on phones, so
   a toast never covers the form it reports on. Bootstrap's alert colours (theme-aware) on the portal tokens; nothing literal,
   so both themes are right from the first paint. The region is always in the page (a live region must exist before text is
   added to it) and lets clicks through where it's empty. Under prefers-reduced-motion nothing animates.
   Layers (QA M1): above page content (sticky bars and the dispatch board's panels are 30 or less) and under every menu and
   panel: Bootstrap's dropdowns (1000), the dispatch drawer (1030), offcanvas menus and the Ask panel (1045) and popovers
   (1050). The header isn't fixed, so there's nothing above to clear. While a dropdown, the menu or the Ask panel is open the
   region is also hidden, so no toast sits beside or under it at any width (the Keep toggle in the Account menu is always
   reachable); the toasts come back, with their timers, when it closes. */
.wye-toasts {
    position: fixed;
    top: 4.25rem;
    right: 1rem;
    z-index: 990;
    width: min(26rem, calc(100vw - 2rem));
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.auth-shell .wye-toasts, .public-shell .wye-toasts { top: 4rem; }
body:has(.dropdown-menu.show, .offcanvas.show, .offcanvas.showing) .wye-toasts { visibility: hidden; }
@media print { .wye-toasts { display: none !important; } }
.wye-toasts-live, .wye-toasts-errors { display: flex; flex-direction: column; gap: 0.5rem; }
.wye-toast {
    pointer-events: auto;
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow-strong);
    animation: wye-toast-in 0.2s ease-out;
    transition: opacity 0.3s ease;
}
.wye-toast.alert-success { border-color: var(--bs-success-border-subtle); }
.wye-toast.alert-info { border-color: var(--bs-info-border-subtle); }
.wye-toast.alert-danger { border-color: var(--bs-danger-border-subtle); }
.wye-toast-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
/* At least 24 x 24 CSS px (WCAG 2.5.8); 32 px here. */
.wye-toast-close { flex: none; width: 32px; height: 32px; min-width: 32px; padding: 0; margin: -0.35rem -0.5rem -0.35rem 0; background-size: 0.75rem; }
/* Its own focus ring (QA L1), 3:1 or more on every alert: currentColor is the close button's black, which Bootstrap's dark
   filter turns white in the dark theme, so the ring is black on the light alerts and white on the dark ones. */
.wye-toast-close:focus-visible { opacity: 1; box-shadow: none; outline: 2px solid currentColor; outline-offset: 1px; }
.wye-toast-leaving { opacity: 0; }
/* Focus lands on <main> when the last toast is dismissed from the keyboard (QA L2); it isn't a control, so no ring. */
main[tabindex="-1"]:focus { outline: none; }
@keyframes wye-toast-in { from { opacity: 0; transform: translateY(-0.5rem); } to { opacity: 1; transform: none; } }
@media (max-width: 575.98px) {
    .wye-toasts { left: 0.5rem; right: 0.5rem; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .wye-toast { animation: none; transition: none; }
}
.toast-keep-button { white-space: normal; text-align: start; }
.toast-keep-button[aria-pressed=true] { color: var(--surface); background: var(--bs-body-color); border-color: var(--bs-body-color); }

/* Wye's own mark (logo D4, docs/design/portal-logo-d4.md). The light and dark symbols follow data-bs-theme; on a band in the
   company's colour the mono symbol is a mask filled with the text colour. */
.wye-mark { width: 1.75em; height: 1.75em; flex: none; vertical-align: -0.45em; margin-right: 0.4em; }
[data-bs-theme=dark] .wye-mark-light, :root:not([data-bs-theme=dark]) .wye-mark-dark { display: none; }
.wye-mark-band { display: inline-block; background: currentColor; -webkit-mask: url(/img/brand/symbol-mono.svg) center / contain no-repeat; mask: url(/img/brand/symbol-mono.svg) center / contain no-repeat; }
.brand-wye { display: inline-flex; align-items: center; }
.brand-wye .wye-mark { vertical-align: baseline; }
/* QA-L-1: forced colors repaint backgrounds as Canvas, which would hide the masked mark on the band; paint it in CanvasText. */
@media (forced-colors: active) { .wye-mark-band { forced-color-adjust: none; background: CanvasText; } }
.help-title, .public-name { display: inline-flex; align-items: center; }
