/* Fleet UI rules: docs/ui-design-rules.md. Loaded last to own the shared design
   tokens and presentation while legacy module-specific behavior is retained. */
:root {
    --ui-bg: #eef3f7;
    --ui-surface: #fff;
    --ui-soft: #f6f8fb;
    --ui-border: #dce4ec;
    --ui-text: #20252a;
    --ui-muted: #667085;
    --ui-accent: #bd2433;
    --ui-accent-hover: #a31d2b;
    --ui-tint: #fbeef0;
    --ui-rail: #202a36;
    --ui-rail-text: #e9eef5;
    --ui-rail-muted: #a8b6c8;
    --ui-radius: 8px;
    --ui-shadow: 0 2px 8px rgb(25 39 55 / 4%);
    --fleet-red: var(--ui-accent);
    --fleet-red-dark: var(--ui-accent-hover);
    --fleet-border: var(--ui-border);
    --fleet-surface: var(--ui-surface);
    --fleet-muted: var(--ui-soft);
    --fleet-text: var(--ui-text);
    --fleet-soft-text: var(--ui-muted);
    --bs-primary: var(--ui-accent);
    --bs-primary-rgb: 189, 36, 51;
    --mud-palette-primary: var(--ui-accent);
}

html.dark-mode, html[data-bs-theme="dark"] {
    --ui-bg: #171d24;
    --ui-surface: #222b35;
    --ui-soft: #29333f;
    --ui-border: #3e4b5b;
    --ui-text: #edf2f7;
    --ui-muted: #b0bdcd;
    --ui-accent: #f28d98;
    --ui-accent-hover: #ffa6af;
    --ui-tint: #432e37;
    --ui-rail: #131b24;
    --ui-shadow: none;
    --bs-primary-rgb: 242, 141, 152;
    --fleet-red: var(--ui-accent);
    --fleet-border: var(--ui-border);
    --fleet-surface: var(--ui-surface);
    --fleet-text: var(--ui-text);
    --fleet-soft-text: var(--ui-muted);
}

html, body { font-family: "Segoe UI", Inter, Arial, sans-serif; font-size: 14px; line-height: 1.5; background: var(--ui-bg); color: var(--ui-text); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, textarea, summary):focus-visible { outline: 3px solid var(--ui-accent); outline-offset: 3px; }
:where(button, input, select, textarea):disabled { cursor: not-allowed; }
.skip-to-content { position: fixed; top: -80px; left: 16px; z-index: 10000; padding: 12px 20px; color: var(--ui-text); background: var(--ui-surface); border: 2px solid var(--ui-accent); border-radius: 6px; }
.skip-to-content:focus { top: 8px; }
.fleet-shell { --workspace-pad: 20px; --workspace-gap: 16px; --grid-action-width: 220px; background: var(--ui-bg); color: var(--ui-text); }
.fleet-shell .top-toolbar { background: var(--ui-surface); color: var(--ui-text); border-bottom: 1px solid var(--ui-border); box-shadow: none; }
.fleet-shell .toolbar-brand { padding: 0 10px; border: 0; background: transparent; box-shadow: none; }
.fleet-shell .toolbar-brand-text, .fleet-shell .toolbar-brand-text b { color: var(--ui-text); font-size: 19px; }
.fleet-shell .toolbar-brand-text .navbar-brand-suffix { color: var(--ui-muted); font-weight: 400; }
.fleet-shell .toolbar-logo { width: 24px; height: 24px; background: var(--ui-accent); box-shadow: none; border-radius: 6px; transform: none; }
.fleet-shell .toolbar-module-title { color: var(--ui-muted); font-size: 14px; font-weight: 500; }
.fleet-shell .global-search { background: var(--ui-soft); border: 1px solid var(--ui-border); box-shadow: none; max-width: 380px; }
.fleet-shell .global-search input { color: var(--ui-text); font-size: 14px; }
.fleet-shell .toolbar-menu-button, .fleet-shell .toolbar-icon, .fleet-shell .toolbar-actions .mud-icon-button { color: var(--ui-muted) !important; background: transparent !important; box-shadow: none; border-color: transparent; }
.fleet-shell .toolbar-menu-button:hover, .fleet-shell .toolbar-icon:hover, .fleet-shell .toolbar-actions .mud-icon-button:hover { background: var(--ui-soft) !important; color: var(--ui-text) !important; }
.fleet-shell .toolbar-menu-mobile { display: none; }

