:root {
  font: 100% "Inter", "Segoe UI", system-ui, sans-serif;
  color: #172033;
  background: #f3f5f8;
  --line: #e1e5ed;
  --soft: #f3f5f8;
  --muted: #536078;
  --brand: #fbc64c;
  --dark: #151a27;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #5178da; outline-offset: 2px;
}
a { color: #3457af; text-underline-offset: .18em; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 2.55rem); letter-spacing: -.046em; line-height: 1.1; }
h2 { font-size: 1.16rem; letter-spacing: -.02em; }
h3 { font-size: .94rem; }
small { font-size: .875rem; color: var(--muted); }
.eyebrow {
  margin-bottom: .55rem; color: var(--muted); font-size: .8125rem;
  font-weight: 750; letter-spacing: .1em; text-transform: uppercase;
}
.muted, .empty { color: var(--muted); }
.empty { padding: 1.1rem; }
.empty p { margin-top: .5rem; }
.full { width: 100%; }
.primary, .secondary, .plain {
  min-height: 2.75rem; padding: .55rem .85rem; border-radius: .62rem;
  font-size: .9375rem; font-weight: 650;
}
.primary { border: 1px solid transparent; background: var(--brand); color: #2c2107; }
.primary:hover:not(:disabled) { background: #f2b933; }
.secondary { border: 1px solid var(--line); background: white; color: #172033; }
.secondary:hover:not(:disabled), .plain:hover { background: var(--soft); }
.plain { border: 1px solid transparent; background: transparent; color: inherit; }
.danger { color: #a1343b; }
.card {
  min-width: 0; background: white; border: 1px solid var(--line);
  border-radius: .88rem; box-shadow: 0 3px 9px #18294305;
}
.brand, .auth-brand { display: flex; align-items: center; gap: .65rem; white-space: nowrap; font-weight: 750; }
.brand strong, .auth-brand strong { font-weight: 550; }
.logo {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; flex: 0 0 2rem; width: 2rem;
  height: 2rem; gap: 2px; padding: .47rem; border-radius: .55rem; background: var(--brand);
}
.logo i:nth-child(1), .logo i:nth-child(4) { background: var(--dark); }
.role-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }
.role-links a {
  color: inherit; display: inline-flex; align-items: center; min-height: 2.75rem;
  padding: .4rem .65rem; border-radius: .5rem; text-decoration: none; font-size: .875rem;
}
.role-links a:hover, .role-links a[aria-current] { background: #7c8a9d24; }
.loading { padding: 2rem; text-align: center; color: var(--muted); }

.auth-shell {
  display: grid; gap: 1.25rem; width: min(100% - 2rem, 25rem); margin: clamp(2rem, 12vh, 8rem) auto 2rem;
}
.auth-brand { justify-content: center; }
.auth-card { padding: clamp(1.1rem, 5vw, 2rem); }
.auth-card form { margin-top: 1.35rem; }
.auth-card .demo { margin-top: .85rem; }
form { display: grid; gap: .85rem; }
label { display: grid; gap: .38rem; font-size: .9rem; font-weight: 620; }
input, textarea, select {
  width: 100%; min-width: 0; border: 1px solid #cbd2df; border-radius: .55rem;
  background: white; color: #172033; padding: .66rem .72rem; font-weight: 450; min-height: 2.75rem;
}
textarea { resize: vertical; }
select { appearance: none; padding-right: 2rem; background: linear-gradient(45deg, transparent 50%, #5c687a 50%) right 1.18rem center / 5px 5px no-repeat,
  linear-gradient(135deg, #5c687a 50%, transparent 50%) right .87rem center / 5px 5px no-repeat white; }
.form-error { color: #a1343b; font-size: .9rem; }
.notice {
  position: fixed; z-index: 2; right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); left: auto;
  padding: .9rem 1.1rem; border-radius: .7rem; color: white; background: #223e36;
  max-width: min(calc(100vw - 2rem), 23rem); box-shadow: 0 6px 24px #0f172a35;
}
.notice.error { background: #813039; }
dialog {
  width: min(100% - 2rem, 30rem); max-height: calc(100dvh - 2rem); border: 1px solid var(--line);
  border-radius: .9rem; color: inherit; padding: 1.15rem; box-shadow: 0 16px 60px #0f172a40;
}
dialog::backdrop { background: #141b2c8c; }
dialog form { margin-top: .7rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .5rem; }
.dispatch-shell { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; gap: 2rem; padding: 1.15rem .9rem 1rem;
  background: var(--dark); color: #eef1f8;
}
.sidebar > nav { display: grid; gap: .45rem; }
.sidebar > nav button {
  min-height: 2.75rem; text-align: left; background: transparent; color: #c6cede;
  border: 1px solid transparent; border-radius: .55rem; padding: .56rem .7rem; font-size: .94rem;
}
.sidebar > nav button span { margin-right: .45rem; color: #adb7ce; }
.sidebar > nav button:hover, .sidebar > nav button[aria-pressed="true"] { background: #292e3e; color: white; }
.sidebar > nav button[aria-pressed="true"] span { color: var(--brand); }
.sidebar-bottom { margin-top: auto; padding-top: .85rem; border-top: 1px solid #343b4d; }
.sidebar-bottom .role-links { justify-content: flex-start; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: .65rem;
  min-height: 4.2rem; border-bottom: 1px solid var(--line); background: #fff; padding: .55rem clamp(1rem, 3vw, 2.25rem);
}
.tag { color: #654a0c; background: #fff2cf; padding: .28rem .6rem; border-radius: .4rem; font-size: .875rem; }
.identity { display: flex; align-items: center; gap: .65rem; font-size: .9rem; }
.avatar {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 2rem;
  background: #e9eefb; border-radius: 50%; color: #40569b; font-weight: 700; font-size: .8rem;
}
.workspace-inner { max-width: 92rem; padding: clamp(1rem, 3vw, 2.25rem); margin-inline: auto; }
.page-head, .section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; }
.page-head { margin-bottom: 1.2rem; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.stat { padding: .8rem 1rem; }
.stat div { display: flex; justify-content: space-between; align-items: center; gap: .4rem; min-height: 2rem; color: var(--muted); font-size: .875rem; }
.stat strong { display: block; margin-top: .22rem; font-size: 1.75rem; letter-spacing: -.04em; }
.stat i { display: grid; place-items: center; flex: 0 0 1.8rem; height: 1.8rem; border-radius: .45rem; font-size: 1rem; font-style: normal; font-weight: 700; }
.stat i.new { background: #fff0c9; color: #684c05; }
.stat i.active { background: #e8efff; color: #304f96; }
.stat i.completed, .stat i.drivers { background: #e4f4ec; color: #256449; }
.dispatch-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, .63fr); gap: 1rem; align-items: start; }
.orders > .section-head { padding: .95rem 1rem .7rem; }
.recruitment-row {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; align-items: start; gap: 1rem;
  padding: 1rem; overflow-wrap: anywhere;
}
.recruitment-row + .recruitment-row { border-top: 1px solid var(--line); }
.recruitment-row h2 { font-size: 1rem; }
.recruitment-row > div { display: grid; gap: .3rem; }
.recruitment-state { grid-column: 4; justify-items: end; }
.recruitment-pages { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-top: 1rem; }
@media (max-width: 880px) {
  .recruitment-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recruitment-state { grid-column: 2; justify-items: start; }
}
@media (max-width: 540px) {
  .recruitment-row { grid-template-columns: minmax(0, 1fr); }
  .recruitment-state { grid-column: auto; }
}
.filters { display: flex; flex-wrap: wrap; gap: .3rem; padding: 0 1rem .7rem; }
.filters button {
  background: white; color: var(--muted); border: 1px solid var(--line);
  border-radius: .45rem; padding: .36rem .58rem; font-size: .875rem; min-height: 2.25rem;
}
.filters button[aria-pressed="true"] { color: #233e77; border-color: #dce5fa; background: #eaf0fd; font-weight: 650; }
.order-list { padding-bottom: .35rem; }
.order-row, .list-labels {
  display: grid; grid-template-columns: 4rem minmax(0, 1fr) 9rem; gap: .65rem;
  align-items: center; padding: .75rem 1rem; text-align: left; width: 100%;
}
.list-labels { background: var(--soft); font-size: .875rem; color: var(--muted); }
.order-row {
  border: 0; border-top: 1px solid var(--line); background: white; color: inherit; font-size: .9rem;
  box-shadow: inset 3px 0 transparent; min-height: 4rem;
}
.order-row:hover { background: #f6f8fc; }
.order-row[aria-pressed="true"] { background: #fff9ed; box-shadow: inset 3px 0 #e5aa2a; }
.order-row strong, .order-row small { display: block; overflow-wrap: anywhere; }
.order-row small, .driver-list small { margin-top: .2rem; }
.status { justify-self: start; display: inline-block; border-radius: 9rem; padding: .23rem .58rem; font-size: .86rem; line-height: 1.25; font-weight: 640; }
.status.new { background: #fff0c9; color: #654a0c; }
.status.assigned, .status.on_way, .status.arrived { background: #e8efff; color: #304f96; }
.status.in_progress { background: #efe9fb; color: #674293; }
.status.completed { background: #e4f4ec; color: #256449; }
.status.cancelled { background: #edf0f4; color: #515d6e; }
.details { padding: 1rem; }
.details-meta { margin: .8rem 0; }
.details-meta > div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .5rem; margin: .56rem 0; font-size: .9rem; }
.details-meta dt { color: var(--muted); }
.details-meta dd { margin: 0; overflow-wrap: anywhere; }
.route { margin: .75rem 0; padding: .72rem; border: 1px solid var(--line); border-radius: .6rem; background: #f8f9fc; }
.route div { display: grid; grid-template-columns: 1rem minmax(0, 1fr); align-items: center; gap: .5rem; position: relative; }
.route div + div { margin-top: .62rem; }
.route i { width: .63rem; height: .63rem; margin-inline: auto; border: 2px solid #a7750d; border-radius: 50%; position: relative; z-index: 1; background: #fff; }
.route div + div i { background: #40599c; border-color: #40599c; }
.route div + div::before { content: ""; position: absolute; left: calc(.5rem - 1px); height: 100%; bottom: 50%; border-left: 2px dotted #b7c0d5; }
.route small, .route strong { display: block; overflow-wrap: anywhere; }
.route strong { font-size: .94rem; }
.history { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .9rem; }
.timeline { list-style: none; padding: 0; margin: .55rem 0; font-size: .875rem; }
.timeline li { display: flex; justify-content: space-between; gap: .6rem; padding: .36rem 0; }
.timeline time { white-space: nowrap; color: var(--muted); }
.driver-list > div { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .65rem; align-items: center; padding: .8rem 1rem; border-top: 1px solid var(--line); }
.driver-list strong, .driver-list small { display: block; }

.mobile-shell { width: min(100%, 34rem); margin-inline: auto; min-height: 100vh; }
.mobile-bar { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .65rem 1rem; background: white; border-bottom: 1px solid var(--line); }
.mobile-shell main { padding: .9rem; }
.mobile-hero { padding: 1.2rem; border-radius: .88rem; color: #fff; background: #20273a; }
.mobile-hero .eyebrow, .mobile-hero p { color: #ccd5e9; }
.mobile-hero p:not(.eyebrow) { margin-top: .5rem; }
.mobile-hero .primary, .duty { margin-top: 1rem; }
.duty { display: flex; align-items: center; justify-content: space-between; gap: .4rem; flex-wrap: wrap; }
.trip-list { margin: 1rem 0 0; }
.trip-list > h2 { margin-bottom: .7rem; }
.trip { padding: .9rem; margin-bottom: .65rem; }
.trip-note, .contact { font-size: .9rem; overflow-wrap: anywhere; margin-bottom: .65rem; }
.contact { display: flex; justify-content: space-between; gap: .4rem .7rem; flex-wrap: wrap; }
.trip summary { color: var(--muted); font-size: .9rem; padding: .4rem 0; }
.trip .primary { margin-top: .6rem; }
.mobile-shell > .role-links { padding: 0 .5rem 1rem; }

.ride-map {
  position: relative; overflow: hidden; min-height: 220px; height: min(32vh, 290px);
  border: 1px solid var(--line); border-radius: .7rem; background: #e6edee;
}
.ride-map .map-canvas { position: absolute; inset: 0; }
.map-message {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center;
  color: var(--muted); margin: 0; pointer-events: none;
}
.map-editor { display: grid; gap: .45rem; }
.map-edit-actions { display: flex; flex-wrap: wrap; gap: .45rem .7rem; align-items: center; }
.map-edit-actions span, .map-summary { color: var(--muted); font-size: .875rem; }
.map-summary { margin-block: .35rem; font-weight: 650; }
.map-attribution { font-size: .8125rem; color: var(--muted); margin-top: .2rem; }
.map-button { margin-bottom: .55rem; }
.navigation-link { display: flex; align-items: center; justify-content: center; margin-block: .45rem; text-decoration: none; }
.map-pin {
  display: inline-grid; place-items: center; width: 1.55rem; height: 1.55rem; flex: 0 0 1.55rem;
  color: #172033; border-radius: 50%; background: var(--brand); font: 700 .85rem system-ui, sans-serif;
}
.map-pin.to { background: #2e56b3; color: #fff; }
.map-canvas .map-pin { width: 1.9rem; height: 1.9rem; border: 2px solid white; box-shadow: 0 2px 5px #16233366; }
.place-field { display: grid; gap: .38rem; }
.place-input { display: flex; align-items: center; gap: .5rem; }
.place-input input { min-width: 0; }
.place-results { max-height: 12rem; overflow: auto; border: 1px solid var(--line); border-radius: .55rem; }
.place-results [role="option"] { cursor: pointer; padding: .55rem .7rem; display: grid; gap: .15rem; }
.place-results [role="option"] + [role="option"] { border-top: 1px solid var(--line); }
.place-results [role="option"]:hover, .place-results [aria-selected="true"] { background: #eaf0fd; }
.place-status { font-size: .875rem; color: var(--muted); }

.fleet-note { padding: .55rem 1rem .85rem; color: var(--muted); font-size: .925rem; }
.settings-panel { display: grid; gap: .8rem; max-width: 44rem; padding: 1rem; }
.settings-panel > button { justify-self: start; }
.check-label { display: flex; gap: .55rem; align-items: center; min-height: 2.25rem; }
.check-label input { min-height: 1rem; width: 1rem; flex: 0 0 1rem; accent-color: #765300; }
.account-period { min-width: 10.5rem; }
.account-tabs { padding-inline: 0; margin-bottom: .55rem; }
.account-card { padding: .95rem 1rem; }
.account-card + .account-card { margin-top: .85rem; }
.account-stats .stat strong { font-size: clamp(1rem, 2vw, 1.45rem); word-break: break-word; }
.account-stats .stat small { display: block; margin-top: .35rem; }
.account-totals { display: grid; grid-template-columns: repeat(auto-fit,minmax(9rem,1fr)); gap: .65rem; background: var(--soft); padding: .7rem; border-radius: .6rem; margin: .85rem 0; }
.account-totals small, .account-row small { display: block; margin-bottom: .25rem; }
.account-row { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .65rem 1rem; border-top: 1px solid var(--line); padding: .7rem 0; overflow-wrap: anywhere; }
.account-row > div:first-child { min-width: min(100%, 9rem); }
.account-row.is-void { color: var(--muted); background: var(--soft); border-radius: .25rem; padding-inline: .4rem; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.account-actions button { font-size: .875rem; }
.account-help { color: var(--muted); margin: .65rem 0; font-size: .9rem; }
.account-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
fieldset.account-fields { min-width: 0; border: 0; padding: 0; margin: 0; }
.account-fields [name="additionalDeduction"] { min-width: 0; }
.account-detail { display: grid; gap: .1rem; margin: .5rem 0; }
.account-detail > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .75rem; border-bottom: 1px solid var(--line); padding: .45rem 0; }
.account-detail dd { margin: 0; font-weight: 650; text-align: right; }
.receipt-links { display: flex; flex-wrap: wrap; gap: .3rem .55rem; max-width: min(100%, 20rem); }
.receipt-links a { font-size: .88rem; overflow-wrap: anywhere; }
.park-receipts { flex-basis: 100%; font-size: .9rem; }
.park-receipts summary { color: var(--muted); cursor: pointer; }
.park-receipt { display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem .75rem; padding: .45rem 0; }
.mobile-tabs { padding: 0 0 .9rem; }
.mobile-tabs button { flex: 1; }
.finance-filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.finance-filters label { flex: 1 1 10rem; max-width: 23rem; min-width: 0; }
.finance-filters input, .finance-filters select { width: 100%; min-width: 0; }
.finance-breakdown { margin-bottom: .85rem; }
.finance-breakdown summary { cursor: pointer; }
.mobile-shell .finance-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
.account-dialog { width: min(100% - 1.6rem, 43rem); }
.account-dialog .form-error { margin-top: .4rem; }
@media (max-width: 560px) {
  .account-fields { grid-template-columns: minmax(0,1fr); }
  .account-card { padding-inline: .7rem; }
  .account-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.driver-list > .fleet-driver { grid-template-columns: 2rem minmax(8rem, 1fr) minmax(12rem, 1.15fr) minmax(8rem, auto); }
.fleet-driver-name, .fleet-linked { overflow-wrap: anywhere; }
.fleet-driver-status, .fleet-driver-actions { display: flex; flex-wrap: wrap; gap: .45rem .9rem; align-items: start; }
.fleet-driver-status > div > small:first-child { margin: 0 0 .3rem; }
.fleet-driver-actions { justify-content: flex-end; }
.fleet-driver-actions .secondary { font-size: .875rem; }
.fleet-subtitle, .fleet-linked { font-size: .95rem; color: var(--muted); padding-block: .45rem; }
.fleet-candidate, .finance-list li {
  display: flex; gap: .5rem; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); padding: .65rem 0; overflow-wrap: anywhere;
}
.fleet-results, .fleet-finance { margin-top: .85rem; }
.fleet-candidate > div, .finance-list li > div { flex: 1; min-width: 0; }
.fleet-candidate small, .finance-list small, .fleet-balance small { display: block; margin-top: .2rem; }
.finance-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.fleet-balance { background: var(--soft); padding: .65rem .85rem; border-radius: .6rem; }
.fleet-balance strong { display: block; margin-top: .15rem; font-size: 1.35rem; }
.finance-list { list-style: none; padding: 0; margin: .65rem 0; }
.finance-list li > strong { text-align: right; }
@media (max-width: 790px) {
  .driver-list > .fleet-driver { grid-template-columns: 2rem minmax(0, 1fr); }
  .fleet-driver-status, .fleet-driver-actions { grid-column: 2; }
  .fleet-driver-actions { justify-content: flex-start; }
}
@media (max-width: 400px) {
  .fleet-candidate { flex-wrap: wrap; }
}

@media (max-width: 1000px) {
  .dispatch-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .dispatch-shell { display: block; }
  .sidebar { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: .4rem .75rem; padding: .55rem .75rem; }
  .sidebar > nav { display: flex; flex-wrap: wrap; }
  .sidebar > nav button { padding-inline: .45rem; }
  .sidebar > nav button span { display: none; }
  .sidebar-bottom { flex-basis: 100%; padding-top: 0; }
  .sidebar-bottom .role-links a { min-height: 2.25rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .stat { padding: .6rem .7rem; }
  .stat strong { font-size: 1.45rem; }
  .topbar { min-height: 3.25rem; padding-block: .25rem; }
}
@media (max-width: 470px) {
  .list-labels { display: none; }
  .order-row { grid-template-columns: 3.2rem minmax(0, 1fr); padding-inline: .7rem; }
  .order-row > .status { grid-column: 2; }
  .page-head > button { width: 100%; }
}
