:root {
  color-scheme: light;
  --ink: #18283c;
  --muted: #546273;
  --quiet: #657386;
  --navy: #14243a;
  --line: #dce3ea;
  --surface: #fff;
  --canvas: #f1f4f7;
  --lime: #cbea69;
  --available: #1d684a;
  --available-bg: #e9f6ef;
  --out: #28588b;
  --out-bg: #eaf1fe;
  --overdue: #9a382b;
  --overdue-bg: #fcece8;
  --service: #546175;
  --service-bg: #edf0f5;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
[hidden] { display: none !important; }
.shell { width: min(1240px, calc(100% - 72px)); margin-inline: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #386995; outline-offset: 3px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); border: 0; white-space: nowrap;
}
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 4; padding: 10px; background: white; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus { clip-path: none; width: auto; height: auto; overflow: visible; }

.topbar { background: var(--navy); color: #f6f8fb; border-bottom: 1px solid #304156; }
.topbar-inner { display: flex; align-items: center; min-height: 70px; gap: 35px; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; font-size: 20px; font-weight: 730; letter-spacing: -.04em; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 33px; height: 33px; display: grid; place-items: center; position: relative; border-radius: 9px; background: var(--lime); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 4px; background: var(--navy); border-radius: 2px; transform: skew(-23deg); }
.brand-mark::before { height: 17px; left: 11px; }
.brand-mark::after { height: 12px; left: 18px; bottom: 8px; }
.topbar nav { display: flex; gap: 6px; }
.topbar nav a { padding: 10px 14px; border-radius: 8px; color: #c0ccda; text-decoration: none; font-size: 14px; font-weight: 650; white-space: nowrap; }
.topbar nav a[aria-current="page"] { color: #fff; background: #31445b; }
.topbar nav a:hover { background: #31445b; }
.topbar :focus-visible { outline-color: var(--lime); }
.language-control { margin-left: auto; }
.language-control select { min-height: 40px; max-width: 110px; padding: 7px; border: 1px solid #657386; border-radius: 8px; background: var(--navy); color: #fff; font-size: 14px; }
.profile { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.25; }
.profile small { display: block; color: #bac9d8; font-size: 12px; margin-top: 3px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #d9e6f5; color: #284763; font-size: 13px; font-weight: 750; }
.avatar:empty { visibility: hidden; }

main { padding-block: 28px 35px; }
.hero {
  background: #162940;
  background-image: linear-gradient(95deg, #162940 27%, #162940e8 42%, #16294028 81%), url("/showroom.jpg");
  background-size: cover;
  background-position: center, right 57%;
  border-radius: 16px;
  min-height: 178px;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: white;
  margin-bottom: 22px;
}
.hero-content { padding: 26px 34px; }
.site-label { margin: 0 0 7px; color: #d9ef9b; font-size: 13px; font-weight: 680; letter-spacing: .075em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(2rem, 4.3vw, 3.15rem); line-height: 1; letter-spacing: -.055em; font-weight: 760; }
.hero-date { margin: 9px 0 0; color: #d6e0eb; font-size: 15px; }

.overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.metric {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "metric-icon label" "metric-icon number";
  align-items: center; justify-items: start; gap: 3px 13px;
  min-height: 88px; padding: 15px 17px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  text-align: left; transition: border-color .15s, background .15s;
}
.metric:hover, .metric[aria-pressed="true"] { border-color: #586e86; background: #fcfdff; }
.metric[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #586e86; }
.metric-icon { grid-area: metric-icon; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; }
.metric-icon::before, .status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.metric-label { grid-area: label; color: var(--muted); font-size: 14px; font-weight: 630; }
.metric-number { grid-area: number; font-size: 27px; line-height: 1; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
[data-status="available"] { color: var(--available); background: var(--available-bg); }
[data-status="out"] { color: var(--out); background: var(--out-bg); }
[data-status="overdue"] { color: var(--overdue); background: var(--overdue-bg); }
[data-status="service"] { color: var(--service); background: var(--service-bg); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px 22px; }
h2 { font-size: 23px; line-height: 1.1; letter-spacing: -.035em; margin: 0; }
.secondary-copy { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.search { position: relative; display: flex; align-items: center; }
.search input { width: 216px; padding: 9px 11px 9px 35px; min-height: 42px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 14px; }
.search-icon { width: 12px; height: 12px; border: 1.8px solid var(--muted); border-radius: 50%; position: absolute; left: 12px; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 5px; height: 1.8px; background: var(--muted); right: -4px; bottom: -1px; transform: rotate(45deg); }
.text-button { color: #395975; border: 0; background: none; padding: 8px 0; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.fleet-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; }
th { color: #566578; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; background: #f7f9fb; font-weight: 700; padding: 10px 12px; }
td { border-top: 1px solid #e6ebf0; padding: 13px 12px; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 22px; width: 35%; }
th:last-child, td:last-child { padding-right: 22px; text-align: right; }
td:nth-child(3), td:nth-child(4) { min-width: 132px; }
.vehicle { display: flex; align-items: center; gap: 12px; }
.vehicle-icon { flex: none; width: 40px; height: 40px; position: relative; border: 1px solid #e1e8ee; border-radius: 9px; background: #f3f6f9; color: #385875; }
.vehicle-icon::before { content: ""; position: absolute; left: 10px; top: 14px; width: 18px; height: 10px; border: 1.6px solid currentColor; border-radius: 5px 5px 2px 2px; }
.vehicle-icon::after { content: ""; position: absolute; left: 12px; top: 22px; width: 4px; height: 5px; border-radius: 2px; background: currentColor; box-shadow: 10px 0 currentColor; }
.vehicle-name { display: block; font-size: 15px; font-weight: 720; letter-spacing: -.015em; }
.vehicle-meta { display: block; margin-top: 2px; color: var(--quiet); font-size: 13px; }
.registration { font-weight: 650; color: #48586b; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 680; padding: 4px 9px; border-radius: 100px; white-space: nowrap; }
.status-pill::before { width: 6px; height: 6px; }
.cell-hint { display: block; color: var(--quiet); font-size: 13px; margin-top: 2px; }
.late { color: var(--overdue); font-weight: 650; }
.missing { color: var(--quiet); }
.mobile-label { display: none; }
.row-action, .secondary-button, .primary-button {
  min-height: 40px; padding: 8px 13px; border-radius: 8px;
  font-size: 14px; font-weight: 700; border: 1px solid #c9d5df; background: white; color: var(--ink); white-space: nowrap;
}
.row-action { min-width: 94px; }
.row-action[data-action="return"], .primary-button { color: #172c1a; background: var(--lime); border-color: #bad659; }
.row-action:hover, .secondary-button:hover, .primary-button:hover { filter: brightness(.96); }
.empty { margin: 0; padding: 26px 22px; border-top: 1px solid var(--line); color: var(--muted); }
.refreshed { margin: 12px 0 0; text-align: right; font-size: 13px; color: var(--quiet); }
.notice { background: #fff8f4; border: 1px solid #edcec0; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notice p { margin: 0; color: #7f3326; }

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 15px 22px; border-top: 1px solid #e6ebf0; }
.event-name { font-size: 15px; font-weight: 700; }
.event-meta, .event-note { margin: 3px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.event-note { color: var(--ink); }
.event-time { font-size: 13px; color: var(--quiet); text-align: right; }

dialog { width: min(500px, calc(100% - 24px)); padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 18px 75px #10213d4d; }
dialog::backdrop { background: #1222369c; }
.dialog-head, .dialog-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 21px; }
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-footer { border-top: 1px solid var(--line); justify-content: end; }
.close-button { min-width: 40px; min-height: 40px; background: #f1f4f7; color: var(--ink); border: 0; border-radius: 8px; font-size: 23px; line-height: 1; }
.form-body { padding: 17px 21px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-body label { display: block; font-size: 14px; font-weight: 680; margin-bottom: 12px; }
.form-body :is(input, select, textarea):not([type="checkbox"]) { display: block; width: 100%; min-width: 0; min-height: 42px; margin-top: 5px; padding: 8px 10px; color: var(--ink); background: #f9fbfd; border: 1px solid #cbd6e0; border-radius: 7px; font-size: 16px; }
#checkout-fields select { appearance: none; padding-right: 25px; background: linear-gradient(45deg, transparent 50%, #52677e 50%) right 13px center / 5px 5px no-repeat, linear-gradient(135deg, #52677e 50%, transparent 50%) right 8px center / 5px 5px no-repeat, #f9fbfd; }
.form-body textarea { resize: vertical; }
.field-hint { margin: -8px 0 12px; color: var(--muted); font-size: 13px; }
.field-hint:empty { display: none; }
.optional { color: var(--quiet); font-size: 12px; font-weight: 500; }
.checkout-details { margin: 0 0 15px; padding: 11px 12px; border-radius: 7px; background: #edf3f8; color: var(--muted); font-size: 14px; }
.form-body .checkbox-row { display: flex; gap: 9px; align-items: center; margin: 5px 0 2px; min-height: 38px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: #387141; }
.form-error { margin: 10px 0 0; color: var(--overdue); font-size: 14px; }
.toast { position: fixed; bottom: 20px; right: 20px; max-width: calc(100% - 40px); z-index: 2; padding: 13px 18px; border-radius: 10px; background: var(--navy); color: #fff; box-shadow: 0 5px 22px #14243a33; font-size: 15px; }

@media (max-width: 920px) {
  .shell { width: calc(100% - 44px); }
  .topbar-inner { gap: 22px; }
  th:first-child, td:first-child { width: 31%; }
  .vehicle-icon { display: none; }
}

@media (max-width: 760px) {
  .shell { width: calc(100% - 28px); }
  .topbar-inner { min-height: 60px; gap: 14px; flex-wrap: wrap; padding-block: 11px 8px; }
  .wordmark { font-size: 18px; }
  .brand-mark { width: 31px; height: 31px; }
  .profile { margin-left: 0; }
  .profile span + span { display: none; }
  .topbar nav { order: 3; width: 100%; }
  .topbar nav a { padding: 7px 12px; min-height: 36px; }
  main { padding-block: 14px 24px; }
  .hero { min-height: 140px; margin-bottom: 14px; border-radius: 12px; background-position: center, 65% 57%; }
  .hero-content { padding: 20px; }
  .overview { grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 15px; }
  .metric { min-height: 69px; padding: 10px; gap: 2px 9px; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-number { font-size: 23px; }
  .panel-head { flex-wrap: wrap; padding: 15px; gap: 12px; }
  .toolbar { width: 100%; }
  .search, .search input { width: 100%; }
  .fleet-table, tbody { display: block; }
  thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .fleet-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px 8px; padding: 13px 15px; border-top: 1px solid #e6ebf0; }
  .fleet-table td { display: block; width: auto; min-width: 0; padding: 0; border: 0; }
  .fleet-table td:first-child { grid-column: 1; }
  .fleet-table td:nth-child(2) { grid-column: 2; text-align: right; }
  .fleet-table td:last-child { grid-column: 1 / -1; text-align: left; }
  .fleet-table td:last-child:empty { display: none; }
  .fleet-table tr[data-idle] td:nth-child(3), .fleet-table tr[data-idle] td:nth-child(4) { display: none; }
  .mobile-label { display: block; color: var(--quiet); font-size: 12px; }
  .row-action { min-height: 44px; }
  .activity-list li { padding: 13px 15px; gap: 10px; }
}
@media (max-width: 360px) {
  .form-grid, .activity-list li { grid-template-columns: 1fr; }
  .event-time { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

.tracker-state { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.trip-filter { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.trip-filter select { min-height: 42px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
.trip-summary, .trip-footnote { padding: 12px 22px; margin: 0; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.trip-issues { margin: 0 22px 16px; padding: 12px 16px; border-radius: 8px; background: #fff7e6; font-size: 14px; }
.trip-issues ul { margin: 6px 0 0; padding-left: 20px; }
.trip-list { list-style: none; margin: 0; padding: 0; }
.trip-card { padding: 20px 22px; border-top: 1px solid var(--line); }
.trip-card-head { display: flex; gap: 12px; justify-content: space-between; align-items: start; }
.trip-card h3 { margin: 0; font-size: 17px; }
.match-pill { display: inline-block; flex: none; border-radius: 20px; padding: 4px 10px; font-size: 12px; font-weight: 650; }
[data-match="matched"] { background: var(--available-bg); color: var(--available); }
[data-match="unmatched"] { background: var(--out-bg); color: var(--out); }
[data-match="review"] { background: #fff2d6; color: #775217; }
.trip-time { font-size: 14px; color: var(--muted); margin: 10px 0; }
.trip-measures { display: flex; gap: 32px; margin: 10px 0; }
.trip-measures strong, .trip-measures small { display: block; }
.trip-measures small { color: var(--muted); font-size: 12px; }
.trip-reasons { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: #775217; }
@media (max-width: 760px) {
  .trip-card { padding: 16px; }
  .trip-card-head { flex-wrap: wrap; }
  .trip-summary, .trip-footnote { padding: 12px 16px; }
  .trip-issues { margin-inline: 16px; }
  .trip-measures { gap: 22px; }
}

.tracker-panel { margin-bottom: 20px; }
.tracker-section-title { margin: 0; padding: 16px 22px 10px; border-top: 1px solid var(--line); font-size: 17px; }
.tracker-list { list-style: none; margin: 0; padding: 0; }
.tracker-card { padding: 18px 22px; border-top: 1px solid var(--line); }
.tracker-card h3 { margin: 0; font-size: 17px; }
.tracker-car { margin: 10px 0 6px; font-size: 15px; font-weight: 650; }
.tracker-card button { margin-top: 12px; }
.tracker-hint { color: #775217; font-size: 13px; margin-bottom: 0; }
.tracker-card button:disabled { cursor: not-allowed; }
.topbar nav { flex-wrap: wrap; }
@media (max-width: 1100px) and (min-width: 761px) {
  .topbar-inner { gap: 14px; flex-wrap: wrap; padding-block: 10px; }
  .topbar nav { order: 3; width: 100%; }
}
@media (max-width: 760px) {
  .tracker-card { padding: 16px; }
  .tracker-section-title { padding-inline: 16px; }
  #tracker-dialog .dialog-footer { flex-wrap: wrap; }
}

.map-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 0 22px 18px; }
.map-controls label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.map-controls label:first-child { flex: 1; min-width: 180px; }
.map-controls :is(select,input) { max-width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: white; color: var(--ink); }
#speed-threshold { width: 120px; }
.fleet-map { height: 440px; background: #e4eff3; z-index: 0; border-block: 1px solid var(--line); }
.city-label { box-shadow: none; background: transparent; border: 0; font-weight: 650; color: #52665d; }
.city-label::before { display: none; }
.leaflet-tooltip.map-speed-tooltip { background: var(--navy); border-color: var(--navy); color: white; font-weight: 600; }
.map-speed-tooltip.leaflet-tooltip-top::before { border-top-color: var(--navy); }
.map-message { margin: 0; padding: 14px 22px; font-size: 15px; }
.map-footnote { padding: 9px 22px; margin: 0; color: var(--muted); font-size: 12px; }
.position-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 10px; padding: 0 22px 20px; }
.position-card { text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 12px; color: var(--ink); background: white; }
.position-card[aria-pressed="true"] { border-color: #2a6580; background: #f0f7fc; }
.position-card span, .position-card small { display: block; color: var(--muted); margin-top: 3px; }
.speed-chart { margin: 0 20px; cursor: crosshair; }
.speed-chart svg { display: block; width: 100%; }
.scrubber-label { display: grid; gap: 6px; padding: 0 22px; font-size: 13px; }
#route-scrubber { width: 100%; accent-color: #245c82; }
.point-readout { margin: 10px 22px; padding: 12px; border-radius: 8px; background: #eef4f8; font-size: 14px; }
.route-events { list-style: none; padding: 0 22px 15px; margin: 0; display: grid; gap: 8px; }
.event-review { display: grid; gap: 4px; width: 100%; padding: 12px; text-align: left; color: #775217; background: #fff6e3; border: 1px solid #e9d9b6; border-radius: 8px; }
.event-review span { font-size: 13px; }
.route-button { margin-top: 12px; }
.location-button { display: block; margin-left: auto; }
@media (max-width: 760px) {
  .fleet-map { height: 350px; }
  .map-controls { padding: 0 16px 14px; }
  .map-message, .map-footnote { padding-inline: 16px; }
  .position-list { padding-inline: 16px; }
  .location-button { margin-left: 0; }
}
