@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

:root {
    --bg: #edf3f5;
    --panel: #ffffff;
    --ink: #152128;
    --muted: #66757f;
    --line: #dbe4e8;
    --line-soft: #e8eef1;
    --nav: #0e1c24;
    --nav-active: #1a3440;
    --green: #1f9d63;
    --amber: #c77910;
    --red: #c2413b;
    --blue: #276fbf;
    --teal: #11a979;
    --shadow: 0 16px 42px rgba(18, 33, 42, 0.08);
}

html,
body {
    height: 100%;
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

a {
    color: inherit;
}

h1:focus {
    outline: none;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    height: 100vh;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    transition: grid-template-columns 160ms ease;
    max-width: 100vw;
    overflow: hidden;
}

.app-shell.sidebar-compact {
    grid-template-columns: 82px minmax(0, 1fr);
}

.routeixa-click-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    height: 3px;
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(90deg, var(--blue), var(--teal), var(--green));
    transform: translateY(-6px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.routeixa-click-loader::before {
    content: "";
    position: absolute;
    inset: 0;
    width: 34%;
    background: rgba(255, 255, 255, 0.72);
    animation: routeixa-progress 850ms ease-in-out infinite;
}

.routeixa-click-loader span {
    position: fixed;
    top: 92px;
    right: 26px;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(39, 111, 191, 0.18);
    border-top-color: var(--blue);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 34px rgba(18, 33, 42, 0.16);
    animation: routeixa-spin 720ms linear infinite;
}

.routeixa-click-loader strong {
    position: fixed;
    top: 96px;
    right: 68px;
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 14px 34px rgba(18, 33, 42, 0.12);
    font-size: 12px;
    font-weight: 900;
}

.routeixa-click-loader.visible {
    opacity: 1;
    transform: translateY(0);
}

.routeixa-click-working {
    position: relative;
    opacity: 0.82;
}

.routeixa-click-locked {
    pointer-events: none;
    filter: saturate(0.92);
}

.routeixa-click-locked,
.routeixa-click-locked * {
    cursor: progress !important;
}

.routeixa-click-working::after {
    content: "";
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    animation: routeixa-spin 650ms linear infinite;
}

.audit-page {
    display: grid;
    gap: 22px;
}

.audit-metrics {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.audit-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
    gap: 18px;
    min-width: 0;
}

.audit-list-panel,
.audit-detail-panel {
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.audit-list-panel {
    display: grid;
    align-content: start;
    max-height: 720px;
    overflow: auto;
}

.audit-list-item {
    position: relative;
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 15px 16px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.audit-list-item:hover,
.audit-list-item.active {
    background: #f4f9fc;
}

.audit-list-item strong,
.audit-list-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audit-list-item strong {
    font-size: 14px;
    font-weight: 900;
}

.audit-list-item small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.audit-detail-panel {
    padding: 20px;
}

.audit-json {
    margin: 18px 0 0;
    max-height: 240px;
    overflow: auto;
    padding: 14px;
    color: #d8f3ff;
    background: #0d2634;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.6;
}

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

@keyframes routeixa-progress {
    0% {
        transform: translateX(-120%);
    }

    100% {
        transform: translateX(320%);
    }
}

.sidebar {
    background: var(--nav);
    color: #f5fafb;
    box-shadow: inset -1px 0 rgba(255, 255, 255, 0.05);
    height: 100vh;
    min-width: 0;
    overflow: hidden;
}

.sidebar-compact .nav-head {
    justify-content: center;
    padding: 16px 10px;
}

.sidebar-compact .brand {
    width: 42px;
}

.sidebar-compact .brand-icon {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
}

.sidebar-compact .brand .nav-label,
.sidebar-compact .nav-section span,
.sidebar-compact .nav-group summary .nav-label,
.sidebar-compact .nav-link .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.sidebar-compact .compact-toggle {
    position: absolute;
    top: 82px;
    left: 50px;
    z-index: 2;
}

.sidebar-compact .nav-scrollable {
    padding: 22px 10px 14px;
}

.sidebar-compact .nav-section {
    height: 1px;
    margin: 14px 10px 8px;
    padding: 0;
    background: rgba(255, 255, 255, 0.14);
}

.sidebar-compact .nav-link {
    justify-content: center;
    padding: 0;
}

.sidebar-compact .nav-group summary {
    justify-content: center;
    padding: 0;
}

.sidebar-compact .nav-submenu {
    padding-left: 0;
}

.sidebar-compact .nav-link:hover {
    transform: none;
}

.main-panel {
    min-width: 0;
    max-width: 100%;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 28px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(10px);
    min-width: 0;
}

.topbar h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0;
}

.topbar-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: min(100%, 1120px);
}

.global-live-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 230px;
    max-width: 340px;
    height: 40px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(18, 33, 42, 0.06);
}

.global-live-chip span:not(.status-dot) {
    display: grid;
    gap: 1px;
    min-width: 0;
    text-align: left;
}

.global-live-chip strong,
.global-live-chip small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-live-chip small {
    color: var(--muted);
    font-size: 12px;
}

.status-dot {
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    background: var(--blue);
    border-radius: 999px;
    box-shadow: 0 0 0 4px rgba(39, 111, 191, 0.12);
}

.status-dot.moving {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(31, 157, 99, 0.14);
}

.status-dot.idle {
    background: var(--blue);
}

.status-dot.stopped {
    background: #6b7785;
    box-shadow: 0 0 0 4px rgba(107, 119, 133, 0.14);
}

.status-dot.offline {
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(194, 65, 59, 0.14);
}

.alert-bell,
.sound-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.alert-bell.active {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
    box-shadow: 0 12px 26px rgba(194, 65, 59, 0.22);
}

.alert-bell strong {
    position: absolute;
    top: -7px;
    right: -7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    color: #fff;
    background: #102634;
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
}

.sound-toggle.active {
    color: #0b6b43;
    background: #e9f7f0;
    border-color: #bde8d1;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 440px;
    color: var(--muted);
    font-size: 13px;
}

.user-chip span:not(.tenant-logo):not(.role-badge),
.user-chip strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip strong {
    color: var(--ink);
}

.user-chip a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    color: #fff;
    background: var(--nav);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.content {
    padding: 26px 28px 36px;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.toast-stack {
    position: fixed;
    top: 94px;
    right: 22px;
    z-index: 30;
    display: grid;
    gap: 10px;
    width: min(390px, calc(100vw - 28px));
    pointer-events: none;
}

.alert-toast {
    position: relative;
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr) 34px;
    gap: 12px;
    align-items: start;
    overflow: hidden;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(18, 33, 42, 0.18);
    pointer-events: auto;
}

.alert-toast .toast-rail {
    align-self: stretch;
    background: var(--blue);
}

.alert-toast.critical .toast-rail,
.alert-toast.high .toast-rail {
    background: var(--red);
}

.alert-toast.medium .toast-rail {
    background: var(--amber);
}

.alert-toast.low .toast-rail {
    background: var(--green);
}

.alert-toast div {
    display: grid;
    gap: 4px;
    padding: 13px 0;
    min-width: 0;
}

.alert-toast strong {
    font-size: 14px;
}

.alert-toast span,
.alert-toast small {
    color: var(--muted);
    line-height: 1.35;
}

.alert-toast button {
    width: 30px;
    height: 30px;
    margin: 9px 8px 0 0;
    color: var(--muted);
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.dashboard {
    display: grid;
    gap: 18px;
}

.ops-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
}

.ops-head h2 {
    margin: 0;
    font-size: 27px;
    line-height: 1.15;
    letter-spacing: 0;
}

.ops-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.ops-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 14px;
    min-width: 0;
}

