:root{font-family:system-ui,-apple-system,"Segoe UI",sans-serif;color:#0f172a;background:#f4f6f9;font-size:16px}*{box-sizing:border-box}body{margin:0}header{background:#0f172a;color:white}.bar{max-width:1200px;margin:auto;padding:20px 24px;display:flex;gap:24px;align-items:center;justify-content:space-between;flex-wrap:wrap}.brand{font-weight:850;font-size:21px;text-decoration:none;color:white;white-space:nowrap}.brand b{color:#fb923c}nav{display:flex;gap:20px;flex-wrap:wrap}nav a{color:#e2e8f0;text-decoration:none}.language{display:flex;align-items:center;gap:8px;font-size:14px}.language select{width:auto;color:#0f172a;margin:0}main{max-width:1200px;margin:auto;padding:32px 24px}h1{font-size:clamp(30px,4vw,46px);line-height:1.15;letter-spacing:-.035em;margin:12px 0 20px}h2{font-size:25px;margin:0 0 12px}h3{font-size:21px}p{line-height:1.65;color:#475569}a{color:#c2410c}.card{background:white;padding:28px;border:1px solid #e2e8f0;border-radius:20px;box-shadow:0 3px 12px #0f172a04;margin-bottom:28px}.eyebrow{color:#c2410c;font-weight:750;letter-spacing:.08em;font-size:13px}.booking-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,1fr);gap:24px}.dark{background:#0f172a;color:white;align-self:start;position:sticky;top:24px}.dark p{color:#cbd5e1}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}label{display:block;font-size:14px;font-weight:650;line-height:1.5}input,select,textarea{display:block;width:100%;margin-top:8px;padding:12px 13px;border:1px solid #cbd5e1;border-radius:9px;background:white;color:#0f172a;font:inherit;min-width:0}input:focus,select:focus,textarea:focus{outline:2px solid #fdba74;outline-offset:1px}.check{display:flex;gap:10px;align-items:center;margin:10px 0}.check input{width:auto;margin:0;accent-color:#ea580c}fieldset{border:1px solid #e2e8f0;border-radius:10px;padding:16px}legend{font-weight:650}button{font:inherit;background:#ea580c;color:white;border:1px solid transparent;border-radius:10px;font-weight:700;padding:13px 18px;cursor:pointer;line-height:1.4}button:hover{background:#c2410c}button:disabled{opacity:.5;cursor:wait}.secondary{background:white;border-color:#cbd5e1;color:#0f172a}.secondary:hover{background:#f1f5f9}.actions{display:flex;gap:10px;align-self:end;flex-wrap:wrap}.wide{grid-column:1/-1}.hidden{display:none!important}.notice{padding:18px 20px;border-radius:12px;background:#fff7ed;border:1px solid #fed7aa;margin-bottom:24px;line-height:1.6}.notice.error{background:#fef2f2;border-color:#fecaca;color:#991b1b}.result{padding:16px;border:1px solid #cbd5e1;border-radius:12px;margin:20px 0;line-height:1.7;white-space:pre-line;overflow-wrap:anywhere}.dark .result{border-color:#475569}.dark button{width:100%;margin-top:20px}#quote-result{line-height:1.8;white-space:pre-line}.admin-section{border-top:1px solid #e2e8f0;margin-top:30px;padding-top:16px}.table-wrap{overflow:auto;margin-top:24px}table{border-collapse:collapse;width:100%;font-size:14px;text-align:left}th{background:#f8fafc;color:#64748b}th,td{padding:12px;border-bottom:1px solid #e2e8f0;vertical-align:top;overflow-wrap:anywhere}td button{padding:7px 11px;font-size:13px}footer{text-align:center;padding:20px;color:#64748b;font-size:14px}section{scroll-margin-top:24px}input[type=hidden]{display:none}@media(max-width:760px){main{padding:22px 14px}.card{padding:20px}.form-grid,.booking-grid{grid-template-columns:1fr}.dark{position:static}.bar{gap:16px;padding:18px}nav{gap:14px;font-size:14px}.language{margin-left:auto}th,td{min-width:100px}}

.admin-workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.admin-workspace-nav a,
.fleet-create-actions button {
  padding: 8px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  text-decoration: none;
}
.fleet-create-actions { grid-column: 1 / -1; }
.fleet-create-actions button { background: white; }
.fleet-create-actions button:hover { background: #f1f5f9; }
.admin-workspace-nav a[aria-current="page"] {
  background: #0f172a;
  border-color: #0f172a;
  color: white;
}

.order-message-list {list-style:none;padding:0;max-height:20rem;overflow:auto}
.order-message-list li {padding:.65rem 0;border-bottom:1px solid #cbd5e1;overflow-wrap:anywhere}
.order-message-list p {margin:.25rem 0;white-space:pre-wrap}
.order-message-form textarea {display:block;width:100%;margin:.4rem 0;box-sizing:border-box}
#operator-order-messages {width:min(32rem,90vw);max-height:85vh}

\n.dispatch-delay{display:flex;align-items:center;justify-content:space-between;gap:.65rem;flex-wrap:wrap;padding:.65rem;border:1px solid #d97706;border-radius:.6rem;background:#fff7ed;color:#7c2d12}\n
body[data-driver-page] #first-setup,body[data-driver-page] #admin,body[data-driver-page] #guest-admin{display:none}

.driver-navigation{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.driver-navigation a{display:inline-flex;align-items:center;min-height:44px;padding:8px 12px;border:1px solid #cbd5e1;border-radius:8px;color:#0f172a;font-weight:650;text-decoration:none}.driver-navigation a:hover,.driver-navigation a:focus-visible{background:#f1f5f9}

.dispatch-alert-controls { margin: .75rem 0; }
.dispatch-new-orders:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .5rem;
  padding: .75rem 1rem;
  border: 2px solid #b45309;
  border-radius: .65rem;
  background: #fef3c7;
  color: #78350f;
}

.operations-bar { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:.75rem; }
.operations-panel #operations-count { margin-bottom:0; }

/* Driver controls and order actions. */
#driver-deliveries .driver-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
#driver-deliveries .driver-availability,
#driver-deliveries .driver-tools {
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}
#driver-deliveries .driver-availability {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
#driver-deliveries .driver-availability p { margin: 0; font-weight: 600; }
#driver-deliveries .driver-tools { margin-top: 12px; }
#driver-deliveries #driver-board-notice:empty { display: none; }
#driver-deliveries .driver-tools summary { cursor: pointer; font-weight: 700; color: #164e83; }
#driver-deliveries .driver-tools-buttons { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
#driver-deliveries .driver-tools-buttons button { background: #164e83; color: #fff; }
#driver-deliveries #driver-push-notice:empty,
#driver-deliveries #driver-order-alert:empty { display: none; }
#driver-deliveries #driver-order-alert {
  padding: 10px;
  background: #e0f2fe;
  color: #0c4a6e;
  border-radius: 8px;
}
#driver-account-availability #driver-availability-toggle { min-height: 46px; background: #a13f16; color: #fff; }
#driver-account-availability #driver-availability-toggle.driver-on-shift { background: #126344; }
#driver-deliveries .driver-current-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
#driver-deliveries .driver-current-heading h3 { margin: 0; }
#driver-deliveries #driver-refresh { min-height: 44px; background: #e2e8f0; color: #1e293b; }
#driver-deliveries #driver-offers { padding: 12px; background: #eff6ff; border-radius: 12px; }
#driver-deliveries .dispatch-actions button[data-action] { background: #126344; color: #fff; min-height: 44px; }
#driver-deliveries .dispatch-actions .driver-decline { background: #fee2e2; color: #991b1b; }
#driver-deliveries .dispatch-actions a[href^="https://www.google.com/maps/"] { color: #164e83; }
#driver-deliveries > details.dispatch-card { border-left-color: #94a3b8; }
@media (max-width: 480px) {
  #driver-account-availability #driver-availability-toggle,
  #driver-deliveries .driver-tools-buttons button { width: 100%; }
}

#driver-offers-map {
  height: clamp(220px, 36vh, 320px);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #e2e8f0;
}
#driver-offers-map-key { margin: 8px 0 12px; font-size: 0.875rem; }
.driver-offer-map-link { display: block; margin-top: 6px; font-weight: 700; }

#operations-order-map {
  height: clamp(240px, 48vh, 440px);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #e2e8f0;
}
#operations-map-notice:empty { display: none; }
#director-order-map { height: clamp(280px, 46vh, 460px); margin-block: .75rem; }


body:not([data-driver-page]) #work-console {
  max-width: none;
}

