:root {
  --navy: #1b2f5b;
  --navy-2: #2c4a8a;
  --target: #e8590c;
  --done: #2f9e44;
  --skip: #9aa0a6;
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #5f6368;
  --line: #e2ded6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button { font: inherit; border: 0; border-radius: 12px; cursor: pointer; }

#banner { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; gap: 12px;
  align-items: center; padding: calc(env(safe-area-inset-top) + 10px) 16px 12px; background: var(--navy);
  color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
#banner.arrived { background: var(--done); }
#banner.car { background: #6741d9; }
#turn-icon { font-size: 40px; width: 48px; text-align: center; font-weight: 700; flex: none; }
#turn-main { font-size: 21px; font-weight: 700; }
#turn-sub { font-size: 15px; opacity: .85; margin-top: 2px; }

#map { position: fixed; inset: 0; background: var(--bg); }
.leaflet-container { background: var(--bg); }

#tools { position: fixed; right: 12px; z-index: 1000; display: flex; flex-direction: column; gap: 8px;
  bottom: calc(env(safe-area-inset-bottom) + 200px); }
#tools button { width: 48px; height: 48px; background: var(--card); color: var(--navy); font-weight: 700;
  box-shadow: 0 1px 6px rgba(0,0,0,.25); font-size: 15px; }
#tools button.on { background: var(--navy); color: #fff; }

#card { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: var(--card);
  border-radius: 18px 18px 0 0; box-shadow: 0 -2px 14px rgba(0,0,0,.2);
  padding: 14px 16px calc(env(safe-area-inset-bottom) + 12px); }
#card-top { display: flex; gap: 12px; align-items: center; }
#door-num { flex: none; min-width: 56px; height: 56px; padding: 0 8px; border-radius: 28px; background: var(--target);
  color: #fff; font-size: 26px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
#door-addr { font-size: 22px; font-weight: 700; }
#door-sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
#card-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 12px; }
#card-actions button { height: 54px; font-size: 19px; font-weight: 700; }
.primary { background: var(--done); color: #fff; }
.secondary { background: #eceae5; color: var(--ink); }
.car-btn { background: #6741d9; color: #fff; }
#card-more { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
#card-more button { background: none; color: var(--navy-2); font-weight: 600; padding: 6px 4px; font-size: 15px; }
#progress { margin-left: auto; color: var(--muted); font-size: 14px; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); z-index: 1100; background: #222; color: #fff;
  padding: 10px 14px; border-radius: 10px; bottom: calc(env(safe-area-inset-bottom) + 200px);
  font-size: 15px; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); }
#toast button { background: none; color: #ffd43b; font-weight: 700; padding: 0; }

#list { position: fixed; inset: 0; z-index: 1200; background: var(--card); display: flex; flex-direction: column; }
#list[hidden], #toast[hidden] { display: none; }
#list-head { display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; border-bottom: 1px solid var(--line); font-size: 18px; }
#list-head button { background: var(--navy); color: #fff; padding: 8px 14px; }
#list-body { overflow-y: auto; flex: 1; padding-bottom: env(safe-area-inset-bottom); }
.run-head { padding: 12px 16px 6px; font-weight: 700; color: var(--navy); background: #f7f6f3;
  position: sticky; top: 0; font-size: 15px; }
.run-head small { color: var(--muted); font-weight: 400; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line);
  width: 100%; background: none; border-radius: 0; text-align: left; }
.row .n { min-width: 36px; height: 30px; border-radius: 15px; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.row.done .n { background: var(--done); }
.row.skipped .n { background: var(--skip); }
.row.target { background: #fff4e6; }
.row.target .n { background: var(--target); }
.row .tag { margin-left: auto; color: var(--muted); font-size: 13px; }

.door-label { background: none; border: 0; }
.door-label span { display: inline-block; transform: translate(-50%, -50%); font: 700 11px/1 sans-serif;
  color: var(--navy); background: rgba(255,255,255,.85); padding: 1px 3px; border-radius: 4px; white-space: nowrap; }
.door-label.target span { background: var(--target); color: #fff; font-size: 15px; padding: 3px 6px; }
.door-label.done span { color: var(--done); }
.door-label.skipped span { color: var(--skip); }
.street-label span { display: inline-block; font: italic 600 12px/1 sans-serif; color: #6b6458; white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; transform-origin: center; }
.car-icon span { display: inline-block; transform: translate(-50%, -50%); background: #6741d9; color: #fff;
  font: 700 12px/1 sans-serif; padding: 4px 6px; border-radius: 6px; white-space: nowrap; }

#door-num.park { background: #16a34a; }
#card-actions.single { grid-template-columns: 1fr; }
#card-actions button[hidden], #card-more[hidden] { display: none; }
.car-icon.focus span { font-size: 16px; padding: 7px 10px; box-shadow: 0 0 0 4px rgba(103,65,217,.3); }
#btn-block[hidden] { display: none; }
