:root {
  color-scheme: dark;
  --bg: #111827;
  --panel: #1a2537;
  --panel2: #212e43;
  --line: #344256;
  --text: #f4f7fc;
  --muted: #a9b7ca;
  --yellow: #ffd15c;
  --green: #52d7a2;
  --danger: #ff9b9b;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 14px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
button { border: 1px solid transparent; border-radius: 10px; font-weight: 700; color: var(--text); }
input {
  width: 100%; min-width: 0; border: 1px solid var(--line); padding: 11px 12px;
  border-radius: 9px; background: #121c2d; color: var(--text);
}
input::placeholder { color: #889ab0; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; }
small, .hint { color: var(--muted); font-weight: 450; }
a { color: #ffe199; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(25px, 3vw, 38px); font-weight: 760; letter-spacing: -.035em; line-height: 1.1; }
h2 { font-size: 19px; letter-spacing: -.022em; }
p { line-height: 1.5; }
.primary { background: var(--yellow); color: #172030; padding: 11px 15px; min-height: 43px; }
.primary:not(:disabled):hover { background: #ffe094; }
.quiet { background: #1d2a3e; padding: 8px 12px; border-color: var(--line); }
.quiet:hover { background: #2a3950; }
.compact { padding: 5px 9px; font-size: 12px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand img { flex: 0 0 auto; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-button { background: none; padding: 0; text-align: left; }
.brand-button:hover strong { color: var(--yellow); }
#app { height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: relative; z-index: 2; flex: 0 0 auto; min-height: 54px; padding: 8px 14px; background: #151f30;
  border-bottom: 1px solid var(--line); display: grid; align-items: center; gap: 12px;
  grid-template-columns: minmax(0, 1fr) min(38vw, 540px) minmax(max-content, 1fr);
}
.topbar .brand-button { justify-self: start; max-width: 100%; }
.top-actions { grid-column: 3; grid-row: 1; display: flex; align-items: center; gap: 7px; }
.map-actions { display: flex; align-items: center; gap: 7px; margin-inline: auto; }
.top-actions button[aria-current] { border-color: var(--yellow); }
#traffic-toggle[aria-pressed=true] { color: var(--yellow); border-color: var(--yellow); }
.address-search { grid-column: 2; grid-row: 1; position: relative; min-width: 0; }
.address-form { display: flex; align-items: center; gap: 6px; }
.address-form input { height: 36px; padding: 7px 10px; }
.address-form button { min-height: 36px; }
.address-panel {
  position: absolute; top: calc(100% + 7px); inset-inline: 0; padding: 7px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 8px 25px #08101a70;
}
.address-panel .feedback:not(:empty) { padding: 5px 7px; }
.address-results { display: grid; gap: 4px; max-height: 45dvh; overflow: auto; }
.address-result { padding: 8px 10px; text-align: left; line-height: 1.4; overflow-wrap: anywhere; }
.address-district { padding: 5px 8px 2px; color: var(--yellow); font-size: 11px; font-weight: 700; }
.icon-button { display: grid; place-items: center; padding: 0; width: 34px; height: 34px; flex: 0 0 auto; }
.connection-warning { position: absolute; right: 14px; top: calc(100% + 7px); padding: 5px 8px; border-radius: 6px; background: var(--panel); color: var(--danger); font-size: 11px; }
.workspace { flex: 1; min-height: 0; overflow: auto; }
.live-grid { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) clamp(144px, 11vw, 200px); }
.surface, .fleet-row, .login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.map-card { min-width: 0; min-height: 0; position: relative; overflow: hidden; isolation: isolate; }
#map { position: absolute; inset: 0; background: #dce4ea; color: #172030; }
.map-note { position: absolute; z-index: 650; bottom: 26px; left: 12px; max-width: calc(100% - 24px); color: #3b2805; background: #fff0bf; border: 1px solid #dfbc5a; box-shadow: 0 3px 16px #11182725; border-radius: 8px; padding: 6px 9px; font-size: 12px; }
.dispatch-card { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #151f30; border-left: 1px solid var(--line); }
.available-list { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px; }
.vehicle-group { padding: 10px 5px 5px; color: var(--text); font-size: 14px; font-weight: 800; letter-spacing: .015em; font-variant-numeric: tabular-nums; }
.vehicle-group:first-child { padding-top: 5px; }
.zone-editor {
  position: absolute; z-index: 700; top: 10px; left: 10px; width: min(340px, calc(100% - 20px));
  display: grid; gap: 9px; padding: 11px; box-shadow: 0 5px 18px #11182755;
}
.check-field { display: flex; align-items: center; gap: 8px; }
.check-field input { width: auto; }
.viewer-topbar { grid-template-columns: minmax(0, 1fr) auto; }
.viewer-topbar .top-actions { grid-column: 2; }
.vehicle-button {
  width: 100%; height: clamp(18px, calc((100dvh - 94px) / 30), 27px);
  display: flex; align-items: center; justify-content: flex-start; gap: 6px; padding: 1px 4px; margin-bottom: 1px;
  background: #1c2a3e; border: 1px solid #314159; border-radius: 6px;
}
button.vehicle-button:hover, .vehicle-button[aria-pressed=true] { border-color: var(--yellow); background: #2d3748; }
.plate-chip {
  display: grid; place-items: center; flex-shrink: 0; min-width: 32px; height: 100%; padding: 0 5px;
  border: 1px solid #fff2cc; border-radius: 6px; color: #1d2837; background: #ffda78;
  font-size: 13px; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums;
}
.vehicle-button[data-stale=true] .plate-chip { background: #a4aebb; color: #172030; border-color: #d1d7de; }
.vehicle-button[data-trip=true] .plate-chip { background: #b91c30; color: #fff; border-color: #ffc2c9; }
.vehicle-distance { min-width: 0; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pickup { display: grid; gap: 7px; padding: 8px; border-top: 1px solid var(--line); }
.pickup-line { display: flex; align-items: center; gap: 6px; }
.pickup input { padding: 7px 8px; }
.pickup .icon-button { font-size: 20px; }
.feedback { color: var(--muted); font-size: 12px; }
.feedback:empty { display: none; }
.dispatch-card > .feedback { padding: 8px; border-top: 1px solid var(--line); }
.feedback[data-error=true], .form-error { color: var(--danger); }
.map-marker { display: grid; place-items: center; position: relative; min-width: 41px; min-height: 33px; white-space: nowrap; padding: 4px 8px; background: #ffda78; color: #1d2837; border: 2px solid #fff; box-shadow: 0 3px 8px #12223957; border-radius: 9px; font: 850 17px system-ui,sans-serif; }
.map-marker::after { content: ""; position: absolute; bottom: -6px; width: 7px; height: 7px; background: inherit; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.map-marker.selected, .map-marker.selected::after { border-color: #172030; }
.map-marker.stale { background: #a4aebb; color: #172030; }
.map-marker.trip { background: #b91c30; color: #fff; }
.map-marker.pick { color: #182235; background: #9cd9ff; min-width: 27px; width: 27px; height: 27px; padding: 0; border-radius: 50%; }
.leaflet-marker-icon.marker-shell { background: transparent; border: 0; width: auto !important; height: auto !important; }
.marker-shell .map-marker { transform: translate(-50%, -100%); }
.leaflet-container .leaflet-control-attribution { font-size: 9px; }
.leaflet-container a { color: #145a91; }
.surface { min-width: 0; padding: 16px; }
.fleet-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.invite-form { display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.invite-form label { flex: 1 1 120px; }
.plate-fields { flex: 1 1 188px; min-width: 0; margin: 0; padding: 0; border: 0; }
.plate-fields legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 650; }
.plate-parts { display: grid; grid-template-columns: 42px minmax(48px, 1fr) minmax(72px, 1fr); gap: 5px; }
.plate-parts input { padding-inline: 4px; text-align: center; font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; }
.plate-parts input[readonly] { background: #1d2a3e; }
.fleet-list { display: grid; gap: 8px; margin-top: 12px; }
.fleet-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 11px; }
.fleet-plate { font-size: 15px; white-space: nowrap; }
.fleet-drivers, .fleet-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.fleet-drivers { flex: 1 1 120px; }
.fleet-actions { margin-left: auto; }
.driver-name { color: var(--muted); overflow-wrap: anywhere; }
.driver-name[data-active=true] { color: #6ee7b7; border-color: #34795c; }
.driver-name[data-outdated=true] { border-color: #f87171; }
#tab-settings { max-width: 1160px; margin: 0 auto; padding: 22px; }
#tab-settings h1 { margin-bottom: 15px; }
.settings-grid { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.map-settings { display: grid; gap: 14px; }
.area-form { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.area-form h3 { font-size: 14px; }
.fields { display: grid; gap: 12px; }
.form-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.map-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map-settings-actions button { flex: 1 1 auto; min-height: 43px; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 50% 0%, #253652 0%, #111827 60%); }
.login-card { width: min(430px, 100%); padding: 27px; box-shadow: 0 14px 55px #05081366; }
.login-card h1 { margin: 23px 0 5px; }
.login-card > p { color: var(--muted); margin-bottom: 16px; }
.dialog { width: min(475px, calc(100vw - 32px)); border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 18px; }
.dialog::backdrop { background: #08101ac2; }
.pin-dialog { width: min(320px, calc(100vw - 32px)); }
#settings-pin { -webkit-text-security: disc; letter-spacing: .45em; text-align: center; font-size: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.code { display: block; font: 800 24px ui-monospace, monospace; letter-spacing: .1em; color: var(--yellow); margin: 10px 0; overflow-wrap: anywhere; }
.toast { position: fixed; bottom: 18px; right: 18px; z-index: 1001; width: min(390px, calc(100vw - 36px)); padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #243751; color: var(--text); box-shadow: 0 6px 24px #0006; }
@media (max-width: 850px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar .quiet:not(.icon-button) { padding: 7px; font-size: 12px; }
}
@media (max-width: 740px), (pointer: coarse) {
  .desktop-settings { display: none; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .brand-button { gap: 6px; }
  .brand-button strong { font-size: 14px; }
  .top-actions { grid-column: 2; }
  .address-search { grid-column: 1 / -1; grid-row: 2; }
  .live-grid, .settings-grid { grid-template-columns: 1fr; }
  .live-grid { height: auto; grid-template-rows: max(255px, 60dvh) auto; }
  .dispatch-card { min-height: 120px; max-height: 42dvh; border-top: 1px solid var(--line); border-left: 0; }
  #tab-settings { padding: 14px; }
}