#work-console #operations-order-map {
  height: clamp(320px, 62vh, 900px);
}

#work-console #driver-offers-map {
  height: 74vh;
  height: 74svh;
  min-height: 300px;
}

.driver-map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}
.driver-map-heading h3 { margin: 0; }
#driver-map-toggle {
  min-height: 44px;
  padding: .5rem .75rem;
}
#driver-map-panel .order-map-days {
  align-items: center;
  gap: .375rem;
}
#driver-map-panel .order-map-days button,
#driver-map-panel .order-map-days input {
  min-height: 44px;
  padding: .5rem .625rem;
}
#driver-map-panel .order-map-days label {
  display: flex;
  align-items: center;
  gap: .375rem;
}
#driver-map-panel .order-map-days label span { margin: 0; }
@media (max-width: 600px) {
  body[data-driver-page] .bar {
    flex-wrap: nowrap;
    gap: .625rem;
    padding: .625rem .75rem;
  }
  body[data-driver-page] .bar select {
    width: auto;
    margin: 0;
    padding: .5rem;
  }
  #driver-map-panel { padding: .75rem; }
  .driver-map-heading h3 { font-size: 1rem; }
  #driver-map-panel .order-map-days label span { display: none; }
}
html.driver-map-expanded { overflow: hidden; }

