/* ==== Design tokens (issue 222, UX-C3 / C4 / C7) ====
   The same values as Services/NSLogiTheme.cs (the MudTheme). Rules: indigo is the only interactive colour (buttons, links, focus);
   amber is the marketing call to action only; success / warning / danger / info mark state, never decoration. Prefer these variables
   (or MudBlazor's --mud-palette-*) over hard-coded hex in new styles. */
:root {
    --brand-50: #EEF2FF;
    --brand-100: #E0E7FF;
    --brand-400: #818CF8;
    --brand-500: #6366F1;
    --brand-600: #4F46E5;   /* buttons, links, focus, app bar */
    --brand-700: #4338CA;
    --accent-500: #F59E0B;  /* marketing CTA only */
    --accent-600: #D97706;
    --gray-900: #111827;    /* headings */
    --gray-700: #374151;
    --gray-600: #4B5563;    /* body / meta minimum on white */
    --gray-500: #6B7280;
    --gray-400: #9CA3AF;
    --gray-300: #D1D5DB;
    --gray-200: #E5E7EB;    /* borders */
    --gray-100: #F3F4F6;
    --gray-50: #F9FAFB;
    --success: #15803D;
    --warning: #B45309;
    --danger: #DC2626;
    --info: #2563EB;
    /* type scale: 12 is the floor; 14 is body, labels, tables and buttons */
    --font-xs: 0.75rem;     /* 12px */
    --font-sm: 0.875rem;    /* 14px */
    --font-md: 1rem;        /* 16px */
    --font-lg: 1.25rem;     /* 20px */
    --font-xl: 1.75rem;     /* 28px */
}

/* Semantic text aliases follow the live theme (light / dark) through MudBlazor's palette variables. */
:root {
    --text-strong: var(--mud-palette-text-primary, var(--gray-900));
    --text-muted: var(--mud-palette-text-secondary, var(--gray-600));
}

html, body {
    font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: var(--mud-palette-primary, var(--brand-600));
}

/* ==== Bootstrap follows the MudBlazor theme (batch 98, CSS review H2 / M4) ====
   Bootstrap 5.3 still styles the Identity template pages (Account/*, Manage/*) and the request-access form. Its variables are mapped to
   MudBlazor's palette here, once, so those pages follow light / dark (and the instant flip, html[data-theme-flip]) like every other page.
   app.css loads after bootstrap.min.css, so this :root wins over Bootstrap's own ":root, [data-bs-theme=light]". */
:root {
    --bs-body-bg: var(--mud-palette-surface);
    --bs-body-color: var(--mud-palette-text-primary);
    --bs-emphasis-color: var(--mud-palette-text-primary);
    --bs-heading-color: inherit;
    --bs-secondary-color: var(--mud-palette-text-secondary);
    --bs-secondary-bg: var(--mud-palette-background-gray);
    --bs-tertiary-color: var(--mud-palette-text-secondary);
    --bs-tertiary-bg: var(--mud-palette-background-gray);
    --bs-border-color: var(--mud-palette-lines-inputs);
    --bs-border-color-translucent: var(--mud-palette-lines-default);
    --bs-link-color: var(--mud-palette-primary);
    --bs-link-hover-color: var(--mud-palette-primary-darken);
    --bs-link-color-rgb: var(--mud-palette-primary-rgb);
    --bs-link-hover-color-rgb: var(--mud-palette-primary-rgb);
    --bs-primary: var(--mud-palette-primary);
    --bs-primary-rgb: var(--mud-palette-primary-rgb);
    --bs-success-rgb: var(--mud-palette-success-rgb);
    --bs-warning-rgb: var(--mud-palette-warning-rgb);
    --bs-danger-rgb: var(--mud-palette-error-rgb);
    --bs-info-rgb: var(--mud-palette-info-rgb);
    --bs-primary-text-emphasis: var(--mud-palette-primary);
    --bs-primary-bg-subtle: color-mix(in srgb, var(--mud-palette-primary) 12%, var(--mud-palette-surface));
    --bs-primary-border-subtle: color-mix(in srgb, var(--mud-palette-primary) 35%, var(--mud-palette-surface));
    --bs-success-text-emphasis: var(--mud-palette-success);
    --bs-success-bg-subtle: color-mix(in srgb, var(--mud-palette-success) 12%, var(--mud-palette-surface));
    --bs-success-border-subtle: color-mix(in srgb, var(--mud-palette-success) 35%, var(--mud-palette-surface));
    --bs-warning-text-emphasis: var(--mud-palette-warning);
    --bs-warning-bg-subtle: color-mix(in srgb, var(--mud-palette-warning) 12%, var(--mud-palette-surface));
    --bs-warning-border-subtle: color-mix(in srgb, var(--mud-palette-warning) 35%, var(--mud-palette-surface));
    --bs-danger-text-emphasis: var(--mud-palette-error);
    --bs-danger-bg-subtle: color-mix(in srgb, var(--mud-palette-error) 12%, var(--mud-palette-surface));
    --bs-danger-border-subtle: color-mix(in srgb, var(--mud-palette-error) 35%, var(--mud-palette-surface));
    --bs-info-text-emphasis: var(--mud-palette-info);
    --bs-info-bg-subtle: color-mix(in srgb, var(--mud-palette-info) 12%, var(--mud-palette-surface));
    --bs-info-border-subtle: color-mix(in srgb, var(--mud-palette-info) 35%, var(--mud-palette-surface));
    --bs-secondary-text-emphasis: var(--mud-palette-text-primary);
    --bs-secondary-bg-subtle: var(--mud-palette-background-gray);
    --bs-secondary-border-subtle: var(--mud-palette-lines-default);
    --bs-form-valid-color: var(--mud-palette-success);
    --bs-form-valid-border-color: var(--mud-palette-success);
    --bs-form-invalid-color: var(--mud-palette-error);
    --bs-form-invalid-border-color: var(--mud-palette-error);
    --bs-code-color: var(--mud-palette-text-primary);
}
/* Bootstrap sets these with fixed colours (or an -rgb variable MudBlazor has no twin for), so each is re-pointed at the palette —
   every state (hover / active / focus / disabled), not only the resting one. */
