:root {
  --red: #e31837;
  --ink: #111;
  --paper: #f4f1ee;
  --card: #fff;
  --muted: #6d6a68;
  --line: #e6e1dc;
  --green: #148943;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

#driver-root { min-height: 100svh; }

.driver-boot, .driver-login, .driver-empty {
  display: grid;
  min-height: 100svh;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
}

.driver-boot { background: #111; color: #fff; }
.driver-boot img { width: 150px; }
.driver-boot strong, .driver-kicker { letter-spacing: .16em; font-size: 11px; }

.driver-login { background: linear-gradient(160deg, #8e071b, var(--red) 55%, #ff4d5a); color: #fff; }
.driver-login .card, .driver-empty .card {
  width: min(100%, 420px);
  padding: 28px 24px;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 24px 50px rgba(0,0,0,.18);
}
.driver-login h1, .driver-empty h1 { margin: 6px 0 8px; font-size: 28px; letter-spacing: -.03em; }
.driver-login p, .driver-empty p { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.driver-login form, .occ-form { display: grid; gap: 12px; }
.driver-login a { color: var(--muted); font-size: 13px; text-align: center; }
.driver-login label, .occ-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 800; }
.driver-login input, .occ-form input, .occ-form select, .occ-form textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px;
}
.occ-form textarea { min-height: 90px; resize: vertical; }
.form-error { min-height: 18px; color: var(--red); font-size: 13px; }

.btn {
  display: flex; min-height: 52px; align-items: center; justify-content: center;
  padding: 0 16px; border: 0; border-radius: 14px; font-weight: 800; background: var(--red); color: #fff;
}
.btn:disabled { opacity: .55; }
.btn.secondary { background: #111; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.green { background: var(--green); }

.driver-shell { display: grid; min-height: 100svh; grid-template-rows: auto 1fr auto; }
.driver-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(16px + env(safe-area-inset-top)) 18px 14px;
  background: #111; color: #fff;
}
.driver-top small { display: block; opacity: .65; letter-spacing: .12em; font-size: 10px; }
.driver-top strong { font-size: 18px; }
.avail {
  border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 800; color: #111; background: #ffd54a;
}
.avail.off { background: #3a3a3a; color: #fff; }

.driver-body { padding: 18px 16px calc(90px + env(safe-area-inset-bottom)); }
.state-banner {
  margin-bottom: 14px; padding: 14px 16px; border-radius: 16px; background: #fff; border: 1px solid var(--line);
}
.state-banner b { display: block; font-size: 15px; }
.state-banner span { color: var(--muted); font-size: 13px; }

.stop-card, .route-head {
  background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-bottom: 12px;
}
.route-head h2 { margin: 4px 0 8px; font-size: 22px; }
.route-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.seq { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #111; color: #fff; font-weight: 800; }
.stop-card.current { border-color: var(--red); box-shadow: 0 10px 28px rgba(227,24,55,.12); }
.stop-card.done { opacity: .62; }
.stop-card header { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.stop-card h3 { margin: 0; font-size: 20px; }
.stop-card small { color: var(--muted); }
.pay { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pay span { padding: 7px 10px; border-radius: 999px; background: #f3eee9; font-size: 12px; font-weight: 800; }
.pay .warn { background: #fff3cd; }
.actions { display: grid; gap: 8px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.queue { display: grid; gap: 8px; margin-top: 8px; }
.queue div { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }

.driver-bar {
  position: sticky; bottom: 0; display: flex; gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line);
}
.offline {
  position: sticky; top: 0; z-index: 5; padding: 10px 14px; text-align: center;
  background: #111; color: #fff; font-size: 13px; font-weight: 700;
}

#driver-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: #111; color: #fff;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#driver-toast.show { opacity: 1; }
#driver-toast.error { background: var(--red); }

.occ-list { margin-top: 10px; display: grid; gap: 8px; }
.occ-list article { padding: 10px 12px; border-radius: 12px; background: #f7f3ef; font-size: 13px; }
.occ-list b { display: block; }