#driver-map-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: .75rem;
  padding: max(.75rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right))
    max(.75rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
  border: 0;
  overflow: auto;
  color: #0f172a;
  background: #f4f6f9;
}
#driver-map-dialog #driver-map-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}
#work-console #driver-map-dialog #driver-offers-map {
  flex: 1 0 10rem;
  height: auto;
  min-height: 0;
}
#driver-map-dialog #driver-offers-map-key { margin-bottom: 0; }
#driver-map-dialog[open] { z-index: 1800; height: 100dvh; }

#driver-route-notice:empty { display: none; }

.order-map-days {
  display: flex;
  align-items: end;
  gap: .5rem;
  flex-wrap: wrap;
  margin-block: .5rem;
}
.order-map-days input { width: auto; }
.order-map-days [aria-pressed="true"] { background: #172554; color: white; }
.order-map-popup { display: grid; gap: .35rem; max-height: 240px; overflow: auto; }

#driver-order-preview, #admin-inbox-dialog {
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  color: #0f172a;
}
#driver-order-preview::backdrop, #admin-inbox-dialog::backdrop { background: rgb(15 23 42 / .62); }
#driver-order-preview dl { margin: 1rem 0; overflow-wrap: anywhere; }
#driver-order-preview dt { font-weight: 700; margin-top: .75rem; }
#driver-order-preview dd { margin: .2rem 0 0; white-space: pre-wrap; }
#driver-order-preview-claim { width: 100%; }

button.order-chat-button { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
button.order-chat-button:hover { background: #1e40af; }
.driver-chat-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin-block: .75rem;
}
.driver-chat-actions button { min-height: 44px; padding: .5rem; overflow-wrap: anywhere; }
.driver-transport-preview { width: min(46rem, 94vw); max-width: none; max-height: 90dvh; overflow: auto; }
.driver-transport-preview canvas { display: block; width: 100%; height: auto; margin-top: .5rem; }
.order-chat-dialog { box-sizing: border-box; width: min(36rem, 94vw); max-height: 85vh; overflow: auto; }

.tracking-map-stage { position: relative; isolation: isolate; }
.tracking-stop-timer:not([hidden]) {
  position: absolute; inset: 0; z-index: 1100; display: grid; place-content: center;
  gap: .5rem; padding: 1rem; text-align: center; color: #064e3b;
  background: #ecfdf3; border: 3px solid #059669; border-radius: .75rem;
  font-variant-numeric: tabular-nums;
}
.tracking-stop-timer strong { font-size: clamp(3rem, 12vw, 7rem); line-height: 1; }
.tracking-stop-timer.error { color: #fff; background: #be123c; border-color: #881337; }
.tracking-map-stage:has(.tracking-stop-timer:not([hidden])) { min-height: 14rem; }

#driver-map-panel .tracking-map-stage {
  display: flex;
  flex-direction: column;
}
#driver-map-panel .tracking-stop-timer:not([hidden]) {
  position: static;
  order: -1;
  gap: .25rem;
  padding: .5rem .75rem;
  margin-bottom: .5rem;
  overflow-wrap: anywhere;
}
#driver-map-panel .tracking-stop-timer strong {
  font-size: clamp(1.75rem, 8vw, 3rem);
}
#work-console #driver-map-panel .tracking-map-stage:has(.tracking-stop-timer:not([hidden])) #driver-offers-map {
  height: clamp(15rem, 52vh, 74vh);
  height: clamp(15rem, 52svh, 74svh);
  min-height: 15rem;
}
#driver-map-dialog .tracking-map-stage {
  flex: 1 1 auto;
  min-height: 15rem;
}
#work-console #driver-map-dialog #driver-map-panel .tracking-map-stage #driver-offers-map {
  flex: 1 0 15rem;
  height: auto;
}


