* { box-sizing: border-box; }
body { margin: 0; font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: #f2f4f8; color: #1b2330; }
.hidden { display: none !important; }
header { position: sticky; top: 0; z-index: 5; background: #1f4fd8; color: #fff; display: flex; justify-content: space-between;
  align-items: center; padding: 12px 14px; }
header .title { font-weight: 700; font-size: 19px; }
header .link { color: #dfe6ff; }
nav { position: sticky; top: 50px; z-index: 4; display: flex; overflow-x: auto; background: #fff; border-bottom: 1px solid #dde2ea; }
nav button { flex: 1 0 auto; border: 0; background: none; padding: 14px 14px; font-size: 16px; color: #555; border-bottom: 3px solid transparent; }
nav button.on { color: #1f4fd8; border-bottom-color: #1f4fd8; font-weight: 700; }
nav .badge { background: #e33; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 13px; margin-left: 4px; }
main { padding: 12px; max-width: 640px; margin: 0 auto; padding-bottom: 80px; }
.card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
h3 { margin: 0 0 10px; font-size: 18px; }
input, select { width: 100%; font-size: 17px; padding: 12px; border: 1px solid #cfd6e0; border-radius: 10px; margin: 4px 0 8px; background: #fff; }
label { display: block; font-size: 15px; color: #445; margin-bottom: 4px; }
label.check { display: flex; gap: 10px; align-items: center; }
label.check input { width: 22px; height: 22px; margin: 0; }
button { font-size: 16px; border-radius: 10px; border: 1px solid #cfd6e0; background: #fff; padding: 10px 14px; cursor: pointer; }
button.big { width: 100%; padding: 16px; font-size: 18px; font-weight: 700; margin-top: 6px; }
button.primary { background: #1f4fd8; color: #fff; border-color: #1f4fd8; }
button.green { background: #12a150; color: #fff; border-color: #12a150; }
button.red { background: #fff; color: #c22; border-color: #e3a5a5; }
button.small { padding: 8px 12px; font-size: 15px; }
button.link { border: 0; background: none; padding: 4px; color: #1f4fd8; }
button:disabled { opacity: .5; }
.picker { width: 100%; text-align: left; padding: 14px; font-size: 18px; font-weight: 600; background: #f6f8fc; }
.picker .sub { display: block; font-weight: 400; font-size: 14px; color: #667; }
.lab { font-size: 14px; color: #667; margin: 6px 0 2px; text-transform: uppercase; letter-spacing: .03em; }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; min-width: 0; }
.swapline { text-align: right; margin: -4px 0 -6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.chip { padding: 10px 12px; border-radius: 20px; background: #f1f3f7; border: 1px solid #d8dde6; font-size: 15px; }
.chip.on { background: #1f4fd8; color: #fff; border-color: #1f4fd8; }
.chip .truck { font-size: 12px; opacity: .8; }
.err { color: #c22; margin-top: 8px; min-height: 1em; }
.ok { color: #12a150; margin-top: 8px; }
.muted { color: #778; font-size: 14px; }
.hrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.search { margin-bottom: 10px; }
.trip .route { font-size: 18px; font-weight: 700; }
.trip .meta { color: #556; font-size: 15px; margin: 4px 0; }
.trip .fare { font-size: 22px; font-weight: 800; }
.trip .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.trip .actions button { flex: 1 0 auto; }
.status { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 14px; font-weight: 700; background: #eef; color: #335; }
.s-requested, .s-booking { background: #fff4d6; color: #8a5a00; }
.s-quoted { background: #e3ecff; color: #1f4fd8; }
.s-waiting-approval { background: #ffe9d6; color: #b45309; }
.s-dry-run-booked { background: #ede3ff; color: #6b21a8; }
.s-driver-assigned, .s-picked-up { background: #dcfce7; color: #166534; }
.s-delivered { background: #d1fae5; color: #065f46; }
.s-cancelled, .s-failed { background: #fde2e2; color: #b91c1c; }
.fares { width: 100%; border-collapse: collapse; margin-top: 8px; }
.fares td { padding: 9px 4px; border-top: 1px solid #eef0f4; }
.fares tr.sel td { font-weight: 700; background: #f0f5ff; }
.fares td.r { text-align: right; white-space: nowrap; }
.fares .was { text-decoration: line-through; color: #99a; font-size: 13px; margin-left: 4px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 3px solid #c7d2fe; border-top-color: #1f4fd8; border-radius: 50%;
  animation: spin 1s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.addr { padding: 12px 4px; border-bottom: 1px solid #eef0f4; }
.addr b { font-size: 17px; }
.addr .muted { font-size: 14px; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; align-items: flex-end; }
.sheetbox { background: #fff; width: 100%; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 12px; }
.sheetbox .opt { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #eef0f4; border-radius: 0; padding: 14px 6px; }
.sheetbox .opt b { font-size: 17px; }
.sheetbox .opt span { display: block; color: #778; font-size: 14px; }
.loginbox { max-width: 360px; margin: 12vh auto; padding: 20px; background: #fff; border-radius: 16px; text-align: center; }
.loginbox .logo { font-size: 48px; }
.loginbox label { text-align: left; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 10px; vertical-align: 2px; }
.pill.warn { background: #fde68a; color: #7c2d12; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1b2330; color: #fff; padding: 12px 18px;
  border-radius: 12px; z-index: 30; max-width: 90vw; }
#a-map { height: 260px; border-radius: 12px; margin: 8px 0; }
.kpis { display: flex; gap: 10px; }
.kpi { flex: 1; background: #fff; border-radius: 14px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 12px; }
.kpi .n { font-size: 26px; font-weight: 800; }
.kpi .l { color: #667; font-size: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl td { padding: 7px 4px; border-top: 1px solid #eef0f4; }
.tbl td.r { text-align: right; }
.route-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid #eef0f4; gap: 8px; }
