/* Driver screen (/driver/): the owner's order page drawn for the road. Always dark (easy on the eyes
   at night in the car), big targets, one delivery at a time. Loaded after styles.css and admin.css. */
:root {
  --bg: #0e1512;
  --card: #18211c;
  --text: #f2f6f3;
  --muted: #a3b3a9;
  --line: #2a3830;
  --field-line: #7d9086;
  --brand: #4ade80;
  --brand-ink: #06200f;
  --brand-soft: #143222;
  --accent: #4ade80;
  --accent-ink: #06200f;
  --accent-soft: #143222;
  --warn-soft: #3a2e12;
  --warn: #f6cf7a;
  --error-soft: #3d1c19;
  --error: #ff9b90;
  --off-bg: #2a3830;
  --off-ink: #c9d5cd;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 28px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
body { background: var(--bg); color: var(--text); }
.site-header { background: #0e1512; color: var(--text); border-bottom: 1px solid var(--line); box-shadow: none; }
.site-header .brand, .site-header .header-link { color: var(--text); }
main.wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 560px; }
button, .button { color: var(--brand-ink); }
button.secondary, .button.secondary { color: var(--brand); border-color: var(--brand); }
button.link { color: var(--brand); }
button.danger { background: var(--error); color: #2b0906; }
a { color: var(--brand); }

/* Bottom bar: Drive, Today, Messages, Office. */
.drive-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  padding: 8px max(12px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  background: rgba(14, 21, 18, 0.96); border-top: 1px solid var(--line);
}
.drive-nav[hidden] { display: none; }
.drive-nav a {
  display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 14px;
  color: var(--muted); font-weight: 700; text-decoration: none;
}
.drive-nav a.active { background: var(--brand-soft); color: var(--brand); }

/* Online / paused / offline. */
.drive-online {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; border-radius: var(--radius); margin: 4px 0 14px; border: 1px solid var(--line); background: var(--card);
}
.drive-online.on { border-color: var(--brand); background: linear-gradient(135deg, #143222, #18211c 70%); }
.drive-online.paused { border-color: var(--warn); }
.drive-online-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 180px; }
.drive-online-text strong { font: 800 1.5rem/1.15 var(--display); }
.drive-online.on .drive-online-text strong { color: var(--brand); }
.drive-online.paused .drive-online-text strong { color: var(--warn); }
.drive-online-text span { color: var(--muted); font-size: 0.9rem; }
.drive-online-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.drive-online-buttons button { min-height: 48px; }

/* Today's numbers. */
.drive-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; text-align: center; min-width: 0; }
.stat strong { display: block; font: 800 1.35rem/1.2 var(--display); }
.stat span { display: block; color: var(--muted); font-size: 0.78rem; line-height: 1.25; }

.drive-title { font: 700 0.85rem/1.2 system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.drive-empty { text-align: center; padding: 44px 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.drive-empty strong { font: 800 1.3rem/1.2 var(--display); }
.drive-empty p { color: var(--muted); margin: 6px 0 0; }

/* The delivery in hand. */
.order { background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }
.drive-now .order { border-color: var(--brand); padding: 16px; }
.order h3 { font-size: 1.15rem; }
.drive-head { margin: 10px 0 12px; }
.drive-steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0; margin: 0 0 12px; }
.drive-steps li { border-top: 4px solid var(--line); padding-top: 6px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.drive-steps li.done { border-color: var(--brand); color: var(--text); }
.drive-steps li.now { border-color: var(--brand); color: var(--brand); }
.drive-stop { display: flex; flex-direction: column; gap: 2px; }
.drive-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.drive-stop strong { font: 800 1.35rem/1.2 var(--display); overflow-wrap: anywhere; }
.drive-address { color: var(--muted); overflow-wrap: anywhere; }
.drive-go { margin-top: 10px; min-height: 52px; display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 1.05rem; }
.drive-earn { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); }
.drive-earn strong { color: var(--brand); }
.drive-earn span { color: var(--muted); font-size: 0.9rem; }
.order .primary-action { min-height: 56px; font-size: 1.1rem; }
.order .next-step .primary-action, .order .next-step .button { min-height: 56px; }

/* Up next: one line each, a tap opens the whole card. */
.queue-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.queue-item > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; min-height: 56px; cursor: pointer; list-style: none; }
.queue-item > summary::-webkit-details-marker { display: none; }
.queue-main { display: flex; flex-direction: column; min-width: 0; }
.queue-where { color: var(--muted); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-due { flex: none; font-weight: 700; font-size: 0.88rem; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.queue-due.late { background: var(--error-soft); color: var(--error); }
.queue-item[open] > summary { border-bottom: 1px solid var(--line); }
.queue-item .order { border: 0; box-shadow: none; margin: 0; background: transparent; }

/* Today. */
.today-total { display: flex; flex-direction: column; padding: 18px 16px; border-radius: var(--radius); background: linear-gradient(135deg, #143222, #18211c 70%); border: 1px solid var(--brand); margin-bottom: 12px; }
.today-total span { color: var(--muted); font-weight: 700; }
.today-total strong { font: 800 2.6rem/1.1 var(--display); color: var(--brand); }
.today-rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.today-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.today-row + .today-row { border-top: 1px solid var(--line); }
.today-list { list-style: none; padding: 0; margin: 12px 0 0; }
.today-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.today-list li span { min-width: 0; overflow-wrap: anywhere; }

.toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
@media (max-width: 360px) {
  .drive-online-buttons { width: 100%; }
  .drive-online-buttons button { flex: 1; }
  .stat strong { font-size: 1.15rem; }
}
.drive-online-buttons button.danger { background: transparent; color: var(--error); border: 2px solid var(--error); box-shadow: none; }
/* Hidden means hidden (Sign out before signing in, the bottom bar). */
[hidden] { display: none !important; }

/* Your times: the driver's own dated windows. */
.av-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 18px; }
.av-panel .drive-title { margin-top: 0; }
/* "Your times" is how ordering opens: a brand border, a bigger title and the one line that says so. */
.av-panel { border: 2px solid var(--brand, #c2410c); }
.av-panel .drive-title { font-size: 1.05rem; color: inherit; }
.av-lead { font-weight: 700; margin: 0 0 6px; }
.av-warn { margin: 8px 0; }
.av-list { list-style: none; padding: 0; margin: 8px 0 12px; }
.av-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.av-list li button { min-height: 44px; flex: none; }
.av-add > summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--brand); cursor: pointer; }
.av-form { display: grid; gap: 10px; padding-top: 6px; }
.av-row select, .av-row input { min-height: 48px; width: 100%; }
.av-times { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.av-times label { color: var(--muted); font-weight: 700; }
.field-problem { color: var(--error); margin: 0; font-weight: 600; }
.drive-online.off .drive-online-text strong { color: var(--text); }

/* Hour slots tapped for a day. */
.av-days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.av-days::-webkit-scrollbar { display: none; }
.av-day { flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px; background: transparent; color: var(--muted); border: 1px solid var(--line); box-shadow: none; font-weight: 700; }
.av-day.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.av-hours { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.av-hour { min-height: 48px; padding: 0; border-radius: 12px; background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; font-weight: 700; }
.av-hour.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.av-hour:disabled { opacity: 0.35; }
.av-hour { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.av-hour small { font-size: 0.65rem; font-weight: 600; }
.av-hour.next-day { border-style: dashed; }
.av-hour.taken { opacity: 0.6; text-decoration: line-through; }
.av-summary { margin: 12px 0; font-weight: 700; }
.av-coming { font: 700 0.85rem/1.2 system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 0; }
@media (max-width: 340px) { .av-hours { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