.btn-primary {
    --bs-btn-color: var(--mud-palette-primary-text);
    --bs-btn-bg: var(--mud-palette-primary);
    --bs-btn-border-color: var(--mud-palette-primary);
    --bs-btn-hover-color: var(--mud-palette-primary-text);
    --bs-btn-hover-bg: var(--mud-palette-primary-darken);
    --bs-btn-hover-border-color: var(--mud-palette-primary-darken);
    --bs-btn-focus-shadow-rgb: var(--mud-palette-primary-rgb);
    --bs-btn-active-color: var(--mud-palette-primary-text);
    --bs-btn-active-bg: var(--mud-palette-primary-darken);
    --bs-btn-active-border-color: var(--mud-palette-primary-darken);
    --bs-btn-disabled-color: var(--mud-palette-primary-text);
    --bs-btn-disabled-bg: var(--mud-palette-primary);
    --bs-btn-disabled-border-color: var(--mud-palette-primary);
}
.btn-danger {
    --bs-btn-color: var(--mud-palette-error-text);
    --bs-btn-bg: var(--mud-palette-error);
    --bs-btn-border-color: var(--mud-palette-error);
    --bs-btn-hover-color: var(--mud-palette-error-text);
    --bs-btn-hover-bg: var(--mud-palette-error-darken);
    --bs-btn-hover-border-color: var(--mud-palette-error-darken);
    --bs-btn-focus-shadow-rgb: var(--mud-palette-error-rgb);
    --bs-btn-active-color: var(--mud-palette-error-text);
    --bs-btn-active-bg: var(--mud-palette-error-darken);
    --bs-btn-active-border-color: var(--mud-palette-error-darken);
    --bs-btn-disabled-color: var(--mud-palette-error-text);
    --bs-btn-disabled-bg: var(--mud-palette-error);
    --bs-btn-disabled-border-color: var(--mud-palette-error);
}
.nav-pills {
    --bs-nav-pills-link-active-color: var(--mud-palette-primary-text);
    --bs-nav-pills-link-active-bg: var(--mud-palette-primary);
}
.table {
    --bs-table-color: var(--mud-palette-text-primary);
    --bs-table-bg: var(--mud-palette-surface);
    --bs-table-border-color: var(--mud-palette-table-lines, var(--mud-palette-lines-default));
    --bs-table-striped-color: var(--mud-palette-text-primary);
    --bs-table-striped-bg: var(--mud-palette-table-striped, transparent);
    --bs-table-hover-color: var(--mud-palette-text-primary);
    --bs-table-hover-bg: var(--mud-palette-table-hover, transparent);
    --bs-table-active-color: var(--mud-palette-text-primary);
    --bs-table-active-bg: var(--mud-palette-action-default-hover);
}
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--mud-palette-primary); box-shadow: none; }
.form-check-input:checked { background-color: var(--mud-palette-primary); border-color: var(--mud-palette-primary); }
.form-floating > label,
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label { color: var(--mud-palette-text-secondary); }
.form-control:disabled, .form-control[readonly] { background-color: var(--mud-palette-background-gray); }
.btn:focus-visible { box-shadow: none; }

