:root {
    --brand-primary: #0F2A44;
    --brand-primary-dark: #0A1F33;
    --brand-primary-hover: #16385A;
    --brand-accent: #D4A24C;
    --brand-bg: #F4F6F8;
    --brand-surface: #FFFFFF;
    --brand-border: #E1E5EA;
    --brand-text: #1A2533;
    --brand-text-muted: #5C6E7E;
    --brand-muted-on-dark: #9CA8B5;
    --brand-danger: #B3261E;
    --brand-success: #198754;
    --sidebar-width: 248px;
    --topbar-height: 64px;
    /* Configurable work-order colors (overridden per-org by App.razor from stored settings). */
    --wo-priority-high: #d55864;
    --wo-priority-high-text: #ffffff;
    --wo-priority-medium: #f5bc0f;
    --wo-priority-medium-text: #000000;
    --wo-priority-low: #9da6af;
    --wo-priority-low-text: #000000;
    /* Parent work order (PWO) priority tones, used on the calendar (10/01). */
    --wo-pwo-priority-high: #a23b72;
    --wo-pwo-priority-high-text: #ffffff;
    --wo-pwo-priority-medium: #e07a2e;
    --wo-pwo-priority-medium-text: #000000;
    --wo-pwo-priority-low: #8a7fb8;
    --wo-pwo-priority-low-text: #000000;
    --wo-today: #0d6efd;
    --wo-today-text: #ffffff;
}

.wo-prio-high { background-color: var(--wo-priority-high); color: var(--wo-priority-high-text); }
.wo-prio-medium { background-color: var(--wo-priority-medium); color: var(--wo-priority-medium-text); }
.wo-prio-low { background-color: var(--wo-priority-low); color: var(--wo-priority-low-text); }
.wo-pwo-prio-high { background-color: var(--wo-pwo-priority-high); color: var(--wo-pwo-priority-high-text); }
.wo-pwo-prio-medium { background-color: var(--wo-pwo-priority-medium); color: var(--wo-pwo-priority-medium-text); }
.wo-pwo-prio-low { background-color: var(--wo-pwo-priority-low); color: var(--wo-pwo-priority-low-text); }
.wo-today-bg { background-color: var(--wo-today) !important; color: var(--wo-today-text) !important; }

html, body {
    height: 100%;
}

body {
    margin: 0;
    background-color: var(--brand-bg);
    color: var(--brand-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* FocusOnNavigate (Routes.razor) moves focus to the page's h1 for screen readers. The heading is not
   interactive, so it gets no visible focus box (customer, 10/27: box around "Sign in" on login). */
h1:focus {
    outline: none;
}

/* Brand button overrides so Bootstrap primary matches the navy palette. */
.btn-primary {
    --bs-btn-bg: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary-hover);
    --bs-btn-hover-border-color: var(--brand-primary-hover);
    --bs-btn-active-bg: var(--brand-primary-dark);
    --bs-btn-active-border-color: var(--brand-primary-dark);
}

.btn-link {
    --bs-btn-color: var(--brand-primary);
    --bs-btn-hover-color: var(--brand-primary-hover);
    text-decoration: none;
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary);
    --bs-btn-hover-border-color: var(--brand-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--brand-primary-dark);
    --bs-btn-active-border-color: var(--brand-primary-dark);
    --bs-btn-active-color: #fff;
}

/* "Generate child WO" and "Associate child WO(s)" on a parent work order: white with bold navy
   text so they stand out on the navy section header. */
.btn-generate-child {
    --bs-btn-bg: var(--brand-surface);
    --bs-btn-font-weight: 700;
}

.text-primary { color: var(--brand-primary) !important; }

.app-splash {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--brand-primary-dark);
}

/* ---- App shell -------------------------------------------------------- */
.app-shell {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--brand-primary-dark);
    border-right: 1px solid #091828;
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    position: relative;
}

.sidebar-brand {
    padding: 12px 8px;
    margin-bottom: 16px;
    text-align: center;
}

.sidebar-logo {
    width: 100%;
    height: 56px;
    object-fit: contain;
    background-color: #fff;
    border-radius: 8px;
    padding: 8px;
}

/* Pin / unpin toggle anchored in the menu's top-right corner. A single button whose icon
   swaps: a filled pin when pinned (expanded) and an outline pin when unpinned (collapsed). */
.sidebar-pin {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.sidebar-pin:hover { background-color: rgba(255, 255, 255, 0.12); color: #fff; }
.sidebar-pin .pin-icon-unpinned { display: none; }
.app-shell.nav-toggled .sidebar-pin .pin-icon-pinned { display: none; }
.app-shell.nav-toggled .sidebar-pin .pin-icon-unpinned { display: inline-flex; }
/* On mobile the rail is a drawer driven by the hamburger/backdrop, so hide the pin. */
@media (max-width: 900px) { .sidebar-pin { display: none; } }

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section + .nav-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #091828;
}

.nav-section-label {
    color: var(--brand-muted-on-dark);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 12px 4px;
}

/* Customer, 10/20: a section heading is a button that collapses the section's entries
   (ewoInterop's nav-section handler toggles .nav-section-collapsed). */
.nav-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 12px 4px 0;
    border: 0;
    background: none;
    color: var(--brand-muted-on-dark);
    text-align: start;
}

