:root {
  color-scheme: light;
  --ink: #162237;
  --muted: #52627a;
  --line: #dce4ee;
  --surface: #fff;
  --blue: #174ed1;
  --pale-blue: #eef4ff;
  --amber: #bc730a;
  --green: #168267;
  --violet: #7154be;
  --slate: #708097;
  font: 14px/1.45 "DM Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f3f6fa; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-weight: 650;
  cursor: pointer;
}
button:hover { border-color: #a9bfe0; background: #f6f9ff; }
:focus-visible { outline: 3px solid #3977e4; outline-offset: 2px; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 2.2vw, 2.2rem); letter-spacing: -.045em; }
h2 { font-size: 1.08rem; letter-spacing: -.018em; }
h3 { font-size: 1rem; }
[hidden] { display: none !important; }
.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: #eef4ff;
  background: #111e34;
  padding: 0 clamp(14px, 3vw, 43px);
}
.brand { display: inline-flex; align-items: center; flex: none; }
.brand-logo { display: block; width: clamp(120px, 28vw, 158px); height: auto; }
.top-divider { height: 23px; width: 1px; background: #40506a; flex: none; }
.account-name { min-width: 0; color: #eef4ff; font-size: .89rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo { margin-left: auto; color: #d5e3ff; white-space: nowrap; font-size: .8rem; }
.demo i { display: inline-block; width: 7px; height: 7px; background: #70a6ff; border-radius: 50%; margin-right: 4px; }
.sign-out { margin-left: auto; min-height: 32px; border-color: #51617b; color: #eef4ff; background: transparent; white-space: nowrap; flex: none; }
.sign-out:hover { color: #162237; }
.auth-card { width: min(100%, 420px); margin: clamp(18px, 10vh, 95px) auto; padding: clamp(17px, 5vw, 32px); background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 5px 20px #16223714; }
.auth-card h1 { font-size: clamp(1.5rem, 5vw, 1.95rem); }
.auth-card > p { color: var(--muted); margin-top: 8px; }
.auth-card form { display: grid; gap: 13px; margin-top: 20px; }
.auth-card button { min-height: 41px; }
.auth-card #auth-error, .form-error { color: #9f2634; margin-top: 8px; }
button:disabled { opacity: .7; cursor: wait; }
main { max-width: 1750px; margin: 0 auto; padding: 21px clamp(12px, 3vw, 42px) 30px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.page-heading p { color: var(--muted); margin-top: 3px; }
.primary { color: white; background: var(--blue); border-color: var(--blue); }
.primary:hover { color: white; background: #103b9f; border-color: #103b9f; }
.quiet { background: transparent; border-color: transparent; color: #294d85; }
.danger { color: #a42130; border-color: #efd0d3; }
.danger:hover { background: #fff3f3; border-color: #eca5ac; }
.controls, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; }
.toolbar, .filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 12px; }
.toolbar { border-bottom: 1px solid var(--line); }
.toolbar button { min-height: 32px; color: #304664; }
.filters { align-items: end; gap: 10px; }
label { display: grid; gap: 4px; min-width: 0; color: #3e526f; font-size: .81rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 35px; padding: 6px 9px; border: 1px solid #d2ddeb; background: white; border-radius: 6px; }
input::placeholder { color: #62738a; }
textarea { resize: vertical; }
.search { flex: 1 1 215px; }
.filters label:not(.search) { flex: 1 1 130px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: 11px 0; }
.metric { display: flex; align-items: center; gap: 9px; text-align: left; min-height: 47px; color: #35465f; }
.metric strong { font-size: 1.32rem; line-height: 1; margin-left: auto; color: var(--ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.amber { background: var(--amber); }
.blue { background: var(--blue); }
.green { background: var(--green); }
.violet { background: var(--violet); }
.slate { background: var(--slate); }
.dispatch { display: grid; grid-template-columns: minmax(235px, .85fr) minmax(340px, 1.5fr) minmax(235px, .85fr); gap: 11px; align-items: stretch; }
.panel { min-width: 0; overflow: hidden; box-shadow: 0 2px 7px #203b5810; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; align-items: center; gap: 7px; }
.panel-heading .map-title { display: grid; gap: 0; }
.map-title p { color: var(--muted); font-size: .81rem; }
.pending .panel-heading { background: #fffaf1; }
.assigned .panel-heading { background: #f1f6ff; }
.count { min-width: 23px; padding: 1px 5px; text-align: center; color: #384c68; background: white; border: 1px solid var(--line); border-radius: 5px; font-weight: 700; }
.queue-columns, .service-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 40px; gap: 7px; }
.queue-columns { color: #576a84; padding: 9px 9px 7px; background: #f7f9fc; border-bottom: 1px solid var(--line); font-size: .69rem; font-weight: 700; }
.queue-columns > :last-child { text-align: right; }
.queue-list { max-height: 490px; overflow-y: auto; }
.service-row { align-items: start; text-align: left; width: 100%; padding: 11px 9px; border: 0; border-bottom: 1px solid #e6edf5; border-radius: 0; font-size: .81rem; border-left: 3px solid transparent; }
.service-row:hover { border-bottom-color: #e6edf5; }
.service-row[aria-pressed="true"] { background: var(--pale-blue); border-left-color: var(--blue); }
.service-row small, .record small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; margin-top: 3px; }
.service-row span { overflow-wrap: anywhere; }
.service-row time { color: #42546e; text-align: right; font-variant-numeric: tabular-nums; }
.route-button { min-height: 32px; flex: none; color: #12634f; background: #edfaf4; border-color: #bfe7d7; }
.route-button b { margin-left: 4px; }
.map { position: relative; height: clamp(315px, 45vh, 470px); overflow: hidden; isolation: isolate; background: #edf1e9; }
.map-surface { position: absolute; inset: 0; z-index: 0; background: #edf1e9; }
.map-status { position: absolute; z-index: 1; left: 10px; top: 10px; padding: 5px 8px; background: white; border-radius: 6px; }
.map-place-label.leaflet-tooltip { background: transparent; border: 0; box-shadow: none; font: 750 .65rem/1.2 system-ui, sans-serif; color: #405650; text-shadow: 0 0 4px white, 1px 1px white; }
.map-pin {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 7px #18233b40;
  font: 750 .76rem/1 system-ui, sans-serif;
  color: white;
}
.map-pin.origin { position: relative; background: #ad560a; }
.map-pin.origin::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top: 5px solid #ad560a; }
.map-pin:hover, .map-pin:focus-visible { color: white; background: #193853; }
.map-zoom { position: absolute; z-index: 1; top: 11px; right: 11px; display: grid; gap: 4px; }
.map-zoom button { width: 31px; min-height: 30px; padding: 0; font-size: 1.1rem; box-shadow: 0 1px 4px #203b581f; }
.map-zoom .map-reset { font-size: .78rem; }
.map-credit { position: absolute; z-index: 1; right: 0; bottom: 0; padding: 1px 5px; background: #fffffff2; color: #394d5f; font-size: .65rem; }
.map-footer, .selection { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding: 7px 10px; }
.map-footer span { display: inline-flex; align-items: center; gap: 4px; font-size: .73rem; }
.map-footer button { min-height: 28px; padding: 2px 5px; font-size: .72rem; margin-left: auto; }
.selection { justify-content: space-between; min-height: 67px; }
.selection-label { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.selection p { margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 6px; border-radius: 5px; background: #eff3f8; color: #465b75; font-size: .71rem; font-weight: 720; }
.badge.pending, .badge.approval { color: #874707; background: #fff0d0; }
.badge.assigned { color: #184aa8; background: #e8f0ff; }
.badge.route, .badge.completed { color: #126649; background: #e2f5ed; }
.badge.canceled { color: #9f3642; background: #fae8eb; }
.empty { padding: 12px; color: var(--muted); font-size: .85rem; }
dialog {
  width: min(540px, calc(100vw - 24px));
  max-height: min(85dvh, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 20px 75px #101b4157;
  color: var(--ink);
}
dialog::backdrop { background: #101d36a0; }
.dialog-heading { position: sticky; top: 0; background: white; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { font-size: 1.13rem; }
.close { font-size: .88rem; }
.dialog-body { padding: 13px; }
.dialog-body h3 { margin-top: 15px; }
.dialog-body form p { margin-bottom: 10px; }
.detail-intro { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.detail-intro p, .muted, .driver-record p { color: var(--muted); }
.details, .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.details > div { background: #f5f8fc; border-radius: 6px; padding: 7px 9px; overflow-wrap: anywhere; }
.details dt { color: var(--muted); font-size: .76rem; font-weight: 650; }
.details dd { margin: 2px 0 0; }
.wide { grid-column: 1 / -1; }
.action-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.action-bar button { font-size: .84rem; }
.timeline { margin: 5px 0 0; padding-left: 19px; overflow-wrap: anywhere; color: var(--muted); }
.timeline li { margin: 5px 0; }
.record { display: flex; justify-content: space-between; align-items: center; text-align: left; width: 100%; margin: 7px 0; overflow-wrap: anywhere; }
.driver-record { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.driver-record p { font-size: .81rem; }
.fleet-state { display: inline-flex; align-items: center; gap: 4px; color: #435773; font-size: .73rem; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; color: #17478a; background: #e9f0fb; font-size: .75rem; font-weight: 750; }
.feedback { position: fixed; z-index: 3; right: 12px; bottom: 12px; padding: 9px 12px; border-radius: 7px; background: #142847; color: white; max-width: min(85vw, 410px); overflow-wrap: anywhere; }
@media (max-width: 1000px) {
  .dispatch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-panel { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .page-heading { flex-wrap: wrap; }
  .page-heading .primary { flex: 1 0 100%; }
  .toolbar, .filters { padding: 8px; gap: 6px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .dispatch { grid-template-columns: minmax(0, 1fr); }
  .map-panel { grid-row: auto; grid-column: auto; }
  .map { height: 310px; }
  .service-row, .queue-columns { grid-template-columns: 65px minmax(0, 1fr) 46px; }
  .queue-list { max-height: 280px; }
}
