/* LocalTokri — Rider website.
   Design system ported from the finalized rider demo, with three changes agreed on 16 Nov:
     · empty-bottle collection removed (out of V1 scope)
     · OTP is 6 digits, not 4
     · Navigate and "Can't deliver" added (roadmap T22)
   Fonts use the demo's own stacks, which fall back to the system UI font exactly as the
   reference does. Self-hosting Baloo 2 / Inter is a later nicety, not a blocker. */

:root {
  --bg-page: #FBF7EE; --bg-header: #FBF7EE; --surface: #FFFFFF; --surface-muted: #F4EFE4;
  --border-soft: #E6DCCB; --border-input: #8C7D6B;
  --primary: #0B4D2B; --primary-hover: #083D22; --primary-tint: #E8F2EA; --primary-border: #2E7D4F;
  --accent: #F28C1B; --accent-text: #B4470E; --accent-tint: #FCEFE2;
  --info: #0D47A1; --info-strong: #1A5FB4; --info-tint: #EAF3FC; --info-border: #BCD6F0;
  --success: #1B6B3A;
  --warning: #B26A00; --warning-tint: #FFF6E3; --warning-border: #E9A53B;
  --danger: #C62828; --danger-tint: #FDECEC; --danger-border: #D64545;
  --text-primary: #1C1C1C; --text-secondary: #4A4A4A; --text-muted: #6B6B6B;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --ts: 1;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *:before, *:after { box-sizing: inherit }
[hidden] { display: none !important }
html { font-size: calc(16px * var(--ts)) }
html, body {
  height: 100%; margin: 0; background: var(--bg-page); color: var(--text-primary);
  font: 400 1rem/1.5 Inter, system-ui, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer }
button:disabled { cursor: not-allowed }
h2, .slot, .cust .row > b, #pt, .dr b, .tt, .jn { font-family: "Baloo 2", Inter, sans-serif }
.num, .kv b, .stat b, .otp, .sm b, .scb .sub b, .no { font-feature-settings: "zero" 1, "tnum" 1 }

#app { height: 100%; max-width: 1000px; margin: auto; display: flex; flex-direction: column; padding: 0 16px 16px }

/* ---- Header ---- */
.hd {
  display: flex; align-items: center; justify-content: space-between; height: 68px; flex: none;
  background: var(--bg-header); border-bottom: 1px solid var(--border-soft);
  margin: 0 -16px 16px; padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0 }
.brand-mark {
  width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--primary);
  color: #fff; display: grid; place-items: center; font: 800 15px "Baloo 2", Inter, sans-serif;
}
.brand-name { font: 700 20px "Baloo 2", Inter, sans-serif; color: var(--primary); line-height: 1 }
.brand-name span { color: var(--accent-text); font-size: 13px; display: block; font-weight: 700 }
.pf {
  width: 48px; height: 48px; border-radius: 999px; border: 2px solid var(--primary);
  background: var(--surface); color: var(--primary); display: grid; place-items: center;
  transition: background .15s ease-out;
}
.pf:hover { background: var(--primary-tint) }
.pf svg { width: 24px; height: 24px; stroke: var(--primary) }

/* ---- Map ---- */
.mapw {
  position: relative; flex: 1; min-height: 150px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border-soft); background: #ECE7DC; box-shadow: var(--shadow);
}
.mapw svg, .scm svg { width: 100%; height: 100%; display: block }
.chip {
  position: absolute; left: 12px; top: 12px; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: 999px; padding: 4px 12px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}

