:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-2: #182032;
  --line: rgba(255, 255, 255, .08);
  --text: #f4f6fa;
  --muted: #98a2b8;
  --accent: #ffc400;
  --accent-ink: #141414;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: Vazirmatn, system-ui, sans-serif; overflow: hidden; }
button, input, select, textarea { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.ms { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 24px;
  line-height: 1; display: inline-block; direction: ltr; font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased; }

/* ---------------------------------------------------------------- map */
#map { position: fixed; inset: 0; z-index: 0; background: #0d1320; }
.leaflet-tile-pane { filter: invert(1) hue-rotate(195deg) brightness(.82) contrast(.92) saturate(.55); }
.leaflet-control-attribution { background: rgba(11, 15, 23, .6) !important; color: #6b7690 !important; font-size: 9px; }
.leaflet-control-attribution a { color: #8a96b0 !important; }
.leaflet-control-zoom { display: none; }
.mk { display: grid; place-items: center; }
.mk-origin { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 6px rgba(255,255,255,.15); }
.mk-origin::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--bg); }
.mk-dest .ms, .mk-stop .ms { font-size: 44px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.mk-dest .ms { color: var(--red); }
.mk-stop .ms { color: #f59e0b; font-size: 36px; }
.mk-car { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 8px rgba(255,196,0,.18), 0 6px 14px rgba(0,0,0,.4); }
.mk-car .ms { font-size: 24px; }
.mk-me { width: 18px; height: 18px; border-radius: 50%; background: var(--blue); border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(59,130,246,.25); }
#center-pin { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -100%); z-index: 5; pointer-events: none; text-align: center; }
#center-pin .ms { font-size: 52px; color: var(--accent); filter: drop-shadow(0 6px 8px rgba(0,0,0,.55)); }
#center-pin i { position: absolute; left: 50%; bottom: -3px; width: 10px; height: 4px; margin-left: -5px; border-radius: 50%; background: rgba(0,0,0,.6); }

/* ---------------------------------------------------------------- top bar */
#topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: linear-gradient(180deg, rgba(11,15,23,.92), rgba(11,15,23,0)); pointer-events: none; }
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; letter-spacing: .5px; }
.brand b { font-weight: 900; }
.logo { width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 22px; }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); background: rgba(18,24,38,.85);
  display: grid; place-items: center; backdrop-filter: blur(10px); }

/* ---------------------------------------------------------------- bottom sheet */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; max-height: 64vh; overflow-y: auto;
  background: var(--panel); border-radius: var(--radius) var(--radius) 0 0; border-top: 1px solid var(--line);
  box-shadow: 0 -20px 40px rgba(0,0,0,.45); padding: 10px 16px calc(18px + var(--safe-b)); }
