:root {
  --ink: #0B1F3A; --muted: #4A5B73; --line: #DCE3EB; --bg: #F3F6F9;
  --blue: #0B1F3A; --amber: #FFB020; --green: #0B4F49; --greenbg: #E3F3EF; --red: #B42318;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body { font-family: Manrope, system-ui, sans-serif; color: var(--ink); background: #fff; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app { height: 100%; display: flex; flex-direction: column; }
header { height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: var(--ink); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -0.3px; }
.brand b { color: var(--amber); }
.logo { width: 24px; height: 24px; border-radius: 50%; background: var(--amber); box-shadow: inset 0 0 0 7px var(--amber), inset 0 0 0 10px var(--ink); }
.chip { height: 44px; padding: 0 16px; border: 1px solid #3A5378; border-radius: 22px; background: #14305A; color: #fff; font-size: 14px; font-weight: 700; }

.mode-switch { display: flex; padding: 3px; gap: 2px; border-radius: 22px; background: #183454; }
.mode-btn { border: 0; border-radius: 18px; padding: 8px 10px; color: #D7E1EF; background: transparent; font-size: 11px; font-weight: 800; white-space: nowrap; }
.mode-btn.on { background: #fff; color: var(--ink); }
.install-btn { width: 34px; height: 34px; flex: none; border: 1px solid #3A5378; border-radius: 50%; background: #14305A; color: #fff; font-size: 22px; line-height: 1; }
.chip.light { height: 34px; padding: 0 12px; background: #F1F5F9; border-color: var(--line); color: var(--ink); }
.wrap { flex-wrap: wrap; }
.route-search { gap: 9px; }
#mapWrap { position: relative; flex: none; height: 42%; min-height: 220px; background: #E6ECF2; }
#mapWrap.tall { height: 58%; }
#mapWrap.short { height: 26%; min-height: 150px; }
#map { position: absolute; inset: 0; z-index: 0; }
.fab { position: absolute; right: 12px; top: 12px; z-index: 500; height: 48px; padding: 0 16px; border: 0; border-radius: 24px; background: var(--amber); color: var(--ink); font-size: 14px; font-weight: 800; box-shadow: 0 4px 12px rgba(11,31,58,.28); }
.mapbtn { position: absolute; z-index: 500; height: 44px; padding: 0 14px; border: 0; border-radius: 22px; background: #fff; font-size: 13px; font-weight: 800; box-shadow: 0 2px 8px rgba(11,31,58,.22); }
.mapbtn.left { left: 12px; bottom: 30px; }
.hint { position: absolute; left: 12px; right: 12px; top: 68px; z-index: 500; padding: 10px 12px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(20,86,240,.2); }
.pin { width: 16px; height: 16px; border-radius: 50%; border: 4px solid var(--ink); background: #fff; }
.pin.end { background: var(--ink); border-color: #fff; box-shadow: 0 0 0 2px var(--ink); }

main { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#sheet { position: relative; z-index: 600; margin-top: -18px; border-radius: 20px 20px 0 0; background: #fff; padding: 10px 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -4px 16px rgba(11,31,58,.12); }
#sheet::before { content: ""; flex: none; width: 40px; height: 4px; border-radius: 2px; background: #C9D3DF; align-self: center; }
#page { background: var(--bg); padding: 18px 14px 24px; display: flex; flex-direction: column; gap: 12px; }
h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
h3 { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 4px; }
.muted { color: var(--muted); font-size: 13px; font-weight: 500; }
.small { font-size: 12px; }

.card { border: 2px solid var(--line); border-radius: 16px; background: #fff; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.card.sel { background: #F7FAFF; }
.card.flat { border-width: 1px; padding: 14px; }
.card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.dark .muted { color: #D6DEE9; }
.pick { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0; border: 0; background: none; text-align: left; width: 100%; }
.bar { width: 6px; align-self: stretch; border-radius: 3px; flex: none; }
.title { font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.time { font-size: 17px; font-weight: 800; }
.price { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.price.free { color: var(--green); }
.status { padding: 10px 12px; border-radius: 12px; background: var(--greenbg); color: var(--green); font-size: 13px; font-weight: 700; }
.status.warn { background: #FFF4DB; color: #6B4A00; }
.tag { font-size: 12px; font-weight: 800; color: var(--amber); }

.btn { min-height: 46px; padding: 0 18px; border: 0; border-radius: 14px; background: var(--amber); color: var(--ink); font-size: 15px; font-weight: 800; }
.btn.amber { background: var(--amber); color: var(--ink); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #B9C4D2; font-size: 13px; padding: 0 12px; }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #E7B4AE; font-size: 13px; padding: 0 12px; }
.btn.wide { width: 100%; min-height: 54px; font-size: 16px; }
.btn:disabled { opacity: .5; }
.pills { display: grid; gap: 8px; }
.pills.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pills.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pills.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pill { height: 46px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; font-weight: 800; }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }
label { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
input[type=text], input[type=time], input[type=number] { height: 48px; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; font-weight: 700; width: 100%; }
input:focus { outline: none; border-color: var(--blue); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 12px; }
.stat b { display: block; font-size: 20px; font-weight: 800; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--ink); color: var(--amber); font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
ul.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
a.tel { color: var(--blue); font-weight: 800; text-decoration: none; }

nav { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); height: 62px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: #fff; box-sizing: content-box; }
nav button { border: 0; background: none; font-size: 13px; font-weight: 800; color: var(--muted); position: relative; }
nav button.on { color: var(--blue); box-shadow: inset 0 3px 0 var(--blue); }
#badge { position: absolute; top: 12px; margin-left: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; }
#toast { position: fixed; left: 14px; right: 14px; bottom: 84px; z-index: 2000; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; text-align: center; box-shadow: 0 6px 20px rgba(11,31,58,.35); }
#toast.err { background: var(--red); }
.leaflet-control-attribution { font-size: 9px; }

@media (max-width: 380px) {
  header { padding: 0 9px; gap: 5px; }
  .brand { font-size: 17px; gap: 5px; }
  .mode-btn { padding: 8px 7px; font-size: 10px; }
  .install-btn { width: 30px; height: 30px; }
}
.pin.start { background: var(--amber); border-color: var(--ink); }

/* Role-specific navigation and clearer first-use screens */
nav { grid-template-columns: repeat(4, minmax(0, 1fr)); height: 66px; }
nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; line-height: 1.1; }
nav button.on { box-shadow: inset 0 3px 0 var(--amber); color: var(--ink); }
.nav-icon { font-size: 19px; line-height: 1; font-weight: 800; }
#badge { top: 5px; margin-left: 34px; }
.driver-welcome { gap: 12px; padding: 16px; }
.eyebrow { color: #8A5A00; font-size: 10px; font-weight: 800; letter-spacing: .9px; }
.profile-hero { border-color: #E8D39C; background: linear-gradient(135deg, #fff 0%, #FFF9E9 100%); }
#postTab { color: var(--ink); }
#postTab .nav-icon { color: #9A6500; }
@media (max-width: 380px) {
  nav { height: 64px; }
  nav button { font-size: 10px; }
  .nav-icon { font-size: 17px; }
}
.field-select { width:100%; min-height:48px; padding:0 12px; border:2px solid var(--line); border-radius:12px; background:#fff; color:var(--ink); font:700 14px Manrope,system-ui,sans-serif; }
#sheet .route-search { padding:14px; }
#sheet .route-search .btn.wide { margin-top:2px; }

#mainNav.passenger-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#mainNav.driver-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