/* ==== Keyboard focus (batch 98, CSS review M2) ====
   MudBlazor removes the outline from every button (button:focus { outline: none }) and nothing put one back, so a keyboard user could
   not see where they were. One ring for links, buttons and plain inputs; "body" lifts it over MudBlazor's rule. MudBlazor's own inputs
   (inside .mud-input-control) already show focus with their border, so they are left alone — no double ring. The app bar and the dark
   marketing bands use a light ring (indigo on indigo / navy would be invisible). */
body :is(a, button, summary, [role="button"], [tabindex]:not([tabindex="-1"])):focus-visible,
body :is(input, select, textarea):not(.mud-input-control *):focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}
body :is(.mud-appbar, .mk-navy, .mk-hero) :is(a, button, summary, input, [role="button"], [tabindex]):focus-visible { outline-color: var(--mud-palette-appbar-text); }

/* ==== Global type rules (UX-C4 / C7) ==== sentence case everywhere: no uppercase transforms on buttons, tabs, overlines or chips
   (the MudTheme sets Button / Overline TextTransform "none"; these catch the components that style themselves). */
.mud-button-root, .mud-tab, .mud-chip, .mud-typography-overline, .mud-table-head .mud-table-cell {
    text-transform: none;
    letter-spacing: normal;
}
.mud-button-root .mud-button-label { font-size: var(--font-sm); }
.mud-button-root.mud-button-size-small .mud-button-label { font-size: 0.8125rem; }
.mud-tab { font-size: var(--font-sm); font-weight: 600; }
.mud-chip.mud-chip-size-small { font-size: var(--font-xs); }
.mud-table-cell { font-size: var(--font-sm); }
.mud-input-helper-text, .mud-typography-caption { font-size: var(--font-xs); }

/* ==== UX-C2: company context chip in the app bar (MainLayout) ====
   Issue 258: our own activator (MudMenu ActivatorContent) — one flex row that never wraps, 30px tall:
   [building icon, child company only] [Group › ]Company (ellipsis) [▾]. Phones (<600px) show only the company's own name. */