.metric {
    min-height: 112px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(18, 33, 42, 0.04);
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.25;
}

.metric strong {
    display: block;
    margin-top: 14px;
    font-size: 30px;
    line-height: 1;
}

.metric small {
    display: block;
    margin-top: 8px;
    color: #7b8a92;
    font-size: 12px;
    line-height: 1.25;
}

.metric-total {
    background: #102634;
    border-color: #102634;
    color: #fff;
}

.metric-total span,
.metric-total small {
    color: rgba(255, 255, 255, 0.72);
}

.metric.moving {
    border-top: 3px solid var(--green);
}

.metric.idle {
    border-top: 3px solid var(--amber);
}

.metric.stopped {
    border-top: 3px solid var(--blue);
}

.metric.offline {
    border-top: 3px solid var(--red);
}

.metric.duplicate {
    border-top: 3px solid #6b7280;
}

.metric.stale {
    border-top: 3px solid #7c3aed;
}

.metric.alert {
    border-top: 3px solid var(--red);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    min-width: 0;
}

.toolbar .search-box {
    flex: 2 1 280px;
}

.command-bar {
    padding: 14px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
}

.toolbar select,
.toolbar button,
.login-form button {
    flex: 1 1 150px;
    min-height: 42px;
    min-width: 0;
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.toolbar button {
    flex: 0 0 120px;
}

.toolbar select,
.history-toolbar select,
.history-toolbar input {
    color: var(--ink);
}

.live-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--line);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    gap: 7px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(31, 157, 99, 0.12);
}

.live-refresh.online {
    color: #0b6b43;
    background: #e9f7f0;
    border-color: #bde8d1;
}

.toolbar button,
.login-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 700;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: #fff;
    background: var(--blue);
    border: 1px solid var(--blue);
    border-radius: 8px;
}

