/* Приложение водителя в цветах логотипа «Мойка Online».
   Подключается только в index.html поверх styles.css — кабинет мойки
   и админка остаются в прежних цветах.
   Светлая тема — вариант A (светлый, оранжевый акцент),
   тёмная — вариант B (чёрный с оранжевым, как промо-страница). */

:root {
  --page-bg: #e9e8e4;
  --bg: #f6f6f4;
  --card: #ffffff;
  --card-2: #f0f0ed;
  --line: #e4e4e0;
  --text: #111111;
  --muted: #696964;             /* 4.9:1 на фоне — читается и на солнце */
  --brand: #ff6b1a;
  --brand-2: #f25c0c;
  --on-brand: #111111;          /* текст на оранжевом: белый читается плохо */
  --brand-soft: rgba(255,107,26,.12);
  --brand-line: rgba(255,107,26,.45);
  --chip-on-bg: #111111;
  --chip-on-text: #ffffff;
  --tab-bg: rgba(255,255,255,.94);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-bg: #000000;
    --bg: #0c0c0d;
    --card: #171717;
    --card-2: #202020;
    --line: #2a2a2a;
    --text: #f2f2f2;
    --muted: #9a9a9a;
    --brand-soft: rgba(255,107,26,.16);
    --chip-on-bg: #ff6b1a;
    --chip-on-text: #111111;
    --tab-bg: rgba(18,18,18,.94);
  }
  :root:not([data-theme="light"]) #phone {
    background: radial-gradient(420px 320px at 105% -40px, rgba(255,107,26,.32), transparent 70%) no-repeat, var(--bg);
  }
}
:root[data-theme="dark"] {
  --page-bg: #000000;
  --bg: #0c0c0d;
  --card: #171717;
  --card-2: #202020;
  --line: #2a2a2a;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --brand-soft: rgba(255,107,26,.16);
  --chip-on-bg: #ff6b1a;
  --chip-on-text: #111111;
  --tab-bg: rgba(18,18,18,.94);
}
:root[data-theme="dark"] #phone {
  background: radial-gradient(420px 320px at 105% -40px, rgba(255,107,26,.32), transparent 70%) no-repeat, var(--bg);
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
/* Ничего не должно вылезать за ширину экрана: иначе телефон чуть
   «отдаляет» страницу и нижнее меню прыгает при смене вкладок.
   Полоса прокрутки на компьютере всегда занимает место — по той же причине. */
html { scrollbar-gutter: stable; }
#phone { box-shadow: 0 0 60px rgba(0,0,0,.25); overflow-x: clip; }

/* ------------------------------------------------------------ шапка */
header { background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom-color: transparent; padding: 12px 16px 8px;
         backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
header .stack { flex: 1; min-width: 0; }
header h1 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: var(--brand);
}
.logo-mark svg { width: 30px; height: 30px; }
/* на внутренних экранах вместо логотипа стрелка «назад» */
header .back:not([hidden]) ~ .logo-mark { display: none; }

/* ------------------------------------------------- цвета элементов */
.big-btn, button.primary, .tabs button.active, .days button.active, .slots button.active,
.check.on .box, .theme-options button.active { color: var(--on-brand); }
.slots button.active .slot-price { color: var(--on-brand); }
button.primary { font-weight: 700; border-radius: 14px; }
button.primary:disabled { background: var(--card-2); color: var(--muted); opacity: 1; }
.pill.blue { color: var(--brand); border-color: var(--brand-line); }
.check.on { background: var(--brand-soft); }
.timeline li.now::before { box-shadow: 0 0 0 4px var(--brand-soft); }
.hint { background: var(--brand-soft); border-color: var(--brand-line); }
.card.tap:hover { border-color: var(--brand-line); }
.map-me { box-shadow: 0 0 0 6px rgba(255,107,26,.25); }
.stars span { color: var(--line); }

/* ----------------------------------------------------------- главная */
.home-head { display: flex; align-items: flex-start; gap: 12px; margin: 4px 0 14px; }
.home-head .stack { flex: 1; min-width: 0; }
#home-class { margin-top: 6px; font-size: 14px; line-height: 1.4; }
#home-name { font-size: 27px; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; margin: 2px 0 0; }

#garage { display: flex; gap: 8px; overflow-x: auto; flex-wrap: nowrap !important;
          margin: 0 -16px 14px !important; padding: 0 16px 2px; scrollbar-width: none; }