.director-workspaces a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1e3a8a;
  background: #eff6ff;
  font-weight: 650;
}

.director-workspaces a:hover,
.director-workspaces a:focus-visible {
  background: #dbeafe;
  text-decoration: underline;
}

.director-report > summary {
  cursor: pointer;
  font-size: 1.125rem;
  font-weight: 700;
  padding-block: 6px;
}
.director-report-table { margin-top: 12px; }
.director-report table { width: 100%; }
.director-report tfoot { background: #eff6ff; font-weight: 700; }
.director-report tfoot th { color: #1e3a8a; background: transparent; }

.history-route { margin-block: 1rem; }
.history-route-map { height: clamp(260px, 55vh, 480px); border-radius: 12px; }

.director-report-console, .director-report-console #director-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 8px;
}
.director-report-console #director-summary { display: contents; }
.director-report-console .director-report { margin: 0; padding: 6px 12px; }
.director-report-console .director-report[open] { grid-column: 1 / -1; padding: 14px; }
.director-report-console { margin-bottom: 16px; }
.director-map-heading { justify-content: space-between; align-items: center; }
#director-order-map { height: clamp(340px, 60vh, 700px); }

.trip-report { margin-block: 1rem; }
.trip-report > summary { color: #1e3a8a; font-weight: 700; cursor: pointer; padding: .75rem; }
.trip-report dt { font-weight: 650; }
.trip-report dd { margin: 0 0 .5rem; overflow-wrap: anywhere; }
.trip-report [aria-live] span { white-space: pre-wrap; overflow-wrap: anywhere; }

.trip-report > .actions { margin-block: .75rem; }
#trip-print-sheet { display: none; }
@media print {
  body.printing-trip-report > :not(#trip-print-sheet) { display: none !important; }
  body.printing-trip-report #trip-print-sheet { display: block; background: #fff; color: #0f172a; }
  #trip-print-sheet h1 { font-size: 20pt; }
  #trip-print-sheet h1, #trip-print-sheet h4, #trip-print-sheet dt { break-after: avoid; }
  #trip-print-sheet p, #trip-print-sheet li, #trip-print-sheet dd { white-space: pre-wrap; overflow-wrap: anywhere; }
}

@media print {
  #trip-print-sheet .trip-letterhead { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 5px solid #12243d; border-bottom: 3px solid #df751b; background: white; break-inside: avoid; }
  #trip-print-sheet .trip-letterhead address { font-style: normal; text-align: right; font-size: 9pt; }
  #trip-print-sheet .trip-print-map { margin: 8mm 0; break-inside: avoid; }
  #trip-print-sheet .trip-print-map svg { width: 100%; height: auto; max-height: 9cm; }
}

@media (max-width: 480px) {
  header .bar {
    flex-wrap: wrap;
  }
  header .bar > :has(#language) {
    min-width: 0;
  }
  header .bar #language {
    width: auto;
    max-width: 100%;
    min-width: 3.25rem;
  }
  .dispatch-card {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}
.dispatch-card-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .75rem;
}

@media (max-width: 480px) {
  .dispatch-order-index {
    table-layout: fixed;
    min-width: 42rem;
  }
  .dispatch-order-index :is(th, td) {
    padding-inline: .375rem;
    overflow-wrap: anywhere;
  }
  .dispatch-order-index thead th:first-child { width: 6.25rem; }
  .dispatch-order-index thead th:nth-child(2) { width: 5.75rem; }
  .dispatch-order-index thead th:nth-child(3) { width: 4.5rem; }
}

.driver-document-buttons {
  display: grid;
  gap: .5rem;
  list-style: none;
  padding: 0;
}

.driver-document-buttons button {
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

#operations-fleet-list .fleet-on-route td,
#operations-fleet-list .fleet-on-shift td {
  background: #e7f6ec;
  color: #155734;
}

.fleet-route-badge {
  display: inline-block;
  margin-inline-start: .4rem;
  font-weight: 700;
}

.fleet-expiry {
  margin-block: .35rem;
  padding: .3rem .6rem;
  border-radius: .4rem;
}

.fleet-expiry-normal { background: #fff; color: #172033; }
.fleet-expiry-warning { background: #ffedd5; color: #7c2d12; }
.fleet-expiry-critical { background: #fee2e2; color: #991b1b; }

@media (min-width: 1050px) {
  #fleet-workspace:not(.hidden) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 1rem;
  }

  #fleet-workspace > .admin-section {
    min-width: 0;
  }
}