.filter-summary {
    flex: 1 1 180px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.fleet-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1.18fr) minmax(360px, 1fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.dashboard-side {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.alert-stack {
    display: grid;
    gap: 10px;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tracking-console-panel {
    min-width: 0;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.console-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
}

.console-tabs button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    color: var(--muted);
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 900;
}

.console-tabs button.active {
    color: #fff;
    background: var(--nav);
    border-color: var(--nav);
}

.vehicle-command-list {
    display: grid;
    gap: 9px;
    max-height: 460px;
    overflow: auto;
    padding: 12px;
}

.vehicle-command-card,
.geofence-command-card {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 76px;
    padding: 10px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: left;
}

.vehicle-command-card:hover,
.geofence-command-card:hover,
.vehicle-command-card.latest {
    border-color: var(--blue);
    background: #f4f9fc;
}

.vehicle-command-card strong,
.vehicle-command-card small,
.geofence-command-card strong,
.geofence-command-card small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicle-command-card small,
.geofence-command-card small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.command-card-meta {
    display: grid;
    gap: 4px;
    justify-items: end;
    text-align: right;
}

.command-card-meta em {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    padding: 0 8px;
    color: #fff;
    background: var(--blue);
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
}

.command-card-meta em.duplicate {
    background: #7c3aed;
}

.command-card-meta em.stale-gps {
    background: var(--amber);
}

.command-card-meta em.live {
    background: var(--green);
}

.geofence-color {
    width: 14px;
    height: 42px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.overlay-toggle {
    flex: 0 0 auto;
    min-height: 42px;
}

.alert-card {
    display: grid;
    gap: 7px;
    padding: 12px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--muted);
    border-radius: 8px;
    background: #fff;
}

.alert-card.critical {
    border-left-color: var(--red);
    background: #fff5f5;
}

.alert-card.high {
    border-left-color: var(--amber);
    background: #fffbeb;
}

.alert-card.medium {
    border-left-color: var(--blue);
    background: #eff6ff;
}

.alert-card.low {
    border-left-color: var(--green);
    background: #f0fdf4;
}

.alert-card strong,
.alert-card span {
    display: block;
}

.alert-card span,
.alert-card p {
    color: var(--muted);
}

.alert-card p {
    margin: 0;
    line-height: 1.35;
}

.alert-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.alert-card-meta span {
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.alerts-page {
    display: grid;
    gap: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.alert-metrics {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.alerts-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.alerts-toolbar .search-box {
    flex: 2 1 300px;
}

.alerts-toolbar label {
    display: grid;
    gap: 5px;
    flex: 1 1 178px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.alerts-toolbar select,
.alerts-toolbar input,
.alerts-toolbar button {
    flex: 1 1 148px;
    min-height: 42px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.alerts-toolbar select,
.alerts-toolbar input {
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
}

.alerts-toolbar button,
.alert-action-bar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 800;
    white-space: nowrap;
}

.alerts-toolbar > button {
    flex: 0 0 122px;
}

.alerts-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.alert-list-panel,
.alert-detail-panel {
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.alert-list-panel {
    display: grid;
    gap: 8px;
    max-height: calc(100vh - 310px);
    min-height: 520px;
    overflow: auto;
    padding: 12px;
}

.alert-list-item {
    position: relative;
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 76px;
    padding: 10px;
    color: var(--ink);
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.alert-list-item.active {
    border-color: var(--blue);
    box-shadow: inset 0 0 0 1px var(--blue);
}

.alert-list-item strong,
.alert-list-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alert-list-item small {
    color: var(--muted);
}

.severity-rail {
    width: 5px;
    height: 100%;
    border-radius: 999px;
    background: var(--muted);
}

.severity-rail.critical,
.severity-badge.critical {
    background: var(--red);
}

.severity-rail.high,
.severity-badge.high {
    background: var(--amber);
}

.severity-rail.medium,
.severity-badge.medium {
    background: var(--blue);
}

.severity-rail.low,
.severity-badge.low {
    background: var(--green);
}

.alert-list-meta {
    display: grid;
    justify-items: end;
    gap: 5px;
    white-space: nowrap;
    min-width: 70px;
}

.alert-detail-panel {
    min-height: 520px;
    overflow: hidden;
    min-width: 0;
}

.alert-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.alert-detail-head h3 {
    margin: 0 0 8px;
    font-size: 23px;
    line-height: 1.15;
}

.alert-detail-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.detail-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-content: flex-start;
    gap: 8px;
}

.severity-badge,
.status-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 10px;
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.status-badge.open {
    background: var(--red);
}

.status-badge.acknowledged {
    background: var(--amber);
}

.status-badge.closed {
    background: #6b7280;
}

.alert-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
}

.alert-detail-grid div {
    display: grid;
    gap: 5px;
    min-height: 76px;
    padding: 14px;
    background: #fff;
}

.alert-detail-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.alert-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 16px;
    border-top: 1px solid var(--line);
}

.alert-action-bar button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.alert-action-bar button:disabled {
    color: #6b7b86;
    background: #eef2f3;
    border-color: var(--line);
}

.alert-action-bar span {
    color: var(--muted);
    font-weight: 800;
}

.map-card,
.table-panel,
.empty-state,
.alert-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.map-card {
    overflow: hidden;
}

.map-card-header {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.map-card-header span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.map-card-header strong {
    display: block;
    margin-top: 2px;
    font-size: 18px;
}

.map-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.map-panel {
    position: relative;
    height: clamp(500px, calc(100vh - 310px), 760px);
    min-height: 500px;
    width: 100%;
    overflow: hidden;
    background: #dfe8e7;
}

.panel-title {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.panel-title strong {
    display: block;
    font-size: 17px;
}

.panel-title > span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.fleet-marker span {
    display: block;
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 5px 16px rgba(21, 33, 40, 0.32);
}

.fleet-marker.latest span {
    width: 26px;
    height: 26px;
    border-width: 4px;
    box-shadow: 0 0 0 8px rgba(31, 157, 99, 0.18), 0 9px 24px rgba(21, 33, 40, 0.38);
}

.fleet-vehicle-badge {
    background: transparent;
    border: 0;
}

.fleet-vehicle-pin {
    position: absolute;
    left: 9px;
    bottom: 5px;
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 5px 16px rgba(21, 33, 40, 0.32);
}

.fleet-vehicle-card {
    position: absolute;
    left: 22px;
    bottom: 17px;
    display: grid;
    gap: 1px;
    min-width: 104px;
    max-width: 118px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.96);
    border-left: 4px solid var(--blue);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(21, 33, 40, 0.22);
}

.fleet-vehicle-card strong,
.fleet-vehicle-card small {
    display: block;
    overflow: hidden;
    color: var(--ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fleet-vehicle-card strong {
    font-size: 12px;
    font-weight: 900;
}

.fleet-vehicle-card small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.live-vehicle-marker {
    position: relative;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 0;
}

.live-vehicle-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 0 0 8px rgba(31, 157, 99, 0.14), 0 8px 22px rgba(21, 33, 40, 0.3);
    transform: translate(-50%, -50%);
}

.live-vehicle-arrow {
    position: absolute;
    left: 50%;
    top: 0;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 17px solid var(--blue);
    filter: drop-shadow(0 4px 5px rgba(21, 33, 40, 0.28));
    transform-origin: 50% 17px;
    transition: transform 180ms linear;
    translate: -50% 0;
}

.leaflet-container {
    width: 100%;
    height: 100%;
    font: inherit;
}

.leaflet-popup-content {
    margin: 10px 12px;
    line-height: 1.35;
}

.leaflet-popup-content strong {
    display: block;
    margin-bottom: 4px;
}

.map-popup {
    display: grid;
    gap: 8px;
    min-width: 260px;
}

.map-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

.map-popup-head strong {
    margin: 0;
    font-size: 15px;
}

.map-popup-head span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    color: #fff;
    background: var(--green);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.map-popup div:not(.map-popup-head) {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.map-popup b {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.map-popup span {
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.table-panel {
    overflow: auto;
    max-height: clamp(500px, calc(100vh - 248px), 820px);
    min-width: 0;
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1180px;
}

th,
td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

th {
    color: var(--muted);
    background: #f7fafb;
    font-size: 12px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
}

td strong,
td span {
    display: block;
}

td span {
    color: var(--muted);
    font-size: 12px;
}

.vehicle-row.selected {
    background: #edf8f3;
}

.vehicle-row.selected td:first-child {
    border-left: 4px solid var(--green);
}

.status {
    display: inline-flex;
    min-width: 74px;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.status.moving {
    background: var(--green);
}

.status.idle {
    background: var(--amber);
}

.status.stopped {
    background: var(--blue);
}

.status.offline {
    background: var(--red);
}

.ignition {
    display: inline-flex;
    min-width: 42px;
    justify-content: center;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 900;
}

.ignition.on {
    color: #0b6b43;
    background: #dcfce7;
}

.ignition.off {
    color: #9f1d1d;
    background: #fee2e2;
}

.health {
    display: inline-flex;
    min-width: 94px;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 999px;
    color: #24323a;
    background: #eef2f3;
    font-size: 12px;
    font-weight: 800;
}

.health.live {
    color: #0b6b43;
    background: #dff5e9;
}

.health.duplicate,
.health.duplicate-resend {
    color: #5b21b6;
    background: #ede9fe;
}

.health.stale-gps {
    color: #5b21b6;
    background: #ede9fe;
}

.health.packet-failed {
    color: #9f1d1d;
    background: #fee2e2;
}

.time-good {
    color: #0b6b43;
}

.time-bad {
    color: #dc2626;
}

.battery {
    position: relative;
    display: inline-flex;
    width: 34px;
    height: 15px;
    padding: 2px;
    border: 2px solid #688274;
    border-radius: 4px;
    background: #fff;
}

.battery::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 4px;
    width: 3px;
    height: 5px;
    background: #688274;
    border-radius: 0 2px 2px 0;
}

.battery i {
    display: block;
    height: 100%;
    background: var(--green);
    border-radius: 2px;
}

.signal-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    min-height: 18px;
}

.signal-bars i {
    display: block;
    width: 4px;
    background: #cad5d9;
    border-radius: 2px 2px 0 0;
}

.signal-bars i:nth-child(1) {
    height: 6px;
}

.signal-bars i:nth-child(2) {
    height: 9px;
}

.signal-bars i:nth-child(3) {
    height: 12px;
}

.signal-bars i:nth-child(4) {
    height: 15px;
}

.signal-bars i.active {
    background: var(--green);
}

.empty-state,
.alert-panel {
    padding: 28px;
}

.empty-state h1,
.empty-state h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

.empty-state p,
.alert-panel span {
    margin: 0;
    color: var(--muted);
}

.alert-panel {
    display: grid;
    gap: 6px;
    border-color: rgba(194, 65, 59, 0.35);
}

.admin-page {
    display: grid;
    gap: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    flex-wrap: wrap;
}

.admin-head h2 {
    margin: 0;
    font-size: 26px;
}

.admin-head select,
.admin-tabs button,
.settings-form button,
.settings-table button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.admin-head select {
    min-width: 0;
    width: min(320px, 100%);
    padding: 0 12px;
}

.admin-metrics .metric {
    min-height: 76px;
}

.admin-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.admin-tabs button {
    padding: 0 14px;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

.admin-tabs button.active {
    color: #fff;
    background: var(--nav);
    border-color: var(--nav);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.settings-form {
    display: grid;
    gap: 14px;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.settings-form h3 {
    margin: 0;
    font-size: 18px;
}

.form-grid {
    display: grid;
    gap: 10px;
}

.form-grid label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form-grid input,
.form-grid select {
    min-height: 40px;
    padding: 0 10px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.form-grid .check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid .check input {
    min-height: auto;
}

.settings-form button {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 800;
}

.settings-form.disabled {
    background: #f7fafb;
}

.settings-form button:disabled {
    color: #6b7b86;
    background: #eef2f3;
    border-color: var(--line);
    cursor: not-allowed;
}

.settings-table {
    max-height: calc(100vh - 270px);
}

.settings-table button {
    padding: 0 10px;
    color: var(--blue);
    font-weight: 700;
}

.readonly-pill {
    display: inline-flex;
    min-width: 74px;
    justify-content: center;
    padding: 4px 8px;
    color: #6b7b86;
    background: #eef2f3;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.permission-admin-grid {
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    min-width: 0;
}

.permission-flags {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.settings-empty {
    padding: 26px;
    color: var(--muted);
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.config-item {
    display: grid;
    gap: 8px;
    min-height: 116px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.config-item strong {
    font-size: 16px;
}

.config-item span {
    color: var(--muted);
    line-height: 1.45;
}

.geofence-page {
    display: grid;
    gap: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.geofence-metrics {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.geofence-layout {
    display: grid;
    grid-template-columns: minmax(420px, 1.25fr) minmax(320px, 0.75fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.geofence-map-card,
.geofence-editor,
.geofence-bottom-grid > .table-panel {
    min-width: 0;
}

.geofence-map-shell {
    position: relative;
}

.geofence-map {
    height: clamp(540px, calc(100vh - 360px), 740px);
    min-height: 540px;
}

.geofence-map-tools {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 28px);
    padding: 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(18, 33, 42, 0.14);
}

.geofence-map-tools button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.geofence-map-tools button:disabled {
    color: #a3adb4;
    background: #eef2f3;
}

.geofence-map-tools span:last-child {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.geofence-editor {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.geofence-form {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.geofence-form label,
.assignment-panel {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.geofence-form input,
.geofence-form select {
    min-height: 40px;
    width: 100%;
    box-sizing: border-box;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 10px;
}

.geofence-form input[type="color"] {
    padding: 4px;
}

.coordinate-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.geofence-flags {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.polygon-editor,
.assignment-panel {
    padding: 12px;
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.polygon-editor {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.polygon-editor strong,
.assignment-panel strong {
    display: block;
    color: var(--ink);
    font-size: 13px;
}

.polygon-editor span,
.assignment-panel span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.polygon-editor button,
.assignment-actions button,
.form-actions button,
.table-action {
    min-height: 36px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-weight: 800;
}

.assignment-panel {
    gap: 10px;
}

.assignment-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.assignment-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 180px;
    overflow: auto;
}

.assignment-list .check {
    min-height: 32px;
    padding: 8px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
}

.form-actions .primary-action {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}

.geofence-bottom-grid {
    display: grid;
    grid-template-columns: minmax(420px, 1.2fr) minmax(320px, 0.8fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.geofence-table-panel,
.geofence-events-panel {
    max-height: 520px;
}

.compact-table {
    min-width: 760px;
}

.compact-table td strong,
.compact-table td span {
    display: block;
}

.compact-table td span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.status.circle,
.status.polygon {
    color: #fff;
    background: var(--blue);
}

.geofence-popup {
    min-width: 220px;
}

.history-page {
    display: grid;
    gap: 18px;
}

.history-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.history-toolbar label {
    display: grid;
    gap: 5px;
    flex: 1 1 210px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.history-toolbar select,
.history-toolbar input,
.history-toolbar button {
    flex: 1 1 160px;
    min-height: 42px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.history-toolbar select,
.history-toolbar input {
    min-width: 0;
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
}

.history-toolbar button {
    flex: 0 0 130px;
    padding: 0 18px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 800;
}

.history-metrics {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.history-grid {
    grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.18fr);
    min-width: 0;
}

.history-map {
    height: clamp(520px, calc(100vh - 345px), 780px);
}

.history-table {
    max-height: clamp(520px, calc(100vh - 285px), 840px);
}

.trips-page {
    display: grid;
    gap: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.trips-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.trips-toolbar label {
    display: grid;
    gap: 5px;
    flex: 1 1 190px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.trips-toolbar select,
.trips-toolbar input,
.trips-toolbar button {
    min-height: 42px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.trips-toolbar select,
.trips-toolbar input {
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
}

.trips-search {
    flex: 2 1 260px;
}

.trips-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 124px;
    padding: 0 16px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 800;
    white-space: nowrap;
}

.trips-toolbar button.primary-action {
    flex-basis: 150px;
    background: var(--green);
    border-color: var(--green);
}

.trips-toolbar button:disabled {
    color: #6b7b86;
    background: #eef2f3;
    border-color: var(--line);
}

.trip-metrics {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.trips-layout {
    display: grid;
    grid-template-columns: minmax(330px, 0.78fr) minmax(0, 1.22fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.trip-list-panel,
.trip-detail-panel {
    min-width: 0;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.trip-list {
    display: grid;
    gap: 10px;
    max-height: calc(100vh - 360px);
    min-height: 520px;
    overflow: auto;
    padding: 14px;
}

.trip-card {
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
    width: 100%;
    min-height: 92px;
    padding: 10px;
    color: var(--ink);
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.trip-card.active {
    border-color: var(--blue);
    box-shadow: inset 0 0 0 1px var(--blue);
}

.trip-card strong,
.trip-card small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trip-card small {
    margin-top: 4px;
    color: var(--muted);
}

.trip-rail {
    width: 5px;
    border-radius: 999px;
    background: var(--muted);
}

.trip-rail.moving {
    background: var(--green);
}

.trip-rail.stopped {
    background: var(--blue);
}

.trip-card-metrics {
    display: grid;
    gap: 5px;
    justify-items: end;
    align-content: center;
    text-align: right;
}

.trip-card-metrics em {
    min-height: 24px;
    padding: 4px 9px;
    color: #fff;
    background: var(--nav);
    border-radius: 999px;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.trip-card-metrics strong {
    font-size: 18px;
}

.trip-detail-panel {
    display: grid;
    gap: 14px;
    padding: 14px;
}

.trip-map-card {
    box-shadow: none;
}

.trip-map {
    height: clamp(430px, calc(100vh - 430px), 680px);
}

.trip-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.trip-summary-grid div {
    min-width: 0;
    padding: 14px;
    background: #f8fbfc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.trip-summary-grid span,
.trip-summary-grid small {
    display: block;
    color: var(--muted);
}

.trip-summary-grid strong {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trip-summary-grid small {
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.trip-table-panel {
    max-height: 380px;
    box-shadow: none;
}

.trip-table {
    min-width: 820px;
}

.trip-table td strong,
.trip-table td span {
    display: block;
}

.trip-table td span:not(.status) {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.live-vehicle-page {
    display: grid;
    gap: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.live-vehicle-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.live-vehicle-toolbar label {
    display: grid;
    gap: 5px;
    flex: 1 1 210px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.live-vehicle-toolbar select,
.live-vehicle-toolbar input,
.live-vehicle-toolbar button {
    flex: 1 1 160px;
    min-height: 42px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.live-vehicle-toolbar select,
.live-vehicle-toolbar input {
    min-width: 0;
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
}

.live-vehicle-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 800;
    white-space: nowrap;
}

.live-vehicle-toolbar > button {
    flex: 0 0 150px;
}

.live-vehicle-toolbar .secondary-action {
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
}

.follow-toggle {
    flex: 0 0 150px !important;
    min-height: 42px;
    display: inline-flex !important;
    grid-template-columns: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 12px;
    color: var(--ink) !important;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    white-space: nowrap;
}

.follow-toggle input {
    min-height: 0;
}

.live-vehicle-metrics {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    min-width: 0;
}

.live-vehicle-metrics .metric-total strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 24px;
}

.live-vehicle-grid {
    display: grid;
    grid-template-columns: minmax(420px, 1.25fr) minmax(300px, 0.75fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.live-vehicle-map {
    height: clamp(540px, calc(100vh - 355px), 780px);
}

.live-detail-panel {
    min-width: 0;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.live-detail-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0 16px 16px;
}

.live-detail-list div {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.live-detail-list div:last-child {
    border-bottom: 0;
}

.live-detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.live-detail-list dd {
    min-width: 0;
    margin: 0;
    color: var(--ink);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.live-empty-detail {
    display: grid;
    gap: 6px;
    padding: 18px 16px;
}

.live-empty-detail span {
    color: var(--muted);
}

.live-point-table {
    max-height: 430px;
}

.reports-page {
    display: grid;
    gap: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.report-metrics {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.reports-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.reports-toolbar label {
    display: grid;
    gap: 5px;
    flex: 1 1 180px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.reports-toolbar select,
.reports-toolbar input,
.reports-toolbar button {
    min-height: 42px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.reports-toolbar > .search-box {
    flex: 2 1 280px;
}

.reports-toolbar button {
    flex: 0 0 128px;
}

.reports-toolbar select,
.reports-toolbar input {
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
}

.reports-toolbar button,
.report-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 800;
    white-space: nowrap;
}

.report-tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 2px;
}

.report-tabs button {
    min-height: 40px;
    padding: 0 14px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 800;
    white-space: nowrap;
}

.report-tabs button.active {
    color: #fff;
    background: var(--nav);
    border-color: var(--nav);
}

.report-tabs .report-export {
    margin-left: auto;
    color: #fff;
    background: var(--green);
    border-color: var(--green);
}

.report-tabs .report-export:disabled {
    color: #6b7b86;
    background: #eef2f3;
    border-color: var(--line);
}

.report-table-panel {
    max-height: calc(100vh - 330px);
    min-height: 520px;
}

.report-table {
    min-width: 1180px;
}

.report-table th {
    white-space: nowrap;
}

.report-table td strong,
.report-table td span {
    display: block;
}

.report-table td span:not(.status):not(.ignition) {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.report-empty {
    margin: 16px;
    box-shadow: none;
}

.maintenance-page {
    display: grid;
    gap: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.maintenance-metrics {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.maintenance-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.maintenance-toolbar label,
.maintenance-form label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.maintenance-toolbar label {
    flex: 1 1 180px;
}

.maintenance-toolbar select,
.maintenance-toolbar input,
.maintenance-toolbar button,
.maintenance-form select,
.maintenance-form input,
.maintenance-form textarea,
.maintenance-form button {
    min-height: 42px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.maintenance-toolbar > .search-box {
    flex: 2 1 280px;
}

.maintenance-toolbar button {
    flex: 0 0 128px;
}

.maintenance-toolbar select,
.maintenance-toolbar input,
.maintenance-form select,
.maintenance-form input,
.maintenance-form textarea {
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
}

.maintenance-form textarea {
    min-height: 74px;
    padding: 10px;
    resize: vertical;
}

.maintenance-toolbar button,
.maintenance-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 800;
    white-space: nowrap;
}

.maintenance-form button:disabled,
.maintenance-form input:disabled,
.maintenance-form select:disabled,
.maintenance-form textarea:disabled {
    color: #6b7b86;
    background: #eef2f3;
    border-color: var(--line);
}

.maintenance-form .secondary-action {
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
}

.maintenance-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 16px;
    align-items: start;
}

.maintenance-history-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
    gap: 16px;
    align-items: start;
}

.maintenance-board,
.maintenance-editor {
    min-width: 0;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.maintenance-card-list {
    display: grid;
    gap: 10px;
    max-height: 620px;
    overflow: auto;
    padding: 14px;
}

.maintenance-plan-card {
    display: grid;
    grid-template-columns: 5px minmax(0, 1fr) minmax(150px, auto);
    gap: 12px;
    align-items: stretch;
    width: 100%;
    min-height: 92px;
    padding: 10px;
    color: var(--ink);
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.maintenance-plan-card.active {
    border-color: var(--blue);
    box-shadow: inset 0 0 0 1px var(--blue);
}

.maintenance-rail {
    width: 5px;
    border-radius: 999px;
    background: var(--green);
}

.maintenance-rail.overdue,
.maintenance-card-meta em.overdue {
    background: var(--red);
}

.maintenance-rail.due-soon,
.maintenance-card-meta em.due-soon {
    background: var(--amber);
}

.maintenance-rail.scheduled,
.maintenance-card-meta em.scheduled {
    background: var(--green);
}

.maintenance-rail.inactive,
.maintenance-card-meta em.inactive,
.maintenance-rail.unscheduled,
.maintenance-card-meta em.unscheduled {
    background: #6b7280;
}

.maintenance-card-main,
.maintenance-card-meta {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.maintenance-card-main strong {
    font-size: 16px;
}

.maintenance-card-main small,
.maintenance-card-main span,
.maintenance-card-meta small {
    color: var(--muted);
}

.maintenance-card-meta {
    justify-items: end;
    text-align: right;
}

.maintenance-card-meta em {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0 9px;
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.maintenance-form {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.maintenance-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.check-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
    color: var(--ink) !important;
}

.check-row input {
    min-height: 0;
}

.maintenance-history {
    max-height: 640px;
}

.maintenance-table {
    min-width: 940px;
}

.maintenance-table td strong,
.maintenance-table td span {
    display: block;
}

.maintenance-table td span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.inline-empty {
    margin: 14px;
    box-shadow: none;
}

.billing-page {
    display: grid;
    gap: 18px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.billing-metrics {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.billing-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.billing-toolbar label,
.billing-form label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.billing-toolbar label {
    flex: 1 1 180px;
}

.billing-toolbar select,
.billing-toolbar input,
.billing-toolbar button,
.billing-form select,
.billing-form input,
.billing-form textarea,
.billing-form button {
    min-height: 42px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.billing-toolbar > .search-box {
    flex: 2 1 280px;
}

.billing-toolbar button {
    flex: 0 0 128px;
}

.billing-toolbar select,
.billing-toolbar input,
.billing-form select,
.billing-form input,
.billing-form textarea {
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
}

.billing-form textarea {
    min-height: 74px;
    padding: 10px;
    resize: vertical;
}

.billing-toolbar button,
.billing-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 800;
    white-space: nowrap;
}

.billing-form button:disabled,
.billing-form input:disabled,
.billing-form select:disabled,
.billing-form textarea:disabled {
    color: #6b7b86;
    background: #eef2f3;
    border-color: var(--line);
}

.billing-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 16px;
    align-items: start;
}

.billing-bottom-grid {
    display: grid;
    grid-template-columns: minmax(290px, 0.75fr) minmax(0, 1.45fr) minmax(290px, 0.7fr);
    gap: 16px;
    align-items: start;
}

.billing-main,
.billing-editor {
    min-width: 0;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.billing-plan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
}

.billing-plan-card {
    display: grid;
    gap: 10px;
    min-height: 168px;
    padding: 16px;
    color: var(--ink);
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(18, 33, 42, 0.04);
}

.billing-plan-card.active {
    border-color: var(--blue);
    box-shadow: inset 0 0 0 1px var(--blue);
}

.billing-plan-card strong,
.billing-plan-card span {
    display: block;
}

.billing-plan-card span,
.billing-plan-card small {
    color: var(--muted);
}

.billing-plan-card div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.billing-plan-card small {
    padding: 4px 8px;
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-weight: 800;
}

.billing-plan-card em {
    justify-self: start;
    padding: 5px 9px;
    color: #fff;
    background: var(--red);
    border-radius: 999px;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.plan-chip {
    justify-self: start;
    min-height: 26px;
    padding: 5px 10px;
    color: #fff !important;
    background: var(--blue);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.plan-chip.basic {
    background: #6b7280;
}

.plan-chip.standard {
    background: var(--blue);
}

.plan-chip.premium {
    background: var(--green);
}

.plan-chip.enterprise {
    background: #102634;
}

.billing-form {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.billing-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.billing-table-panel {
    max-height: 680px;
}

.billing-table {
    min-width: 1040px;
}

.billing-table td strong,
.billing-table td span {
    display: block;
}

.billing-table td span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.login-body {
    background: #eef3f4;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 460px);
    padding: 30px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 28px 70px rgba(21, 33, 40, 0.12);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-full-logo {
    width: 112px;
    height: 76px;
    object-fit: contain;
    margin-left: -10px;
}

.tenant-logo {
    display: inline-flex;
    width: 28px;
    height: 28px;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
}

.tenant-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-brand h1 {
    margin: 0;
    font-size: 24px;
}

.login-brand p {
    margin: 2px 0 0;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 9px;
}

.login-form label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.login-form input {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfdfe;
}

.login-form button {
    margin-top: 8px;
}

.login-error,
.field-error {
    color: var(--red);
    font-size: 13px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    max-width: 520px;
    padding: 12px 40px 12px 14px;
    color: #fff;
    background: var(--red);
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(21, 33, 40, 0.25);
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 8px;
    right: 12px;
    cursor: pointer;
}

.vehicle-detail-page {
    display: grid;
    gap: 22px;
    min-width: 0;
}

.vehicle-control-strip {
    display: grid;
    grid-template-columns: minmax(320px, 1.2fr) minmax(190px, .55fr) auto auto;
    gap: 12px;
    align-items: stretch;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow);
    min-width: 0;
}

.vehicle-control-field {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #d7e3ec;
    border-radius: 8px;
    background: linear-gradient(180deg, #fff, #f8fbfd);
}

.vehicle-control-field .control-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 8px;
    color: var(--blue);
    background: #eaf3ff;
}

.vehicle-control-field label {
    display: grid;
    gap: 3px;
    width: 100%;
    min-width: 0;
}

.vehicle-control-field label > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.vehicle-control-field select {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 16px;
    font-weight: 850;
}

.vehicle-control-action,
.vehicle-follow-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 62px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 900;
    white-space: nowrap;
}

.vehicle-control-action {
    color: #fff;
    border: 1px solid var(--blue);
    background: var(--blue);
    box-shadow: 0 10px 22px rgba(47, 116, 192, .18);
}

.vehicle-control-action:disabled {
    cursor: progress;
    opacity: .68;
}

.vehicle-follow-pill {
    color: #0b6b43;
    border: 1px solid #b7ebce;
    background: #e9fbf0;
}

.vehicle-follow-pill input {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
}

.vehicle-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, .8fr) auto;
    gap: 18px;
    align-items: center;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    min-width: 0;
}

.vehicle-hero-main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.vehicle-hero-main .status-dot {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.vehicle-hero-main h3 {
    margin: 4px 0 2px;
    font-size: 34px;
    line-height: 1;
}

.vehicle-hero-main p,
.vehicle-hero-status small {
    margin: 0;
    color: var(--muted);
}

.vehicle-hero-status {
    display: grid;
    gap: 8px;
    justify-items: start;
}

.vehicle-hero-status strong {
    font-size: 18px;
}

.vehicle-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.vehicle-hero-actions a,
.table-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #cfe0ef;
    border-radius: 8px;
    color: var(--blue);
    background: #f8fbfd;
    font-weight: 900;
    text-decoration: none;
}

.table-action-link {
    min-height: 30px;
    padding: 5px 10px;
}

.vehicle-detail-metrics {
    grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.vehicle-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(330px, .7fr);
    gap: 22px;
    min-width: 0;
}

.vehicle-detail-map {
    height: 620px;
    min-height: 620px;
}

.vehicle-side-stack,
.vehicle-bottom-grid {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.vehicle-bottom-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    min-width: 0;
}

.detail-card .panel-title {
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.vehicle-health-list {
    display: grid;
    margin: 0;
    padding: 0 18px 18px;
}

.vehicle-health-list div {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid #eef3f6;
}

.vehicle-health-list div:last-child {
    border-bottom: 0;
}

.vehicle-health-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.vehicle-health-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 800;
}

.mini-list,
.vehicle-timeline {
    display: grid;
    gap: 10px;
    padding: 18px;
}

.mini-list-item,
.mini-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid #edf2f5;
    border-radius: 8px;
    background: #fbfdfe;
    min-width: 0;
}

.mini-list-item {
    justify-content: flex-start;
}

.mini-list strong,
.mini-list small {
    display: block;
}

.mini-list small {
    color: var(--muted);
}

.vehicle-timeline {
    max-height: 420px;
    overflow: auto;
}

.timeline-item {
    display: grid;
    grid-template-columns: 6px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #edf2f5;
}

.timeline-item > span {
    border-radius: 999px;
    background: var(--blue);
}

.timeline-item.high > span,
.timeline-item.critical > span {
    background: var(--red);
}

.timeline-item.medium > span {
    background: var(--amber);
}

.timeline-item strong,
.timeline-item small {
    display: block;
}

.timeline-item small,
.timeline-item p {
    color: var(--muted);
}

.timeline-item p {
    margin: 6px 0 0;
}

.status.due-soon,
.status.scheduled,
.status.unscheduled,
.status.inactive,
.status.overdue {
    min-width: 94px;
}

.status.due-soon {
    color: #7a4400;
    background: #fff1cc;
}

.status.scheduled {
    color: #0b6b43;
    background: #dcfce7;
}

.status.unscheduled,
.status.inactive {
    color: #43515f;
    background: #eef3f6;
}

.status.overdue {
    color: #9f1d1d;
    background: #fee2e2;
}

@media (max-width: 980px) {
    html,
    body {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .app-shell.sidebar-compact {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 8;
        height: auto;
        overflow: visible;
    }

    .main-panel {
        height: auto;
        overflow: visible;
    }

    .topbar {
        position: static;
        align-items: flex-start;
    }

    .metrics-grid,
    .fleet-grid,
    .admin-grid,
    .config-grid,
    .geofence-layout,
    .geofence-bottom-grid,
    .live-vehicle-toolbar,
    .live-vehicle-grid,
    .vehicle-hero,
    .vehicle-control-strip,
    .vehicle-detail-grid,
    .vehicle-bottom-grid,
    .history-toolbar,
    .trips-toolbar,
    .trips-layout,
    .reports-toolbar,
    .maintenance-toolbar,
    .maintenance-grid,
    .maintenance-history-grid,
    .billing-toolbar,
    .billing-layout,
    .billing-bottom-grid,
    .alerts-toolbar,
    .alerts-layout,
    .audit-layout {
        grid-template-columns: 1fr;
    }

    .alert-list-panel,
    .audit-list-panel {
        min-height: 0;
        max-height: 360px;
    }

    .map-panel {
        height: 460px;
        min-height: 460px;
    }

    .geofence-map {
        height: 500px;
        min-height: 500px;
    }

    .live-vehicle-map {
        height: 500px;
        min-height: 500px;
    }

    .trip-map {
        height: 480px;
        min-height: 480px;
    }

    .vehicle-detail-map {
        height: 500px;
        min-height: 500px;
    }

    .table-panel {
        max-height: none;
    }

    .report-table-panel {
        min-height: 0;
    }

    .maintenance-card-list,
    .trip-list,
    .vehicle-command-list,
    .maintenance-history,
    .billing-table-panel {
        max-height: none;
    }
}

@media (max-width: 680px) {
    .topbar,
    .content {
        padding-left: 16px;
        padding-right: 16px;
    }

    .topbar {
        display: grid;
    }

    .user-chip {
        flex-wrap: wrap;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .global-live-chip {
        width: 100%;
        max-width: none;
        flex: 1 0 100%;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .geofence-metrics,
    .coordinate-grid,
    .geofence-flags,
    .assignment-list {
        grid-template-columns: 1fr;
    }

    .toolbar {
        grid-template-columns: 1fr;
    }

    .alert-metrics,
    .audit-metrics,
    .trip-metrics,
    .report-metrics,
    .maintenance-metrics,
    .billing-metrics,
    .alert-detail-grid {
        grid-template-columns: 1fr;
    }

    .maintenance-form-grid,
    .maintenance-plan-card,
    .billing-form-grid,
    .billing-plan-grid {
        grid-template-columns: 1fr;
    }

    .maintenance-card-meta {
        justify-items: start;
        text-align: left;
    }

    .alert-detail-head {
        display: grid;
    }

    .detail-badges {
        justify-content: flex-start;
    }

    .admin-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-head select {
        width: 100%;
        min-width: 0;
    }

    .map-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .map-meta {
        justify-content: flex-start;
    }

    .map-panel {
        height: 380px;
        min-height: 380px;
    }

    .geofence-map {
        height: 420px;
        min-height: 420px;
    }

    .live-vehicle-map {
        height: 430px;
        min-height: 430px;
    }

    .trip-map {
        height: 420px;
        min-height: 420px;
    }

    .trip-card {
        grid-template-columns: 5px minmax(0, 1fr);
    }

    .vehicle-detail-metrics {
        grid-template-columns: 1fr;
    }

    .vehicle-hero-main h3 {
        font-size: 28px;
    }

    .vehicle-hero-actions {
        justify-content: flex-start;
    }

    .vehicle-health-list div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .vehicle-control-strip {
        grid-template-columns: 1fr;
    }

    .vehicle-control-field,
    .vehicle-control-action,
    .vehicle-follow-pill {
        min-height: 56px;
    }

    .trip-card-metrics {
        grid-column: 2;
        justify-items: start;
        text-align: left;
    }

    .vehicle-command-card,
    .geofence-command-card {
        grid-template-columns: 14px minmax(0, 1fr);
    }

    .command-card-meta {
        grid-column: 2;
        justify-items: start;
        text-align: left;
    }

    .ops-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .ops-head-actions {
        justify-content: flex-start;
    }

    .audit-list-item {
        grid-template-columns: 6px minmax(0, 1fr);
    }

    .audit-list-item .alert-list-meta {
        grid-column: 2;
        justify-items: start;
        text-align: left;
    }

    .report-tabs {
        align-items: stretch;
    }

    .report-tabs button {
        flex: 0 0 auto;
    }

    .report-tabs .report-export {
        margin-left: 0;
    }

    .filter-summary {
        white-space: normal;
    }
}