#garage::-webkit-scrollbar { display: none; }
/* ТЗ кл. прил. 7 п.3: кнопки с маркой авто крупные — легко попасть пальцем */
#garage .pill {
  flex: none; font-size: 15px; font-weight: 600; padding: 11px 16px; min-height: 44px; cursor: pointer;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
}
#garage .pill.blue { background: var(--chip-on-bg); color: var(--chip-on-text); border-color: var(--chip-on-bg); }

/* активная запись — карточка с QR, чтобы на мойке не искать */
.active-card { border-radius: 20px; padding: 14px 16px; }
.active-card .lbl { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.active-card .when { font-size: 17px; font-weight: 800; margin: 2px 0; }
.active-card .qr-ico {
  width: 48px; height: 48px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line);
}
.active-card .qr-ico svg { width: 34px; height: 34px; }

.home-title { font-size: 16px !important; font-weight: 800; margin: 18px 2px 10px !important; }

.big-btn {
  display: flex; align-items: center; gap: 14px;
  border-radius: 20px; padding: 16px; font-size: 17px; font-weight: 800; letter-spacing: -.01em;
  background: var(--brand);
}
.big-btn small { color: inherit; opacity: .72; font-size: 12.5px; letter-spacing: 0; }
.big-btn .ico {
  width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: rgba(0,0,0,.1);
}
.big-btn .ico svg { width: 22px; height: 22px; }
.big-btn.secondary { background: var(--card); }
.big-btn.secondary .ico { background: var(--brand-soft); color: var(--brand); }
.big-btn:active { transform: scale(.99); }

/* «Помыть сейчас» и «Записаться» — две плитки рядом (вариант B) */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  min-height: 138px; border: 1px solid transparent; border-radius: 22px; padding: 16px;
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  text-align: left; cursor: pointer; font: inherit;
  background: var(--brand); color: var(--on-brand);
  font-size: 17px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15;
  transition: transform .1s;
}
.tile svg { width: 26px; height: 26px; }
.tile small { display: block; font-size: 12px; font-weight: 500; letter-spacing: 0; opacity: .72; margin-top: 4px; line-height: 1.3; }
.tile.secondary { background: var(--card); border-color: var(--line); color: var(--text); }
.tile.secondary svg { color: var(--brand); }
.tile:active { transform: scale(.98); }

#nearby .card { border-radius: 18px; }

/* второстепенные кнопки: читаемые, а не «серые как выключенные» */
button.ghost, a.ghost { background: var(--card); color: var(--text); font-weight: 600; border-radius: 14px; }
.card button.ghost, .card a.ghost { background: transparent; }

/* ---------------------------------------- шаги записи: услуги, время */
.check { background: var(--card); border-radius: 14px; padding: 13px 14px; }
.check .box { border-color: var(--line); border-width: 2px; border-radius: 7px; }
.check.on { border-color: var(--brand); }
.days { scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.days button, .slots button { background: var(--card); border-radius: 12px; }
.days button { color: var(--text); font-weight: 600; }
.days button.active, .slots button.active { border-color: var(--brand); }
.slots button[disabled] { color: var(--muted); opacity: .45; }
/* «Список / Карта» — такой же переключатель, как «Сейчас / На время» */
.tabs { gap: 0; padding: 3px; border-radius: 13px; background: var(--card-2); }
.tabs button { border: 0; background: none; font-weight: 700; font-size: 14px; padding: 10px; }
.tabs button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.sticky-total { border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; }

/* ------------------------------------- «Записи» и «Профиль» (вкладки) */
#s-history > h2, #s-settings > h2 {
  font-size: 27px; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; margin: 4px 0 14px;
}
.card { border-radius: var(--radius); }
.card > b:first-child { font-size: 15px; font-weight: 800; }

/* пустой список записей */
.empty {
  text-align: center; padding: 30px 20px 22px; border-radius: 22px;
  background: var(--card); border: 1px solid var(--line);
}
.empty .ico {
  width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 12px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}
.empty .ico svg { width: 28px; height: 28px; }
.empty b { display: block; font-size: 17px; font-weight: 800; }
.empty p { color: var(--muted); margin: 4px 0 16px; font-size: 14px; }

/* машины в профиле */
.car-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.car-row:first-child { border-top: 0; padding-top: 2px; }
.car-row .stack { flex: 1; min-width: 0; }
.car-row .stack b { font-size: 15px; }
.car-row .muted { font-size: 13px; }
.car-btn {
  height: 34px; padding: 0 12px; border-radius: 10px; flex: none; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  font: 600 13px/1 inherit;
}
.car-btn.del { color: var(--red); }
#btn-add-car { margin-top: 8px; }