.nav-section-toggle:hover,
.nav-section-toggle:focus-visible { color: #fff; }
.nav-section-toggle:hover .nav-section-label,
.nav-section-toggle:focus-visible .nav-section-label { color: #fff; }

.nav-section-toggle .nav-section-label { padding-bottom: 0; }

.nav-section-chevron {
    font-size: 11px;
    transition: transform 0.15s ease;
}

.nav-section-collapsed .nav-section-chevron { transform: rotate(-90deg); }
.nav-section-collapsed .nav-section-items { display: none; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--brand-muted-on-dark);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.nav-item:hover {
    background-color: #162C44;
    color: #fff;
}

.nav-item-active {
    background-color: var(--brand-primary);
    color: #fff;
    border-left: 3px solid var(--brand-accent);
    padding-left: 9px;
}

.nav-item-active i { color: var(--brand-accent); }

/* The apps listed under the Apps entry, indented beneath it. Declared after .nav-item /
   .nav-item-active (and doubled up) so their padding doesn't cancel the indent. */
.nav-item.nav-item-child {
    padding-left: 36px;
    font-size: 13px;
}

.nav-item.nav-item-child.nav-item-active { padding-left: 33px; }

/* Customer, 11/11: the Work Orders app's clipboard glyph is narrower than the PRI app's box, so at
   the same font size it looked smaller. Scaled up to match, on the launcher tile and in the rail.
   A transform, so the row and tile layout don't move. */
.app-icon-wo { display: inline-block; transform: scale(1.2); }

.nav-item-disabled {
    opacity: 0.55;
    cursor: default;
}

/* AI Settings tabs — outlined "real tab" look. The generic .nav-item rules above
   are the dark sidebar nav; reset them here so Bootstrap's <li class="nav-item">
   tab wrappers don't pick up the dark hover fill. */
.ai-tabs.nav-tabs, .app-tabs.nav-tabs {
    border-bottom: 1px solid #000;
    gap: 4px;
}
.ai-tabs .nav-item, .app-tabs .nav-item {
    display: block;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    color: inherit;
}
.ai-tabs .nav-item:hover, .app-tabs .nav-item:hover {
    background-color: transparent;
    color: inherit;
}
.ai-tabs .nav-link, .app-tabs .nav-link {
    margin-bottom: -1px;
    padding: 8px 16px;
    border: 1px solid #000;            /* hairline black outline around each tab */
    border-radius: 6px 6px 0 0;
    background-color: #fff;
    color: var(--brand-text);
    font-weight: 500;
}
.ai-tabs .nav-link:hover, .app-tabs .nav-link:hover {
    background-color: var(--brand-surface, #f1f3f5);
    color: var(--brand-text);
    border-color: #000;
}
.ai-tabs .nav-link.active, .app-tabs .nav-link.active {
    background-color: #fff;
    color: var(--brand-primary);
    font-weight: 600;
    border-color: #000;
    border-bottom-color: #fff;         /* merge the active tab into the content area */
}

.sidebar-footer {
    padding: 16px 12px 0;
    border-top: 1px solid #091828;
}

.sidebar-footer-text {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.sidebar-footer-muted {
    color: var(--brand-muted-on-dark);
    font-size: 11px;
    margin-top: 2px;
}

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

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    background-color: var(--brand-surface);
    border-bottom: 1px solid var(--brand-border);
}

.topbar-title-wrap { flex: 1; }

.topbar-title {
    color: var(--brand-text);
    font-weight: 600;
    font-size: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user { text-align: right; line-height: 1.2; }
.topbar-user-name { display: block; color: var(--brand-text); font-size: 13px; font-weight: 600; }
.topbar-user-email { display: block; color: var(--brand-text-muted); font-size: 11px; }

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.topbar-logout {
    padding: 8px;
    border-radius: 8px;
    color: var(--brand-text-muted);
    display: inline-flex;
}

.topbar-logout:hover { background-color: var(--brand-bg); color: var(--brand-text); }

.app-content {
    flex: 1;
    background-color: var(--brand-bg);
    overflow-y: auto;
}

.page-inner {
    /* Fill the available width (rail + this content area); no centered max-width cap. */
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.page-title { color: var(--brand-text); font-weight: 700; font-size: 24px; margin: 0; }
.page-subtitle { color: var(--brand-text-muted); margin: 4px 0 0; }
.page-header { margin-bottom: 8px; }
.welcome { margin-bottom: 8px; }

/* ---- Cards / dashboard ------------------------------------------------ */
.card {
    background-color: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: 12px;
}

.kpi-row, .card-split {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.kpi-card { flex: 1 1 200px; }
.kpi-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.kpi-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    color: inherit;
}
.kpi-link:focus-visible {
    outline: 2px solid var(--brand-primary, #1565d8);
    outline-offset: 2px;
}
.kpi-label { color: var(--brand-text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { color: var(--brand-text); font-size: 32px; font-weight: 700; margin-top: 4px; }
.kpi-trend { color: var(--brand-text-muted); font-size: 12px; margin-top: 4px; }
.kpi-trend-success { color: var(--brand-success); }
.kpi-trend-warn { color: var(--brand-accent); }

.panel-card { flex: 1 1 320px; }
.panel-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.panel-title { font-size: 16px; font-weight: 600; margin: 0; color: var(--brand-text); }
.panel-muted { color: var(--brand-text-muted); margin-bottom: 12px; }

/* ---- Settings tiles --------------------------------------------------- */
.tile-grid { display: flex; flex-wrap: wrap; gap: 16px; }

.tile-card {
    width: 280px;
    background-color: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.1s ease;
}

.tile-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(15, 42, 68, 0.08); }

.tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background-color: var(--brand-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    color: var(--brand-primary);
    font-size: 22px;
}

/* App launcher (/apps): the same tile, centred, with a larger icon and the label underneath. */
.tile-card-app { width: 200px; padding: 24px 16px; }
.tile-icon-app { width: 88px; height: 88px; border-radius: 20px; font-size: 44px; }

.tile-label { color: var(--brand-text); font-weight: 700; }
.tile-description { color: var(--brand-text-muted); font-size: 13px; line-height: 18px; }
.tile-footer { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--brand-primary); font-size: 13px; font-weight: 600; }

/* ---- Auth (login / register) ----------------------------------------- */
.auth-shell { display: flex; min-height: 100vh; background-color: var(--brand-bg); }

.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-form-col { width: 100%; max-width: 420px; }

.auth-brand { text-align: center; margin-bottom: 16px; }
.auth-logo { width: 220px; max-width: 100%; height: 56px; object-fit: contain; background-color: #fff; border-radius: 6px; }

.auth-form { width: 100%; }
.auth-title { color: var(--brand-text); font-weight: 700; font-size: 24px; margin: 0; }
.auth-subtitle { color: var(--brand-text-muted); margin: 4px 0 16px; }
.auth-submit { margin-top: 8px; padding: 10px; border-radius: 6px; }
.auth-link { margin-top: 8px; }
.auth-field-error { color: var(--brand-danger); font-size: 13px; margin-top: 4px; }
.auth-form-error {
    color: var(--brand-danger);
    background-color: rgba(179, 38, 30, 0.08);
    border: 1px solid rgba(179, 38, 30, 0.25);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    margin-bottom: 8px;
}

.auth-hero-side {
    flex: 1;
    background-size: cover;
    background-position: center;
    display: none;
}

.auth-hero-overlay {
    height: 100%;
    background-color: rgba(15, 42, 68, 0.65);
    display: flex;
    align-items: flex-end;
    padding: 40px;
}

.auth-hero-content { max-width: 480px; }
.auth-hero-eyebrow { color: var(--brand-accent); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; margin: 0 0 8px; }
.auth-hero-title { color: #fff; font-size: 28px; font-weight: 700; line-height: 36px; margin: 0 0 8px; }
.auth-hero-subtitle { color: var(--brand-muted-on-dark); font-size: 14px; margin: 0; }

@media (min-width: 900px) {
    .auth-hero-side { display: block; }
}

/* ---- Users manage page ------------------------------------------------ */
.users-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.users-header-text { flex: 1; }

/* Wraps on purpose: this toolbar is shared, and the widest consumer (Suppliers) puts five items in
   it - a 420px search box, three selects and a checkbox - which overflowed horizontally at 390px
   while this was a nowrap flex row. The gap replaces the ms-2 / ms-3 spacers its children used to
   carry, and supplies the ROW gap a wrapped toolbar needs, which margins never did. */
.users-toolbar { display: flex; flex-wrap: wrap; gap: 12px; }
.users-search { max-width: 420px; }
.users-search .input-group-text { background-color: var(--brand-surface); }

.users-card { overflow: hidden; }
/* An open PersonPicker list is absolutely positioned and would be clipped at the card's bottom edge
   (customer, 10/27: last PM / EPM option cut off on the PWO form). Let the card overflow while a
   list is open so the whole list shows over the content below. */
.users-card:has(.person-picker-menu) { overflow: visible; }
.users-state { padding: 32px; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.wo-link {
    text-decoration: none;
    color: var(--brand-text);
    font-weight: 600;
}
.wo-link:hover,
.wo-link:focus-visible {
    text-decoration: none;
    color: var(--brand-primary, #1565d8);
}

.users-table { margin: 0; }
.users-table thead th { color: var(--brand-text-muted); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--brand-border); }
.users-table td { vertical-align: middle; color: var(--brand-text); }
.users-empty { color: var(--brand-text-muted); padding: 16px; text-align: center; }
.users-actions { white-space: nowrap; }

/* Bootstrap 5.3 has no white-space utility, and the repo rule forbids inline styles. Stored prose
   that carries its own line breaks - the purchase order terms clause frozen at issuance, for one -
   needs them preserved, or a multi-paragraph legal clause renders as one run-on block. */
.text-pre-wrap { white-space: pre-wrap; }

/* Icon-only row actions. The 44x44 MINIMUM is the point of this rule, not the padding: at
   4px 8px these were roughly 24x32 on the expected-receipts chevron and 17-19px on the Remove
   buttons - about half the WCAG 2.5.8 / platform minimum - and a receiver on a phone at a loading
   dock who mis-taps the chevron lands on the row's Receive link and is navigated off the page.
   inline-flex + centring keeps the glyph in the middle of the larger box instead of top-left, and
   the padding stays as the FLOOR for a target that carries text as well as an icon. */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--brand-text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover:not(:disabled) { background-color: var(--brand-bg); color: var(--brand-text); }
.btn-icon:disabled { opacity: 0.4; }
.btn-icon.text-danger { color: var(--brand-danger); }

/* Team members row action that carries a visible label — reads as a link next to the icon-only
   actions, so it stays noticeable without a second primary button in the row. */
.create-login-action { color: var(--brand-primary, #1565d8); font-weight: 500; }
.create-login-action:hover:not(:disabled),
.create-login-action:focus-visible { color: var(--brand-primary, #1565d8); text-decoration: underline; }

.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.role-chip-user { background-color: var(--brand-bg); color: var(--brand-text); }
.role-chip-admin { background-color: #FEF1D6; color: #7A5A12; }

.users-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--brand-border); }
.users-pagination-label { color: var(--brand-text-muted); font-size: 13px; }

.role-toggle .btn { --bs-btn-active-bg: var(--brand-primary); }

/* ---- Modals / dialogs ------------------------------------------------- */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background-color: rgba(10, 31, 51, 0.45);
    z-index: 1040;
}

.modal-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--brand-surface);
    border-radius: 12px;
    padding: 24px;
    /* Roomy by default so multi-field forms don't cramp/wrap; caps at the viewport on small screens. */
    width: min(560px, calc(100vw - 32px));
    z-index: 1050;
    box-shadow: 0 12px 40px rgba(10, 31, 51, 0.25);
    max-height: 90vh;
    overflow-y: auto;
}

/* Live camera preview of the calibrated-equipment QR scanner (EquipmentQrScanner): capped so the
   dialog's buttons stay on screen on a phone held upright. */
.equipment-scanner-video { max-height: 40vh; object-fit: cover; }

/* Wider variant for form-heavy dialogs (multiple side-by-side fields, e.g. Project). */
.modal-card-wide { width: min(860px, calc(100vw - 32px)); }

/* Narrow variant around a square drop area (work order part image): the part image is square, so
   the dialog is too, and nobody is led to take a wide screenshot. */
.modal-card-square { width: min(400px, calc(100vw - 32px)); }

.modal-title { font-size: 20px; font-weight: 700; margin: 0 0 16px; color: var(--brand-text); }

.confirm-card { max-width: 420px; text-align: center; }
.confirm-icon { color: var(--brand-danger); font-size: 32px; margin-bottom: 8px; }
.confirm-title { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
.confirm-body { color: var(--brand-text); margin-bottom: 8px; }
.confirm-note { color: var(--brand-text-muted); font-size: 13px; margin-bottom: 16px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Snackbar --------------------------------------------------------- */
.snackbar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background-color: var(--brand-text);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1060;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* ---- Health / diagnostics -------------------------------------------- */
.health-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.health-status { font-size: 32px; font-weight: 600; color: var(--brand-success); margin: 0; }
.health-service { margin-top: 8px; font-size: 14px; color: var(--brand-text-muted); }

/* ---- API status page -------------------------------------------------- */
.status-root { max-width: 920px; margin: 24px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 16px; }
.status-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.status-h1 { font-size: 24px; font-weight: 700; margin: 0; color: var(--brand-text); }
.status-sub { color: var(--brand-text-muted); margin: 0; }
.status-h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; color: var(--brand-text); }
.status-card { }
.status-loading { padding: 24px; display: flex; justify-content: center; }

.status-meta th { width: 38%; color: var(--brand-text-muted); font-weight: 600; font-size: 13px; vertical-align: top; }
.status-meta td { color: var(--brand-text); word-break: break-all; }
.status-meta code, .probe-url code, .status-foot code { font-size: 13px; }

.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-ok { background-color: #E3F4EA; color: var(--brand-success); }
.pill-fail { background-color: #FBE3E1; color: var(--brand-danger); }
.pill-muted { background-color: var(--brand-bg); color: var(--brand-text-muted); }

.probe { border: 1px solid var(--brand-border); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; }
.probe:last-child { margin-bottom: 0; }
.probe-ok { border-left: 4px solid var(--brand-success); }
.probe-fail { border-left: 4px solid var(--brand-danger); }
.probe-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.probe-icon { font-size: 18px; }
.probe-ok .probe-icon { color: var(--brand-success); }
.probe-fail .probe-icon { color: var(--brand-danger); }
.probe-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.probe-name { font-weight: 600; color: var(--brand-text); }
.probe-url { color: var(--brand-text-muted); font-size: 12px; word-break: break-all; }
.probe-stat { display: flex; align-items: center; gap: 8px; }
.probe-ms { color: var(--brand-text-muted); font-size: 12px; }
.probe-error { color: var(--brand-danger); font-size: 13px; margin-top: 8px; }
.probe-note { color: var(--brand-text-muted); font-size: 13px; margin-top: 8px; }
.probe-section-label { color: var(--brand-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 10px; }
.probe-body {
    background-color: var(--brand-bg);
    border-radius: 6px;
    padding: 10px 12px;
    margin: 4px 0 0;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 240px;
    overflow: auto;
}
.status-foot { color: var(--brand-text-muted); font-size: 13px; margin: 0; }

/* ---- Kanban board drag-and-drop -------------------------------------- */
.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.kanban-dragging { opacity: 0.5; }
/* Roomy cells so the High/Med/Low vertical drop zones have space, and a hover hint. */
.kanban-cell { min-height: 7rem; transition: background-color 0.1s ease; }
.kanban-board td.kanban-cell:hover { background-color: #eef2f6 !important; }

/* Flex-column board views (Operations, Op status). */
.kanban-col { width: 20rem; }
.kanban-col-narrow { width: 18rem; }

/* Projects board lanes (10/01): a tinted column, tall enough to drop into when empty, outlined
   while a card is dragged over it. */
.project-lane { background-color: var(--bs-tertiary-bg); min-height: 8rem; }
.project-lane.project-lane-over { outline: 2px dashed var(--brand-primary); outline-offset: -2px; }

/* Touch devices can't fire HTML5 drag events — cards are tap-to-act (buttons/links),
   so drop the grab cursor that implies dragging. */
@media (pointer: coarse) {
    .kanban-card, .kanban-card:active { cursor: default; }
}

/* Phones: columns shrink to ~viewport width so you swipe one column at a time
   instead of scrolling a tiny sliver. */
@media (max-width: 768px) {
    .kanban-col, .kanban-col-narrow { width: 85vw; max-width: 22rem; }
}

/* ---- Collapsible left rail ------------------------------------------- */
/* Hamburger toggle in the top bar (always visible). */
.topbar-toggle {
    background: transparent;
    border: none;
    color: var(--brand-text-muted);
    font-size: 22px;
    line-height: 1;
    padding: 8px 10px;
    margin-right: 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
}
.topbar-toggle:hover { background-color: var(--brand-bg); color: var(--brand-text); }

/* Smooth the rail width change on desktop collapse. */
.sidebar { transition: transform 0.2s ease; }

/* Backdrop behind the mobile drawer; hidden unless the drawer is open on a narrow screen. */
.sidebar-backdrop { display: none; }

/* Desktop: rail shows by default; collapse it when toggled. */
@media (min-width: 901px) {
    /* Collapsed: pull the rail off-canvas so content fills the width, but keep it as a hover
       flyout — hovering the hamburger (or the rail itself) slides it in so you can click an
       item without re-expanding the layout. */
    .app-shell.nav-toggled .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 1045;
        /* The flyout is viewport-tall too, so it scrolls when the menu is longer than the window. */
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .app-shell.nav-toggled:has(.topbar-toggle:hover) .sidebar,
    .app-shell.nav-toggled .sidebar:hover {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(10, 31, 51, 0.35);
    }
}

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 900px) {
    /* The rail becomes an off-canvas drawer: hidden by default, slid in when toggled. */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        height: 100dvh;
        transform: translateX(-100%);
        z-index: 1045;
        /* Customer, 2026-11-19: the drawer is taller than a phone screen, so it scrolls on its own
           (touch-swipe up and down) without dragging the page behind it. */
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
    .app-shell.nav-toggled .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(10, 31, 51, 0.45);
    }
    .app-shell.nav-toggled .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background-color: rgba(10, 31, 51, 0.45);
        z-index: 1044;
    }
}

/* ---- Mobile: reclaim horizontal space -------------------------------------
   Fixed 24px page padding costs 48px on a ~375px phone; tighten it below the
   phone breakpoint so content (especially cards and tables) gets the width. */
@media (max-width: 768px) {
    .page-inner { padding: 12px; gap: 12px; }
    .page-title { font-size: 20px; }
}

/* ---- Mobile: stack data tables into cards ---------------------------------
   Auto-adapts by viewport width — no device toggle. Add class "table-cards" to
   a .table and a data-label to each <td>. Below the phone breakpoint the header
   row is hidden and each row renders as a bordered card of "Label: value" pairs.
   Special per-cell classes:
     .table-cards-primary  → full-width heading row (e.g. the work order number)
     .table-cards-hide     → dropped on mobile (redundant spacer/icon cells)
     .users-actions        → buttons row, left-aligned with a top divider
   Cells with no data-label (and none of the classes above) render value-only. */
@media (max-width: 768px) {
    .table-cards thead { display: none; }
    .table-cards,
    .table-cards tbody,
    .table-cards tr,
    .table-cards td { display: block; width: 100%; }

    .table-cards tr {
        border: 1px solid var(--brand-border);
        border-radius: 10px;
        padding: 10px 12px;
        margin-bottom: 12px;
        background-color: var(--brand-surface);
        box-shadow: 0 1px 2px rgba(10, 31, 51, 0.06);
    }
    .table-cards tr:last-child { margin-bottom: 0; }

    .table-cards td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        text-align: right;
        padding: 4px 0;
        border: 0;
    }
    .table-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: var(--brand-text-muted);
        text-align: left;
        white-space: nowrap;
    }
    /* Value-only cells: no pseudo-label. */
    .table-cards td:not([data-label])::before { content: none; }

    .table-cards td.table-cards-primary {
        justify-content: flex-start;
        text-align: left;
        font-size: 18px;
        font-weight: 700;
        padding-bottom: 8px;
    }

    .table-cards td.table-cards-hide { display: none; }

    .table-cards td.users-actions {
        justify-content: flex-start;
        gap: 0.5rem;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--brand-border);
        white-space: normal;
        flex-wrap: wrap;
    }

    /* Comfortable touch targets inside stacked cards. */
    .table-cards .btn-sm { padding: 0.375rem 0.75rem; }
    .table-cards .btn-icon { padding: 8px 12px; }
}

/* ---- Mobile: stack EDITING tables into form cards -------------------------
   Like .table-cards, but each cell renders label-above-full-width-input (better
   for inputs/selects than the read-only "label: value" row). Use class
   "table-cards-form" + a data-label per <td>. Add .tc-inline to a checkbox cell
   to keep its label and box on one line. */
@media (max-width: 768px) {
    .table-cards-form thead { display: none; }
    .table-cards-form,
    .table-cards-form tbody,
    .table-cards-form tr,
    .table-cards-form td { display: block; width: 100%; }

    .table-cards-form tr {
        border: 1px solid var(--brand-border);
        border-radius: 10px;
        padding: 10px 12px;
        margin-bottom: 12px;
        background-color: var(--brand-surface);
        box-shadow: 0 1px 2px rgba(10, 31, 51, 0.06);
    }
    .table-cards-form tr:last-child { margin-bottom: 0; }

    .table-cards-form td {
        padding: 4px 0;
        border: 0;
        text-align: left !important;
    }
    .table-cards-form td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 12px;
        color: var(--brand-text-muted);
        margin-bottom: 2px;
    }
    .table-cards-form td:not([data-label])::before { content: none; }

    /* Inputs fill the card width, overriding any fixed inline widths. */
    .table-cards-form td .form-control,
    .table-cards-form td .form-select {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* Checkbox cells: label and box on one line. */
    .table-cards-form td.tc-inline { display: flex; align-items: center; gap: 0.5rem; }
    .table-cards-form td.tc-inline::before { margin-bottom: 0; }
}

/* ---- PersonPicker ----------------------------------------------------- */
.person-picker-menu { z-index: 1056; max-height: 16rem; overflow-y: auto; }
.person-picker-item { cursor: pointer; }

/* ---- MultiSelectFilter (checkbox filter dropdown) ---------------------- */
/* The app ships Bootstrap CSS without its JS, so the menu is positioned here rather than by
   Popper, and an invisible full-page layer catches the click that closes it. */
.ms-filter { position: relative; }
.ms-filter-backdrop { position: fixed; inset: 0; z-index: 1050; }
.ms-filter-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-top: 0.125rem;
    z-index: 1051;
    min-width: 12rem;
    max-height: 16rem;
    overflow-y: auto;
}

/* A read-only field that should read as disabled (e.g. email mirrored from a linked login). */
.form-control-locked {
    background-color: var(--bs-secondary-bg, #e9ecef);
    opacity: 1;
}

/* ---- Work order "traveler" grid (mirrors the printed DES WORK ORDER form) ---- */
.wo-traveler { border: 1px solid #1a2533; overflow: hidden; }
.wo-traveler-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background-color: var(--brand-primary); color: #fff;
}
.wo-traveler-name { font-weight: 700; letter-spacing: 1px; font-size: 15px; }

/* Navy section header that matches the traveler's blue bar. Breaks out of the card's
   p-3 padding to span full width; .users-card has overflow:hidden so the top corners clip clean. */
.wo-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -1rem -1rem 1rem;
    padding: 8px 16px;
    background-color: var(--brand-primary);
    color: #fff;
    /* Rounds its own top corners so they stay clean while the card overflows (see .users-card:has). */
    border-top-left-radius: var(--bs-card-inner-border-radius);
    border-top-right-radius: var(--bs-card-inner-border-radius);
}
.wo-section-title { margin: 0; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }
/* Bold red warning centred in a section's dark header bar. Bootstrap's .text-danger red
   only reaches ~3.2:1 against --brand-primary, so use a lighter red. */
.wo-section-warning { color: #FF9AA0; font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }
.wo-traveler-no { font-size: 14px; }
/* Child work order cards on a parent: lets a long title truncate instead of widening the card on a phone. */
.wo-child-body { min-width: 0; }
.wo-grid { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0; }
.wo-grid th.wo-label {
    width: 8%; background-color: #eef1f4; border: 1px solid #c8ced3;
    padding: 4px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: #41505f; vertical-align: middle; white-space: normal; word-break: break-word;
}
.wo-grid td.wo-cell { width: 17%; border: 1px solid #c8ced3; padding: 0; overflow: hidden; }
.wo-grid .wo-field {
    width: 100%; max-width: 100%; box-sizing: border-box; border: 0; padding: 6px 8px;
    background-color: transparent; font-size: 14px; color: var(--brand-text);
}
.wo-grid .wo-field:focus { outline: 2px solid var(--brand-primary); outline-offset: -2px; }
.wo-grid .wo-field.is-invalid { background-color: #fdecea; box-shadow: inset 0 0 0 1px var(--bs-danger, #dc3545); }
.wo-cell-error { padding: 2px 8px 4px; font-size: 12px; color: var(--bs-danger, #dc3545); }
.wo-req { color: var(--bs-danger, #dc3545); margin-left: 2px; font-weight: 700; }
.wo-traveler-errors { padding: 6px 12px; font-size: 13px; }

/* Work order quick-filter facet chips */
.wo-facets { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0 0 1rem; }
.wo-facet-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.wo-facet-label {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    color: #6c757d; margin-right: 0.15rem;
}
.wo-chip {
    border: 1px solid var(--bs-border-color, #dee2e6); background: #fff;
    color: var(--brand-text, #1f2d3d); border-radius: 999px; padding: 0.2rem 0.65rem;
    font-size: 0.8rem; line-height: 1.4; cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.wo-chip:hover { background: #f1f4f8; }
.wo-chip:focus-visible { outline: 2px solid var(--brand-primary, #0F2A44); outline-offset: 1px; }
.wo-chip.active { background: var(--brand-primary, #0F2A44); border-color: var(--brand-primary, #0F2A44); color: #fff; }
.wo-chip-count { font-weight: 700; margin-left: 0.3rem; opacity: 0.7; }
.wo-chip-clear { color: #b02a37; border-color: #f1c2c7; }
.wo-chip-clear:hover { background: #fbe9eb; }
@media (max-width: 768px) {
    .wo-grid, .wo-grid tbody, .wo-grid tr { display: block; }
    .wo-grid th.wo-label, .wo-grid td.wo-cell { display: block; width: 100%; }
}

/* ---- Rolling operation notes / comments ------------------------------- */
/* One growing thread per operation, so line breaks in the notes have to survive, and the
   read-only view doubles as the click-to-edit target. */
.wo-notes-text { white-space: pre-wrap; word-break: break-word; }
.wo-notes-box { resize: vertical; overflow-y: auto; }
.wo-notes-open {
    display: block; width: 100%; text-align: left; cursor: text;
    border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 6px;
    background: #fff; color: var(--brand-text, #1f2d3d);
    padding: 0.375rem 0.5rem; font-family: inherit; font-size: 0.875rem; line-height: 1.35;
}
.wo-notes-open:hover { background: #f8fafc; border-color: var(--brand-primary, #0F2A44); }
.wo-notes-open:focus-visible { outline: 2px solid var(--brand-primary, #0F2A44); outline-offset: 1px; }
.wo-notes-empty { color: var(--brand-text-muted, #6c757d); font-style: italic; }

/* ---- Work order tags -------------------------------------------------- */
/* Shop-safety chips (Settings → Tags). Colours are per-tag data, so they are the one thing
   applied inline; everything else about the chip lives here. */
.wo-tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.wo-tag {
    display: inline-flex; align-items: center; gap: 0.35rem;
    border-radius: 4px; padding: 0.15rem 0.5rem;
    font-size: 0.8rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.wo-tag-remove {
    border: 0; background: transparent; color: inherit; opacity: 0.75;
    padding: 0; line-height: 1; font-size: 0.9rem; cursor: pointer;
}
.wo-tag-remove:hover { opacity: 1; }
.wo-tag-remove:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; border-radius: 2px; }
.wo-tag-empty { color: var(--brand-text-muted, #6c757d); font-style: italic; font-size: 0.85rem; }
.wo-tag-picker-add { max-width: 16rem; }
/* Swatch shown next to a colour input in the tag dialog. */
.wo-tag-swatch { width: 3rem; height: calc(1.5em + 0.75rem + 2px); padding: 0.15rem; }

/* TDP level only ever holds 1, 2 or 3, so its dropdown is sized to its "TDP level" label rather
   than stretched across the column (customer, 9/30). Used on every TDP level dropdown. */
.form-select.tdp-select { width: 5rem; }

/* The deliverable's %Complete box: just wide enough for "100", so what is typed is always visible
   (customer, 9/30). */
.input-group > .form-control.pct-input { flex: 0 0 auto; width: 2.5rem; }

/* ---- Asset Log seating chart (customer, 10/06) ------------------------
   A floor plan has a shape Bootstrap's grid cannot express, so the plan is laid out here: conference
   rooms down the left, the A–D pods and the offices across the top, E–L below, the lab on the right.
   Wide by nature — the card scrolls sideways on small screens rather than reflowing the building. */
/* Exactly as wide as the building and centred in the card: a wider window adds margin on both sides,
   never a gap inside the plan — the lab stays right beside column L (customer, 10/06). */
.seat-plan { display: flex; gap: 1.5rem; align-items: stretch; width: max-content; margin-inline: auto; }
.seat-plan-rooms { display: flex; flex-direction: column; justify-content: flex-end; gap: .5rem; width: 9rem; }
/* Columns: pod AB, pod CD, then the offices with the E–L pods beneath them. Fixed tracks, so widening the
   window never slides one row against the other. */
.seat-plan-main {
    display: grid; grid-template-columns: max-content max-content max-content; column-gap: 1.25rem; row-gap: 1.5rem;
    align-items: start; align-content: start; flex: 0 0 auto;
}
.seat-plan-lower { grid-column: 3; grid-row: 2; display: flex; gap: 1.25rem; }
.seat-offices { grid-column: 3; grid-row: 1; justify-self: start; }
.seat-plan-lab { display: flex; width: 9rem; }
.seat-plan-lab .seat-cell { flex: 1 1 auto; }

.seat-pod { display: grid; grid-template-columns: 1rem repeat(2, 7rem); gap: 2px; }
.seat-axis { color: var(--brand-danger); font-weight: 600; font-size: .85rem; text-align: center; align-self: center; }
.seat-offices { display: grid; grid-template-columns: repeat(7, 6.5rem); gap: 2px; }

.seat-cell {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    min-height: 4.25rem; padding: .3rem .4rem; text-align: left;
    background-color: var(--brand-surface); color: var(--brand-text);
    border: 2px solid var(--brand-primary); border-radius: 2px; font-size: .78rem; line-height: 1.2;
}
.seat-cell:hover { background-color: var(--brand-bg); }
.seat-cell:focus-visible { outline: 3px solid var(--brand-accent); outline-offset: 2px; }
.seat-empty { border-color: var(--brand-border); color: var(--brand-text-muted); }
.seat-match { background-color: #fff3cd; border-color: var(--brand-accent); box-shadow: 0 0 0 2px var(--brand-accent); }
/* Offices are a good deal deeper than a cubicle on the real floor (customer, 10/06): about two cubicles tall. */
.seat-office { min-height: 10rem; }
.seat-room { min-height: 7rem; width: 100%; }
.seat-remote { min-width: 14rem; border-style: dashed; }
.seat-code { font-weight: 700; color: var(--brand-danger); }
.seat-person { font-weight: 600; cursor: help; }
.seat-computers { display: flex; flex-wrap: wrap; gap: 2px 6px; margin-top: auto; color: var(--brand-text-muted); font-size: .72rem; }
.seat-computer { white-space: nowrap; cursor: help; }

/* File drop zones (cart import, work order part image): Bootstrap has no dashed-border utility.
   The part image zone takes focus so a screenshot can be pasted into it. */
.file-drop-zone { border: 2px dashed var(--brand-border); border-radius: .5rem; background-color: var(--brand-surface); }
.file-drop-zone.file-drop-over,
.file-drop-zone:focus-visible { border-color: var(--brand-primary); background-color: var(--brand-bg); outline: none; }
.file-drop-zone:focus { border-color: var(--brand-primary); outline: none; }

/* Supplier list: the "How approved" line under the approval badge stays one line; the full text is
   in the title. */
.supplier-basis { max-width: 18rem; }

/* "How approved" (customer, 2026-10-30): the choices are long sentences, so they are a wrapping radio
   list that scrolls inside the form rather than pushing it a full screen down. */
.approval-basis-list { max-height: 16rem; }

/* Purchase lines table (customer, 2026-10-12): fixed layout so a dragged width sticks, a wide
   description, text the requestor scales with the "Text size" slider (lines-scale-NN), and inputs
   that follow the table text size instead of Bootstrap's fixed 1rem. Scrolls sideways on a phone. */
.lines-table { table-layout: fixed; width: 100%; min-width: 52rem; }
.lines-table th { position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lines-table .form-control, .lines-table .form-select { font-size: inherit; }
.lines-col-desc { width: 36%; }
.lines-col-part { width: 12%; }
.lines-col-qty { width: 8%; }
.lines-col-uom { width: 9%; }
.lines-col-price { width: 9%; }
.lines-col-ext { width: 8%; }
.lines-col-actions { width: 6%; }
.lines-scale-70 { font-size: .7rem; }
.lines-scale-80 { font-size: .8rem; }
.lines-scale-90 { font-size: .9rem; }
.lines-scale-100 { font-size: 1rem; }
.lines-scale-110 { font-size: 1.1rem; }
.lines-scale-120 { font-size: 1.2rem; }
.lines-size-range { width: 8rem; }
.col-resize-grip { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; user-select: none; z-index: 1; }
.col-resize-grip:hover, .col-resize-grip.col-resizing { background-color: var(--brand-border); }
/* Any table opting in with data-resizable-columns (10/15): the grip needs a positioned header cell, and
   once a column has been dragged the table is fixed-layout at those widths, clipping long headers. */
th.col-resizable { position: relative; }
.table-cols-sized { table-layout: fixed; max-width: none; }
.table-cols-sized th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-cols-sized td { overflow-wrap: anywhere; }
@media (hover: none) { .col-resize-grip { width: 14px; } }
/* A table that stacks into cards on a phone ignores widths dragged on a desktop. */
@media (max-width: 768px) {
    .table-cards.table-cols-sized, .table-cards-form.table-cols-sized { width: 100% !important; table-layout: auto; }
}
/* data-resize-anywhere (customer, 10/29): near a column edge in ANY row the cursor offers the resize,
   and while a column is being dragged the whole table shows it and stops selecting text. */
.col-resize-hot, .col-resize-hot *, .col-resize-dragging, .col-resize-dragging * { cursor: col-resize !important; }
.col-resize-dragging { user-select: none; }

/* Email → Templates: the "specific people" checklist on the IT asset log notices. Scrolls rather
   than pushing Save off the screen when the team is large. */
.email-person-list { max-height: 16rem; }
/* Settings → Countries import preview (customer, 2026-11-17): the change list scrolls inside the dialog. */
.country-import-changes { max-height: 16rem; }

/* Customer, 10/20: the Purchase Requests list's "Text size" slider. The class sits on the table and
   scales the headings too, which .users-table otherwise fixes at 13px. */
.list-scale-70, .list-scale-70 thead th { font-size: .7rem; }
.list-scale-80, .list-scale-80 thead th { font-size: .8rem; }
.list-scale-90, .list-scale-90 thead th { font-size: .9rem; }
.list-scale-100, .list-scale-100 thead th { font-size: 1rem; }
.list-scale-110, .list-scale-110 thead th { font-size: 1.1rem; }
.list-scale-120, .list-scale-120 thead th { font-size: 1.2rem; }

/* Customer, 10/29: the work order operation tables (new / edit form and the work order page) take
   the same "Text size" slider. Their inline inputs and selects follow the table's size rather than
   Bootstrap's fixed small size. */
.ops-text-scaled .form-control-sm,
.ops-text-scaled .form-select-sm,
.ops-text-scaled .btn-sm { font-size: inherit; }

/* Customer, 10/29: very light gray column lines on the work order operation tables, so each column
   reads down the table. Desktop layout only — on a phone the form table stacks into cards. */
@media (min-width: 769px) {
    .ops-col-lines > :not(caption) > tr > th:not(:last-child),
    .ops-col-lines > :not(caption) > tr > td:not(:last-child) {
        border-right: 1px solid var(--bs-gray-200, #e9ecef);
    }
}

/* Customer, 11/10: printing one part of a page (ewoInterop.printArea) — e.g. the Asset Log's
   computer list. Everything that is not the print area, inside it, or one of its ancestors is
   hidden; the app shell stops scrolling so a long list flows onto as many pages as it needs. */
@page print-area-landscape {
    size: landscape;
    margin: 0.5in;
}

@media print {
    body.print-area-active *:not(:has(.print-area)):not(.print-area):not(.print-area *) {
        display: none !important;
    }

    body.print-area-active .app-shell,
    body.print-area-active .app-main,
    body.print-area-active .app-content,
    body.print-area-active .page-inner {
        display: block;
        min-height: 0;
        padding: 0;
        overflow: visible;
        background: none;
    }

    body.print-area-active .print-area { page: print-area-landscape; }

    body.print-area-active .print-area .users-card,
    body.print-area-active .print-area .table-responsive {
        overflow: visible;
        border: 0;
        box-shadow: none;
    }

    body.print-area-active .print-area table { font-size: 10px; }
    body.print-area-active .print-area thead { display: table-header-group; }
    body.print-area-active .print-area tr { break-inside: avoid; }
}

/* Customer, 11/13: Quality → BMS Assistant. Ask Sage's widget is a launcher fixed to the bottom-right
   corner with its chat panel floating above it. On this page it is seated in the page instead: the
   launcher centred under the instruction, and the open chat full width below it. Scoped to the page's
   .bms-assistant host; the widget's own markup has no stable classes, so these key off its launcher
   (the button labelled "Open/Close Ask Sage chat") and that button's siblings (the panel). */
.bms-assistant asksage-chatbot-embed,
.bms-assistant #asksage-widget-root,
.bms-assistant #asksage-widget-root > div { display: block !important; width: 100%; }
.bms-assistant div:has(> button[aria-label$="Ask Sage chat"]) {
    position: relative !important; left: auto !important; top: auto !important; z-index: auto !important;
    display: flex !important; flex-direction: column; align-items: center; gap: 1rem; width: 100%;
}
.bms-assistant div:has(> button[aria-label$="Ask Sage chat"]) > :not(button) {
    position: relative !important; right: auto !important; bottom: auto !important; left: auto !important;
    top: auto !important; z-index: auto !important; text-align: start;
    width: 100% !important; max-width: 960px; height: min(70vh, 720px) !important; min-height: 420px;
}
/* A closed chat keeps its panel mounted but hidden; take it out of the layout too. */
.bms-assistant div:has(> button[aria-label="Open Ask Sage chat"]) > :not(button) { display: none !important; }

/* Customer, 11/13: Quality → Quality dashboard. Two series colours (categorical slots 1 and 2 of the
   validated dataviz palette: blue = raised, orange = closed), a recessive grid, and thin bars. Text
   never wears a series colour; every chart has a legend and a table with the same figures. */
.nc-trend-svg { width: 100%; height: auto; max-height: 280px; display: block; }
.nc-trend-svg .nc-grid { stroke: var(--brand-border, #dee2e6); stroke-width: 1; stroke-dasharray: 3 3; }
.nc-trend-svg .nc-axis { stroke: var(--brand-text-muted, #6c757d); stroke-width: 1; }
.nc-trend-svg .nc-tick { fill: var(--brand-text-muted, #6c757d); font-size: 11px; }
.nc-trend-svg .nc-hit { fill: transparent; }
.nc-trend-svg .nc-period:hover .nc-hit { fill: rgba(0, 0, 0, 0.04); }
.nc-bar-opened, .nc-swatch-opened { fill: #2a78d6; background-color: #2a78d6; }
.nc-bar-closed, .nc-swatch-closed { fill: #eb6834; background-color: #eb6834; }
.nc-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: baseline; }
.nc-breakdown .nc-bar-col { width: 30%; min-width: 80px; }
.nc-bar { width: 100%; height: 8px; display: block; }
.nc-bar-track { fill: var(--brand-border, #e9ecef); }
.nc-bar-fill { fill: #2a78d6; }
.nc-ai-analysis { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow-y: auto; }

/* Customer, 2026-11-18: the hover / keyboard-focus pop-up on a supplier's on-time score
   ("12 month rolling", "#POs n"). CSS only: no tooltip library is loaded on these pages. */
.score-popup-anchor { position: relative; display: inline-block; cursor: help; }
.score-popup-anchor:focus-visible { outline: 2px solid var(--brand-primary, #1565d8); outline-offset: 2px; border-radius: 2px; }
.score-popup {
    display: none;
    position: absolute;
    z-index: 1080;
    bottom: 100%;
    left: 0;
    margin-bottom: 4px;
    padding: 6px 10px;
    min-width: 9rem;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 400;
    color: #fff;
    background-color: #212529;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    text-align: left;
}
.score-popup-anchor:hover .score-popup,
.score-popup-anchor:focus .score-popup,
.score-popup-anchor:focus-within .score-popup { display: block; }
