/* Bilzy Rider — made for a phone held in one hand, on a scooter, in the sun:
   big type, big buttons, strong contrast; a night palette for evening runs. */
:root {
  --bg: #F2F4F9;
  --card: #FFFFFF;
  --ink: #0B1220;
  --muted: #566078;
  --line: #E1E6F0;
  --navy: #0E1B4D;
  --navy-2: #172A6B;
  --blue: #1F4FFF;
  --blue-soft: #E8EEFF;
  --green: #0B8A4B;
  --green-soft: #E4F6EC;
  --amber: #B45309;
  --amber-soft: #FEF3E2;
  --red: #C81E1E;
  --red-soft: #FDECEC;
  --shadow: 0 1px 2px rgba(14, 27, 77, .06), 0 6px 18px rgba(14, 27, 77, .06);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Devanagari', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A0F1E;
    --card: #131A2E;
    --ink: #EEF2FF;
    --muted: #A2ACC6;
    --line: #243049;
    --navy: #0A1433;
    --navy-2: #13235A;
    --blue: #6D8BFF;
    --blue-soft: #18244A;
    --green: #34D17F;
    --green-soft: #0F2A1D;
    --amber: #FBBF24;
    --amber-soft: #2E2308;
    --red: #F87171;
    --red-soft: #2E1414;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { min-height: 100dvh; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 16px; text-decoration: none; color: var(--ink); cursor: pointer; }
.btn:active { transform: translateY(1px); }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.go { background: var(--green); border-color: var(--green); color: #fff; }
.btn.collect { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.soft { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.btn[disabled] { opacity: .5; }
.btn svg { flex: 0 0 auto; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; }

/* ── Sign in ─────────────────────────────────────────────────── */
.login { min-height: 100dvh; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--navy), var(--navy-2) 55%, var(--bg) 55%); padding: calc(24px + env(safe-area-inset-top)) 16px 24px; }
.login-top { text-align: center; color: #fff; padding: 12px 0 22px; }
.login-top img { border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.login-top h1 { margin: 12px 0 2px; font-size: 28px; letter-spacing: -.01em; }
.login-top p { margin: 0; opacity: .85; }
.login-card { width: 100%; max-width: 420px; margin: 0 auto; display: grid; gap: 14px; padding: 20px; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-size: 14px; font-weight: 700; color: var(--muted); }
.field input, .field textarea { width: 100%; min-height: 52px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); font-size: 18px; }
.field textarea { min-height: 88px; padding: 12px 14px; font-size: 16px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--blue); outline: none; }
.pass { position: relative; display: block; }
.pass input { padding-right: 80px; }
.eye { position: absolute; right: 8px; top: 8px; height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 14px; }
.err { min-height: 1.3em; margin: 0; color: var(--red); font-weight: 600; }
.hint { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.lang { justify-self: center; border: 0; background: none; color: var(--blue); font-weight: 700; padding: 8px; }

/* ── The app ─────────────────────────────────────────────────── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--navy); color: #fff; }
.who { flex: 1 1 auto; min-width: 0; display: grid; }
.who b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { opacity: .8; font-size: 13px; }
.duty { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; }
.duty i { width: 12px; height: 12px; border-radius: 50%; background: #9CA3AF; box-shadow: 0 0 0 3px rgba(255, 255, 255, .15); }
.duty[aria-pressed="true"] { background: #16A34A; }
.duty[aria-pressed="true"] i { background: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); } }
.strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--card); border: 1px solid var(--line); }
.chip.ok { color: var(--green); background: var(--green-soft); border-color: transparent; }
.chip.warn { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.chip.bad { color: var(--red); background: var(--red-soft); border-color: transparent; }
.chip button { border: 0; background: none; color: inherit; font-weight: 800; text-decoration: underline; padding: 0; cursor: pointer; }
.tabs { display: flex; gap: 6px; padding: 12px 12px 4px; }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: var(--card); color: var(--muted); font-weight: 800; font-size: 15px; box-shadow: var(--shadow); cursor: pointer; }
.tabs button.on { background: var(--navy); color: #fff; }
.tabs em { font-style: normal; display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: rgba(127, 127, 127, .18); font-size: 13px; }
.list { flex: 1 1 auto; display: grid; align-content: start; gap: 12px; padding: 10px 12px 20px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.day { position: sticky; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); font-weight: 700; display: flex; justify-content: space-between; gap: 10px; }

/* ── An order card ───────────────────────────────────────────── */
.card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; border: 1.5px solid transparent; }
.card.new { border-color: var(--blue); animation: glow 1.2s ease-in-out 3; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--blue) 25%, transparent); } }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-top b { font-size: 18px; }
.card-top > div { min-width: 0; }
.card-top small { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.state { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.state.accepted, .state.packed { background: var(--amber-soft); color: var(--amber); }
.state.out_for_delivery { background: var(--blue-soft); color: var(--blue); }
.state.delivered { background: var(--green-soft); color: var(--green); }
.state.cancelled, .state.returned { background: var(--red-soft); color: var(--red); }
.addr { font-size: 16px; }
.addr small { display: block; color: var(--muted); font-size: 14px; }
.money { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-weight: 800; }
.money.cod b { color: var(--amber); font-size: 20px; }
.money.paid { color: var(--green); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1 1 0; min-width: 0; }
.dist { color: var(--muted); font-size: 14px; font-weight: 700; }

/* ── Full-screen sheets ──────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: var(--bg); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.sheet-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--navy); color: #fff; }
.sheet-top h2 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-top .state, .top .icon-btn, .sheet-top .icon-btn, .duty { flex: 0 0 auto; }
.sheet-body { display: grid; gap: 12px; padding: 12px; max-width: 640px; margin: 0 auto; }
.box { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; }
.box h3 { margin: 0; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.big-name { font-size: 22px; font-weight: 800; }
.items { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.items li { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.items li:last-child { border-bottom: 0; }
.steps { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.note-list { display: grid; gap: 6px; font-size: 14px; }
.note-list div { padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.reasons button { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; }
.reasons button.on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* ── Dialog, toast ───────────────────────────────────────────── */
.dlg { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 0; border: 0; border-radius: 20px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.dlg::backdrop { background: rgba(5, 10, 25, .6); }
.dlg form { display: grid; gap: 14px; padding: 18px; }
.dlg h2 { margin: 0; font-size: 20px; }
.dlg p { margin: 0; color: var(--muted); }
.dlg .acts { display: flex; gap: 10px; }
.dlg .acts .btn { flex: 1; }
.otp { letter-spacing: .4em; text-align: center; font-size: 26px !important; font-weight: 800; }
.toast { position: fixed; left: 50%; top: calc(74px + env(safe-area-inset-top)); z-index: 60; transform: translateX(-50%) translateY(-12px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100vw - 24px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--red); color: #fff; }
.spin { display: inline-block; width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