/* Navigation uses stable groups and a compact profile instead of decorative chrome. */
.fleet-shell .left-rail { background: var(--ui-rail) !important; color: var(--ui-rail-text); border: 0; box-shadow: none; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #526175 transparent; }
.fleet-shell .rail-profile, .fleet-shell:not(.rail-pinned) .rail-profile { display: block; min-height: 0; margin: 4px 0 12px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.fleet-shell .rail-profile-link { min-height: 72px !important; padding: 12px 8px !important; border: 0 !important; border-radius: 6px; background: rgb(255 255 255 / 4%) !important; }
.fleet-shell .rail-profile-cover { display: none; }
.fleet-shell .rail-avatar { background: #43556c !important; box-shadow: none !important; }
.fleet-shell .rail-profile-info strong { color: var(--ui-rail-text); font-size: 13px; font-weight: 600; }
.fleet-shell .rail-profile-info small, .fleet-shell .rail-profile-caret { color: var(--ui-rail-muted); font-size: 12px; }
.fleet-shell .rail-menu { gap: 3px; }
.fleet-shell .rail-menu-header { display: block; margin: 18px 10px 7px; padding: 0; color: var(--ui-rail-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.fleet-shell .rail-link { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 42px; height: auto; margin: 0; padding: 9px 12px; font-size: 14px; font-weight: 400; color: var(--ui-rail-text); border: 0; border-radius: 6px; background: transparent; box-shadow: none; }
.fleet-shell .rail-link .mud-icon-root:first-child { color: var(--ui-rail-muted); background: transparent; font-size: 20px; }
.fleet-shell .rail-link:hover, .fleet-shell .rail-link:focus-visible { color: #fff; background: #303d4e; }
.fleet-shell .rail-link.active { color: #fff; font-weight: 600; background: #394354; box-shadow: inset 3px 0 0 #ee8993; }
.fleet-shell .rail-link.active .mud-icon-root:first-child { color: #f5a3ad; background: transparent; }
.fleet-shell .rail-profile-action { min-height: 40px; color: var(--ui-rail-text); background: transparent; border: 0; font-size: 13px; }
.fleet-shell .rail-profile-action:hover { color: #fff; background: #303d4e; }

/* One page heading and a dedicated, optional filter column. */
.fleet-shell .module-workspace-host.has-page-header { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: var(--ui-bg); }
.module-page-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 20px; min-width: 0; padding: 22px 24px 18px; }
.module-page-header h1 { margin: 0; color: var(--ui-text); font-size: 26px; line-height: 1.25; font-weight: 650; letter-spacing: -.5px; }
.module-page-header p { margin: 5px 0 0; color: var(--ui-muted); font-size: 14px; }
.workspace-panel-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; min-height: 40px; padding: 8px 12px; border: 1px solid var(--ui-border); border-radius: 6px; color: var(--ui-text); background: var(--ui-surface); cursor: pointer; font-weight: 500; }
.workspace-panel-toggle[aria-expanded="true"] { color: var(--ui-accent); background: var(--ui-tint); border-color: var(--ui-accent); }
.fleet-shell .has-page-header > .module-layout, .fleet-shell .has-page-header > .automatic-reports-shell { flex: 1 1 auto; min-height: 0; height: auto; }
.fleet-shell .workspace:not(.map-workspace) { background: var(--ui-bg); padding: var(--workspace-pad); gap: var(--workspace-gap); }
.fleet-shell .module-panel { background: var(--ui-surface); color: var(--ui-text); border-color: var(--ui-border); box-shadow: none; padding: 16px; }
.fleet-shell .module-panel::before { display: none; }
.fleet-shell .module-panel .panel-header { min-height: 42px; margin: 0 0 12px; padding: 0 0 12px; background: transparent; color: var(--ui-text); border-bottom: 1px solid var(--ui-border); box-shadow: none; }
.fleet-shell .panel-header h2 { color: var(--ui-text); font-size: 17px; font-weight: 600; }
.fleet-shell .panel-section-title, .fleet-shell .settings-nav-heading { margin: 20px 0 8px; color: var(--ui-muted); font-size: 12px; font-weight: 650; line-height: 1.5; letter-spacing: .02em; background: transparent; }
.fleet-shell .filter-bar { gap: 8px; padding: 0 0 14px; border-bottom: 1px solid var(--ui-border); background: transparent; }
.fleet-shell .filter-chip { color: var(--ui-muted); border: 0; border-radius: 4px; background: var(--ui-soft); font-size: 12px; font-weight: 400; }
.fleet-shell .panel-command, .fleet-shell .segmented-panel button, .fleet-shell .panel-list button { min-height: 40px; height: auto; padding: 9px 12px; border-radius: 6px; font-size: 14px; line-height: 1.4; box-shadow: none; }
.fleet-shell .panel-command { margin-block: 4px; color: var(--ui-text); border: 1px solid var(--ui-border); background: var(--ui-surface); }
.fleet-shell .panel-command.primary, .toolbar-add-button, .fleet-shell .automatic-create-button { color: #fff; background: #bd2433; border-color: #bd2433; }
.fleet-shell .panel-command.danger { color: #fff; background: #b42332; border-color: #b42332; }
.fleet-shell .panel-list button, .fleet-shell .settings-nav-item { color: var(--ui-text); background: transparent; border-color: transparent; box-shadow: none; }
.fleet-shell .panel-list button small, .fleet-shell .settings-nav-item small { font-size: 12px; color: var(--ui-muted); line-height: 1.5; }
.fleet-shell .panel-list button.selected, .fleet-shell .settings-nav-item.active, .fleet-shell .segmented-panel button.active, .fleet-shell .segmented-panel button.selected { color: var(--ui-accent); background: var(--ui-tint); border-color: transparent; box-shadow: inset 3px 0 0 var(--ui-accent); }
.fleet-shell .panel-list button:hover, .fleet-shell .settings-nav-item:hover { background: var(--ui-soft); }
.fleet-shell .segmented-panel { gap: 4px; padding: 4px; background: var(--ui-soft); border: 1px solid var(--ui-border); border-radius: 8px; }
.fleet-shell .segmented-panel button { color: var(--ui-muted); background: transparent; border: 0; }
.fleet-shell .segmented-panel button.active, .fleet-shell .segmented-panel button.selected { color: var(--ui-accent); box-shadow: var(--ui-shadow); background: var(--ui-surface); }
.fleet-shell .dialog-field { gap: 6px; color: var(--ui-text); font-size: 13px; line-height: 1.5; }
.fleet-shell .dialog-field input:not([type="checkbox"]):not([type="radio"]), .fleet-shell .dialog-field select, .fleet-shell .dialog-field textarea { min-width: 0; max-width: 100%; min-height: 40px; padding: 8px 10px; color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 6px; font-size: 14px; }
.fleet-shell .module-panel .mud-input-control input { font-size: 14px !important; }
.fleet-shell .entity-dialog-preview { background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 8px; box-shadow: var(--ui-shadow); }
.fleet-shell .dialog-title { padding: 12px 16px; background: var(--ui-soft); color: var(--ui-text); border-bottom: 1px solid var(--ui-border); }
.fleet-shell .dialog-title h3 { font-size: 17px; color: inherit; }
.fleet-shell .dialog-content { gap: 16px; padding: 16px; }

/* Search and the primary action stay visible. Export/view options are disclosed. */
.fleet-shell .export-toolbar { position: relative; display: flex; flex-wrap: wrap; gap: 10px; min-height: 62px; height: auto; padding: 10px 12px; border: 1px solid var(--ui-border); border-radius: 8px; background: var(--ui-surface); box-shadow: none; overflow: visible; }
.fleet-shell .export-toolbar-actions { display: flex; flex: 0 0 auto; gap: 4px; }
.fleet-shell .export-toolbar > .export-toolbar-actions { order: 1; }
.fleet-shell .export-toolbar > .export-toolbar-search { flex: 1 1 220px; min-width: 160px; max-width: none; order: 0; margin: 0; }
.fleet-shell .export-toolbar .mud-icon-button { width: 40px !important; min-width: 40px !important; min-height: 40px !important; height: 40px !important; color: var(--ui-muted) !important; background: transparent !important; }
.fleet-shell .export-toolbar .mud-icon-button:hover { color: var(--ui-accent) !important; background: var(--ui-tint) !important; }
.fleet-shell .export-toolbar .mud-input-control input { font-size: 14px !important; }
.toolbar-add-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border: 1px solid #bd2433; border-radius: 6px; cursor: pointer; font-weight: 600; }
.toolbar-add-button:disabled { opacity: .5; }
.toolbar-add-button:hover:not(:disabled) { background: #a31d2b; }
.export-more { order: 2; align-self: center; }
.export-more summary { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 10px; color: var(--ui-muted); border: 1px solid var(--ui-border); border-radius: 6px; cursor: pointer; font-size: 13px; list-style: none; }
.export-more summary::-webkit-details-marker { display: none; }
.export-more[open] summary { color: var(--ui-accent); background: var(--ui-tint); }
.export-more-content { position: absolute; top: calc(100% + 6px); right: 0; z-index: 25; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; width: min(420px, 100%); padding: 16px; border: 1px solid var(--ui-border); border-radius: 8px; color: var(--ui-text); background: var(--ui-surface); box-shadow: 0 8px 24px rgb(20 30 45 / 12%); }
.fleet-shell .export-more-content select { flex: 1 1 160px; min-width: 0; max-width: 100%; min-height: 40px; color: var(--ui-text); background: var(--ui-soft); border: 1px solid var(--ui-border); border-radius: 6px; }
.fleet-shell .dashboard-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 0; background: transparent; border: 0; }
.fleet-shell .dashboard-toolbar > .export-toolbar { flex: 1 1 560px; }
.fleet-shell .dashboard-period-label { color: var(--ui-muted); font-size: 13px; }
.fleet-shell .automatic-reports-toolbar { flex-wrap: wrap; gap: 12px; background: transparent; border: 0; padding: 0; }
.fleet-shell .automatic-reports-toolbar > .export-toolbar { flex: 1 1 580px; }

/* Shared data presentation: surfaces carry structure; color carries meaning. */
.fleet-shell .dashboard-kpis { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.fleet-shell .dashboard-kpis > span { flex: 1 1 140px; min-width: 0; padding: 14px 16px; color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 8px; font-size: 14px; line-height: 1.5; box-shadow: none; overflow-wrap: anywhere; }
.fleet-shell .report-summary-strip:not(.map-overlay-panel) { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 16px; color: var(--ui-muted); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 8px; box-shadow: none; font-size: 13px; }
.fleet-shell .report-summary-strip:not(.map-overlay-panel) > span { color: inherit; background: transparent; border: 0; box-shadow: none; padding: 0; min-height: 0; font-size: inherit; }
.fleet-shell .score-strip { gap: 12px; padding: 0; background: transparent; }
.fleet-shell .score-strip article { padding: 16px; color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 8px; box-shadow: none; }
.fleet-shell .score-strip article span { color: var(--ui-muted); font-size: 13px; }
.fleet-shell .score-strip article strong { color: var(--ui-text); font-size: 24px; }
.fleet-shell .widget-grid { gap: 16px; }
.fleet-shell .widget-tile { color: var(--ui-text); background: var(--ui-surface); background-image: none; border: 1px solid var(--ui-border); border-radius: 8px; padding: 20px; box-shadow: var(--ui-shadow); }
.fleet-shell .widget-tile.selected { border-color: var(--ui-accent); box-shadow: inset 3px 0 0 var(--ui-accent); }
.fleet-shell .widget-tile > span { color: var(--ui-muted); font-size: 14px; }
.fleet-shell .widget-tile > strong { color: var(--ui-text); font-size: 30px; line-height: 1.25; }
.fleet-shell .widget-tile > small { color: var(--ui-muted); font-size: 12px; }
.fleet-shell .widget-actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--ui-border); padding-top: 12px; }
.fleet-shell .grid-link { min-height: 32px; padding: 5px 8px; color: var(--ui-accent); border-radius: 4px; font-size: 13px; line-height: 1.4; }
.fleet-shell .grid-link.danger { color: #b42332; }
.fleet-shell .status-badge.status-driving { color: #18704f; }
.fleet-shell .status-badge.status-stopped { color: #90600a; }
.fleet-shell .status-badge.status-unavailable { color: #b42332; }
html.dark-mode .fleet-shell .status-badge.status-driving { color: #83d5b3; }
html.dark-mode .fleet-shell .status-badge.status-stopped { color: #efc674; }
html.dark-mode .fleet-shell .status-badge.status-unavailable { color: #f4a0aa; }
.fleet-shell .dense-grid th[aria-sort="none"] .dense-grid-heading .dense-grid-filter-icon { display: none; }
.fleet-shell .dense-grid th[aria-sort="none"] .dense-grid-heading { grid-template-columns: minmax(0, 1fr); }
.fleet-shell .dense-grid .dense-grid-heading > span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; word-break: normal; }
.fleet-shell .offline-banner { padding: 14px 16px; color: var(--ui-text); background: var(--ui-soft); border: 1px solid var(--ui-border); border-left: 3px solid #b88013; border-radius: 6px; line-height: 1.5; }
.fleet-shell .loading-screen { color: var(--ui-muted); font-size: 14px; line-height: 1.5; }
.fleet-shell .view-settings-panel, .fleet-shell .quick-action-menu { color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 8px; box-shadow: 0 8px 24px rgb(20 30 45 / 12%); }
.fleet-shell .quick-action-menu button, .fleet-shell .view-settings-actions button { min-height: 40px; color: var(--ui-text); background: var(--ui-surface); font-size: 14px; }

/* Map remains a full-height workspace. */
.fleet-shell .map-module-layout .module-panel { padding: 12px; background: var(--ui-surface); }
.fleet-shell .map-module-layout .panel-header-actions .mud-icon-button { width: 40px; height: 40px; min-height: 40px; color: var(--ui-muted); }
.fleet-shell .map-module-layout .panel-header .mud-icon-root { color: var(--ui-muted); }
.fleet-shell .map-module-layout .vehicle-row { background: var(--ui-surface); border-color: var(--ui-border); border-radius: 6px; box-shadow: none; padding: 12px; }
.fleet-shell .map-module-layout .vehicle-row.selected { background: var(--ui-tint); box-shadow: inset 3px 0 0 var(--ui-accent); }
.fleet-shell .map-module-layout .vehicle-row-body strong { color: var(--ui-text); font-size: 14px; }
.fleet-shell .map-module-layout .vehicle-row-body small { color: var(--ui-muted); font-size: 12px; }
.fleet-shell .map-module-layout .vehicle-row-body > strong,
.fleet-shell .map-module-layout .vehicle-row-body > span,
.fleet-shell .map-module-layout .vehicle-row-body > small { text-align: left; }
.fleet-shell .map-module-layout .vehicle-row { grid-template-columns: 28px minmax(0, 1fr); align-items: start; }
.map-panel-options { flex: 0 0 auto; min-width: 0; margin: 8px 0; border: 1px solid var(--ui-border); border-radius: 6px; background: var(--ui-surface); }
.map-panel-options > summary { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; color: var(--ui-muted); font-size: 13px; cursor: pointer; list-style: none; }
.map-panel-options > summary::after { content: "+"; margin-left: auto; font-size: 18px; }
.map-panel-options[open] > summary::after { content: "−"; }
.map-panel-options[open] > summary { border-bottom: 1px solid var(--ui-border); }
.map-panel-options > :not(summary) { margin-inline: 8px; }

/* Auth pages share the same type, spacing and surfaces as the application. */
.auth-page { background: var(--ui-bg); color: var(--ui-text); padding: 32px 20px; }
.auth-panel { width: min(460px, 100%); border: 1px solid var(--ui-border); border-radius: 12px; background: var(--ui-surface); box-shadow: 0 12px 36px rgb(25 39 55 / 8%); }
.auth-header { padding: 28px 28px 22px; color: var(--ui-text); background: var(--ui-surface); border-bottom: 1px solid var(--ui-border); }
.auth-header h1 { color: var(--ui-text); font-size: 22px; line-height: 1.3; letter-spacing: -.4px; }
.auth-header p { color: var(--ui-muted); font-size: 14px; line-height: 1.5; margin-top: 8px; }
.auth-logo { background: var(--ui-accent); box-shadow: none; }
.auth-body { padding: 28px; }
.auth-form { gap: 20px; }
.auth-field { color: var(--ui-text); font-size: 14px; gap: 8px; }
.auth-field > span:first-child { font-size: 14px; font-weight: 500; }
.auth-field input { min-height: 46px; padding: 10px 12px; color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 6px; font-size: 16px; }
.auth-button { min-height: 46px; background: #bd2433; color: #fff; border-radius: 6px; box-shadow: none; font-size: 15px; }
.auth-link { color: var(--ui-accent); }
.auth-note { color: var(--ui-muted); font-size: 13px; }
.auth-inline-row { display: flex; flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.auth-inline-row .auth-check { flex: 0 0 auto; min-width: 0; }
.state-return-link { display: flex; align-items: center; justify-content: center; text-decoration: none; padding: 10px 16px; }
.auth-note code { overflow-wrap: anywhere; }
.fleet-shell .access-denied { align-self: center; justify-self: center; max-width: 560px; margin: 24px; padding: 32px; background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 8px; line-height: 1.6; }

@media (min-width: 761px) {
    .fleet-shell { --toolbar-height: 60px; --rail-width: 232px; --rail-expanded-width: 232px; --module-panel-width: 288px; grid-template-rows: 60px minmax(0, 1fr); }
    .fleet-shell .top-toolbar { height: 60px; min-height: 60px; padding: 0 20px 0 10px; grid-template-columns: minmax(300px, auto) minmax(160px, 1fr) auto; }
    .fleet-shell .fleet-main, .fleet-shell.rail-pinned .fleet-main { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
    .fleet-shell .left-rail, .fleet-shell.rail-pinned .left-rail, .fleet-shell:not(.rail-pinned) .left-rail { width: 232px; min-width: 232px; padding: 12px; position: relative; top: auto; bottom: auto; transform: none; }
    .fleet-shell:not(.rail-pinned) .fleet-main { grid-template-columns: 64px minmax(0, 1fr); }
    .fleet-shell:not(.rail-pinned) .left-rail { width: 64px; min-width: 64px; padding: 12px 7px; overflow-x: hidden; }
    .fleet-shell:not(.rail-pinned) .rail-profile { display: none !important; }
    .fleet-shell:not(.rail-pinned) .rail-menu-header { height: 1px; margin: 12px 3px 8px; font-size: 0; background: #3b485a; }
    .fleet-shell:not(.rail-pinned) .rail-link { display: flex; align-items: center; justify-content: center; padding: 10px; min-height: 44px; }
    .fleet-shell:not(.rail-pinned) .rail-link span { display: none !important; }
    .fleet-shell .has-page-header > .module-layout { padding: 0 24px 24px; gap: 20px; grid-template-columns: 288px minmax(0, 1fr); }
    .fleet-shell .has-page-header > .module-layout > .workspace { padding: 0; }
    .fleet-shell .has-page-header > .module-layout > .module-panel { border: 1px solid var(--ui-border); border-radius: 8px; }
    .fleet-shell .has-page-header.desktop-panel-closed > .module-layout:not(:has(.module-panel .entity-dialog-preview)) { grid-template-columns: minmax(0, 1fr); }
    .fleet-shell .has-page-header.desktop-panel-closed > .module-layout > .module-panel:not(:has(.entity-dialog-preview)) { display: none; }
    .fleet-shell .has-page-header > .automatic-reports-shell { padding: 0 24px 24px; }
    .fleet-shell .automatic-reports-shell > .workspace { padding: 0; }
    .fleet-shell.view-wide-panel .has-page-header.desktop-panel-open > .module-layout { grid-template-columns: 336px minmax(0, 1fr); }
    .fleet-shell .map-module-layout .vehicle-status-strip, .fleet-shell .map-module-layout .filter-chip { display: none; }
    .fleet-shell .map-module-layout .vehicle-status-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--ui-soft); border-radius: 6px; }
    .fleet-shell .map-module-layout .vehicle-status-filters .segmented-panel { display: contents; }
    .fleet-shell .map-module-layout .vehicle-status-filters button { min-width: 0; padding-inline: 4px; font-size: 13px; }
    .fleet-shell .map-module-layout .module-panel > .panel-command { position: static; }
    .fleet-shell .map-module-layout .vehicle-row:not(.selected) .vehicle-telemetry-grid,
    .fleet-shell .map-module-layout .vehicle-row:not(.selected) .vehicle-actions,
    .fleet-shell .map-module-layout .vehicle-row:not(.selected) .vehicle-device-id { display: none; }
    .fleet-shell .map-module-layout .vehicle-list { flex: 1 1 auto; min-height: 180px; overflow-y: auto; }
}

@media (min-width: 761px) and (max-width: 1150px) {
    .fleet-shell { --rail-width: 204px; --rail-expanded-width: 204px; }
    .fleet-shell .fleet-main, .fleet-shell.rail-pinned .fleet-main { grid-template-columns: 204px minmax(0, 1fr); }
    .fleet-shell .left-rail, .fleet-shell.rail-pinned .left-rail { width: 204px; min-width: 204px; padding: 10px 8px; }
    .fleet-shell .rail-link { font-size: 13px; padding-inline: 8px; }
    .fleet-shell .toolbar-search { justify-content: flex-end; }
    .fleet-shell .global-search { display: none; }
    .module-page-header { padding: 18px 16px 16px; }
    .module-page-header h1 { font-size: 23px; }
    .module-page-header p { max-width: 440px; }
    .fleet-shell .has-page-header > .module-layout { gap: 14px; padding: 0 16px 16px; grid-template-columns: 260px minmax(0, 1fr); }
    .fleet-shell .has-page-header > .automatic-reports-shell { padding: 0 16px 16px; }
}

/* A tablet shows one working pane at a time, leaving room for the data. */
@media (min-width: 761px) and (max-width: 1100px) {
    .fleet-shell .workspace-panel-toggle { display: none; }
    .fleet-shell .mobile-workspace-tabs { display: flex; flex: 0 0 52px; gap: 4px; margin: 0 16px 12px; padding: 4px; background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 8px; }
    .fleet-shell .mobile-workspace-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1 1 0; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 6px; color: var(--ui-muted); background: transparent; cursor: pointer; font-size: 14px; }
    .fleet-shell .mobile-workspace-tabs button.active { color: var(--ui-accent); background: var(--ui-tint); font-weight: 600; }
    .fleet-shell .has-page-header > .module-layout { display: block; position: relative; margin: 0 16px 16px; padding: 0; }
    .fleet-shell .has-page-header > .module-layout > .module-panel,
    .fleet-shell .has-page-header > .module-layout > .workspace { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; margin: 0; overflow: auto; }
    .fleet-shell .has-page-header > .module-layout > .module-panel { padding: 16px; }
    .fleet-shell .has-page-header.mobile-results > .module-layout > .module-panel:not(:has(.entity-dialog-preview)) { display: none; }
    .fleet-shell .has-page-header.mobile-functions > .module-layout > .module-panel { display: flex !important; flex-direction: column; }
    .fleet-shell .has-page-header.mobile-functions > .module-layout > .workspace { visibility: hidden; pointer-events: none; }
    .fleet-shell .has-page-header > .module-layout > .module-panel:has(.entity-dialog-preview) { display: flex !important; flex-direction: column; z-index: 30; }
}

@media (max-width: 760px) {
    :root, html.dark-mode {
        --mobile-accent: var(--ui-accent);
        --mobile-surface: var(--ui-surface);
        --mobile-background: var(--ui-bg);
        --mobile-text: var(--ui-text);
        --mobile-muted: var(--ui-muted);
        --mobile-line: var(--ui-border);
        --mobile-tint: var(--ui-tint);
    }
    .fleet-shell { --workspace-pad: 12px; --workspace-gap: 12px; }
    .fleet-shell .toolbar-menu-desktop { display: none !important; }
    .fleet-shell .toolbar-menu-mobile { display: inline-flex; }
    .fleet-shell .map-module-layout[data-mobile-map-view="vehicles"] .map-panel-options { display: none !important; }
    .fleet-shell .map-panel-options > summary { min-height: 44px; }
    .module-page-header { display: none; }
    .fleet-shell .left-rail .rail-profile-info strong, .fleet-shell .left-rail .rail-link { color: var(--ui-rail-text) !important; }
    .fleet-shell .left-rail .rail-menu-header, .fleet-shell .left-rail .rail-profile-info small { color: var(--ui-rail-muted) !important; }
    .fleet-shell .left-rail .rail-link { min-height: 44px; font-size: 14px !important; }
    .fleet-shell .left-rail .rail-link.active { background: #394354 !important; color: #fff !important; }
    .fleet-shell .mobile-workspace-tabs, .fleet-shell .map-mobile-tabs { padding: 4px 12px; }
    .fleet-shell .mobile-workspace-tabs button, .fleet-shell .map-mobile-tabs button { font-size: 14px; }
    .fleet-shell .module-layout > .workspace { padding: 12px !important; }
    .fleet-shell .export-toolbar { padding: 10px !important; gap: 8px !important; border-radius: 8px; }
    .fleet-shell .export-toolbar > .export-toolbar-actions { order: 1; flex: 1 1 auto; }
    .fleet-shell .export-toolbar > .export-toolbar-search { order: 0; flex: 1 0 100% !important; }
    .fleet-shell .export-more { order: 2; }
    .fleet-shell .export-more summary, .fleet-shell .toolbar-add-button { min-height: 44px; font-size: 14px; }
    .fleet-shell .export-toolbar .mud-icon-button { min-width: 44px !important; width: 44px !important; min-height: 44px !important; height: 44px !important; }
    .fleet-shell .dashboard-kpis { padding: 0 !important; gap: 8px !important; }
    .fleet-shell .dashboard-kpis > span { padding: 12px !important; border: 1px solid var(--ui-border) !important; font-size: 14px; }
    .fleet-shell .dashboard-toolbar { gap: 10px; }
    .fleet-shell .dashboard-toolbar > .export-toolbar { flex-basis: 100%; }
    .fleet-shell .widget-tile { padding: 16px; }
    .fleet-shell .widget-tile > strong { font-size: 27px; }
    .fleet-shell .grid-link { min-height: 44px; padding: 10px; font-size: 14px; }
    .fleet-shell .workspace .dense-grid-wrap.mobile-table { flex: 0 0 auto; height: auto !important; min-height: 520px !important; max-height: none !important; }
    .fleet-shell .dense-grid-wrap.mobile-table .dense-grid-scroll { flex: 0 0 auto; height: auto !important; min-height: 280px; max-height: 480px; overflow: auto; }
    .fleet-shell .module-panel .panel-command, .fleet-shell .segmented-panel button { min-height: 44px !important; }
    .fleet-shell .dialog-field input:not([type="checkbox"]):not([type="radio"]), .fleet-shell .dialog-field select, .fleet-shell .dialog-field textarea { min-height: 44px; }
    .auth-with-mobile-hero { align-items: stretch !important; background: var(--ui-bg) !important; }
    .auth-with-mobile-hero .auth-mobile-hero { width: 100%; min-height: 170px; height: 24dvh; background: var(--ui-bg); }
    .auth-mobile-hero .auth-logo { color: #fff; background: #bd2433; box-shadow: none; }
    .auth-panel { border-color: var(--ui-border); }
    .auth-with-mobile-hero .auth-panel { background: var(--ui-surface) !important; border-radius: 16px 16px 0 0 !important; }
    .auth-with-mobile-hero .auth-button { background: #bd2433 !important; border-color: #bd2433 !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
