:root {
  --bg: #f4f4f1; --surface: #fcfcfb; --line: #e3e2dc; --ink: #0b0b0b; --ink-2: #52514e; --ink-3: #7c7b76;
  --brand: #2a78d6; --brand-ink: #fff; --good: #0b8a0b; --warn: #b26b00; --bad: #c4291c;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111110; --surface: #1a1a19; --line: #2e2e2c; --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #8f8e86;
    --brand: #3987e5; --good: #3fbf3f; --warn: #f0a92a; --bad: #ff6b5e; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; }
a { color: var(--brand); }
header.top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top h1 { font-size: 18px; margin: 0; }
header.top .who { margin-left: auto; color: var(--ink-2); font-size: 14px; display: flex; gap: 14px; align-items: center; }
main { max-width: 1100px; margin: 0 auto; padding: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }
h2 { font-size: 17px; margin: 0 0 14px; }
label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
input, select, textarea, gmp-place-autocomplete {
  display: block; width: 100%; margin-top: 5px; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
}
gmp-place-autocomplete { padding: 0; border: none; background: none; color-scheme: inherit; }
textarea { min-height: 60px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 9px; cursor: pointer; text-decoration: none; }
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.good { background: var(--good); color: #fff; border-color: var(--good); }
button.big { width: 100%; padding: 15px; font-size: 17px; }
button:disabled { opacity: .55; cursor: default; }
button.link { background: none; border: none; color: var(--ink-2); padding: 4px 6px; font-weight: 500; text-decoration: underline; }
.muted { color: var(--ink-2); } .small { font-size: 13px; }
.error { color: var(--bad); font-weight: 600; }
.ok { color: var(--good); font-weight: 600; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.pill.pending { color: var(--ink-2); } .pill.out { color: var(--brand); } .pill.delivered { color: var(--good); } .pill.cancelled { color: var(--ink-3); text-decoration: line-through; }
.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 650; }
.row .addr { color: var(--ink-2); font-size: 14px; }
.row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { padding: 6px 12px; font-size: 14px; }
.tabs button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 50; max-width: 90vw; box-shadow: var(--shadow); }
.thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; }
.empty { text-align: center; color: var(--ink-2); padding: 30px 10px; }
.notice { padding: 10px 12px; border-radius: 9px; border: 1px solid var(--warn); color: var(--warn); font-size: 14px; margin-bottom: 12px; }

/* login & landing */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.center .card { width: 100%; max-width: 380px; }
.roles { display: grid; gap: 10px; }
.roles a { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--bg); }
.roles a b { display: block; font-size: 17px; } .roles a span { color: var(--ink-2); font-size: 14px; }

/* driver */
.driver main { max-width: 640px; padding: 14px; }
#map { height: 300px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 12px; background: var(--line); }
.summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.summary .big { font-size: 20px; font-weight: 700; }
.stop { padding: 14px; }
.stop .num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.stop.next { border: 2px solid var(--brand); }
.stop .btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.stop .btns .btn, .stop .btns button { padding: 11px 6px; font-size: 15px; }
dialog { border: none; border-radius: 16px; padding: 0; width: min(520px, 94vw); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog .inner { padding: 18px; }
.photo-preview { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 10px; background: var(--bg); margin: 10px 0; display: none; }
.camera-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 30px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; color: var(--ink-2); font-weight: 600; text-align: center; }
.camera-btn input { display: none; }

.overview { margin-bottom: 4px; }
.route-line { list-style: none; margin: 0 0 14px; padding: 0; position: relative; }
.route-line li { display: flex; gap: 12px; align-items: flex-start; padding: 7px 0; position: relative; }
.route-line li::before { content: ""; position: absolute; left: 14px; top: 26px; bottom: -8px; width: 2px; background: var(--brand); opacity: .35; }
.route-line li:last-child::before { display: none; }
.route-line .dot { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; position: relative; z-index: 1; }
.route-line .ends .dot { background: var(--surface); color: var(--brand); border: 2px solid var(--brand); font-size: 12px; }
.route-line .grow { flex: 1; min-width: 0; }
.route-line .eta { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 4px; }
.route-line li:first-child .dot { font-size: 10px; }

/* stats */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi .label { font-size: 13px; color: var(--ink-2); }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.kpi .sub { font-size: 13px; color: var(--ink-3); }
.filters { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.filters label { margin: 0; }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 13px; padding: 6px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -110%); display: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--ink-2); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.section { margin-bottom: 20px; }

/* customer proof page */
.proof { max-width: 520px; margin: 0 auto; padding: 24px; text-align: center; }
.proof img { width: 100%; border-radius: 14px; margin-top: 10px; border: 1px solid var(--line); }