/* тема — сегментный переключатель в одну строку */
.theme-options { flex-wrap: nowrap; gap: 0; padding: 3px; border-radius: 13px; background: var(--card-2); }
.theme-options button {
  flex: 1 1 0; min-width: 0; white-space: nowrap; border: 0; background: none;
  color: var(--muted); font-weight: 700; font-size: 13px; padding: 11px 4px; border-radius: 10px;
}
.theme-options button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* выход и удаление аккаунта */
#btn-logout { margin-top: 4px; }
#btn-delete { background: none; border: 0 !important; margin-top: 2px; }
#s-settings > p.muted { font-size: 12px; padding: 0 10px; }

/* --------------------------------------------------- нижнее меню */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  background: var(--tab-bg); border-top: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
#tabbar[hidden] { display: none; }
/* тестовый режим: две вкладки — «Главная» слева, «Карта» справа */
body.guest-tabs #tabbar { grid-template-columns: 1fr 1fr; }
#tabbar button {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font: 600 11px/1.2 inherit; padding: 4px 0;
}
#tabbar button svg { width: 23px; height: 23px; }
#tabbar button.on { color: var(--brand); }
body.with-tabs main { padding-bottom: 104px; }
body.with-tabs .toast { bottom: 96px; }

/* ------------------------------------- вкладка «Карта» на весь экран */
body.map-full header { display: none; }
#s-map.active {
  position: fixed; top: 0; bottom: 0; left: 0; right: 0; margin: 0 auto;
  width: 100%; max-width: 430px; z-index: 10; overflow: hidden;
  animation: none;
}
#fullmap-body, #fullmap-body > .map { position: absolute; inset: 0; }
.map.map-fill { height: auto; border: 0; border-radius: 0; }

