:root {
    --sidebar: #0b1220;
    --sidebar-soft: #172033;
    --sidebar-line: #23324a;
    --bg: #f3f6fb;
    --panel: #ffffff;
    --panel-soft: #f8fbff;
    --text: #142033;
    --muted: #667085;
    --line: #d9e4f2;
    --green: #13a56b;
    --blue: #1f6feb;
    --cyan: #0891b2;
    --amber: #d97706;
    --red: #dc2626;
    --shadow: 0 14px 36px rgba(20, 32, 51, 0.08);
    --shadow-hover: 0 18px 46px rgba(20, 32, 51, 0.13);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    overflow-x: hidden;
}

html,
body,
.app-shell,
.panel,
.map-panel,
.feature-card,
.table-wrap {
    max-width: 100%;
}

body * {
    min-width: 0;
}

a { color: inherit; text-decoration: none; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    background: var(--sidebar);
    color: #e5e7eb;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 10;
    border-right: 1px solid var(--sidebar-line);
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.18);
}

.brand {
    display: flex;
    align-items: center;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 6px 14px;
    min-height: 86px;
    padding: 10px 8px 14px;
}

.brand > span {
    display: grid;
    place-items: center;
    grid-row: span 2;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--green), var(--blue));
    color: white;
    font-weight: 800;
}

.brand-logo {
    overflow: hidden;
    background: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.brand-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-logo.is-fallback::before {
    content: attr(data-logo-fallback);
}

.brand-logo.is-fallback {
    background: linear-gradient(135deg, var(--green), var(--blue)) !important;
    border-color: transparent;
}

.brand strong {
    align-self: end;
    font-size: 20px;
    line-height: 1;
    letter-spacing: 0;
}

.brand small {
    align-self: start;
    color: #8da2c0;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.sidebar nav {
    display: grid;
    gap: 4px;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar nav::-webkit-scrollbar {
    display: none;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    color: #b8c6d9;
    font-size: 14px;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: var(--sidebar-soft);
    color: white;
}

.sidebar nav a.active {
    box-shadow: inset 3px 0 0 var(--green);
}

.sidebar nav a:hover {
    transform: translateX(3px);
}

.sidebar-fleet-panel {
    display: grid;
    gap: 8px;
    margin-top: 0;
}

.sidebar-fleet-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--sidebar-line);
    border-radius: 8px;
    background: #101a2c;
    color: #f8fafc;
    text-align: left;
    cursor: pointer;
}

.sidebar-fleet-toggle:hover,
.sidebar-fleet-toggle[aria-expanded="true"] {
    background: var(--sidebar-soft);
}