.ctx-chip.mud-menu {
    display: inline-flex;
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(420px, 46vw);
}
/* MudBlazor makes the activator display:contents (and loads after this file): a real box keeps the focus ring and the ellipsis chain. */
.ctx-chip.mud-menu > div.mud-menu-activator {
    display: flex;
    min-width: 0;
    max-width: 100%;
    border-radius: 999px;
    outline: none;
}
.ctx-chip.mud-menu > div.mud-menu-activator:focus-visible .ctx-chip-btn { box-shadow: 0 0 0 2px #fff; }
/* Issue 287: before the live connection the chip is a plain link (to the company page) with the same face. */
.ctx-chip.ctx-chip-link {
    display: inline-flex;
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(420px, 46vw);
    color: inherit;
    text-decoration: none;
    border-radius: 999px;
    outline: none;
}
.ctx-chip.ctx-chip-link:focus-visible .ctx-chip-btn { box-shadow: 0 0 0 2px #fff; }
.ctx-chip-btn {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    height: 30px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 4px 0 12px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 999px;
    color: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.ctx-chip-btn:hover { border-color: #fff; background-color: rgba(255, 255, 255, .1); }
.ctx-chip-linked .ctx-chip-btn { padding-left: 8px; }
.ctx-chip-btn .ctx-chip-icon, .ctx-chip-btn .ctx-chip-caret { flex: 0 0 auto; font-size: 18px; width: 18px; height: 18px; }
.ctx-chip-btn .ctx-chip-caret { margin-left: -2px; }
.ctx-chip-name, .ctx-chip-static > span[aria-hidden] {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 28px;
}
/* Issue 247: working inside a child company keeps the same neutral outline (no amber on every page); the building icon at the
   start of the chip and the "Parent › Child" path say where you are. */
.ctx-chip-static {
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(420px, 46vw);
    height: 30px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
}
/* Issue 282: no switching → no chip, just the company's name. */
.ctx-chip-static.ctx-chip-plain { border: none; padding: 0; height: auto; }
@media (max-width: 599.98px) {
    .ctx-chip.mud-menu, .ctx-chip.ctx-chip-link, .ctx-chip-static { max-width: 44vw; }
    .ctx-chip-parent { display: none; }   /* phones: the company's own name only — the group is in the menu */
}
/* Issue 292: the chip's menu shows at once (no fade) and its items take a click the moment they are visible. */
.mud-popover.ctx-chip-popover.mud-popover-open { transition: none !important; opacity: 1; pointer-events: auto; }
/* Issue 864: the switch list holds every company (up to 60) — it scrolls instead of running off the screen. */
.mud-popover.ctx-chip-popover { max-height: min(70vh, 640px); overflow-y: auto; }
/* Issue 292: a company switch is a full page load through the server — say it is on its way (js/nslogiPwa.js sets the class). */
html.nslogi-navigating, html.nslogi-navigating * { cursor: progress !important; }
html.nslogi-navigating body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 10000;
    background: linear-gradient(90deg, transparent, var(--accent-500), transparent);
    background-size: 50% 100%;
    background-repeat: no-repeat;
    animation: nslogi-nav-bar 1s linear infinite;
}
@keyframes nslogi-nav-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
/* Batch 98 (L5): no sweeping bar for visitors who asked for less motion — a still bar says the same — and MudBlazor's indeterminate
   progress bars slow right down. */
@media (prefers-reduced-motion: reduce) {
    html.nslogi-navigating body::before { animation: none; background: var(--accent-500); opacity: .8; }
    .mud-progress-linear.mud-progress-indeterminate .mud-progress-linear-bar { animation-duration: 6s !important; }
}

/* Issue 288: a header click made before the page is live is remembered (replayed when it starts) — the button says so. */
.nslogi-pending { opacity: .6; cursor: progress; }
/* Issues 274 / 288: the signed-out phone menu — a plain <details> link list that works with or without the live connection. */
.nslogi-phone-menu { position: relative; }
.nslogi-phone-menu > summary { list-style: none; cursor: pointer; }
.nslogi-phone-menu > summary::-webkit-details-marker { display: none; }
.nslogi-phone-menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: calc(var(--mud-zindex-appbar, 1300) + 10);
    min-width: 200px;
    display: flex;
    flex-direction: column;
    padding: 6px 0;
    border-radius: 8px;
    background-color: var(--mud-palette-surface);
}
.nslogi-phone-menu-list > a {
    padding: 10px 16px;
    color: var(--mud-palette-text-primary);
    text-decoration: none;
    font-size: .95rem;
}
.nslogi-phone-menu-list > a:hover, .nslogi-phone-menu-list > a:focus-visible { background-color: var(--mud-palette-action-default-hover, rgba(0, 0, 0, .06)); }

h1:focus {
    outline: none;
}

/* Issue 169: FocusOnNavigate lands on the page heading (tabindex -1) for screen readers; no ring around a heading. */
.mud-main-content :is(h1, h2, h3, h4, h5)[tabindex="-1"]:focus {
    outline: none;
}

/* Blazor's .valid / .invalid classes add no outline (it doubled the input's own border); the message reads in the theme's error colour. */
.validation-message {
    color: var(--mud-palette-error);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--danger);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* Google Places autocomplete dropdown must sit above the MudBlazor dialog (z-index ~1400). */
.pac-container {
    z-index: 13000 !important;
}

/* Red asterisk for MudBlazor required fields. */
.mud-input-required,
.mud-input-label .mud-input-required { color: var(--mud-palette-error) !important; }

/* Multi-line MudBlazor text areas are user-resizable (drag the corner). Batch 98 (M5): no global min-height — each field's Lines= sets
   its height (a 118px floor made the two-line Ask NSLogi box five lines tall on phones). */
.mud-input-control textarea,
textarea.mud-input-slot { resize: vertical !important; }


/* App-bar search sits on the primary (purple) bar — force readable light text/icon/border. */
.appbar-search .mud-input-slot,
.appbar-search input,
.appbar-search .mud-input-adornment .mud-icon-root { color: #fff !important; }
.appbar-search input::placeholder { color: rgba(255, 255, 255, 0.75) !important; opacity: 1; }
.appbar-search .mud-input-outlined-border { border-color: rgba(255, 255, 255, 0.6) !important; }
.appbar-search.mud-input-control:hover .mud-input-outlined-border { border-color: #fff !important; }

/* ---- Responsive helpers (mobile/tablet/desktop) ---- */

/* Global: every MudTable's container scrolls horizontally on overflow (many-column money/fleet tables
   on phones) instead of widening the whole page. MudSimpleTable (portal breakdowns) is 2-col, unaffected. */
.mud-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Page headers (title + action buttons) wrap instead of overflowing on small screens. */
.page-header { flex-wrap: wrap; gap: 8px; }

/* Load board row card (issue 78): a CSS grid, so every column keeps its place at every width instead of
   flex-wrap dropping columns onto a second line at random. 7 tracks = ⋮ menu + 6 columns; below 1400px
   the card is two rows of three (identity / pickup / drop-off, then dispatch / money / counts), below
   900px three rows of two, on phones one column. */
.load-row-grid { display: grid; grid-template-columns: auto minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .7fr); gap: 8px 20px; align-items: start; }
@media (max-width: 1399.95px) {
    .load-row-grid { grid-template-columns: auto minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); }
    .load-row-grid > .lr-dispatch { grid-column: 2; }
}
@media (max-width: 899.95px) {
    .load-row-grid { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); }
    .load-row-grid > .lr-dispatch { grid-column: auto; }
    .load-row-grid > .lr-drop, .load-row-grid > .lr-money { grid-column: 2; }
}
/* Master lists (drivers, units…): on phones, stack each field full-width so two min-width columns can't
   combine to exceed the viewport and force horizontal scroll. */
@media (max-width: 599.95px) {
    .load-row-grid { grid-template-columns: auto minmax(0, 1fr); }
    .load-row-grid > div:not(.lr-menu) { grid-column: 2; }
    .master-row > div { flex-basis: 100% !important; min-width: 0 !important; }
}

/* Load editor: actual check-in/out times read red so they aren't mistaken for the appointment window. */
.actual-time .mud-input-label,
.actual-time .mud-input-label.mud-input-label-inputcontrol { color: var(--mud-palette-error) !important; font-weight: 600; }
.actual-time .mud-input.mud-input-underline:before { border-bottom-color: var(--mud-palette-error) !important; }

/* Documents panel drop zone */
.doc-drop-input { opacity: 0; cursor: pointer; }
.doc-drop-zone { border-style: dashed !important; transition: background-color .15s, border-color .15s; }
.doc-drop-zone-active { background-color: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent); border-color: var(--mud-palette-primary) !important; }