/* схема без ключа карт — рисуем «как карту»: кварталы, улицы, парк, река */
.map-fill:not([id]) {
  background:
    radial-gradient(ellipse 90px 60px at 30% 34%, #cfe6c4 98%, transparent 100%),
    radial-gradient(ellipse 70px 90px at 86% 16%, #cfe6c4 98%, transparent 100%),
    linear-gradient(172deg, transparent 63%, #bcd6ef 63%, #bcd6ef 66%, transparent 66%),
    repeating-linear-gradient(97deg, transparent 0 74px, #fff 74px 84px),
    repeating-linear-gradient(-4deg, transparent 0 96px, #fff 96px 108px),
    #ebe8e1;
}
:root[data-theme="dark"] .map-fill:not([id]) {
  background:
    radial-gradient(ellipse 90px 60px at 30% 34%, #1f2d1f 98%, transparent 100%),
    radial-gradient(ellipse 70px 90px at 86% 16%, #1f2d1f 98%, transparent 100%),
    linear-gradient(172deg, transparent 63%, #18263a 63%, #18263a 66%, transparent 66%),
    repeating-linear-gradient(97deg, transparent 0 74px, #2b2b2b 74px 84px),
    repeating-linear-gradient(-4deg, transparent 0 96px, #2b2b2b 96px 108px),
    #191919;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .map-fill:not([id]) {
    background:
      radial-gradient(ellipse 90px 60px at 30% 34%, #1f2d1f 98%, transparent 100%),
      radial-gradient(ellipse 70px 90px at 86% 16%, #1f2d1f 98%, transparent 100%),
      linear-gradient(172deg, transparent 63%, #18263a 63%, #18263a 66%, transparent 66%),
      repeating-linear-gradient(97deg, transparent 0 74px, #2b2b2b 74px 84px),
      repeating-linear-gradient(-4deg, transparent 0 96px, #2b2b2b 96px 108px),
      #191919;
  }
}

/* метки: тёмная «капля» со временем и ценой, быстрая — оранжевая */
.map-fill .pin, .map-pin.taxi {
  position: absolute; transform: translate(-50%, calc(-100% - 6px));
  background: #111; color: #fff; border: 0; border-radius: 11px;
  padding: 6px 9px; font-size: 12px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.3); cursor: pointer; line-height: 1.1;
}
.map-pin.taxi { position: relative; transform: translate(-50%, calc(-100% - 6px)); width: max-content; }
.map-fill .pin::after, .map-pin.taxi::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px;
  border: 6px solid transparent; border-bottom: 0; border-top-color: #111;
}
.map-fill .pin.now, .map-pin.taxi.now { background: var(--brand); color: #111; }
.map-fill .pin.now::after, .map-pin.taxi.now::after { border-top-color: var(--brand); }
.map-fill .me {
  width: 18px; height: 18px; background: #2f7dff; border: 3px solid #fff;
  box-shadow: 0 0 0 9px rgba(47,125,255,.2);
}

/* поиск поверх карты — во всю ширину */
.map-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; gap: 8px; padding: calc(12px + env(safe-area-inset-top)) 12px 0;
}
.map-search {
  flex: 1; display: flex; align-items: center; gap: 8px; margin: 0;
  background: var(--card); border-radius: 14px; padding: 0 12px; height: 46px;
  box-shadow: 0 4px 16px rgba(0,0,0,.14); color: var(--muted); font-size: 15px;
}
.map-search svg { width: 18px; height: 18px; flex: none; }
.map-search input {
  border: 0; background: transparent; padding: 0; height: 100%; color: var(--text);
}
.map-search input:focus { border: 0; }

/* шторка снизу: переключатель, список, главная кнопка */
.map-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  background: var(--card); border-radius: 26px 26px 0 0;
  padding: 6px 14px calc(84px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.16);
  display: flex; flex-direction: column; gap: 8px;
  max-height: 72%;
}
.map-sheet .grab {
  width: 60px; height: 20px; margin: 0 auto; border: 0; background: none; cursor: pointer;
  position: relative; flex: none;
}
.map-sheet .grab::before {
  content: ""; position: absolute; left: 11px; right: 11px; top: 8px; height: 4px;
  border-radius: 2px; background: var(--line);
}
.map-sheet .seg {
  display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 13px;
  background: var(--card-2); flex: none;
}
.map-sheet .seg button {
  border: 0; background: none; color: var(--muted); font: 700 14px/1 inherit;
  padding: 10px; border-radius: 10px; cursor: pointer;
}
.map-sheet .seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
#sheet-list { overflow-y: auto; min-height: 0; flex: 0 1 auto; }
.sheet-row { display: flex; align-items: center; gap: 12px; padding: 8px 2px; cursor: pointer; }
.sheet-row + .sheet-row { border-top: 1px solid var(--line); }
.sheet-row b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-row small { color: var(--muted); font-size: 12px; }
.sheet-ph {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center;
  font-size: 20px; background: linear-gradient(135deg, #ffd2b8, #ff9a5e);
}
.sheet-when { color: var(--green); font-weight: 800; white-space: nowrap; }
.sheet-when.off { color: var(--red); font-weight: 600; font-size: 12px; }
.sheet-more {
  width: 100%; border: 0; background: none; color: var(--brand); font: 700 13px/1 inherit;
  padding: 8px; cursor: pointer;
}
#sheet-go { flex: none; padding: 16px; font-size: 16px; font-weight: 800; border-radius: 16px; }

/* в тёмной теме чёрные метки сливаются с картой — делаем их светлыми */
:root[data-theme="dark"] .map-fill .pin:not(.now),
:root[data-theme="dark"] .map-pin.taxi:not(.now) { background: #f2f2f2; color: #111; }
:root[data-theme="dark"] .map-fill .pin:not(.now)::after,
:root[data-theme="dark"] .map-pin.taxi:not(.now)::after { border-top-color: #f2f2f2; }
:root[data-theme="dark"] .map-search { background: #222; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .map-fill .pin:not(.now),
  :root:not([data-theme="light"]) .map-pin.taxi:not(.now) { background: #f2f2f2; color: #111; }
  :root:not([data-theme="light"]) .map-fill .pin:not(.now)::after,
  :root:not([data-theme="light"]) .map-pin.taxi:not(.now)::after { border-top-color: #f2f2f2; }
  :root:not([data-theme="light"]) .map-search { background: #222; }
}
:root[data-theme="dark"] .map-sheet .seg button.on,
:root[data-theme="dark"] .theme-options button.active,
:root[data-theme="dark"] .tabs button.active { background: #3a3a3a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .map-sheet .seg button.on,
  :root:not([data-theme="light"]) .theme-options button.active,
  :root:not([data-theme="light"]) .tabs button.active { background: #3a3a3a; }
}

/* скрытые кнопки нижнего меню (тестовый режим: без «Записей» и «Профиля») */
#tabbar button[hidden] { display: none !important; }
