:root {
  --ink: #0f172a;
  --surface-ink: #172238;
  --slate: #526176;
  --muted: #718096;
  --canvas: #f4f7ff;
  --paper: #fff;
  --line: #dce4ef;
  --strong-line: #c3cedd;
  --cobalt: #4f7cff;
  --cobalt-dark: #355fd8;
  --cobalt-soft: #eaf0ff;
  --green: #158545;
  --green-soft: #e8f8ee;
  --amber: #8a4d00;
  --amber-soft: #fff4dc;
  --red: #c83232;
  --red-soft: #fff0f0;
  --shadow: 0 18px 48px rgba(15, 23, 42, .16);
  font-family: Inter, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.skip-link { position: fixed; z-index: 100; left: 12px; top: -80px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; }
.skip-link:focus { top: 12px; }

.topbar { height: 66px; padding: 0 clamp(14px, 4vw, 42px); display: flex; align-items: center; gap: 12px; color: #fff; background: var(--ink); position: sticky; top: 0; z-index: 30; }
.brand { color: #fff; text-decoration: none; font-size: 25px; letter-spacing: -.05em; }
.brand span { color: #6ee7a8; }
.topbar__copy { display: grid; line-height: 1.05; }
.topbar__copy b { font-size: 14px; }
.topbar__copy small { color: #b8c5d8; font-size: 10px; margin-top: 4px; }
.icon-button { margin-left: auto; border: 1px solid #33415a; background: var(--surface-ink); color: #fff; min-width: 44px; min-height: 44px; border-radius: 12px; }

.role-nav { position: sticky; top: 66px; z-index: 29; display: flex; justify-content: center; gap: 4px; padding: 8px 12px; background: rgba(244, 247, 255, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.role-nav button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 9px; color: var(--slate); background: transparent; font-weight: 800; font-size: 12px; }
.role-nav button[aria-current="page"] { color: #fff; background: var(--ink); }

#app { width: min(1440px, 100%); margin: 0 auto; padding: clamp(16px, 3vw, 40px); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 5vw, 54px); line-height: .98; letter-spacing: -.045em; margin-bottom: 12px; }
h2 { font-size: 20px; letter-spacing: -.025em; }
h3 { font-size: 15px; margin-bottom: 8px; }
p { color: var(--slate); line-height: 1.55; }
.eyebrow { color: var(--cobalt-dark); font-size: 10px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.subtle { color: var(--muted); font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.loading-state, .empty { min-height: 55vh; display: grid; place-content: center; text-align: center; }
.spinner { width: 34px; height: 34px; margin: 0 auto 18px; border: 3px solid var(--line); border-top-color: var(--cobalt); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 22px; align-items: stretch; }
.hero__lead { padding: clamp(22px, 5vw, 54px); min-height: 300px; display: flex; flex-direction: column; justify-content: center; background: var(--ink); color: #fff; border-radius: 18px; }
.hero__lead p { color: #c2ccdb; max-width: 65ch; }
.hero__lead .eyebrow { color: #86a4ff; }
.hero__aside { padding: 22px; border: 1px solid var(--line); background: var(--paper); border-radius: 18px; }
.hero__aside ul { padding-left: 18px; color: var(--slate); line-height: 1.7; }

.tabs, .view-switch { display: flex; gap: 4px; padding: 4px; width: fit-content; background: var(--cobalt-soft); border-radius: 10px; }
.tabs button, .view-switch button { border: 0; min-height: 38px; padding: 0 14px; border-radius: 8px; background: transparent; color: var(--slate); font-weight: 800; font-size: 12px; }
.tabs button.active, .view-switch button.active { background: var(--ink); color: #fff; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: clamp(17px, 3vw, 24px); }
.panel + .panel { margin-top: 16px; }
.panel--dark { background: var(--ink); color: #fff; border-color: #26334b; }
.panel--dark p, .panel--dark .subtle { color: #b9c5d7; }
.panel__head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; margin-bottom: 16px; }
.panel__head h2, .panel__head h3 { margin-bottom: 4px; }
.stack { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.admin-grid { display: grid; grid-template-columns: 310px minmax(0, 1fr) 360px; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: 11px; color: var(--slate); font-weight: 850; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; border: 1px solid var(--strong-line); border-radius: 10px; background: #fff; color: var(--ink); padding: 10px 12px; }
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(79, 124, 255, .32); outline-offset: 2px; }
.honeypot { position: absolute !important; left: -9999px !important; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid transparent; border-radius: 11px; font-weight: 850; font-size: 12px; text-decoration: none; }
.button--primary { color: #fff; background: var(--cobalt); }
.button--primary:hover { background: var(--cobalt-dark); }
.button--secondary { color: var(--ink); background: #fff; border-color: var(--strong-line); }
.button--danger { color: var(--red); background: var(--red-soft); border-color: #f2bcbc; }
.button--success { color: #fff; background: var(--green); }
.button--hero { min-height: 58px; width: 100%; font-size: 15px; }

.status { display: inline-flex; min-height: 25px; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; color: #2f5bd0; background: var(--cobalt-soft); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .045em; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--success { color: #087337; background: var(--green-soft); }
.status--wait { color: var(--amber); background: var(--amber-soft); }
.status--danger { color: var(--red); background: var(--red-soft); }
.status--neutral { color: #42516a; background: #eef2f7; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.metric-grid--detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric { min-width: 0; padding: 14px; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; }
.metric b { display: block; font-size: 24px; line-height: 1.05; letter-spacing: -.04em; overflow-wrap: anywhere; }
.metric--money b { font-size: 22px; white-space: nowrap; }
.metric small { color: var(--slate); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.eta { font-size: clamp(46px, 10vw, 88px); line-height: .86; letter-spacing: -.065em; font-weight: 780; margin: 16px 0 8px; }
.eta span { font-size: .28em; letter-spacing: -.02em; color: var(--slate); }
.panel--dark .eta span { color: #c1cbe0; }

.order-card { border: 1px solid var(--line); border-radius: 13px; padding: 15px; background: #fff; }
.order-card.selected { border-color: var(--cobalt); box-shadow: inset 4px 0 0 var(--cobalt); }
.order-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order-card__top strong { font-size: 13px; }
.order-card p { margin: 8px 0 0; font-size: 12px; }
.order-card button[data-select-order] { all: unset; cursor: pointer; width: 100%; }
.order-list { display: grid; gap: 9px; max-height: 68vh; overflow: auto; padding-right: 3px; }

.journey { position: relative; display: grid; gap: 0; }
.journey__item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; min-height: 58px; }
.journey__item::before { content: ""; position: absolute; left: 10px; top: 18px; bottom: -4px; width: 2px; background: var(--line); }
.journey__item:last-child::before { display: none; }
.journey__dot { width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid var(--strong-line); border-radius: 50%; background: #fff; z-index: 1; color: var(--muted); font-size: 10px; font-weight: 900; }
.journey__item.done .journey__dot { background: var(--green); border-color: var(--green); color: #fff; }
.journey__item.current .journey__dot { background: var(--cobalt); border-color: var(--cobalt); color: #fff; box-shadow: 0 0 0 5px var(--cobalt-soft); }
.journey__item.done::before { background: var(--green); }
.journey__body b { font-size: 12px; }
.journey__body small { display: block; color: var(--muted); margin-top: 3px; }

.map { width: 100%; height: clamp(360px, 52vh, 560px); min-height: 0; overflow: hidden; position: relative; isolation: isolate; border: 1px solid var(--line); border-radius: 14px; background: #edf3fa; }
.map--compact { height: 300px; }
.map-lock { min-height: 300px; display: grid; place-content: center; text-align: center; padding: 24px; background: #edf3fa; border: 1px dashed var(--strong-line); border-radius: 14px; }
.map-lock strong { font-size: 18px; }
.map-lock p { max-width: 48ch; margin: 8px auto 0; }

.alert { padding: 12px 14px; border-radius: 11px; border: 1px solid #efc27e; background: var(--amber-soft); color: var(--amber); font-size: 12px; font-weight: 750; }
.alert--danger { border-color: #f0b4b4; background: var(--red-soft); color: var(--red); }
.alert--success { border-color: #a9dfbd; background: var(--green-soft); color: var(--green); }
.quote-list { display: grid; gap: 8px; }
.quote-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
.quote-row b { font-size: 12px; }
.quote-row small { display: block; color: var(--muted); margin-top: 3px; }
.quote-row strong { font-size: 18px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; min-width: 940px; border-collapse: collapse; font-size: 11px; }
th { position: sticky; top: 0; background: #f7f9fd; color: var(--slate); text-align: left; text-transform: uppercase; letter-spacing: .05em; font-size: 9px; }
th, td { padding: 10px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr:focus { background: var(--cobalt-soft); outline: 0; }
.stage-cell { font-weight: 850; }

.rider-shell { width: min(620px, 100%); margin: 0 auto; }
.rider-hero { background: var(--ink); color: #fff; padding: 22px; border-radius: 18px; }
.rider-hero p { color: #c1cbe0; }
.next-action { padding: 16px; border: 1px solid #34425a; background: var(--surface-ink); border-radius: 13px; margin: 16px 0; }
.next-action small { color: #a7b5ca; text-transform: uppercase; font-weight: 900; letter-spacing: .08em; }
.next-action strong { display: block; font-size: 27px; letter-spacing: -.04em; margin-top: 6px; }
.voice-button { min-height: 52px; width: 100%; color: #fff; background: #263450; border: 1px solid #455777; border-radius: 13px; font-weight: 850; }
.location-state { display: flex; align-items: center; gap: 8px; color: #b9c5d7; font-size: 11px; margin-top: 12px; }
.location-state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.location-state.live::before { background: #42d480; box-shadow: 0 0 0 4px rgba(66, 212, 128, .15); }

.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { padding: 13px 15px; border-radius: 12px; color: #fff; background: var(--ink); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease-out; }
.toast.error { background: #8f2525; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

@media (max-width: 1050px) {
  .admin-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .admin-grid > :last-child { grid-column: 1 / -1; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .topbar { height: 58px; }
  .role-nav { top: 58px; justify-content: flex-start; overflow-x: auto; }
  #app { padding: 14px 12px 88px; }
  .hero, .grid-2, .grid-3, .admin-grid, .form-grid { grid-template-columns: 1fr; }
  .hero__lead { min-height: 250px; padding: 26px 20px; }
  .field--wide { grid-column: auto; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .admin-grid > :last-child { grid-column: auto; }
  .panel { border-radius: 13px; }
  .panel__head { align-items: stretch; flex-direction: column; }
  .view-switch { width: 100%; overflow-x: auto; }
  .view-switch button { flex: 1 0 auto; }
  .button-row .button { flex: 1 1 140px; }
  .map { height: 320px; }
}

@media (max-width: 430px) {
  .topbar__copy small { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .role-nav button { padding: 0 12px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric b { font-size: 20px; }
  .eta { font-size: 62px; }
}