/* Dialogs: the close "X" reads red on every modal so it's unmistakable. */
.mud-dialog .mud-button-close,
.mud-dialog .mud-button-close .mud-icon-root { color: var(--mud-palette-error) !important; }
.mud-dialog .mud-button-close:hover { background-color: color-mix(in srgb, var(--mud-palette-error) 8%, transparent); }

/* ---- Ops dashboard / Revenue by Truck analysis cards (MonthAnalysisCards, Dashboard) ---- */
.dash-h { font-size: 1.15rem; font-weight: 700; margin-bottom: 2px; }
.dash-sub { color: var(--mud-palette-text-secondary); font-size: .85rem; }
.dash-sec { border-left: 4px solid var(--mud-palette-primary); padding-left: 8px; font-weight: 700; font-size: 1rem; margin: 12px 0 6px; }
.dash-sec.muted { border-left-color: var(--mud-palette-text-secondary); color: var(--mud-palette-text-secondary); }
.dash-row { font-size: .95rem; line-height: 1.7; }
.dash-row b { font-weight: 700; }
.dash-hr { border-top: 1px solid var(--mud-palette-lines-default); margin: 8px 0; }
.dash-up { color: var(--mud-palette-success); } .dash-down { color: var(--mud-palette-error); }
.dash-score { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .95rem; margin-top: 8px; }
.dash-score .rev { color: var(--mud-palette-text-secondary); font-size: .85rem; }
.dash-score .pct { color: var(--mud-palette-error); font-weight: 700; }
.dash-score .pct.ok { color: var(--mud-palette-success); }
.dash-score .last { color: var(--mud-palette-text-secondary); font-size: .8rem; }
.dash-bar { height: 6px; border-radius: 3px; background: var(--mud-palette-lines-default); overflow: hidden; margin-top: 3px; }
.dash-bar > div { height: 100%; background: var(--mud-palette-error); }
.dash-bar > div.ok { background: var(--mud-palette-success); }
.dash-days { display: flex; justify-content: space-between; text-align: center; font-size: .8rem; }
.dash-days .col { flex: 1; }
.dash-days .bar { width: 26px; margin: 4px auto 2px; border-radius: 3px; background: var(--mud-palette-primary); }
.dash-days .bar.low { background: var(--mud-palette-text-secondary); }

/* App bar on phones: smaller company name so it isn't clipped, icon-only actions (see MainLayout). Batch 98 (L4): the logo only — not
   every image in the bar. */
@media (max-width: 599.98px) {
    .mud-appbar .appbar-title { font-size: .95rem !important; letter-spacing: 0 !important; }
    .mud-appbar img.appbar-logo { height: 28px !important; max-width: 80px !important; }
}
/* Batch 98 (H4): the signed-out bar never wraps — "Sign in" and "Request access" stay one line each; below 600px "Sign in" moves into
   the phone menu (MainLayout). */
