:root {
    --primary: #0B6B5C; --on-primary: #FFFFFF; --sidebar: #1C2A33; --on-sidebar: #FFFFFF; --accent: #E8A317;
    --ground: #F2F4F3; --surface: #FFFFFF; --ink: #14212A; --muted: #55656F; --line: #D8DEDD; --danger: #B3261E;
    --sidebar-width: 264px; --rail-width: 72px; --topbar: 60px;
    font-family: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-size: 16px; line-height: 1.5; }
h1, h2, p, dl, dd, ul { margin: 0; padding: 0; }
img { max-width: 100%; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 50; padding: 8px 14px; background: var(--surface); }
.skip-link:focus { top: 8px; }

/* Shell */
.shell { min-height: 100dvh; }
.workspace { margin-inline-start: var(--sidebar-width); min-width: 0; transition: margin .2s ease; }
.nav-rail .workspace { margin-inline-start: var(--rail-width); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; height: var(--topbar); padding-inline: 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.page-title { flex: 1 1 auto; min-width: 0; font-size: 1.125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; min-width: 0; }
.account-name { color: var(--muted); font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button { flex: none; width: 44px; height: 44px; border: 0; border-radius: 6px; background: none; color: var(--ink); cursor: pointer; }
.icon-button:hover { background: var(--ground); }
.content { display: grid; gap: 20px; width: 100%; padding: 24px; }

/* Sidebar */
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 30; display: flex; flex-direction: column; width: var(--sidebar-width); background: var(--sidebar); color: var(--on-sidebar); transition: width .2s ease, transform .2s ease; }
.nav-rail .sidebar { width: var(--rail-width); }
.brand { display: flex; align-items: center; gap: 12px; height: var(--topbar); flex: none; padding-inline: 18px; color: inherit; text-decoration: none; overflow: hidden; }
.brand-logo { flex: none; width: 36px; height: 36px; object-fit: contain; border-radius: 6px; }
.brand-logo-empty { display: grid; place-items: center; background: var(--primary); color: var(--on-primary); }
.brand-name { font-weight: 600; font-size: 1.0625rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding-block: 8px 24px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 14px; min-height: 44px; padding-inline: 26px 16px; color: color-mix(in srgb, var(--on-sidebar) 82%, var(--sidebar)); text-decoration: none; white-space: nowrap; cursor: pointer; list-style: none; }
.nav-item::-webkit-details-marker { display: none; }
a.nav-item:hover, summary.nav-item:hover { background: color-mix(in srgb, var(--on-sidebar) 8%, transparent); color: var(--on-sidebar); }
.nav-icon { flex: none; width: 20px; text-align: center; }
.nav-fold { margin-inline-start: auto; font-size: .75rem; transition: transform .15s ease; }
.nav-group[open] > summary .nav-fold { transform: rotate(180deg); }
.nav-item.is-pending { cursor: default; color: color-mix(in srgb, var(--on-sidebar) 62%, var(--sidebar)); }
/* The active page sits on a dashed road marking. */
.nav-item.is-active { color: var(--on-sidebar); font-weight: 500; background: color-mix(in srgb, var(--on-sidebar) 10%, transparent); }
.nav-item.is-active::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 8px; width: 3px; background: repeating-linear-gradient(to bottom, var(--accent) 0 8px, transparent 8px 13px); }
.nav-rail .nav-text { display: none; }
.nav-rail .nav-item { padding-inline: 26px; }
.nav-rail .brand { padding-inline: 18px; }
.nav-rail .nav-children { background: color-mix(in srgb, var(--on-sidebar) 6%, transparent); }
.scrim { display: none; }