.sheet::before { content: ''; display: block; width: 42px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.18); margin: 0 auto 12px; }
h2 { margin: 2px 0 12px; font-size: 20px; font-weight: 800; }
h3 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* route fields */
.route-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px; padding: 4px 12px; position: relative; }
.route-row { display: flex; align-items: center; gap: 10px; min-height: 54px; border-bottom: 1px solid var(--line); cursor: pointer; }
.route-row:last-child { border-bottom: 0; }
.route-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.o { background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.12); }
.dot.s { background: #f59e0b; }
.dot.d { background: var(--red); }
.route-row .label { flex: 1; min-width: 0; }
.route-row .label small { display: block; color: var(--muted); font-size: 11.5px; }
.route-row .label span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.route-row .label span.ph { color: var(--muted); }
.route-row.active { background: rgba(255,196,0,.06); margin: 0 -12px; padding: 0 12px; }
.route-row .x { color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2);
  font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.chip .ms { font-size: 18px; }

.vehicles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.veh { border: 1.5px solid var(--line); background: var(--panel-2); border-radius: 18px; padding: 12px; text-align: right; }
.veh.on { border-color: var(--accent); background: rgba(255,196,0,.08); }
.veh .ms { font-size: 30px; color: var(--accent); }
.veh b { display: block; margin-top: 4px; font-size: 15px; }
.veh small { color: var(--muted); }

.field { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 12px; min-height: 48px; }
.field input, .field select { flex: 1; background: transparent; border: 0; outline: 0; font-size: 15px; min-width: 0; height: 46px; }
.field input::placeholder { color: var(--muted); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.results { margin-top: 8px; }
.result { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.result .ms { color: var(--muted); }
.result div { min-width: 0; }
.result b { display: block; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.quote { display: flex; align-items: center; justify-content: space-between; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px; margin-top: 14px; }
.quote .price { font-size: 26px; font-weight: 900; }
.quote .meta { color: var(--muted); font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 20px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.btn { width: 100%; height: 54px; border-radius: 16px; border: 0; background: var(--accent); color: var(--accent-ink);
  font-size: 17px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; }
.btn:disabled { opacity: .45; }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); font-weight: 700; }
.btn.danger { background: rgba(239,68,68,.12); color: #ff8a8a; border: 1px solid rgba(239,68,68,.35); }
.btn.green { background: var(--green); color: #04130a; }
.btn.sm { height: 44px; font-size: 14.5px; margin-top: 8px; border-radius: 13px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ride status */
.status { display: flex; align-items: center; gap: 12px; }
.status .badge { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: rgba(255,196,0,.14); color: var(--accent); }
.status .badge.g { background: rgba(34,197,94,.14); color: var(--green); }
.status .badge.r { background: rgba(239,68,68,.14); color: var(--red); }
.status .badge.b { background: rgba(59,130,246,.14); color: var(--blue); }
.status b { font-size: 18px; display: block; }
.steps { display: flex; gap: 6px; margin: 14px 0 4px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); }
.steps i.on { background: var(--accent); }
.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.driver-card { display: flex; gap: 12px; align-items: center; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 18px; padding: 10px; margin-top: 12px; }
.driver-card img { width: 86px; height: 70px; border-radius: 13px; object-fit: cover; background: #222; flex: none; }
.driver-card b { font-size: 15.5px; display: block; }
.plate { display: inline-block; direction: ltr; background: #f5f5f5; color: #111; border-radius: 6px; padding: 1px 8px;
  font-weight: 800; font-size: 13px; letter-spacing: 1px; margin-top: 4px; border-right: 6px solid #1e40af; }
.rating { color: var(--accent); font-size: 13px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; margin-top: 10px; }
.kv span:nth-child(odd) { color: var(--muted); }

.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-top: 10px; }
.offer .top { display: flex; justify-content: space-between; align-items: baseline; }
.offer .price { font-size: 22px; font-weight: 900; color: var(--accent); }
.offer .line { display: flex; gap: 8px; align-items: center; font-size: 14px; margin-top: 6px; }
.offer .line .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.stars { display: flex; gap: 6px; justify-content: center; margin: 12px 0; direction: ltr; }
.stars button { background: none; border: 0; padding: 0; }
.stars .ms { font-size: 44px; color: #3a4357; }
.stars .ms.on { color: var(--accent); }

.switch { position: relative; width: 64px; height: 36px; border-radius: 18px; background: #30384b; border: 0; flex: none; transition: .2s; }
.switch::after { content: ''; position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: .2s; }
.switch.on { background: var(--green); }
.switch.on::after { right: 32px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 20px; font-weight: 900; }
.stat small { color: var(--muted); font-size: 12px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 6px; direction: ltr; }
.bar i { height: 8px; border-radius: 4px; background: var(--accent); display: block; }
.bar .track { flex: 1; background: rgba(255,255,255,.07); border-radius: 4px; }

/* full pages (chat, history) */
.page { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.page header { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.page header b { font-size: 17px; flex: 1; }
.page .body { flex: 1; overflow-y: auto; padding: 12px 14px; }
.msgs { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 80%; padding: 9px 13px; border-radius: 18px; font-size: 15px; line-height: 1.6; word-wrap: break-word; }
.msg.me { align-self: flex-start; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-end; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg time { display: block; font-size: 10.5px; opacity: .6; margin-top: 2px; }
.composer { display: flex; gap: 8px; padding: 10px 12px calc(10px + var(--safe-b)); background: var(--panel); border-top: 1px solid var(--line); }
.composer input { flex: 1; height: 48px; border-radius: 24px; border: 1px solid var(--line); background: var(--panel-2); padding: 0 16px; font-size: 15px; outline: 0; }
.composer button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .ms { font-size: 48px; display: block; margin-bottom: 8px; opacity: .6; }
.hist-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.hist-item .ic { width: 40px; height: 40px; border-radius: 13px; background: var(--panel-2); display: grid; place-items: center; flex: none; }
.hist-item div { flex: 1; min-width: 0; }
.hist-item b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.overlay { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.55); }
.toast { position: fixed; left: 16px; right: 16px; top: 74px; z-index: 50; background: #1d2638; border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.err { border-color: rgba(239,68,68,.5); }
.loading { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: var(--bg); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255,255,255,.12); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.timeline { font-size: 13px; }
.timeline div { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.timeline time { color: var(--muted); margin-left: 8px; direction: ltr; display: inline-block; }

.chips.wrap { flex-wrap: wrap; overflow: visible; }
.sheet-footer { position: sticky; bottom: calc(-18px - var(--safe-b)); margin: 12px -16px 0; padding: 4px 16px calc(14px + var(--safe-b));
  background: linear-gradient(180deg, rgba(18,24,38,.0), var(--panel) 14px); }
.sheet-footer .quote { margin-top: 6px; }