.mud-appbar .appbar-anon-link, .mud-appbar .appbar-cta { white-space: nowrap; flex: 0 0 auto; }
.mud-appbar .appbar-cta.mud-button-root { background-color: var(--accent-500); color: var(--mud-palette-secondary-text); text-transform: none; font-weight: 600; }
.mud-appbar .appbar-cta.mud-button-root:hover { background-color: var(--accent-600); }
@media (max-width: 599.98px) {
    .mud-appbar .appbar-cta.mud-button-root { padding: 4px 10px; }
}
/* Batch 98 (L6): viewport-fit=cover lets the page run under an iPhone's notch / rounded corners in landscape — the bar's content keeps clear. */
.mud-appbar .mud-toolbar-appbar { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
@media (min-width: 600px) {
    .mud-appbar .mud-toolbar-appbar { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
}
/* The sign-in page hides the bar's own "Sign in" link (it is the page). Login.razor marks its card .auth-login (L7: no <style> block). */
body:has(.auth-login) .mud-appbar a[href="Account/Login"] { display: none !important; }

/* Load editor: near full-screen so the document pane and the form both fit. */
.load-editor-backdrop .mud-dialog { width: 96vw !important; max-width: 96vw !important; }
.load-editor-backdrop .mud-dialog-content { max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); }

/* ---- Sign-in and the other Identity pages (statically rendered: plain HTML, no MudBlazor components) ---- */
.auth { display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px 64px; min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px); background: var(--mud-palette-background); }
.auth-card { width: 100%; max-width: 440px; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); border: 1px solid var(--mud-palette-lines-default); border-radius: 14px; padding: 28px 28px 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, .10); }
.auth h1 { font-size: 1.6rem; font-weight: 600; margin: 0 0 14px; text-wrap: balance; }
.auth-field { display: block; margin-bottom: 14px; }
.auth-field > span { display: block; font-size: .875rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.auth-field input { width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; padding: 11px 13px; border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; background: var(--mud-palette-surface); color: inherit; }
.auth-field input:focus { outline: 2px solid var(--mud-palette-primary); outline-offset: 1px; border-color: var(--mud-palette-primary); }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 18px; font-size: .9rem; }
.auth-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.auth-check input { width: 16px; height: 16px; accent-color: var(--mud-palette-primary); }
.auth-btn { width: 100%; font: inherit; font-size: 1rem; font-weight: 600; letter-spacing: .3px; padding: 12px; border: 0; border-radius: 8px; background: var(--mud-palette-primary); color: var(--mud-palette-primary-text, #fff); cursor: pointer; }
.auth-btn:hover { filter: brightness(1.08); }

.auth-errors, .auth-error { color: var(--mud-palette-error); font-size: .85rem; margin: 6px 0 0; padding-left: 0; list-style: none; }
.auth-errors:empty { display: none; }
.auth-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--mud-palette-lines-default); font-size: .85rem; opacity: .85; line-height: 1.5; }
.auth a:not(.btn) { color: var(--mud-palette-primary); }   /* not .btn: a link styled as a button keeps its own text colour */
.auth .alert, .auth .text-danger { color: var(--mud-palette-error); font-size: .9rem; margin-bottom: 10px; }
@media (max-width: 480px) { .auth { padding: 20px 12px 40px; } .auth-card { padding: 22px 18px 18px; } }
/* Batch 98 (H3): the Identity template pages (Forgot / Reset password, Resend confirmation, two-factor, Register…) sit in the same centred
   card for signed-out visitors (MainLayout wraps them in .auth.auth-template); their Bootstrap grid columns take the card's full width and
   .row loses its negative gutters (no sideways scroll at 390 px). */
.auth-template .auth-card { max-width: 520px; }
.auth-template .auth-card h1 { font-size: 1.6rem; }
.auth-template .auth-card h2 { font-size: 1.05rem; font-weight: 500; color: var(--mud-palette-text-secondary); }
.auth-template .auth-card .row { margin-left: 0; margin-right: 0; }
.auth-template .auth-card .row > [class*="col-"] { flex: 0 0 100%; width: 100%; max-width: 100%; padding-left: 0; padding-right: 0; }
.auth-template .auth-card .btn-lg { font-size: 1rem; }

/* Load editor: form beside the document pane on wide screens, stacked on phones (a 360px pane floor pushed the form off-screen) */
.load-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); gap: 12px; align-items: start; }
@media (max-width: 959.95px) { .load-editor-grid { display: block; } }
/* Issue 642: the "you can't edit loads — view-only now" warning stays at the top of the dialog's scroll area wherever the form is scrolled.
   The alert's own tint is translucent, so it sits on a solid surface (the tint as an image over it) — the stops don't show through. */