/* Dashboard readout: one instrument strip instead of a row of cards */
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.readout-item { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; padding: 18px 20px; background: var(--surface); }
.readout dt { color: var(--muted); font-size: .9375rem; }
.readout dd { font-size: 2.25rem; line-height: 1.15; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Panels, tables */
.panel { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.panel h2 { margin-block-end: 12px; font-size: 1.0625rem; font-weight: 600; }
.empty, .hint { color: var(--muted); font-size: .9375rem; overflow-wrap: anywhere; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 8px 10px; text-align: start; color: var(--muted); font-weight: 500; font-size: .875rem; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: 0; }
.severity { font-weight: 500; }
.severity-high, .severity-critical { color: var(--danger); }
.severity-medium { color: #8A5A00; }
.severity-low { color: var(--muted); }

/* Forms */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field > label { font-weight: 500; font-size: .9375rem; }
input[type=text], input[type=password] { width: 100%; min-height: 44px; padding: 8px 12px; background: var(--surface); border: 1px solid #9AA8A8; border-radius: 6px; }
input[type=file] { width: 100%; font-size: 1rem; }
input[type=file]::file-selector-button { min-height: 44px; margin-inline-end: 10px; padding: 8px 14px; background: var(--surface); border: 1px solid #9AA8A8; border-radius: 6px; font: inherit; cursor: pointer; }
.field-error { padding: 10px 14px; color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-radius: 6px; list-style: none; }
.notice { padding: 10px 14px; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); border-inline-start: 3px solid var(--primary); border-radius: 4px; }
.button { min-height: 44px; padding: 8px 18px; background: var(--surface); border: 1px solid #9AA8A8; border-radius: 6px; font-weight: 500; cursor: pointer; }
.button:hover { background: var(--ground); }
.button-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.button-primary:hover { background: color-mix(in srgb, var(--primary) 86%, #000); }
.button-wide { width: 100%; }
.settings { display: grid; gap: 20px; max-width: 860px; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-block-start: 12px; }
.color-field { display: flex; gap: 8px; }
.color-field input[type=color] { flex: none; width: 44px; height: 44px; padding: 2px; background: none; border: 1px solid #9AA8A8; border-radius: 6px; cursor: pointer; }
.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.upload { display: flex; gap: 14px; min-width: 0; }
.upload-preview { flex: none; display: grid; place-items: center; width: 72px; height: 72px; background: var(--sidebar); border-radius: 6px; }
.upload-preview img { width: 52px; height: 52px; object-fit: contain; }
.check { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Login */
.login { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100dvh; }
.login-side { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 48px; background: var(--sidebar); color: var(--on-sidebar); overflow: hidden; }
.login-side::after { content: ""; position: absolute; inset-block: 0; inset-inline-end: 56px; width: 6px; background: repeating-linear-gradient(to bottom, var(--accent) 0 44px, transparent 44px 80px); }
.login-logo { width: 64px; height: 64px; object-fit: contain; margin-block-end: 8px; }
.login-brand { font-size: 2.25rem; line-height: 1.15; font-weight: 600; padding-inline-end: 80px; }
.login-line { max-width: 30ch; padding-inline-end: 80px; color: color-mix(in srgb, var(--on-sidebar) 80%, var(--sidebar)); }
.login-main { display: grid; place-items: center; padding: 32px 16px; }
.login-form { display: grid; gap: 16px; width: 100%; max-width: 360px; }
.login-form h1 { font-size: 1.5rem; font-weight: 600; }

/* Tablet and phone: the sidebar becomes a drawer */
@media (max-width: 991px) {
    .workspace, .nav-rail .workspace { margin-inline-start: 0; }
    .sidebar, .nav-rail .sidebar { width: min(var(--sidebar-width), 84vw); transform: translateX(-100%); }
    [dir=rtl] .sidebar { transform: translateX(100%); }
    .nav-rail .nav-text { display: revert; }
    .nav-rail .nav-item { padding-inline: 26px 16px; }
    .nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; width: 100%; border: 0; background: rgba(10, 20, 26, .5); }
    .nav-open body { overflow: hidden; }
}
@media (max-width: 700px) {
    .content { padding: 16px; gap: 16px; }
    .account-name { display: none; }
    /* Only the page title shrinks on a narrow bar; the buttons keep their size. */
    .account { flex: none; }
    .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .readout-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .readout-item { padding: 14px 16px; }
    .readout dd { font-size: 1.75rem; }
    .panel { padding: 16px; }
    /* Table rows become labelled blocks */
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; }
    .table tr { padding-block: 10px; border-bottom: 1px solid var(--line); }
    .table tr:last-child { border-bottom: 0; }
    /* The label sits in a fixed column; everything in the cell flows together beside it. */
    .table td { position: relative; min-height: 26px; padding: 3px 0 3px 106px; border: 0; }
    .table td::before { content: attr(data-label); position: absolute; inset-inline-start: 0; top: 4px; width: 96px; color: var(--muted); font-size: .875rem; }
    [dir=rtl] .table td { padding: 3px 106px 3px 0; }
    .actions .button { flex: 1 1 100%; }
    .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; }
    .login-side { padding: 28px 16px; }
    .login-side::after { inset-block: auto 0; inset-inline: 0; width: auto; height: 5px; background: repeating-linear-gradient(to right, var(--accent) 0 28px, transparent 28px 48px); }
    .login-brand { font-size: 1.625rem; padding-inline-end: 0; }
    .login-line { padding-inline-end: 0; }
    .login-logo { width: 44px; height: 44px; }
    .login-main { place-items: start center; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Shared page pieces */
input[type=number], input[type=email], input[type=date], input[type=search], input[type=tel], input[type=time], select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; background: var(--surface); border: 1px solid #9AA8A8; border-radius: 6px; font: inherit; color: inherit; }
textarea { min-height: 88px; resize: vertical; }
.toolbar { display: flex; justify-content: flex-end; gap: 10px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.form-grid h2 { margin: 0; }
.span-all { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
.two-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-block-end: 12px; }
.panel-head h2 { margin: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.button-primary { color: var(--on-primary); }
.button-small { min-height: 36px; padding: 4px 12px; font-size: .9375rem; }
.button-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--surface)); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.link-button { padding: 0; background: none; border: 0; color: var(--primary); text-decoration: underline; cursor: pointer; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.row-edit summary { list-style: none; }
.row-edit summary::-webkit-details-marker { display: none; }
.row-edit[open] { flex-basis: 100%; }
.row-edit form { margin-block-start: 10px; text-align: start; }
.inline { display: inline; }
.assign { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.assign select, .assign input { width: auto; min-width: 130px; flex: 1; min-height: 36px; padding: 4px 8px; }
.dot { display: inline-block; width: 9px; height: 9px; margin-inline-end: 7px; border-radius: 50%; }
.dot-on { background: #1E8E4E; }
.dot-off { background: #9AA8A8; }
.swatch { display: inline-block; width: 12px; height: 12px; margin-inline-end: 8px; border-radius: 3px; }
.color-input { width: 64px; height: 44px; padding: 2px; background: none; border: 1px solid #9AA8A8; border-radius: 6px; }
.vehicle-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.vehicle-picks legend { padding-inline: 6px; font-weight: 500; font-size: .9375rem; }
.readout dd.readout-text { font-size: 1.25rem; line-height: 1.6; overflow-wrap: anywhere; }
.test-banner { padding: 8px 14px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-inline-start: 3px solid var(--accent); border-radius: 4px; font-size: .9375rem; }
.issue-shot { width: 100%; max-height: 420px; object-fit: contain; background: var(--ground); border: 1px solid var(--line); border-radius: 6px; }
.issue-files { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9em; }
.issue-files a { overflow-wrap: anywhere; }
.pagination { display: flex; align-items: center; gap: 12px; margin-block-start: 14px; }
.pagination [aria-disabled=true] { opacity: .5; cursor: default; }

/* Maps */
.map { width: 100%; height: 440px; border-radius: 6px; background: #DDE3E2; z-index: 0; }
.map-tall { height: calc(100dvh - var(--topbar) - 48px); min-height: 380px; }
.tracking { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; }
/* Map pages use the whole screen: less padding, taller maps. */
.content:has(> .tracking) { padding: 16px; }
#replay-map { height: calc(100dvh - var(--topbar) - 300px); min-height: 420px; }
#fence-map { height: max(60dvh, 420px); }
.tracking-list { display: flex; flex-direction: column; gap: 10px; min-height: 0; max-height: calc(100dvh - var(--topbar) - 48px); }
.vehicle-list { flex: 1; overflow-y: auto; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.vehicle-list button { display: block; width: 100%; padding: 10px 14px; text-align: start; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.vehicle-list button:hover { background: var(--ground); }
.vehicle-list small { display: block; color: var(--muted); }
.popup-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 8px; }
.replay-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-block-start: 12px; }
.replay-bar input { flex: 1; min-width: 160px; }

/* Header action pills */
.header-actions { display: flex; flex: none; align-items: center; gap: 8px; margin-inline-start: auto; }
.header-actions ~ .account { margin-inline-start: 4px; }
.pill-wrap { position: relative; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; border: 0; cursor: pointer; color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; transition: transform .12s, box-shadow .12s; }
.pill:hover { transform: translateY(-1px); }
.pill:disabled { opacity: .6; cursor: default; }
.pill-icon { width: 15px; height: 15px; flex-shrink: 0; }
.pill-report { background: linear-gradient(135deg, #7c3aed, #2563eb); box-shadow: 0 2px 10px rgba(79, 70, 229, .45); }
.pill-report:hover { box-shadow: 0 4px 16px rgba(79, 70, 229, .55); }
.pill-report.is-capturing { opacity: .75; }
.pill-report.is-error { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.pill-push { background: linear-gradient(135deg, #f59e0b, #ea580c); box-shadow: 0 2px 10px rgba(234, 88, 12, .4); }
.pill-install { background: linear-gradient(135deg, #059669, #0d9488); box-shadow: 0 2px 10px rgba(5, 150, 105, .4); }
.pill-spinner { width: 15px; height: 15px; flex-shrink: 0; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: pill-spin .7s linear infinite; }
@keyframes pill-spin { to { transform: rotate(360deg); } }
.popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: 18rem; max-width: calc(100vw - 24px); padding: 12px 14px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 33, 42, .18); font-size: 14px; white-space: normal; }
.popover a { color: var(--primary); }
.toast { position: fixed; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px); padding: 10px 16px; background: var(--ink); color: #fff; border-radius: 6px; font-size: 14px; }
.toast.is-error { background: var(--danger); }
.leaflet-container { font-family: inherit; }
@media (max-width: 767px) {
    .pill-label { display: none; }
    .pill { padding: 8px 10px; }
    .header-actions { gap: 5px; }
}
@media (max-width: 900px) {
    .tracking { grid-template-columns: minmax(0, 1fr); }
    .tracking-list { order: 2; max-height: none; }
    .tracking-list .vehicle-list { overflow: visible; }
    .map-tall { height: 62dvh; min-height: 300px; }
    #replay-map { height: 56dvh; min-height: 300px; }
    .map { height: 340px; }
}
@media (max-width: 700px) {
    .row-actions { justify-content: flex-start; margin-block-start: 6px; }
    .table td.row-actions { display: flex; padding-inline-start: 0; }
    .table td.row-actions::before { content: none; }
}

/* Live tracking: name labels and vehicle card */
.leaflet-tooltip.vehicle-label { padding: 2px 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 1px 4px rgba(20, 33, 42, .2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.leaflet-tooltip-top.vehicle-label::before { border-top-color: var(--surface); }
.vehicle-popup .leaflet-popup-content-wrapper { padding: 0; border-radius: 10px; overflow: hidden; }
.vehicle-popup .leaflet-popup-content { margin: 0; width: auto !important; font: inherit; }
.vehicle-card { min-width: 270px; }
.vehicle-card-actions .button { white-space: nowrap; }
.leaflet-tooltip-bottom.vehicle-label::before { border-bottom-color: var(--surface); }
.vehicle-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 36px 10px 14px; background: var(--sidebar); color: var(--on-sidebar); }
.vehicle-card-head strong { font-size: 1rem; }
.vehicle-card-plate { font-size: .8125rem; opacity: .8; white-space: nowrap; }
.vehicle-card-chips { display: flex; gap: 6px; padding: 10px 14px 0; }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 600; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-on { background: #E3F4EA; color: #1E7A45; }
.chip-off { background: #ECEFF1; color: #55656F; }
.chip-moving { background: #E4ECFD; color: #1D4FD8; }
.chip-idle { background: #F3EEE2; color: #7A5A12; }
.vehicle-card-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; padding: 10px 14px; font-size: .875rem; }
.vehicle-card-facts dt { color: var(--muted); }
.vehicle-card-facts dd { margin: 0; text-align: end; font-weight: 500; font-variant-numeric: tabular-nums; }
.vehicle-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.vehicle-card-actions .button { width: 100%; }
.vehicle-card-actions .button:last-child { grid-column: 1 / -1; }
.vehicle-popup a.leaflet-popup-close-button { color: var(--on-sidebar); top: 8px; right: 8px; }
.nowrap { white-space: nowrap; }

/* Installed app (PWA): keep content clear of the notch and the home bar. */
.topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar) + env(safe-area-inset-top)); padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
.content { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.sidebar { padding-top: env(safe-area-inset-top); }

/* Touch screens: every control at least 44px high, the size of a fingertip. */
@media (pointer: coarse), (max-width: 767px) {
    .button, .button-small { min-height: 44px; }
    .button-small { padding: 6px 14px; }
    .assign select, .assign input { min-height: 44px; }
    .pill { min-width: 40px; min-height: 40px; justify-content: center; }
    .icon-button { width: 44px; height: 44px; }
    .link-button { min-height: 44px; }
    .replay-bar input[type=range] { height: 44px; }
    .check { min-height: 44px; }
    .check input { width: 22px; height: 22px; }
    .vehicle-list button { min-height: 52px; }
}
.impersonation-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #FFF4E5; border: 1px solid #F0C27A; border-inline-start: 4px solid #D97706; border-radius: 6px; font-weight: 500; }
.chip-danger { background: #FDE8E7; color: #B3261E; }

/* Live tracking: operator panel */
.fleet-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.fleet-filter { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: .75rem; color: var(--muted); cursor: pointer; }
.fleet-filter strong { font-size: 1.25rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.fleet-filter .dot, .vehicle-row .dot { flex: none; width: 9px; height: 9px; margin: 0; }
.fleet-filter-label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.fleet-filter[aria-pressed=true] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); color: var(--ink); }
.vehicle-list button.vehicle-row { display: grid; gap: 2px; padding: 10px 14px; border-inline-start: 3px solid transparent; }
.vehicle-list button.vehicle-row.is-selected { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); border-inline-start-color: var(--primary); }
.vehicle-row-top { display: flex; align-items: center; gap: 8px; }
.vehicle-row-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-row-speed { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: #1E7A45; }
.vehicle-row-speed.is-speeding { color: var(--danger); }
.vehicle-row small { padding-inline-start: 18px; font-size: .8125rem; }
.vehicle-row-flags { display: flex; flex-wrap: wrap; gap: 4px; padding-inline-start: 18px; margin-block-start: 2px; }
.vehicle-row-flags .chip { font-size: .75rem; padding: 1px 8px; }
.vehicle-list-empty { padding: 16px 14px; color: var(--muted); }
.fleet-refresh { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fleet-refresh.is-lost { padding: 8px 10px; background: #FDE8E7; color: var(--danger); border-radius: 6px; font-weight: 600; }
.vehicle-card-summary { padding: 8px 14px 0; font-size: .875rem; font-weight: 600; }
.vehicle-card-chips { flex-wrap: wrap; }
.vehicle-card-links { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; }
.vehicle-card-links .button { flex: 1 1 auto; text-align: center; text-decoration: none; white-space: nowrap; }
.vehicle-popup .leaflet-popup-content .vehicle-card-links a.button { color: var(--ink); }
.map-fit { padding: 6px 12px; background: var(--surface); color: var(--ink); border: 2px solid rgba(0, 0, 0, .2); border-radius: 4px; background-clip: padding-box; font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; }
.map-fit:hover { background: var(--ground); }
@media (pointer: coarse), (max-width: 767px) { .fleet-filter { min-height: 52px; } .map-fit { min-height: 40px; } }
.vehicle-card-summary + .vehicle-card-facts { padding-block-start: 6px; }
.vehicle-card-links { flex-wrap: nowrap; }
.vehicle-card-links .button { flex: 1 1 0; min-width: 0; min-height: 34px; padding: 4px 6px; font-size: .8125rem; }
.vehicle-card-commands { border-top: 1px solid var(--line); }
.vehicle-card-commands summary { padding: 9px 14px; font-size: .875rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.vehicle-card-commands .vehicle-card-actions { border-top: 0; padding-block-start: 2px; }
@media (max-width: 900px) { .tracking .map-tall { height: 62dvh; min-height: 340px; } }
.vehicle-popup .leaflet-popup-content p.vehicle-card-summary { margin: 0; }

/* Trips: one-click periods and a list grouped by day */
.periods { display: flex; flex-wrap: wrap; gap: 6px; }
.periods [aria-current=true] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .day-row th { padding: 14px 10px 8px; background: var(--ground); border-bottom: 1px solid var(--line); color: var(--ink); font-size: .9375rem; }
.day-name { font-weight: 600; text-transform: capitalize; }
.day-totals { margin-inline-start: 12px; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.trips-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 700px) {
    .table .num { text-align: start; }
    .table tr.day-row { display: block; padding: 0; }
    .table .day-row th { display: block; padding: 10px 12px; border-radius: 6px; }
    .day-totals { display: block; margin: 0; }
}

/* API access */
.api-code { display: block; padding: 10px 12px; background: var(--ground); border: 1px solid var(--line); border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875rem; overflow-x: auto; white-space: pre; direction: ltr; text-align: left; }
.api-key-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.api-key-row .api-code { flex: 1 1 260px; white-space: normal; overflow-wrap: anywhere; user-select: all; }
.api-new { border-color: var(--primary); }
.api-create { display: grid; gap: 14px; max-width: 460px; }
.api-docs code { direction: ltr; unicode-bidi: isolate; }

/* Language menu */
.language-menu { position: relative; flex: none; }
.language-menu > summary { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: auto; min-width: 44px; padding-inline: 8px; list-style: none; }
.language-menu > summary::-webkit-details-marker { display: none; }
.language-code { font-size: .75rem; font-weight: 600; letter-spacing: .02em; }
.language-list { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 45; min-width: 10rem; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 33, 42, .18); }
.language-list a { display: block; padding: 10px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.language-list a:hover, .language-list a:focus-visible { background: var(--ground); }
.language-list a[aria-current] { font-weight: 600; color: var(--primary); }
.header-actions ~ .language-menu { margin-inline-start: 4px; }
.login-main { position: relative; }
.login-language { position: absolute; top: 12px; inset-inline-end: 12px; }
[dir=rtl] .popover { right: auto; left: 0; }
[dir=rtl] .vehicle-popup a.leaflet-popup-close-button { right: auto; left: 8px; }
[dir=rtl] .toast { transform: translateX(50%); }
[dir=rtl] .api-code, [dir=rtl] code, [dir=rtl] .ltr { direction: ltr; unicode-bidi: isolate; }

/* Sign-up requests, offers form, choices */
.nav-badge { margin-inline-start: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #14212A; font-size: .8125rem; font-weight: 600; text-align: center; }
.nav-rail .nav-badge { position: absolute; top: 6px; inset-inline-end: 10px; min-width: 18px; padding: 0 5px; font-size: .6875rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .9375rem; }
.tab.is-active { background: var(--sidebar); border-color: var(--sidebar); color: var(--on-sidebar); }
.signup-card { display: grid; gap: 14px; }
.signup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.signup-head h2 { margin: 0; }
.signup-head .hint { margin-inline-start: auto; }
.signup-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 20px; }
.signup-facts dt { color: var(--muted); font-size: .875rem; }
.signup-facts dd { overflow-wrap: anywhere; }
.signup-message { padding: 10px 14px; background: var(--ground); border-radius: 6px; white-space: pre-line; overflow-wrap: anywhere; }
.signup-follow { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 3fr) auto; gap: 12px; align-items: end; }
.credentials { border-inline-start: 4px solid var(--accent); }
.credentials strong { font-size: 1.125rem; user-select: all; }
.choice { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 0; padding: 0; border: 0; }
.choice legend { padding: 0; margin-block-end: 6px; font-weight: 500; }
.choice label, .check { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.choice input, .check input { width: 20px; height: 20px; accent-color: var(--primary); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 20px; }
.check { align-self: end; }
@media (max-width: 640px) { .signup-follow { grid-template-columns: 1fr; } }

/* Inside the Android app: nothing about installing or browser notifications, the app does both itself. */
.in-app #push-wrap, .in-app #install-wrap, .in-app a[href$="/android"] { display: none !important; }

/* Demo site: one-click sign-in for each role, under the normal form. */
.login-main:has(.demo-logins) { align-content: center; gap: 28px; }
.demo-logins { display: grid; gap: 10px; width: 100%; max-width: 360px; padding-top: 24px; border-top: 1px solid var(--line, rgba(0,0,0,.12)); }
.demo-logins h2 { font-size: 1.125rem; font-weight: 600; }
.demo-login { display: grid; gap: 2px; width: 100%; padding: 12px 14px; text-align: start; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line, rgba(0,0,0,.16)); border-inline-start: 3px solid var(--accent); border-radius: 6px; cursor: pointer; }
.demo-login:hover, .demo-login:focus-visible { border-color: var(--primary); }
.demo-login span { font-size: .875rem; opacity: .75; }
.test-banner a { font-weight: 600; white-space: nowrap; }
