/* FR Cycling Logistics – driver app styles. Colours match the admin system. */
:root {
  --ink: #1A1D24;
  --ink-2: #3D4452;
  --muted: #5B6472;
  --line: #E2E5EA;
  --line-2: #EEF0F3;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --red: #B0283A;
  --red-soft: #FBE9EB;
  --red-ink: #9A2132;
  --green: #17633D;
  --green-soft: #E7F5ED;
  --amber: #8A5A00;
  --amber-mid: #C47A00;
  --amber-soft: #FFF4DE;
  --blue: #1E4FA8;
  --blue-soft: #EEF3FC;
  --purple-soft: #F1EAFB;
  --purple-ink: #5B2C9E;
  --radius: 16px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
a { color: var(--blue); }
h1, h2 { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.loading { padding: 40vh 0; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.muted-inv { color: #C9CDD5; margin: 0; font-size: 14px; }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.strike { text-decoration: line-through; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand { font-weight: 800; font-style: italic; letter-spacing: .5px; font-size: 16px; }
.brand span { color: #F0525F; }
.brand-lg { font-size: 34px; line-height: 1.05; color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 12px; border: 0; font-weight: 600; font-size: 15px; text-decoration: none; }
.btn-lg { min-height: 56px; font-size: 16px; font-weight: 700; width: 100%; }
.btn-sm { min-height: 44px; font-size: 13px; padding: 0 12px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-amber { background: var(--amber); color: #fff; }
.btn-disabled, .btn:disabled { background: #8C929C; color: #fff; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.btn-outline-green { background: #fff; color: var(--green); border: 2px solid var(--green); width: 100%; }
.btn-outline-amber { background: #fff; color: var(--amber); border: 2px solid var(--amber-mid); }
.btn-soft { background: var(--bg); color: var(--ink); }
.btn-soft-blue { background: var(--blue-soft); color: var(--blue); }
.link-btn { background: none; border: 0; color: inherit; text-decoration: underline; font-size: 13px; padding: 10px 4px; min-height: 44px; }
.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions-wide { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.actions-wide .btn-lg { width: auto; }

/* Sign in */
.signin { min-height: 100vh; display: flex; flex-direction: column; background: var(--ink); }
.signin-brand { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px 28px; color: #C9CDD5; }
.signin-brand p { margin: 10px 0 0; }
.signin-card { background: #fff; border-radius: 24px 24px 0 0; padding: 28px 24px 40px; display: flex; flex-direction: column; gap: 10px; }
.signin-card h1 { font-size: 28px; }
.signin-card p { margin: 0; }
.signin-card label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.signin-card input { height: 52px; border: 1px solid #C9CDD5; border-radius: 12px; padding: 0 14px; font-size: 16px; }
.signin-card .btn { margin-top: 12px; }
.demo-hint { background: var(--amber-soft); color: #6B4600; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.error { color: var(--red); font-weight: 600; }

/* Demo bar */
.demo-bar { background: var(--amber-soft); color: #6B4600; font-size: 12px; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.demo-controls { display: flex; align-items: center; gap: 8px; }
.seg-group { display: inline-flex; border: 1px solid #E2C48A; border-radius: 8px; overflow: hidden; }
.seg { background: #fff; border: 0; padding: 0 10px; min-height: 36px; font-size: 12px; color: #6B4600; }
.seg + .seg { border-left: 1px solid #E2C48A; }
.seg-on { background: #6B4600; color: #fff; }

/* Header */
.top { background: var(--ink); color: #fff; padding: 18px 20px 68px; display: flex; flex-direction: column; gap: 10px; padding-top: max(18px, env(safe-area-inset-top)); }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.top-right { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #C9CDD5; white-space: nowrap; }
.top h1 { font-size: 38px; line-height: 1; font-weight: 800; }

/* Layout */
.content { display: flex; flex-direction: column; gap: 14px; padding: 0 16px 48px; margin-top: -54px; padding-bottom: max(48px, env(safe-area-inset-bottom)); }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 10px rgba(16, 24, 40, .06); }
.card h2 { font-size: 15px; }
.card-dark { background: var(--ink); color: #fff; }
.card-dark h2 { font-size: 24px; }
.card-dark p { color: #C9CDD5; margin: 6px 0 0; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 6px 4px 0; }

/* Shift card */
.shift { display: flex; align-items: center; gap: 14px; }
.shift-col { display: flex; flex-direction: column; gap: 12px; }
.shift-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.big { font-size: 26px; font-weight: 800; }
.on-shift { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #1E7A4C; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: #1E9E5E; }

/* Live route */
.live { display: flex; flex-direction: column; gap: 12px; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.badge-neutral { background: var(--bg); color: var(--ink-2); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-good { background: var(--green-soft); color: var(--green); }
.status-line { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.tl { position: relative; height: 92px; margin: 0 12px; }
.tl-track, .tl-fill { position: absolute; left: 0; top: 46px; height: 4px; border-radius: 2px; }
.tl-track { right: 0; background: var(--line); }
.tl-fill { background: var(--red); transition: width .4s linear; }
.tl-end { position: absolute; top: 40px; width: 16px; height: 16px; border-radius: 4px; background: var(--ink); transform: translateX(-50%); }
.tl-time { position: absolute; top: 66px; font-size: 11px; font-weight: 600; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.tl-time-end { transform: translateX(-80%); }
.tl-dot { position: absolute; top: 37px; width: 22px; height: 22px; border-radius: 11px; background: #fff; border: 2px solid #9AA1AD; transform: translateX(-50%); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.dot-current { border: 3px solid var(--red); }
.dot-done { background: var(--green); border-color: var(--green); color: #fff; }
.dot-amend { background: var(--amber-mid); border-color: var(--amber-mid); color: #fff; }
.tl-bike { position: absolute; top: 2px; transform: translateX(-50%); color: var(--red); transition: left .4s linear; }
.tl-bike.moving { animation: bob .5s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -2px); } }
@media (prefers-reduced-motion: reduce) { .tl-bike.moving { animation: none; } .tl-fill, .tl-bike { transition: none; } }
.staff-note { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.stats > * { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.stats strong { font-size: 16px; }
.stats span { font-size: 11px; color: var(--muted); }
.stats a strong, .stats a span { color: var(--blue); }

/* Stop cards */
.stop { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 2px solid transparent; }
.stop-current { border-color: var(--red); box-shadow: 0 4px 16px rgba(16, 24, 40, .1); }
.banner { padding: 8px 14px; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.banner-red { background: var(--red); }
.banner-green { background: var(--green); }
.banner-grey { background: var(--muted); }
.stop-head { display: flex; gap: 12px; align-items: center; width: 100%; padding: 14px; background: none; border: 0; text-align: left; color: inherit; }
.num { width: 32px; height: 32px; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.num-red { background: var(--red); }
.num-green { background: var(--green); width: 28px; height: 28px; font-size: 13px; }
.num-amber { background: var(--amber-mid); width: 28px; height: 28px; font-size: 13px; }
.stop-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stop-time { font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stop-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; padding: 3px 6px; border-radius: 5px; white-space: nowrap; }
.chip-collect { background: var(--purple-soft); color: var(--purple-ink); }
.chip-drop { background: var(--red-soft); color: var(--red-ink); }
.chip-ok { background: var(--green-soft); color: var(--green); }
.chip-amend { background: var(--amber-soft); color: var(--amber); }
.chev { color: var(--muted); transition: transform .2s; flex-shrink: 0; }
.chev-open { transform: rotate(180deg); }
.progress { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; display: flex; }
.bar > span { background: var(--green); border-radius: 3px; }
.progress-text { font-size: 12px; font-weight: 700; color: var(--green); white-space: nowrap; }
.pad { padding: 0 14px 14px; }
.detail { display: flex; flex-direction: column; gap: 12px; padding: 0 14px 14px; }
.note { font-size: 14px; background: var(--amber-soft); color: #6B4600; border-radius: 10px; padding: 10px 12px; line-height: 1.4; }
.facts { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.facts > div { display: flex; gap: 10px; }
.facts dt { width: 72px; color: var(--muted); flex-shrink: 0; }
.facts dd { margin: 0; }
.onsite { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line-2); background: #F7F8FA; }

/* Bulk checklist */
.checklist { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.checklist-head { display: flex; justify-content: space-between; padding: 10px 12px; background: #F7F8FA; font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .4px; }
.check-row { border-top: 1px solid var(--line-2); background: #fff; }
.check-row.is-done { background: #F1F8F4; }
.check-row.is-amend { background: #FFFAF0; }
.check-line { display: flex; align-items: center; gap: 4px; padding-right: 8px; }
.check-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 60px; background: none; border: 0; text-align: left; color: inherit; }
.check-main:disabled { cursor: default; opacity: .75; }
.box { width: 28px; height: 28px; border-radius: 8px; border: 2px solid #9AA1AD; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; flex-shrink: 0; background: #fff; }
.is-done .box { background: var(--green); border-color: var(--green); }
.is-amend .box { background: var(--amber-mid); border-color: var(--amber-mid); }
.check-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.state { font-size: 11px; font-weight: 700; letter-spacing: .3px; color: var(--muted); }
.is-done .state { color: var(--green); }
.is-amend .state { color: var(--amber); }
.warn-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #E2C48A; background: #FFF8EA; color: var(--amber); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.warn-btn:disabled { opacity: .4; cursor: default; }
.check-note { margin: 0 12px 12px 52px; font-size: 13px; color: #6B4600; background: var(--amber-soft); border-radius: 8px; padding: 8px 10px; }

/* Amend panel */
.amend { margin: 0 0 4px; padding: 12px; border-radius: 12px; background: #fff; border: 2px solid #E2C48A; display: flex; flex-direction: column; gap: 10px; }
.check-row .amend { margin: 0 12px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { min-height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid #C9CDD5; background: #fff; font-weight: 600; font-size: 13px; color: var(--ink); }
.pill-on { border: 2px solid var(--amber-mid); background: var(--amber-soft); }
textarea { width: 100%; border: 1px solid #C9CDD5; border-radius: 10px; padding: 10px 12px; font-size: 15px; resize: vertical; color: var(--ink); }

/* Completed */
.done-hint { margin: -8px 4px 0; }
.done-row { background: #fff; border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.done-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }

/* SMS sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; background: #fff; border-radius: 20px 20px 0 0; padding: 18px 18px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; z-index: 11; max-height: 90vh; overflow: auto; }
.sheet h2 { font-size: 18px; }
.sheet p { margin: 0; }
.sheet .pill-on { border-color: var(--blue); background: var(--blue-soft); }

/* Toast */
.toast { position: fixed; left: 16px; right: 16px; bottom: 24px; max-width: 528px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 12px; padding: 14px 16px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.toast.show { opacity: 1; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Proof of delivery form */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
.center { text-align: center; }
.pod-top { position: sticky; top: 0; z-index: 5; background: var(--ink); color: #fff; display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
.pod-heading { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pod-heading .small { color: #C9CDD5; }
.link-inv { color: #fff; }
.pod { display: flex; flex-direction: column; gap: 14px; padding: 16px 16px 48px; }
.pod-summary { display: flex; flex-direction: column; gap: 10px; }
.pod-summary p { margin: 0; }
.pod-form { display: flex; flex-direction: column; gap: 18px; }
.q { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.q-head { display: flex; flex-direction: column; gap: 2px; }
.q-label { font-size: 15px; font-weight: 700; }
.q-desc { font-size: 13px; color: var(--muted); }
.q-error { font-size: 13px; font-weight: 700; color: var(--red); }
.q-has-error { border-left: 4px solid var(--red); padding-left: 10px; }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.yn-btn { min-height: 48px; border-radius: 12px; border: 1px solid #C9CDD5; background: #fff; font-weight: 700; font-size: 15px; color: var(--ink); }
.yn-yes { background: var(--green-soft); border: 2px solid var(--green); color: var(--green); }
.yn-no { background: var(--red-soft); border: 2px solid var(--red); color: var(--red-ink); }
.input { height: 48px; border: 1px solid #C9CDD5; border-radius: 10px; padding: 0 12px; font-size: 16px; color: var(--ink); width: 100%; }
textarea { font-size: 16px; }
.pill-sm { align-self: flex-start; min-height: 36px; font-size: 12px; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 88px; height: 88px; border-radius: 10px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 14px; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 18px; line-height: 1; }
.add-photo { width: 88px; height: 88px; border-radius: 10px; border: 1px dashed #9AA1AD; background: #F7F8FA; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.add-photo:focus-within { outline: 3px solid var(--blue); }
.sig-wrap { position: relative; }
.sig { width: 100%; height: 180px; border: 1px solid #C9CDD5; border-radius: 12px; background: #fff; touch-action: none; display: block; }
.sig-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9AA1AD; font-weight: 600; pointer-events: none; }
.q .link-btn { align-self: flex-start; }