.mud-alert.load-editor-block-notice { position: sticky; top: 0; z-index: 5; background-color: var(--mud-palette-surface); background-image: linear-gradient(var(--mud-palette-warning-hover), var(--mud-palette-warning-hover)); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }

/* Document pane beside the load form (js/pdfPane.js) */
.pdf-pane { display: flex; flex-direction: column; border: 1px solid var(--mud-palette-lines-default); border-radius: 6px; overflow: hidden; background: var(--gray-700); }
.pdf-pane-bar { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: var(--mud-palette-surface); border-bottom: 1px solid var(--mud-palette-lines-default); font-size: .8rem; color: var(--mud-palette-text-secondary); }
.pdf-pane-status { flex: 1 1 auto; }
.pdf-pane-btn { font: inherit; padding: 2px 10px; border-radius: 12px; border: 1px solid var(--mud-palette-lines-default); background: transparent; color: var(--mud-palette-text-primary); cursor: pointer; text-decoration: none; }
.pdf-pane-btn:hover { background: var(--mud-palette-action-default-hover); }
.pdf-pane-pages { flex: 1 1 auto; overflow: auto; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pdf-pane-page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); max-width: 100%; }
.pdf-pane-img { max-width: 100%; height: auto; background: #fff; }

/* Rate-con import drop zone (js/dropZone.js): highlight while a file is dragged over it */
.ratecon-drop.drop-over .mud-paper { border-color: var(--mud-palette-primary) !important; background: rgba(var(--mud-palette-primary-rgb), .08) !important; }

/* Load Search postings (issue 105): the table scrolls sideways inside its card instead of squeezing every column; dates, miles,
   rates and the action buttons never wrap mid-word. */
.postings-table .mud-table-container { overflow-x: auto; }
.postings-table table { min-width: 1180px; }
.postings-table td, .postings-table th { vertical-align: top; }
.postings-table .mud-button-root { white-space: nowrap; }
.postings-table td.posting-comments { max-width: 280px; white-space: normal; font-size: .8rem; word-break: break-word; }

/* Find Loads lane tabs (issue 110): one tab per open lane search, scrolls sideways on narrow screens */
.lane-tabs { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding: 4px 2px 0; border-bottom: 2px solid var(--mud-palette-lines-default); }
.lane-tab { display: flex; align-items: center; gap: 4px; padding: 6px 4px 6px 12px; min-width: 190px; max-width: 280px; cursor: pointer; border-radius: 8px 8px 0 0;
            background: var(--mud-palette-background-gray); border-bottom: 3px solid transparent; }
.lane-tab:hover { background: var(--mud-palette-action-default-hover); }
.lane-tab.active { background: var(--mud-palette-surface); border-bottom-color: var(--mud-palette-primary); }
.lane-tab-text { min-width: 0; flex: 1; }
.lane-tab-title { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-tab-sub { font-size: .75rem; color: var(--mud-palette-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-tab-add { align-self: center; flex: none; }

/* Blazor's dropped-circuit notice (issue 130; issue 656). One global rule set here — not split between app.css (an old yellow strip) and
   MainLayout's scoped CSS (which needs the scoped bundle and the layout's attribute) — in the reconnect toast's look: the dark card with
   the brand edge, a primary Reload button and a plain close button. Blazor only switches its display on.
   Issue 665: MudBlazor.min.css loads after this file and has its own #blazor-error-ui rules (red bar pinned to the bottom, full width,
   "color: inherit" on the link) — "body" makes ours more specific so they win regardless of order; the toast for a dropped circuit
   (ReconnectModal) has the same fight, handled in its own CSS. */
body #blazor-error-ui {
    display: none; position: fixed; z-index: 3000;
    top: calc(72px + env(safe-area-inset-top, 0px)); bottom: auto; right: auto; left: 50%; transform: translateX(-50%);
    width: max-content; max-width: min(560px, calc(100vw - 32px)); box-sizing: border-box;
    padding: 12px 44px 12px 16px; border-radius: 10px; border-left: 4px solid var(--brand-600, #4F46E5);
    background: var(--gray-900, #111827); color: var(--gray-50); box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif; font-size: .9rem; line-height: 1.45;
}
body #blazor-error-ui b { color: #fff; }
body #blazor-error-ui .reload {
    display: inline-block; margin-left: 10px; padding: 4px 12px; border-radius: 6px;
    background: var(--brand-600, #4F46E5); color: #fff; font-weight: 600; text-decoration: none; white-space: nowrap;
}
body #blazor-error-ui .reload:hover, body #blazor-error-ui .reload:focus-visible { filter: brightness(1.1); }
body #blazor-error-ui .dismiss {
    position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: var(--gray-300); font-size: 1rem; line-height: 28px; text-align: center; cursor: pointer;
}
body #blazor-error-ui .dismiss:hover { background: rgba(255, 255, 255, .1); color: #fff; }
@media (max-width: 600px) { body #blazor-error-ui { top: calc(64px + env(safe-area-inset-top, 0px)); } }
.lane-tab-count { flex: none; min-width: 22px; padding: 0 6px; border-radius: 11px; font-size: .75rem; font-weight: 600; text-align: center; line-height: 22px;
                  background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }

/* Find Loads on a phone (issue 125): cards instead of the wide table */
.postings-cards { display: none; }
@media (max-width: 899.95px) {
    .postings-table { display: none !important; }
    .postings-cards { display: block; }
    .posting-card .mud-chip { margin: 0; }
}

/* issue 145: a posting under the lane's minimum (Flag mode) stays in the list, greyed, under the ones that clear the line */
.postings-table tr.posting-below-min td, .posting-card.posting-below-min { opacity: .55; }
.postings-table tr.posting-below-min:hover td { opacity: .9; }

/* Issue 279 (b): the light / dark toggle holds both icons; html[data-theme] (set by the server, flipped on the click by
   js/nslogiTheme.js) shows the one naming the other mode, so the icon changes with the colours, not after the server's re-render. */
html[data-theme="dark"] .nslogi-theme-icon-moon,
html:not([data-theme="dark"]) .nslogi-theme-icon-sun { display: none; }
/* While the palette flips, MudBlazor's colour transitions (buttons 250 ms, chips 300 ms, the bell's badge animates every property
   for 300 ms) painted in-between frames — a lighter Accept green, a blank badge. js/nslogiTheme.js removes the class right after. */
html.nslogi-theme-switching *, html.nslogi-theme-switching *::before, html.nslogi-theme-switching *::after { transition: none !important; }

/* Issue 327: the driver-tools bar (PortalTools) keeps two rows' height on phones, where its buttons wrap — a button that changes
   state after the phone answers (push / GPS / install) can't push the page down under the driver's finger. */
/* Run 37: at every width — My Pay is a phone-narrow column on desktop too, and "Install app" can appear ~3 s late. */
.portal-tools { min-height: 84px; align-content: flex-start; }

/* Issue 638(b): the Ask NSLogi drawer never wider than the screen (440 px wide on a 400 px phone sat 40 px off the left edge), and its
   answers rendered from markdown (AnswerMarkdown) with tight paragraph / list spacing inside the bubble. */
.ask-drawer.mud-drawer { max-width: 100vw; }
.ask-answer { white-space: normal; overflow-wrap: anywhere; }
.ask-answer p { margin: 0 0 6px; }
.ask-answer p:last-child, .ask-answer ul:last-child, .ask-answer ol:last-child { margin-bottom: 0; }
.ask-answer ul, .ask-answer ol { margin: 0 0 6px; padding-left: 20px; }
.ask-answer li { margin: 2px 0; }
.ask-answer code { font-size: .85em; padding: 0 3px; border-radius: 3px; background: var(--mud-palette-action-default-hover); }

/* Issue 685 (B): the user guide rendered in the app (Help pages and the "?" drawer) — GuideMarkdown output */
.guide-body h2 { font-size: 1.3rem; font-weight: 600; margin: 20px 0 8px; }
.guide-body h3 { font-size: 1.1rem; font-weight: 600; margin: 16px 0 6px; }
.guide-body h4, .guide-body h5 { font-size: 1rem; font-weight: 600; margin: 12px 0 4px; }
.guide-body p { margin: 0 0 10px; line-height: 1.55; }
.guide-body ul, .guide-body ol { margin: 0 0 10px; padding-left: 22px; }
.guide-body li { margin: 3px 0; }
.guide-body img.guide-img { display: block; max-width: 100%; height: auto; margin: 8px 0 12px; border: 1px solid var(--mud-palette-lines-default); border-radius: 6px; }
.guide-body code { font-size: .85em; padding: 0 3px; border-radius: 3px; background: var(--mud-palette-action-default-hover); }
.guide-body pre { overflow-x: auto; padding: 8px 10px; border-radius: 6px; background: var(--mud-palette-background-gray); }
.guide-body blockquote.guide-note { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--mud-palette-primary); background: var(--mud-palette-background-gray); }
.guide-body .guide-table { overflow-x: auto; margin: 0 0 12px; }
.guide-body table { border-collapse: collapse; width: 100%; }
.guide-body th, .guide-body td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--mud-palette-lines-default); vertical-align: top; }

/* Issue 863: a plain fieldset — groups inputs only to disable them together (no border, no padding, no browser legend chrome). */
fieldset.nslogi-plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
