:root {
  color-scheme: dark;
  --bg: #07110f;
  --panel: rgba(9, 20, 17, 0.96);
  --panel-2: #10221d;
  --line: #1d3a33;
  --text: #f1fff9;
  --muted: #93afa6;
  --accent: #33e6a4;
  --accent-2: #0fb77d;
  --drop: #67a7ff;
  --danger: #ff7171;
  --shadow: 0 20px 70px rgba(0,0,0,.38);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow: hidden; }
button { font: inherit; }

.app-shell { min-height: 100svh; display: grid; grid-template-rows: 1fr auto; background: radial-gradient(circle at top left, #123f35 0, #07110f 40%, #020504 100%); }
.map-wrap { position: relative; min-height: 56svh; }
#map { position: absolute; inset: 0; background: #10221d; }
#map::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 -90px 90px rgba(7,17,15,.72); z-index: 500; }

.top-card { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; right: 14px; z-index: 700; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 14px 16px; border: 1px solid rgba(29,58,51,.82); border-radius: 22px; background: rgba(7, 17, 15, 0.82); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.language-switch { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 999px; background: rgba(16,34,29,.92); color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .04em; }
.language-switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 42px; height: 24px; padding: 3px; border-radius: 999px; background: #06110f; border: 1px solid rgba(51,230,164,.18); transition: background .18s ease, border-color .18s ease; }
.switch-thumb { display: block; width: 16px; height: 16px; border-radius: 999px; background: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,.32); transition: transform .18s ease; }
.language-switch input:checked + .switch-track { background: rgba(51,230,164,.16); border-color: rgba(51,230,164,.45); }
.language-switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.lang-label { line-height: 1; }
.eyebrow { margin: 0 0 3px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(20px, 5vw, 32px); line-height: 1; letter-spacing: -.045em; }
.icon-btn { width: 44px; height: 44px; border-radius: 15px; border: 1px solid var(--line); color: var(--text); background: var(--panel-2); font-size: 24px; font-weight: 900; display: grid; place-items: center; }

.panel { z-index: 800; margin-top: -28px; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; border-top: 1px solid rgba(51,230,164,.22); background: var(--panel); box-shadow: 0 -18px 60px rgba(0,0,0,.32); }
.hidden { display: none !important; }
.role-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-bottom: 10px; background: rgba(51,230,164,.08); border: 1px solid rgba(51,230,164,.22); border-radius: 18px; }
.role-btn { border: 0; border-radius: 14px; padding: 12px 10px; color: var(--muted); background: transparent; font-weight: 900; }
.role-btn.active { color: #031711; background: var(--accent); box-shadow: 0 10px 26px rgba(51,230,164,.16); }
.role-panel { min-height: 0; }
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: #06110f; border: 1px solid var(--line); border-radius: 17px; }
.mode-btn { border: 0; border-radius: 13px; padding: 11px 10px; color: var(--muted); background: transparent; font-weight: 800; }
.mode-btn.active { color: #052018; background: var(--accent); }
.hint { margin: 12px 3px 14px; color: var(--muted); font-size: 14px; }

.locations { display: grid; gap: 8px; }
.loc-row { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; padding: 10px 12px; background: rgba(16,34,29,.78); border: 1px solid var(--line); border-radius: 16px; }
.loc-row strong { display: block; font-size: 13px; }
.loc-row span:not(.dot) { color: var(--muted); font-size: 13px; word-break: break-word; }
.dot { width: 12px; height: 12px; margin-top: 4px; border-radius: 999px; display: inline-block; box-shadow: 0 0 0 5px rgba(255,255,255,.04); }
.pickup-dot { background: var(--accent); }
.dropoff-dot { background: var(--drop); }

.estimate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.estimate-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 18px; background: #0b1915; }
.estimate-card span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.estimate-card strong { font-size: 27px; letter-spacing: -.05em; }
.fare-card strong { color: var(--accent); }
.band-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; padding: 11px 13px; border-radius: 16px; background: rgba(51,230,164,.09); color: var(--accent); }
.band-row span { font-weight: 800; }
.band-row small { color: var(--muted); text-align: right; }
.actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 12px; }
.driver-panel { padding-top: 4px; }
.test-badge { display: inline-flex; margin: 0 0 10px; padding: 6px 10px; border: 1px solid rgba(51,230,164,.30); border-radius: 999px; color: var(--accent); background: rgba(51,230,164,.08); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
h2 { margin: 0; font-size: clamp(24px, 7vw, 34px); letter-spacing: -.05em; }
.driver-copy { margin: 8px 0 14px; color: var(--muted); line-height: 1.35; }
.driver-status-card { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: #0b1915; }
.driver-status-card span, .driver-status-card small { color: var(--muted); }
.driver-status-card strong { color: var(--accent); font-size: 30px; letter-spacing: -.05em; }
.driver-actions { grid-template-columns: 1fr; }
.driver-pin { background: #ffd166; color: #241300; font-size: 16px; }
.primary-btn, .secondary-btn { min-height: 50px; border-radius: 17px; border: 0; font-weight: 900; }
.primary-btn { color: #031711; background: var(--accent); box-shadow: 0 12px 30px rgba(51,230,164,.18); }
.primary-btn:disabled { opacity: .38; box-shadow: none; }
.secondary-btn { padding: 0 18px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }

.pin { border-radius: 999px; display: grid; place-items: center; border: 2px solid #07110f; box-shadow: 0 7px 20px rgba(0,0,0,.38); }
.pin span { transform: translateY(-1px); }
.pickup-pin { background: var(--accent); color: #052018; }
.dropoff-pin { background: var(--drop); color: #031326; }

/* Live presence indicator + peer pins */
.live-drivers { margin: -4px 3px 8px; color: var(--accent); font-size: 13px; font-weight: 700; }
.debug-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0 0 10px; }
.debug-tools .mini-btn { min-height: 38px; padding: 0 10px; border-radius: 13px; font-size: 12px; }
.debug-tools .mini-btn:first-child { grid-column: 1 / -1; }
.presence-debug { margin: 0 0 10px; padding: 8px 10px; border: 1px dashed rgba(51,230,164,.35); border-radius: 12px; background: rgba(6,17,15,.72); color: var(--muted); white-space: pre-wrap; font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.peer-pin { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.peer-pin .peer-dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; background: #ffd166; color: #241300; font-size: 16px; border: 2px solid #07110f; box-shadow: 0 7px 20px rgba(0,0,0,.38); }
.peer-pin.rider .peer-dot { background: var(--accent); color: #052018; }
.peer-pin .peer-name { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 2px 7px; border-radius: 999px; background: rgba(7,17,15,.9); border: 1px solid rgba(51,230,164,.4); color: var(--text); font-size: 11px; font-weight: 800; box-shadow: 0 4px 12px rgba(0,0,0,.4); }

/* Settings sheet */
.sheet { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: end center; padding: 16px; background: rgba(3,8,7,.62); backdrop-filter: blur(4px); }
.sheet-card { width: 100%; max-width: 460px; display: grid; gap: 14px; padding: 18px 18px max(18px, env(safe-area-inset-bottom)); border: 1px solid rgba(51,230,164,.22); border-radius: 26px 26px 0 0; background: var(--panel); box-shadow: var(--shadow); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: clamp(20px, 6vw, 26px); }
.field { display: grid; gap: 7px; }
.field span { color: var(--muted); font-size: 13px; font-weight: 700; }
.field input { width: 100%; min-height: 50px; padding: 0 14px; border-radius: 15px; border: 1px solid var(--line); background: #06110f; color: var(--text); font-size: 16px; }
.field input:focus { outline: none; border-color: rgba(51,230,164,.55); }
.sheet-hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }

@media (min-width: 780px) {
  .sheet { place-items: center; }
  .sheet-card { border-radius: 26px; }
}
.leaflet-control-attribution { opacity: .6; font-size: 10px; }
.leaflet-control-zoom a { background: #0b1915; color: var(--text); border-color: var(--line); }

@media (min-width: 780px) {
  body { overflow: auto; }
  .app-shell { grid-template-columns: 1fr 420px; grid-template-rows: 1fr; }
  .map-wrap { min-height: 100vh; }
  .panel { margin-top: 0; border-radius: 0; border-left: 1px solid rgba(51,230,164,.20); border-top: 0; display: flex; flex-direction: column; justify-content: center; }
  .top-card { max-width: 520px; }
}
