:root {
  --accent: #ffcc00;
  --accent-ink: #1a1a1a;
  --bg: #ffffff;
  --bg-2: #f3f3f1;
  --ink: #1a1a1a;
  --ink-2: #6b6b6b;
  --line: #e4e4e0;
  --ok: #1f9d55;
  --danger: #d93025;
  --shadow: 0 -6px 30px rgba(0, 0, 0, .12);
  --radius: 20px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e; --bg-2: #2a2a2d; --ink: #f2f2f2; --ink-2: #a0a0a5; --line: #38383b;
    --shadow: 0 -6px 30px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#map { position: fixed; inset: 0; z-index: 0; background: #e8e6df; }

/* Нижняя панель поверх карты */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: var(--bg); border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow); padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 72vh; overflow-y: auto; max-width: 560px; margin: 0 auto;
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 0 auto 12px; }
.topbar { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px;
  z-index: 1000; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  pointer-events: none; max-width: 560px; margin: 0 auto; }
.topbar > * { pointer-events: auto; }
.pill { background: var(--bg); border-radius: 999px; padding: 8px 14px; box-shadow: 0 2px 10px rgba(0,0,0,.15);
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.logo { font-weight: 800; letter-spacing: -.02em; }
.logo b { background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 0 5px; margin-right: 2px; }

h2 { font-size: 22px; margin: 4px 0 12px; letter-spacing: -.01em; }
.muted { color: var(--ink-2); font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 10px; }

/* Поля адресов */
.addr { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 8px; border: 2px solid transparent; cursor: pointer; }
.addr.active { border-color: var(--accent); }
.addr .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.a { background: var(--ink); } .dot.b { background: var(--accent); box-shadow: 0 0 0 2px var(--ink) inset; }
.addr .label { font-size: 12px; color: var(--ink-2); }
.addr .value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr input { border: 0; background: transparent; font: inherit; color: var(--ink); width: 100%; outline: none; padding: 0; }

input.field, textarea.field, select.field { width: 100%; font: inherit; color: var(--ink); background: var(--bg-2);
  border: 2px solid transparent; border-radius: 14px; padding: 12px 14px; outline: none; margin-bottom: 8px; }
input.field:focus, textarea.field:focus, select.field:focus { border-color: var(--accent); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  border: 0; border-radius: 16px; padding: 15px; font-family: inherit; font-weight: 600; font-size: 17px; line-height: 1.2; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.ghost { background: var(--bg-2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); font-weight: 500; padding: 10px; }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.small { padding: 10px 12px; font-size: 15px; border-radius: 12px; width: auto; }

.price { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.trip-meta { display: flex; justify-content: space-between; align-items: flex-end; margin: 8px 0 12px; }

/* Карточка водителя/заказа */
.card { background: var(--bg-2); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; }
.plate { display: inline-block; border: 2px solid var(--ink); border-radius: 6px; padding: 1px 6px;
  font: 700 15px/1.3 ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.stars { color: #f5a400; }
.rate { display: flex; justify-content: center; gap: 6px; margin: 10px 0 14px; }
.rate button { font-size: 38px; background: none; border: 0; cursor: pointer; color: var(--line); padding: 0 2px; }
.rate button.on { color: #f5a400; }

.status-line { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; margin-bottom: 10px; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); flex: none;
  animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,204,0,.7);} 70% { box-shadow: 0 0 0 14px rgba(255,204,0,0);} 100% { box-shadow: 0 0 0 0 rgba(255,204,0,0);} }

.list-item { padding: 12px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }

/* Переключатель «на линии» */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-2); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 30px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(22px); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.stat { background: var(--bg-2); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; }

.toast { position: fixed; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 5000;
  font-size: 14px; max-width: 90vw; box-shadow: 0 4px 20px rgba(0,0,0,.25); }
.hint { font-size: 13px; color: var(--ink-2); text-align: center; margin: 8px 0 0; }
.hidden { display: none !important; }
.notice { background: #fff3c4; color: #5c4800; border-radius: 14px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }
@media (prefers-color-scheme: dark) { .notice { background: #3d3410; color: #ffe27a; } }
.tag { display: inline-block; background: var(--bg-2); border-radius: 6px; padding: 1px 6px; font-size: 12px; color: var(--ink-2); }
.tag.hot { background: var(--accent); color: var(--accent-ink); }

/* Окно выбора города */
.modal { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.modal-box { background: var(--bg); width: 100%; max-width: 560px; max-height: 80vh; overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.modal .city { cursor: pointer; }
.modal .city:hover { color: var(--ink-2); }
button.pill { border: 0; cursor: pointer; color: var(--ink); font-family: inherit; }
.topbar .right { display: flex; gap: 8px; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger);
  color: #fff; font-size: 12px; line-height: 18px; text-align: center; font-weight: 700; }
.menu-item { cursor: pointer; font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 2px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px;
  padding: 7px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.chip.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.chat { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 14px; font-size: 15px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.user .muted { color: rgba(0,0,0,.55); }
.msg.support { align-self: flex-start; background: var(--bg-2); }
textarea.field { resize: vertical; font-family: inherit; }

/* Маркеры на карте */
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.pin.a { background: #1a1a1a; } .pin.b { background: var(--accent); }
.car { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2f7cf6; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(47,124,246,.25); }
.leaflet-control-attribution { font-size: 10px !important; }

select.field { appearance: none; -webkit-appearance: none; cursor: pointer; }
/* Выбор класса */
.classes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 8px; }
.cls { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; cursor: pointer;
  background: var(--bg-2); border: 2px solid transparent; border-radius: 14px; padding: 8px 10px; color: var(--ink); font: inherit; }
.cls.on { border-color: var(--accent); background: var(--bg); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.cls-ico { font-size: 22px; line-height: 1.1; }
.cls b { font-size: 14px; }
.cls-price { font-size: 17px; font-weight: 800; }
.cls-eta { font-size: 12px; }
/* Время в пути и водитель */
.eta-big { font-size: 18px; margin: -4px 0 10px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 19px; flex: none; }
.cdot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); vertical-align: -1px; }

/* Плашка «Поддержка ответила» */
.replybar { position: fixed; left: 12px; right: 12px; top: calc(62px + env(safe-area-inset-top)); z-index: 2500;
  max-width: 536px; margin: 0 auto; display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--ink); color: var(--bg); border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.3); animation: drop .3s ease-out; }
.replybar .btn.ghost { background: transparent; color: var(--bg); }
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Ввод адреса текстом */
.addr-input { border: 0; background: transparent; font: inherit; color: var(--ink); width: 100%; outline: none; padding: 0;
  text-overflow: ellipsis; }
.addr .clr { border: 0; background: transparent; color: var(--ink-2); font-size: 15px; cursor: pointer; padding: 4px 6px; }
.sugg { background: var(--bg); border-radius: 14px; margin: -2px 0 8px; box-shadow: 0 4px 18px rgba(0,0,0,.08); overflow: hidden; }
.sugg-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.sugg-item:first-child { border-top: 0; }
.sugg-item:hover, .sugg-item:active { background: var(--bg-2); }

.promo-row { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; font-size: 14px; }
.promo-row a { color: var(--ink); opacity: .75; }
.coupon { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 2px dashed var(--accent);
  border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.coupon b { font-size: 18px; }

/* SOS */
button.pill.sos-btn { background: var(--danger); color: #fff; font-weight: 800; letter-spacing: .04em; }
#sosbar { position: fixed; top: calc(62px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 1100;
  max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
#sosbar > * { pointer-events: auto; }
.sos-card { background: var(--danger); color: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.3);
  animation: sospulse 1.6s ease-in-out infinite; }
.sos-card.calm { animation: none; }
.sos-card .muted { color: rgba(255,255,255,.85); }
.sos-card .btn { background: #fff; color: var(--danger); }
.sos-card .btn.ghost { background: rgba(255,255,255,.18); color: #fff; }
.sos-card .row { gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sos-card .plate { color: #fff; border-color: #fff; }
@keyframes sospulse { 50% { box-shadow: 0 0 0 6px rgba(217,48,37,.35), 0 8px 30px rgba(0,0,0,.3); } }
.sos-pin { width: 34px; height: 34px; border-radius: 50%; background: var(--danger); color: #fff; display: grid; place-items: center;
  font-size: 18px; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(217,48,37,.3); }
.sos-big { width: 100%; padding: 22px; font-size: 22px; font-weight: 800; background: var(--danger); color: #fff; border: 0;
  border-radius: 18px; cursor: pointer; font-family: inherit; }
.topbar .pill { white-space: nowrap; }
.topbar #city { min-width: 0; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; display: block; }
.topbar .right { flex-shrink: 0; }

/* Остановки, чипсы заказа, кнопки поездки */
.dot.stop { background: #fff; box-shadow: 0 0 0 3px var(--ink) inset; }
.pin.stop { width: 22px; height: 22px; background: #fff; border: 3px solid #1a1a1a; }
.orderchips { margin: 0 0 8px; }
.favchips { margin-bottom: 8px; }
.tripbtns { gap: 6px; flex-wrap: wrap; }
.tripbtns .btn { padding: 10px 8px; font-size: 15px; }
.btn.sosmini { width: auto; flex: 0 0 auto; color: var(--danger); font-weight: 800; }
.card.boost { border: 2px dashed var(--accent); }
#chatlog { max-height: 45vh; overflow-y: auto; }
.badge.green { background: #1e8e3e; }

button.pill.on { background: var(--accent); color: var(--accent-ink); }
.photo-in { display: flex; flex-direction: column; gap: 6px; border: 2px dashed var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; cursor: pointer; }
.photo-in span { font-weight: 600; }
.photo-in img { max-height: 160px; object-fit: cover; border-radius: 10px; }
.home-toggle { border: 2px solid var(--accent); }
.next-card { border: 2px solid var(--accent); }
.bars { display: flex; gap: 6px; align-items: flex-end; height: 150px; margin: 6px 0 14px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: 11px; text-align: center; }
.bar > div { width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar .bv { font-size: 11px; font-weight: 600; margin-bottom: 2px; }
.photo-in input { display: none; } .photo-in em { font-style: normal; font-size: 14px; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 4px 0 12px; cursor: pointer; }
.consent input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; }
.goal { margin-top: 6px; } .goal .bar2 { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 3px; }
.goal .bar2 > div { height: 100%; background: var(--accent); }
.offer-card { border: 2px solid var(--accent); }
.offer-timer { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: -4px 0 8px; }
.offer-timer > div { height: 100%; background: var(--accent); animation: offerbar linear forwards; }
@keyframes offerbar { from { width: 100%; } to { width: 0%; } }

/* Сворачиваемая нижняя панель */
.sheet { transition: max-height .25s ease, transform .2s ease; }
.sheet.collapsed { max-height: calc(118px + env(safe-area-inset-bottom)); overflow: hidden; }
.sheet.collapsed::after { content: "Потяни вверх, чтобы развернуть"; position: absolute; left: 0; right: 0; bottom: calc(6px + env(safe-area-inset-bottom));
  text-align: center; font-size: 12px; color: var(--ink-2); background: linear-gradient(transparent, var(--bg) 40%); padding-top: 18px; }
.sheet-grip { position: fixed; z-index: 1001; height: 34px; touch-action: none; cursor: grab; max-width: 560px; }