.sidebar-fleet-toggle span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.sidebar-fleet-toggle strong {
    display: block;
    overflow: hidden;
    color: #f8fafc;
    font-size: 13px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-fleet-toggle small {
    display: block;
    overflow: hidden;
    color: #8da2c0;
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-fleet-toggle i {
    width: 9px;
    height: 9px;
    border-right: 2px solid #8da2c0;
    border-bottom: 2px solid #8da2c0;
    transform: rotate(45deg);
    transition: transform 160ms ease, border-color 160ms ease;
}

.sidebar-fleet-toggle[aria-expanded="true"] i {
    border-color: #f8fafc;
    transform: rotate(225deg);
}

.sidebar-vehicle-list {
    display: grid;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-vehicle-list[hidden] {
    display: none;
}

.sidebar-vehicle-list::-webkit-scrollbar {
    display: none;
}

.sidebar-vehicle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid #23324a;
    border-radius: 8px;
    background: #0f172a;
    color: #dbeafe;
}

.sidebar-vehicle-item:hover {
    background: #172033;
}

.sidebar-vehicle-item span {
    min-width: 0;
}

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

.sidebar-vehicle-item strong {
    color: #f8fafc;
    font-size: 12px;
}

.sidebar-vehicle-item small {
    color: #8da2c0;
    font-size: 11px;
}

.sidebar-vehicle-item em {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
    text-transform: uppercase;
}

.sidebar-vehicle-item em.online {
    background: #dcfce7;
    color: #166534;
}

.sidebar-vehicle-item em.offline {
    background: #fee2e2;
    color: #991b1b;
}

.app-shell {
    margin-left: 272px;
    padding: 18px 24px 32px;
    display: grid;
    gap: 16px;
    min-width: 0;
}

.topbar {
    min-height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 2px 2px 8px;
    border-bottom: 1px solid rgba(217, 228, 242, 0.72);
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; letter-spacing: 0; overflow-wrap: anywhere; }
h2 { margin-bottom: 8px; font-size: 18px; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.5; }

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 5px 10px 5px 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

.user-chip strong,
.user-chip small {
    display: block;
    line-height: 1.15;
}

.user-chip strong {
    max-width: 150px;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: capitalize;
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border-radius: 8px;
    background: #e6f7ef;
    color: #08764c;
    font-weight: 900;
}

button,
.primary-button,
.secondary-button,
.icon-text-button {
    border: 0;
    border-radius: 8px;
    min-height: 40px;
    padding: 0 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
    background: var(--blue);
    color: white;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    background: white;
    color: var(--blue);
    border: 1px solid var(--line);
}

.icon-text-button {
    background: #eef4fb;
    color: #23405f;
    border: 1px solid var(--line);
}

button:hover,
.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
}

.primary-button:hover {
    background: #1d4ed8;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.secondary-button:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.connection {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    background: #e0f2fe;
    color: #075985;
    font-size: 13px;
    font-weight: 800;
}

.connection.is-live { background: #dcfce7; color: #166534; }
.connection.is-offline { background: #fee2e2; color: #991b1b; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 14px;
    min-width: 0;
    width: 100%;
}

.dashboard-kpi-grid {
    grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.kpi-card,
.panel,
.map-panel,
.feature-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 0;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.kpi-card:hover,
.panel:hover,
.map-panel:hover,
.feature-card:hover {
    border-color: #b7c8df;
    box-shadow: var(--shadow-hover);
}

.kpi-card:hover,
.feature-card:hover {
    transform: translateY(-3px);
}

.kpi-card {
    padding: 14px 16px;
    min-height: 88px;
    display: grid;
    align-content: space-between;
}

.kpi-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.kpi-card strong {
    font-size: 25px;
    color: #0f1f34;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 22px;
    min-width: 0;
    width: 100%;
}

.dashboard-map-focus {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
    min-height: 0;
}

body[data-page="dashboard"] {
    height: 100vh;
    overflow: hidden;
}

body[data-page="dashboard"] .app-shell {
    height: 100vh;
    padding: 14px;
    grid-template-rows: auto minmax(0, 1fr);
}

body[data-page="dashboard"] .topbar {
    position: relative;
    z-index: 440;
    min-height: 54px;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(217, 228, 242, 0.82);
    border-radius: 8px;
    background: rgba(243, 246, 251, 0.92);
    backdrop-filter: blur(8px);
}

body[data-page="dashboard"] .topbar > div:first-child {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
}

body[data-page="dashboard"] .topbar h1 {
    font-size: 24px;
}

body[data-page="dashboard"] .topbar .top-actions {
    justify-self: end;
}

body[data-page="dashboard"] .dashboard-map-focus,
body[data-page="dashboard"] .dashboard-map-focus .map-panel,
body[data-page="dashboard"] .dashboard-map-focus .map-stage {
    height: 100%;
    min-height: 0;
}

.can-card-grid,
.dashboard-status-row {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.can-card-grid {
    grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.dashboard-status-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
}

.can-top-card {
    display: grid;
    align-content: space-between;
    gap: 8px;
    min-height: 112px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.can-top-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.can-top-card strong {
    color: #102033;
    font-size: 20px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.can-top-card small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.can-top-card.is-available {
    border-color: #bbf7d0;
    background: #f2fff7;
}

.can-top-card.is-available small {
    color: #08764c;
}

.can-top-card.is-raw-live {
    border-color: #fde68a;
    background: #fffbeb;
}

.can-top-card.is-raw-live strong {
    color: #713f12;
}

.can-top-card.is-raw-live small {
    color: #92400e;
}

.can-top-card.is-expected {
    border-color: #bfdbfe;
    background: #fbfdff;
}

.can-top-card.is-expected strong {
    color: #1f6feb;
}

.can-top-card.is-expected small {
    color: #075985;
}

.can-top-card.is-unavailable {
    background: #f8fafc;
    opacity: 0.74;
}

.can-source-card {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.can-summary-panel {
    min-width: 0;
}

.can-summary-card {
    display: grid;
    grid-template-columns: minmax(210px, 0.28fr) minmax(0, 1fr);
    gap: 8px;
    overflow: visible;
}

.can-summary-source {
    display: grid;
    gap: 2px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.can-summary-source strong {
    color: #102033;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.can-summary-source small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.can-summary-grid {
    display: grid;
    grid-template-rows: repeat(3, minmax(42px, 1fr));
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 5px;
    overflow: visible;
}

.can-vehicle-detail-card {
    min-width: 0;
    padding: 8px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
}

.can-vehicle-detail-card > strong {
    display: block;
    margin-bottom: 6px;
    color: #102033;
    font-size: 13px;
}

.can-vehicle-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.can-vehicle-card-heading > strong {
    color: #102033;
    font-size: 13px;
}

.can-vehicle-card-heading .secondary-button {
    min-height: 24px;
    padding: 3px 8px;
    font-size: 11px;
}

.can-vehicle-detail-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 7px;
    margin: 0;
}

.can-vehicle-detail-card dt {
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.can-vehicle-detail-card dd {
    margin: 1px 0 0;
    color: #102033;
    font-size: 11px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.can-summary-item {
    min-width: 0;
    padding: 5px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.can-summary-item.is-available {
    border-color: #bbf7d0;
    background: #f2fff7;
}

.can-summary-item.is-raw-live {
    border-color: #fed7aa;
    background: #fff7ed;
}

.can-summary-item span {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.can-summary-item strong {
    display: block;
    margin-top: 2px;
    color: #102033;
    font-size: 11px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.can-summary-item small {
    display: block;
    margin-top: 3px;
    color: #92400e;
    font-size: 8px;
    font-weight: 900;
    line-height: 1.1;
    text-transform: uppercase;
}

.configurator-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    min-width: 0;
}

.status-panel {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.status-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.status-panel h2 {
    margin: 0;
    color: #102033;
    font-size: 15px;
}

.embedded-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.embedded-panel-heading > span:first-child {
    color: #102033;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.status-definition-grid {
    display: grid;
    grid-template-columns: minmax(92px, 0.85fr) minmax(0, 1fr);
    gap: 8px 10px;
    margin: 0;
    min-width: 0;
}

.status-definition-grid dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.status-definition-grid dd {
    margin: 0;
    color: #102033;
    font-size: 13px;
    font-weight: 800;
    min-width: 0;
    overflow-wrap: anywhere;
}

.io-info-list {
    display: grid;
    gap: 8px;
    max-height: 260px;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 2px;
}

.io-info-row {
    display: grid;
    grid-template-columns: minmax(95px, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 34px;
    padding: 7px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.io-info-row span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.io-info-row strong {
    color: #102033;
    font-size: 13px;
    overflow-wrap: anywhere;
}

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

.four-panel-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.map-panel,
.feature-card {
    padding: 18px;
}

.dashboard-map-focus .map-panel {
    padding: 0;
    overflow: hidden;
}

body[data-page="dashboard"] .dashboard-map-focus #fleet-map {
    height: 100%;
    min-height: 0;
}

.map-data-tabs {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 430;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: calc(100% - 92px);
    pointer-events: none;
}

body.company-map-view .map-data-tabs {
    display: none;
}

.map-data-tab {
    width: min(760px, calc(100vw - 380px));
    max-width: 100%;
    border: 1px solid rgba(191, 219, 254, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.map-data-tab:not([open]) {
    width: auto;
}

.map-data-tab summary {
    min-height: 38px;
    padding: 9px 13px;
    color: #102033;
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
    list-style: none;
    text-transform: uppercase;
}

.map-data-tab summary::-webkit-details-marker {
    display: none;
}

.map-data-tab summary::after {
    margin-left: 8px;
    color: var(--blue);
    content: "+";
}

.map-data-tab[open] summary::after {
    content: "-";
}

.map-data-tab-panel,
.map-data-tab .can-summary-card {
    max-height: min(58vh, 520px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 12px 12px;
}

.map-data-tab .can-summary-card {
    display: block;
}

.map-data-tab .can-summary-grid {
    grid-template-rows: none;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
}

.map-data-tab .can-vehicle-detail-card {
    box-shadow: none;
}

.dashboard-can-accordion {
    position: relative;
    z-index: 430;
    width: 100%;
    max-width: none;
    margin: 0;
    border: 1px solid rgba(191, 219, 254, 0.85);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
    color: #ffffff;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.dashboard-can-accordion summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
    list-style: none;
    text-transform: uppercase;
}

.dashboard-can-accordion summary::-webkit-details-marker {
    display: none;
}

.dashboard-can-accordion summary::after {
    color: #93c5fd;
    content: "+";
    font-size: 18px;
    line-height: 1;
}

.dashboard-can-accordion[open] summary::after {
    content: "-";
}

.dashboard-can-accordion summary small {
    margin-left: auto;
    color: #bfdbfe;
    font-size: 11px;
    font-weight: 900;
    text-transform: none;
}

.dashboard-can-panel {
    display: grid;
    gap: 10px;
    max-height: min(34vh, 320px);
    padding: 12px;
    overflow: auto;
    background: rgba(248, 250, 252, 0.98);
    color: #102033;
}

.dashboard-can-panel .can-summary-source {
    padding: 0 0 10px;
}

.dashboard-can-data {
    display: grid;
    gap: 14px;
}

.dashboard-can-section {
    display: grid;
    gap: 8px;
}

.dashboard-can-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #102033;
}

.dashboard-can-section-heading strong {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.dashboard-can-section-heading small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
}

.dashboard-can-panel .can-summary-grid {
    grid-template-rows: none;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
}

.dashboard-can-panel .can-summary-item small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.vehicle-can-accordion {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.vehicle-can-accordion summary {
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    color: #102033;
    font-size: 14px;
    font-weight: 900;
    list-style: none;
    text-transform: uppercase;
}

.vehicle-can-accordion summary::-webkit-details-marker {
    display: none;
}

.vehicle-can-accordion summary::after {
    color: var(--blue);
    content: "+";
    font-size: 18px;
    line-height: 1;
}

.vehicle-can-accordion[open] summary::after {
    content: "-";
}

.vehicle-can-accordion summary small {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: none;
}

.vehicle-can-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: #f8fafc;
}

.vehicle-can-section {
    display: grid;
    align-content: start;
    gap: 7px;
    min-width: 0;
}

.vehicle-can-section h3 {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.vehicle-can-item {
    display: grid;
    gap: 3px;
    min-height: 48px;
    padding: 8px;
    border: 1px solid #d9e4f2;
    border-radius: 6px;
    background: #ffffff;
}

.vehicle-can-item span,
.vehicle-can-updated span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.vehicle-can-item strong,
.vehicle-can-updated strong {
    color: #102033;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.vehicle-can-updated {
    display: grid;
    gap: 4px;
    align-content: center;
    min-height: 58px;
    padding: 10px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.panel-heading p { margin-bottom: 0; font-size: 13px; }
.panel-heading a { color: var(--blue); font-weight: 800; font-size: 14px; }

#fleet-map {
    width: 100%;
    height: min(588px, calc((100vh - 120px) * 0.6));
    min-height: 516px;
    border-radius: 8px;
    border: 0;
    overflow: hidden;
    background: #eaf1f7;
}

.map-stage {
    position: relative;
    isolation: isolate;
    height: 100%;
}

.activity-hud {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 430;
    width: min(340px, 34%);
    max-height: none;
    padding: 14px;
    border: 0;
    border-radius: 0 8px 8px 0;
    background:
        linear-gradient(180deg, rgba(8, 17, 33, 0.82), rgba(8, 17, 33, 0.58)),
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, transparent 1px, transparent 7px);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28), inset 0 0 28px rgba(19, 165, 107, 0.08);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.activity-hud::before {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(125, 211, 252, 0.14), transparent 18%, transparent 82%, rgba(19, 165, 107, 0.12));
    content: "";
}

.activity-hud-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: #e0f2fe;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.activity-hud-heading a {
    color: #7dd3fc;
    font-size: 11px;
}

.activity-scroll {
    max-height: calc(100% - 32px);
    height: calc(100% - 32px);
    overflow-y: auto;
    padding-right: 4px;
    scroll-behavior: smooth;
    mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}

.activity-scroll::-webkit-scrollbar {
    width: 6px;
}

.activity-scroll::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.16);
    border-radius: 999px;
}

.activity-scroll::-webkit-scrollbar-thumb {
    background: #13a56b;
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(19, 165, 107, 0.78);
}

.activity-hud .alert-item {
    border-color: transparent;
    background: rgba(15, 23, 42, 0.42);
    color: #f8fafc;
    box-shadow: inset 2px 0 0 rgba(19, 165, 107, 0.72);
    animation: activityHudPulse 2600ms ease-in-out infinite;
}

.activity-hud .alert-item:hover {
    border-color: rgba(125, 211, 252, 0.7);
    background: rgba(15, 23, 42, 0.66);
    box-shadow: inset 3px 0 0 rgba(19, 165, 107, 0.9), 0 0 24px rgba(14, 165, 233, 0.16);
}

.activity-hud .alert-item strong {
    color: #ffffff;
    font-size: 12px;
}

.activity-hud .alert-item small {
    color: #cbd5e1;
    font-size: 11px;
}

@keyframes activityHudPulse {
    0%, 100% {
        border-color: transparent;
    }
    50% {
        border-color: transparent;
    }
}

.map-filter-field {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.map-filter-field select {
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--text);
    padding: 0 9px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-transform: none;
}

.map-filter-tabs {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: none;
    padding: 8px;
    border-radius: 8px;
    background: rgba(8, 17, 33, 0.62);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(8px);
}

.map-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 8px 0 11px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: #e0f2fe;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.map-filter-tab select {
    width: min(180px, 24vw);
    min-height: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    background: rgba(226, 232, 240, 0.95);
    color: #0f172a;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    text-transform: none;
}

.map-filter-reset {
    border: 0;
    color: #ffffff;
    cursor: pointer;
}

.map-filter-reset.is-active {
    background: #13a56b;
    box-shadow: 0 0 0 1px rgba(187, 247, 208, 0.78), 0 10px 24px rgba(19, 165, 107, 0.36);
}

.map-filter-reset:hover {
    background: rgba(19, 165, 107, 0.82);
    transform: none;
}

.status-chip,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    text-transform: capitalize;
}

.moving, .online { background: #dcfce7; color: #166534; }
.stopped { background: #e0f2fe; color: #075985; }
.offline { background: #f1f5f9; color: #475569; }
.alert, .high { background: #fee2e2; color: #991b1b; }
.medium, .due, .upcoming { background: #fef3c7; color: #92400e; }
.critical, .overdue { background: #fee2e2; color: #991b1b; }
.completed { background: #dcfce7; color: #166534; }
.cancelled { background: #f1f5f9; color: #475569; }
.low, .scheduled, .active, .resolved { background: #e0f2fe; color: #075985; }

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
    table-layout: fixed;
}

.report-table {
    min-width: 0;
}

.report-filter-grid {
    align-items: end;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    max-width: 0;
    overflow-wrap: anywhere;
    vertical-align: top;
    word-break: break-word;
}

th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0;
}

td {
    color: #26364c;
}

tbody tr {
    transition: background 160ms ease, box-shadow 160ms ease;
}

tbody tr:hover {
    background: #f8fbff;
    box-shadow: inset 3px 0 0 var(--blue);
}

.search-input {
    width: min(280px, 100%);
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    font: inherit;
    background: white;
}

.compact-number-input {
    width: 110px;
}

.select-input {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: white;
    color: var(--text);
    font: inherit;
}

.summary-list {
    display: grid;
    gap: 10px;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.summary-row span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.can-panel {
    position: sticky;
    top: 18px;
}

.can-summary {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.can-summary div {
    display: grid;
    gap: 3px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.can-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.can-summary strong {
    color: #102033;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.can-parameter-list {
    display: grid;
    gap: 8px;
}

.can-profile-label {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.can-parameter {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.can-parameter div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.can-parameter strong {
    font-size: 13px;
}

.can-parameter span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.can-parameter code {
    display: block;
    width: 100%;
    min-height: 30px;
    padding: 7px 9px;
    border-radius: 8px;
    background: #eef4fb;
    color: #12304f;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.can-parameter.is-available {
    border-color: #bbf7d0;
    background: #f2fff7;
}

.can-parameter.is-available span {
    color: #08764c;
}

.can-parameter.is-unavailable {
    opacity: 0.76;
}

.can-note {
    display: grid;
    gap: 3px;
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #23405f;
    font-size: 13px;
    line-height: 1.45;
}

.history-filter-panel {
    margin-bottom: 14px;
}

.history-filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
}

.history-filter-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.history-filter-grid input,
.history-filter-grid select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    padding: 0 10px;
}

.history-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.history-summary-grid .status-panel {
    display: grid;
    gap: 6px;
}

.history-summary-grid strong {
    color: #102033;
    font-size: 24px;
    line-height: 1;
}

.history-summary-grid small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.history-table td {
    vertical-align: top;
}

.history-table code {
    display: block;
    min-width: 0;
    max-width: 760px;
    max-height: 92px;
    overflow-x: visible;
    overflow-y: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    color: #12304f;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    line-height: 1.35;
}

.table-action {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

.inventory-table {
    min-width: 0;
}

.table-action-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.file-button input {
    display: none;
}

.stacked-heading {
    align-items: flex-start;
}

.filter-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.trip-filter-row {
    align-items: center;
    flex-wrap: nowrap;
}

.trip-filter-row .search-input {
    width: 220px;
    min-width: 180px;
}

.trip-filter-row .secondary-button {
    flex: 0 0 auto;
    min-height: 44px;
}

.fuel-filter-row {
    align-items: center;
    flex-wrap: nowrap;
}

.fuel-filter-row .search-input {
    width: 190px;
    min-width: 150px;
}

.fuel-filter-row .secondary-button {
    flex: 0 0 auto;
    min-height: 44px;
}

body[data-page="fuel"] .fuel-summary-row .status-card {
    display: grid;
    align-content: center;
    gap: 4px;
    min-height: 72px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

body[data-page="fuel"] .fuel-summary-row .status-card strong {
    font-size: 18px;
    color: var(--text);
}

body[data-page="fuel"] .fuel-summary-row .status-card small {
    color: var(--muted);
    font-weight: 700;
}

.maintenance-filter-row {
    align-items: center;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.alert-list,
.stack-list {
    display: grid;
    gap: 10px;
}

.alert-item,
.stack-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.alert-item:hover,
.stack-item:hover {
    transform: translateY(-2px);
    border-color: #b7c8df;
    background: white;
    box-shadow: 0 12px 26px rgba(25, 36, 61, 0.08);
}

.alert-item strong,
.stack-item strong { display: block; margin-bottom: 4px; }
.alert-item small,
.stack-item small { color: var(--muted); }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.vehicle-groups {
    display: grid;
    gap: 18px;
}

.vehicle-group-block {
    display: grid;
    gap: 12px;
}

.group-block-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.group-block-heading h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.group-block-heading span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.compact-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.group-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.group-card {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.group-card:hover {
    transform: translateY(-2px);
    border-color: #b7c8df;
    background: white;
    box-shadow: 0 12px 26px rgba(25, 36, 61, 0.08);
}

.group-card span {
    color: var(--blue);
    font-weight: 800;
}

.group-card small,
.empty-state,
.form-note {
    color: var(--muted);
}

.feature-card h2 { margin-bottom: 8px; }

.installation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
}

.installation-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
    display: grid;
    gap: 14px;
}

.installation-card header,
.installation-card footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.installation-card header small {
    display: block;
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 11px;
}

.installation-card h3 {
    margin: 4px 0 0;
    font-size: 18px;
}

.installation-definition {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px 12px;
    margin: 0;
}

.installation-definition dt {
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 11px;
}

.installation-definition dd {
    margin: 0;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.installation-checklist {
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    background: #f8fafc;
    display: grid;
    gap: 8px;
    list-style: none;
}

.installation-checklist li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: var(--muted);
}

.installation-checklist li span {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #e2e8f0;
    color: #475569;
    flex: 0 0 auto;
}

.installation-checklist li.is-done {
    color: #0f5132;
}

.installation-checklist li.is-done span {
    background: #dcfce7;
    color: #15803d;
}

.installation-card footer {
    align-items: center;
    color: var(--muted);
    font-weight: 800;
}

.settings-diagnostic-shell {
    margin-bottom: 16px;
}

.settings-diagnostic-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-diagnostic-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-weight: 800;
    text-decoration: none;
}

.settings-diagnostic-tabs a:hover,
.settings-diagnostic-tabs a.active {
    color: var(--blue);
    border-color: #bfdbfe;
    background: #eff6ff;
}

.settings-device-status-row [hidden] {
    display: none !important;
}

.vehicle-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.vehicle-card:hover {
    transform: translateY(-3px);
    border-color: #b7c8df;
    background: white;
    box-shadow: var(--shadow-hover);
}

.vehicle-card header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.vehicle-card dl,
.definition-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    margin: 0;
}

dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; font-weight: 800; word-break: break-word; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    min-width: 0;
    width: 100%;
}

.wide { grid-column: 1 / -1; }

.embedded-map {
    min-height: 360px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.wide-modal {
    width: min(1180px, calc(100vw - 32px));
}

.tall-map {
    min-height: 560px;
}

.compact-check-list .stack-item {
    padding: 10px 12px;
}

.leaflet-div-icon.vehicle-marker,
.vehicle-marker {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.vehicle-marker-triangle {
    display: block;
    width: 24px;
    height: 28px;
    background: var(--marker-color, var(--green));
    clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
    filter: drop-shadow(0 0 1px #ffffff) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.42));
    transform-origin: 50% 50%;
}

.vehicle-marker-square {
    display: block;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 2px;
    background: var(--marker-color, #64748b);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.34);
}

.vehicle-marker-circle {
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    background: var(--marker-color, #64748b);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.26);
    opacity: 0.68;
}

.vehicle-marker.moving { --marker-color: var(--green); }
.vehicle-marker.stopped { --marker-color: var(--blue); }
.vehicle-marker.idle { --marker-color: var(--amber); }
.vehicle-marker.offline { --marker-color: #64748b; }
.vehicle-marker.alert { --marker-color: var(--red); }
.vehicle-marker.unknown { --marker-color: #94a3b8; }

.leaflet-tooltip {
    border: 0;
    border-radius: 8px;
    background: #0b1220;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
    font-weight: 800;
}

.leaflet-tooltip::before {
    position: absolute;
    width: 0;
    height: 0;
    border: 7px solid transparent;
    background: transparent;
    content: "";
}

.leaflet-tooltip-top::before {
    left: 50%;
    bottom: -14px;
    margin-left: -7px;
    border-top-color: #0b1220;
}

.leaflet-tooltip-bottom::before {
    left: 50%;
    top: -14px;
    margin-left: -7px;
    border-bottom-color: #0b1220;
}

.leaflet-tooltip-left::before {
    top: 50%;
    right: -14px;
    margin-top: -7px;
    border-left-color: #0b1220;
}

.leaflet-tooltip-right::before {
    top: 50%;
    left: -14px;
    margin-top: -7px;
    border-right-color: #0b1220;
}

.map-popup {
    min-width: 240px;
    width: min(300px, 78vw);
    max-width: min(340px, 82vw);
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.map-popup strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 15px;
}

.map-popup dl {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 7px 14px;
    margin: 0 0 10px;
}

.map-popup dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.map-popup dd {
    margin: 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.map-popup-company {
    width: min(320px, 80vw);
}

.map-popup-company dl {
    grid-template-columns: 112px minmax(0, 1fr);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.48);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-card {
    width: min(760px, 100%);
    max-height: min(820px, 92vh);
    overflow-x: hidden;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.25);
    padding: 20px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    min-height: 36px;
    padding: 0;
    background: #f1f5f9;
    color: var(--text);
}

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

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

.form-grid input,
.form-grid select,
.form-grid textarea {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--text);
    font: inherit;
    font-weight: 500;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.search-input:focus,
.select-input:focus {
    outline: 3px solid #dbeafe;
    border-color: #93c5fd;
}

.form-grid textarea {
    min-height: 84px;
    padding: 10px 12px;
    resize: vertical;
}

.form-note,
.form-actions {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #eef2f7;
}

.mobile-nav-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1300;
    display: none;
    width: 42px;
    min-height: 42px;
    padding: 0;
    background: var(--sidebar);
    border: 1px solid var(--sidebar-line);
    border-radius: 8px;
}

.mobile-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 3px auto;
    background: white;
}

.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1180;
    display: none;
    padding: 0;
    border: 0;
    background: rgba(11, 18, 32, 0.42);
}

.mobile-nav-backdrop[hidden] {
    display: none;
}

.login-shell {
    width: min(440px, calc(100vw - 32px));
}

.login-panel {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    padding: 28px;
}

.login-panel h1 {
    margin: 0 0 22px;
}

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

    .sidebar nav a:hover,
    button:hover,
    .primary-button:hover,
    .secondary-button:hover,
    .kpi-card:hover,
    .feature-card:hover,
    .alert-item:hover,
    .stack-item:hover,
    .vehicle-card:hover {
        transform: none;
    }
}

@media print {
    body {
        background: white;
    }

    .sidebar,
    .topbar .top-actions,
    .mobile-nav-toggle,
    .report-controls-panel {
        display: none !important;
    }

    .app-shell {
        margin: 0;
        padding: 0;
    }

    .topbar {
        border-bottom: 1px solid #cbd5e1;
        min-height: auto;
        padding: 0 0 12px;
    }

    .panel,
    .map-panel,
    .feature-card {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .report-print-area {
        display: block;
    }

    .table-wrap {
        overflow: visible;
    }

    table,
    .report-table {
        min-width: 0;
        font-size: 10px;
    }

    th,
    td {
        padding: 6px 5px;
        font-size: 10px;
    }
}

@media (max-width: 980px) {
    .sidebar {
        position: fixed;
        width: min(310px, 86vw);
        z-index: 1250;
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    body.nav-open .mobile-nav-backdrop {
        display: block;
    }

    .sidebar nav {
        grid-template-columns: 1fr;
    }

    .app-shell {
        margin-left: 0;
        padding: 18px;
        padding-top: 64px;
    }

    .mobile-nav-toggle { display: inline-grid; place-items: center; }

    .kpi-grid,
    .can-card-grid,
    .dashboard-status-row,
    .configurator-status-grid,
    .dashboard-grid,
    .four-panel-grid,
    .three-panel-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .can-panel {
        position: static;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        overflow: visible;
    }

    body[data-page="dashboard"] {
        height: 100svh;
    }

    body[data-page="dashboard"] .app-shell {
        height: 100svh;
        padding: 12px;
        padding-top: 64px;
        grid-template-rows: auto minmax(0, 1fr);
    }

    body[data-page="dashboard"] .topbar {
        display: flex;
        align-items: stretch;
        gap: 10px;
        min-height: 0;
        padding: 10px 58px 10px 10px;
    }

    body[data-page="dashboard"] .topbar > div:first-child {
        position: static;
        transform: none;
        text-align: left;
        pointer-events: auto;
    }

    body[data-page="dashboard"] .topbar .top-actions {
        justify-content: flex-start;
        width: 100%;
    }

    body[data-page="dashboard"] .leaflet-control-zoom {
        display: none;
    }

    .filter-row,
    .form-actions {
        justify-content: flex-start;
    }

    .trip-filter-row,
    .fuel-filter-row {
        flex-wrap: wrap;
    }

    .trip-filter-row .search-input,
    .fuel-filter-row .search-input {
        width: min(100%, 220px);
        flex: 1 1 180px;
    }
}

@media (max-width: 560px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .can-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vehicle-can-grid { grid-template-columns: 1fr; }
    .can-summary-card { grid-template-columns: 1fr; }
    .can-summary-grid { grid-template-rows: none; grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
    .can-top-card strong { font-size: 16px; }
    #fleet-map { height: 258px; min-height: 258px; }
    body[data-page="dashboard"] #fleet-map {
        height: 100%;
        min-height: 0;
    }
    body[data-page="dashboard"] .topbar h1 {
        font-size: 20px;
        line-height: 1.1;
    }
    body[data-page="dashboard"] .topbar .top-actions {
        justify-content: flex-end;
        gap: 6px;
        flex-wrap: nowrap;
    }
    body[data-page="dashboard"] .topbar .connection,
    body[data-page="dashboard"] .topbar .icon-text-button {
        min-height: 36px;
        padding: 0 8px;
        font-size: 12px;
    }
    body[data-page="dashboard"] .topbar .user-chip {
        max-width: min(42vw, 160px);
        min-height: 36px;
        padding: 4px 8px 4px 4px;
    }
    body[data-page="dashboard"] .topbar .user-avatar {
        width: 28px;
        height: 28px;
    }
    body[data-page="dashboard"] .topbar .user-chip strong {
        max-width: 100px;
        font-size: 12px;
    }
    body[data-page="dashboard"] .topbar .user-chip small {
        max-width: 100px;
        overflow: hidden;
        font-size: 10px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .map-data-tabs {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        flex-direction: column;
    }
    body[data-page="dashboard"] .map-data-tabs {
        display: none;
    }
    .map-data-tab,
    .map-data-tab:not([open]) {
        width: 100%;
    }
    .map-data-tab-panel,
    .map-data-tab .can-summary-card {
        max-height: 44vh;
    }
    .activity-hud {
        position: relative;
        top: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        max-height: none;
        margin-top: 12px;
        border-radius: 8px;
    }
    .activity-scroll { max-height: 220px; }
    .map-filter-tabs {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        max-width: 100%;
        margin-bottom: 0;
        flex-direction: column;
        align-items: stretch;
        transform: none;
    }
    .map-filter-tab {
        justify-content: space-between;
    }
    .map-filter-tab select {
        width: min(210px, 58vw);
    }
    body[data-page="dashboard"] .map-filter-tabs {
        position: relative;
        top: auto;
        left: auto;
        z-index: 1;
        width: 100%;
        max-width: none;
        margin-bottom: 0;
        padding: 6px;
        transform: none;
        flex-direction: row;
        align-items: center;
        gap: 4px;
    }
    body[data-page="dashboard"] .map-filter-tab {
        flex: 1 1 0;
        min-width: 0;
        min-height: 32px;
        padding: 0 5px;
        gap: 4px;
        font-size: 9px;
        white-space: nowrap;
    }
    body[data-page="dashboard"] .map-filter-tab select {
        flex: 1 1 auto;
        min-width: 0;
        width: min(96px, 22vw);
        min-height: 26px;
        padding: 0 5px;
        font-size: 11px;
    }
    body[data-page="dashboard"] .map-filter-reset {
        flex: 0 0 auto;
        padding: 0 7px;
    }
    body[data-page="dashboard"] .leaflet-control-zoom {
        display: none;
    }
    .card-grid,
    .compact-grid,
    .group-summary { grid-template-columns: minmax(0, 1fr); }
    .vehicle-card dl,
    .definition-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) and (max-height: 560px) and (orientation: landscape) {
    body[data-page="dashboard"] .app-shell {
        height: 100svh;
        padding: 8px 10px 10px;
        padding-top: 50px;
        gap: 6px;
        grid-template-rows: auto minmax(300px, 1fr);
    }

    body[data-page="dashboard"] .topbar {
        display: flex;
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
        min-height: 42px;
        padding: 6px 58px 6px 10px;
    }

    body[data-page="dashboard"] .topbar > div:first-child {
        position: static;
        flex: 0 0 auto;
        transform: none;
        text-align: left;
        pointer-events: auto;
    }

    body[data-page="dashboard"] .topbar h1 {
        font-size: 22px;
        line-height: 1;
    }

    body[data-page="dashboard"] .topbar .top-actions {
        flex: 1 1 auto;
        justify-content: flex-start;
        width: auto;
        gap: 8px;
        flex-wrap: nowrap;
    }

    body[data-page="dashboard"] .topbar .connection,
    body[data-page="dashboard"] .topbar .icon-text-button {
        min-height: 34px;
        padding: 0 10px;
        font-size: 12px;
    }

    body[data-page="dashboard"] .topbar .user-chip {
        max-width: 210px;
        min-height: 34px;
        padding: 4px 8px 4px 4px;
    }

    body[data-page="dashboard"] .topbar .user-avatar {
        width: 28px;
        height: 28px;
    }

    body[data-page="dashboard"] .topbar .user-chip strong {
        max-width: 138px;
        font-size: 12px;
    }

    body[data-page="dashboard"] .topbar .user-chip small {
        max-width: 138px;
        overflow: hidden;
        font-size: 10px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body[data-page="dashboard"] .map-data-tabs {
        display: none;
    }

    body[data-page="dashboard"] .map-filter-tabs {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        max-width: none;
        margin-bottom: 0;
        padding: 6px;
        transform: none;
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }

    body[data-page="dashboard"] .map-filter-tab {
        min-height: 32px;
        padding: 0 7px;
        gap: 6px;
        font-size: 10px;
        white-space: nowrap;
    }

    body[data-page="dashboard"] .map-filter-tab select {
        width: min(150px, 22vw);
        min-height: 26px;
        font-size: 12px;
    }

    body[data-page="dashboard"] .dashboard-map-focus,
    body[data-page="dashboard"] .dashboard-map-focus .map-panel,
    body[data-page="dashboard"] .dashboard-map-focus .map-stage,
    body[data-page="dashboard"] #fleet-map {
        min-height: 0;
        height: 100%;
    }

    body[data-page="dashboard"] .dashboard-map-focus {
        min-height: calc(100svh - 150px);
    }

    body[data-page="dashboard"] .dashboard-map-focus .map-panel,
    body[data-page="dashboard"] .dashboard-map-focus .map-stage,
    body[data-page="dashboard"] #fleet-map {
        min-height: 300px;
    }
}

.subscription-feature-list {
    margin-top: 18px;
}

.subscription-feature-list h3 {
    margin: 0 0 10px;
    color: var(--text-primary);
    font-size: 16px;
}

.feature-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.feature-check {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    min-height: 86px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-muted);
}

.feature-check input {
    margin-top: 3px;
}

.feature-check strong,
.feature-check small {
    display: block;
}

.feature-check small {
    margin-top: 4px;
    color: var(--text-muted);
    line-height: 1.35;
}