/* ---- Panel ---- */
.pnl {
  flex: none; margin-top: 16px; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 16px; padding: 16px; box-shadow: var(--shadow); animation: up .15s ease-out;
}
@keyframes up { from { transform: translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---- Buttons ---- */
.btn {
  width: 100%; min-height: 56px; border: 0; border-radius: 12px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 17px; transition: background .15s ease-out;
}
.btn:hover, .btn:active { background: var(--primary-hover) }
.btn.sec {
  background: var(--surface); color: var(--primary); border: 2px solid var(--primary);
  min-height: 52px; font-size: 16px;
}
.btn.sec:hover { background: var(--primary-tint) }
.btn.danger { background: var(--surface); color: var(--danger); border: 2px solid var(--danger-border); min-height: 52px; font-size: 16px }
.btn.danger:hover { background: var(--danger-tint) }
.btn:disabled { background: var(--surface-muted); color: #A79C8C; border-color: var(--surface-muted) }
.btn:focus-visible, .pf:focus-visible, .mi:focus-visible, .tg:focus-visible,
select:focus-visible, input:focus-visible, .stp:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between }
h2 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 700; color: var(--primary) }
.sub { color: var(--text-muted); font-size: 14px }

.pill {
  display: inline-flex; align-items: center; gap: 5px; background: var(--primary-tint);
  color: var(--success); border: 1px solid var(--primary-border); border-radius: 999px;
  padding: 4px 10px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.pill:before { content: "✓"; font-weight: 800 }

.tg {
  width: 100%; background: none; border: 0; display: flex; justify-content: space-between;
  align-items: center; min-height: 48px; padding: 10px 2px 4px; color: var(--primary);
  font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.tg svg { transition: transform .15s ease-out } .tg[aria-expanded=true] svg { transform: rotate(180deg) }
.det { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .15s ease-out }
.det.o { grid-template-rows: 1fr }
.det > div { overflow: hidden }
.kv { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; border-top: 1px solid var(--border-soft) }
.kv span { font-weight: 700; font-size: 15px; color: var(--text-secondary) }
.kv b { color: var(--info); font-size: 20px; font-weight: 700 }

.prog { display: flex; gap: 6px; margin: 0 0 14px }
.prog i { flex: 1; height: 8px; border-radius: 6px; background: #E6DCCB }
.prog i.d { background: var(--primary) } .prog i.c { background: var(--accent) } .prog i.f { background: var(--danger) }

/* ---- OTP ---- */
.otp {
  width: 100%; height: 64px; border-radius: 12px; border: 1.5px solid var(--border-input);
  background: var(--surface); color: var(--text-primary); font-size: 30px; font-weight: 700;
  letter-spacing: .4em; text-align: center; padding-left: .4em; margin: 8px 0 4px;
}
.otp.bad { border: 2px solid var(--danger); animation: sh .35s }
@keyframes sh { 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
.err { color: var(--danger); min-height: 22px; font-weight: 700; font-size: 15px }
.err:not(:empty):before {
  content: "!"; display: inline-grid; place-items: center; width: 18px; height: 18px;
  border: 2px solid var(--danger); border-radius: 50%; font-size: 12px; margin-right: 6px; vertical-align: -3px;
}
.ok { color: var(--success); font-weight: 700; margin-bottom: 4px }
.demo {
  display: inline-block; background: var(--warning-tint); color: var(--warning);
  border: 1px solid var(--warning-border); border-radius: 999px; padding: 1px 8px;
  font-size: 12px; font-weight: 700; margin-right: 6px;
}

/* ---- Reason select (route change + failed delivery) ---- */
.ro { margin-top: 10px; display: grid; gap: 10px; animation: up .15s ease-out }
.ro label { font-weight: 600; font-size: 15px; color: var(--text-primary) }
select {
  width: 100%; min-height: 52px; border-radius: 12px; background: var(--surface);
  color: var(--text-primary); border: 1.5px solid var(--border-input); padding: 0 14px; font-size: 16px;
}
.ro.fail { border-top: 1px solid var(--border-soft); padding-top: 12px }
.note {
  background: var(--primary-tint); border: 2px solid var(--primary-border); color: var(--primary);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.note svg { width: 20px; height: 20px; flex: none }
.note.bad { background: var(--danger-tint); border-color: var(--danger-border); color: var(--danger) }

/* ---- Drawer ---- */
.scr {
  position: fixed; inset: 0; background: rgba(28,28,28,.35); opacity: 0; pointer-events: none;
  transition: opacity .15s ease-out; z-index: 5;
}
.scr.o { opacity: 1; pointer-events: auto }
.dr {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); background: var(--surface);
  border-right: 1px solid var(--border-soft); transform: translateX(-102%);
  transition: transform .15s ease-out; z-index: 6;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px 16px; visibility: hidden;
  box-shadow: 0 2px 24px rgba(0,0,0,.08);
}
.dr.o { transform: none; visibility: visible }
.dr b { font-size: 19px; color: var(--text-primary) }
.dr #cl { border: 1.5px solid var(--border-input) !important; color: var(--text-secondary) !important; background: var(--surface) }
.av {
  width: 56px; height: 56px; border-radius: 50%; background: var(--primary-tint);
  border: 2px solid var(--primary-border); display: grid; place-items: center;
  font-weight: 700; font-size: 22px; color: var(--primary);
}
.mi {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 18px; min-height: 54px;
  padding: 0 14px; border-radius: 12px; border: 2px solid var(--primary-border);
  background: var(--primary-tint); color: var(--primary); font-weight: 700; font-size: 17px; text-align: left;
}
.mi.out { border-color: var(--border-input); background: var(--surface); color: var(--text-secondary) }

/* ---- Completion popup ---- */
.pop { position: fixed; inset: 0; display: none; place-items: center; background: rgba(28,28,28,.4); z-index: 9; padding: 18px }
.pop.o { display: grid }
.card {
  width: min(420px, 100%); background: var(--primary-tint); border: 2px solid var(--primary-border);
  border-radius: 16px; padding: 28px 22px; text-align: center; animation: up .15s ease-out; box-shadow: var(--shadow);
}
.card #sum { background: var(--surface); border: 2px dashed var(--primary-border); border-radius: 12px; padding: 4px 14px }
.card #sum .kv:first-child { border-top: 0 }
.chk {
  width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--primary);
  background: transparent; margin: 0 auto 12px; display: grid; place-items: center;
}
.chk svg { stroke: var(--primary) }
#pt { font-size: 26px }
.card .sub { color: var(--text-secondary); font-size: 16px }

.toast {
  position: fixed; left: 50%; top: 80px; transform: translate(-50%,-10px); background: var(--primary);
  color: #fff; font-weight: 700; padding: 12px 20px; border-radius: 999px; opacity: 0;
  transition: .15s ease-out; z-index: 8; pointer-events: none; box-shadow: var(--shadow);
}
.toast.o { opacity: 1; transform: translate(-50%,0) }
.toast.bad { background: var(--danger) }

.pulse { animation: pl 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center }
@keyframes pl { 0% { transform: scale(.8); opacity: .6 } 100% { transform: scale(2.2); opacity: 0 } }
.flow { stroke-dasharray: 14 12; animation: fl 1s linear infinite }
@keyframes fl { to { stroke-dashoffset: -26 } }

/* ---- Home: schedule cards ---- */
#hm { flex: 1; display: flex; flex-direction: column; gap: 16px; min-height: 0 }
.hh { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex: none; margin-bottom: -4px }
.hh h2 { font-size: 24px }
.sc {
  flex: 1; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: 16px; overflow: hidden; min-height: 0; box-shadow: var(--shadow);
}
.scm { flex: 3; position: relative; min-height: 0; background: #ECE7DC }
.scb {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; background: var(--info-tint); border-top: 1px solid var(--info-border);
}
.si { min-width: 0 }
.slot { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1.1; margin-bottom: 6px }
.scb .sub { color: var(--text-secondary) } .scb .sub b { color: var(--info) }
.sst { width: auto; min-width: 104px; min-height: 52px; padding: 0 22px }
.sst3 { display: flex; gap: 6px }
.sst3 span {
  display: flex; flex-direction: column; align-items: flex-start; background: var(--surface);
  border: 1px solid var(--info-border); border-radius: 10px; padding: 3px 9px 4px;
  font-size: 11px; font-weight: 600; color: var(--text-secondary); line-height: 1.2;
}
.sst3 b { font-size: 18px; color: var(--info); font-feature-settings: "zero" 1, "tnum" 1 }

/* ---- Trip header ---- */
.eyb { font-size: 13px; font-weight: 700; color: var(--accent-text); letter-spacing: .02em }
.trip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px }
.tt { font-weight: 700; font-size: 24px; line-height: 1.1; color: var(--primary); white-space: nowrap }
.tc { display: flex; gap: 6px }
.tc span {
  display: flex; flex-direction: column; align-items: center; min-width: 52px; border-radius: 10px;
  padding: 3px 6px; background: var(--surface-muted); font-size: 11px; font-weight: 700;
  color: var(--text-secondary); line-height: 1.15;
}
.tc b { font-size: 18px; color: var(--text-primary); font-feature-settings: "zero" 1, "tnum" 1 }
.tc .d { background: var(--primary-tint) } .tc .d b { color: var(--primary) }
.tc .e { background: var(--danger-tint) } .tc .e b { color: var(--danger) }

/* ---- Job card ---- */
.job {
  background: var(--surface); border: 1.5px solid var(--border-soft); border-left: 5px solid var(--primary);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px;
}
.job.failed { border-left-color: var(--danger) }
.jh { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.jn { font-weight: 700; font-size: 26px; line-height: 1.1; color: var(--text-primary) }
.ja { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 15px; margin: 2px 0 10px }
.ja svg { width: 18px; height: 18px; flex: none; color: var(--accent) }
.st { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700; white-space: nowrap; border: 1px solid }
.st svg { width: 15px; height: 15px }
.st.i { background: var(--info-tint); color: var(--info); border-color: var(--info-border) }
.st.w { background: var(--warning-tint); color: var(--warning); border-color: var(--warning-border) }
.st.g { background: var(--primary-tint); color: var(--success); border-color: var(--primary-border) }
.st.r { background: var(--danger-tint); color: var(--danger); border-color: var(--danger-border) }

.tiles2, .tiles3 { display: grid; gap: 8px }
.tiles2 { grid-template-columns: 1fr 1fr } .tiles3 { grid-template-columns: 1fr 1fr 1fr; margin-bottom: 14px }
.tiles2 > div, .tiles3 > div {
  display: flex; align-items: center; gap: 8px; border-radius: 12px; padding: 8px 10px;
  background: var(--surface-muted); border: 1px solid var(--border-soft);
}
.tiles3 > div { flex-direction: column; align-items: flex-start; gap: 0 }
.tiles2 b, .tiles3 b { font-size: 28px; line-height: 1; font-weight: 700; color: var(--text-primary); font-feature-settings: "zero" 1, "tnum" 1 }
.tiles2 span, .tiles3 span { font-size: 13px; font-weight: 600; color: var(--text-secondary); line-height: 1.2 }
.tiles2 .i, .tiles3 .i { background: var(--info-tint); border-color: var(--info-border) }
.tiles2 .i b, .tiles3 .i b { color: var(--info) }
.tiles2 .o, .tiles3 .o { background: var(--accent-tint); border-color: #F3C99A }
.tiles2 .o b, .tiles3 .o b { color: var(--accent-text) }

.lb { display: block; font-weight: 700; font-size: 16px; color: var(--text-primary) }
.stack { display: grid; gap: 10px; margin-top: 10px }

/* ---- Stop list ---- */
.lst { display: grid; gap: 6px }
.stp {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 5px 12px;
  border-radius: 12px; border: 1.5px solid var(--border-input); background: var(--surface);
  text-align: left; transition: background .15s ease-out;
}
.stp:hover { background: var(--accent-tint); border-color: var(--primary) }
.stp.n { border: 2px solid var(--accent); background: var(--accent-tint) }
.stp.done { opacity: .6 } .stp.done:hover { background: var(--surface); border-color: var(--border-input) }
.stp .no {
  width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--primary);
  color: #fff; font-weight: 700; display: grid; place-items: center;
}
.stp .no.y { background: var(--accent); color: var(--text-primary) }
.stp .no.g { background: #C9C0AE; color: var(--text-primary) }
.stp .no.r { background: var(--danger) }
.sx { flex: 1; min-width: 0; display: flex; flex-direction: column }
.sx b { font-size: 17px }
.sx span { color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.sx em {
  font-style: normal; font-size: 11px; font-weight: 700; background: var(--accent-tint);
  color: var(--accent-text); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 8px; margin-left: 6px;
}
.sm { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: var(--text-muted); white-space: nowrap }
.sm b { color: var(--info); font-size: 16px }
.sm span { display: inline-flex; align-items: center; gap: 3px }
.sm svg { width: 13px; height: 13px; color: var(--info) }

/* ---- Sign in ---- */
.auth { flex: 1; display: grid; place-items: center; padding: 16px }
.auth-inner { width: 100%; max-width: 23rem; display: grid; gap: 18px }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center }
.auth-card {
  display: grid; gap: 16px; padding: 22px; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: 16px; box-shadow: var(--shadow);
}
.fld { display: grid; gap: 6px }
.inp {
  width: 100%; min-height: 58px; padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--border-input); background: var(--surface); color: var(--text-primary);
  font-size: 20px; font-weight: 600; letter-spacing: .04em;
}
.inp::placeholder { font-size: 16px; letter-spacing: 0; color: var(--text-muted); font-weight: 400 }
.inp-pin { letter-spacing: .5em }

@media (min-width: 760px) {
  #app { padding: 0 24px 22px }
  .hd { margin: 0 -24px 16px; padding: 0 24px }
  .pnl { padding: 20px 24px }
  #hm { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; gap: 16px }
  .hh { grid-column: 1/-1; margin: 0 }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important } }

/* ---- Payment (T23) ----
   The QR sits on its own white card whatever the surrounding tint, because a scanner
   needs dark modules on a light background. crispEdges keeps the module edges sharp
   when the SVG is scaled to the phone's width. */
.qrw { margin-top: 12px }
.qr {
  margin: 10px auto 8px; width: 100%; max-width: 260px; aspect-ratio: 1;
  background: #fff; border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 10px; display: grid; place-items: center; box-shadow: var(--shadow);
}
.qr svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges }
.vpa {
  text-align: center; font-weight: 700; font-size: 16px; margin-bottom: 4px;
  background: var(--surface-muted); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 8px 10px; word-break: break-all;
  user-select: all; -webkit-user-select: all;
  font-feature-settings: "zero" 1, "tnum" 1;
}
