/* ============================================================
   ПОПУТЧИКИ АЛАБУГА — PREMIUM REDESIGN
   Стиль: Алабуга Политех — чистый, технологичный, деловой
   Палитра: холодный светлый фон, белые карточки, синий акцент
   ============================================================ */

/* ── CSS-переменные: светлая тема ── */
:root {
  --bg:            #eef1f6;
  --card:          #ffffff;
  --text:          #0d1b2a;
  --muted:         #6b7684;
  --accent:        #1f5fff;
  --accent-strong: #1348d0;
  --accent-soft:   #e6efff;
  --danger:        #e5484d;
  --radius:        16px;
  --line:          rgba(13, 27, 42, .08);
  --shadow-sm:     0 1px 2px rgba(13, 27, 42, .04), 0 4px 12px rgba(13, 27, 42, .06);
  --shadow-md:     0 2px 4px rgba(13, 27, 42, .05), 0 8px 24px rgba(13, 27, 42, .10);
  --shadow-accent: 0 4px 14px rgba(31, 95, 255, .30);
}

/* ── CSS-переменные: тёмная тема ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0a0f1a;
    --card:          #121a29;
    --text:          #eef2f8;
    --muted:         #8b97a8;
    --accent:        #4d84ff;
    --accent-strong: #3a6fe6;
    --accent-soft:   #16233d;
    --danger:        #ff6b66;
    --line:          rgba(255, 255, 255, .08);
    --shadow-sm:     0 1px 3px rgba(0, 0, 0, .20), 0 6px 20px rgba(0, 0, 0, .28);
    --shadow-md:     0 2px 6px rgba(0, 0, 0, .28), 0 12px 32px rgba(0, 0, 0, .36);
    --shadow-accent: 0 4px 16px rgba(77, 132, 255, .35);
  }
}

/* ── Сброс и базовые стили ── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(136px + env(safe-area-inset-bottom));
}

/* ──────────────────────────────────────────
   ШАПКА — TOPBAR
   ────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--card);
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.topbar-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

/* ── Колокольчик уведомлений ── */
.notif-bell {
  position: relative;
  border: none;
  background: var(--accent-soft);
  border-radius: 50%;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
  cursor: pointer;
  color: var(--accent);
  transition: background 0.15s ease, transform 0.15s ease;
}
.notif-bell:active {
  background: var(--accent-soft);
  transform: scale(.93);
}

.notif-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 17px; height: 17px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px;
  text-align: center; border-radius: 999px;
  padding: 0 4px;
  border: 2px solid var(--card);
}

/* ── Список уведомлений ── */
.notif-item {
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { font-weight: 600; color: var(--text); }
.notif-item-time { font-size: 12px; color: var(--muted); margin-top: 3px; }
.notif-empty { color: var(--muted); font-size: 15px; padding: 20px 2px; }

/* ── Чипы выбора даты ── */
.chips {
  display: flex; gap: 6px;
  overflow-x: auto; padding-bottom: 10px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chips button {
  flex: 0 0 auto;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px; font-weight: 500;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.chips button:active { transform: scale(.96); }
.chips button.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-accent);
}

/* ── Табы фильтра ролей — сегмент-контрол ── */
.tabs {
  display: flex; gap: 0;
  background: var(--bg);
  border-radius: 12px;
  padding: 3px;
  margin-top: 6px;
}
.tabs button {
  flex: 1;
  border: none;
  border-radius: 9px;
  padding: 7px 0;
  font-size: 13px; font-weight: 500;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tabs button.active {
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ── Фильтр маршрута ── */
.route-filter {
  display: flex; gap: 6px; align-items: center;
  margin-top: 8px; padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.route-filter::-webkit-scrollbar { display: none; }

.filter-reset-btn {
  flex: 0 0 auto;
  border: none; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 700; cursor: pointer;
  padding: 4px 6px; line-height: 1;
  transition: color 0.15s ease;
}
.filter-reset-btn:active { color: var(--danger); }

/* ──────────────────────────────────────────
   ЛЕНТА КАРТОЧЕК
   ────────────────────────────────────────── */
.feed {
  padding: 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.card:active {
  transform: scale(.99);
  box-shadow: var(--shadow-md);
}

.card .head {
  display: flex; align-items: baseline; gap: 8px;
}

.card .time {
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card .badge {
  font-size: 11px; font-weight: 600;
  border-radius: 7px; padding: 3px 8px;
  background: var(--accent-soft); color: var(--accent);
  letter-spacing: 0.01em;
}
.card .badge.passenger {
  background: #fff3e0; color: #bf6000;
}
@media (prefers-color-scheme: dark) {
  .card .badge.passenger { background: #3a2a12; color: #ffb74d; }
}

.card .price {
  margin-left: auto;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.card .route {
  font-size: 15px;
  font-weight: 600;
  margin: 8px 0 3px;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.card .meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.card .comment {
  font-size: 14px;
  margin-top: 6px;
  color: var(--muted);
}

.card .foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line);
}

.card .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  overflow: hidden; flex: 0 0 auto;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.card .avatar img { width: 100%; height: 100%; object-fit: cover; }

.card .author {
  font-size: 14px; color: var(--muted);
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.card .contact, .card .del {
  border: none; border-radius: 10px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  min-height: 36px; display: inline-flex; align-items: center;
}
.card .contact {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.card .contact:active {
  background: var(--accent-strong);
  transform: scale(.97);
  box-shadow: none;
}
.card .del {
  background: transparent;
  color: var(--danger);
}
.card .del:active { opacity: .7; transform: scale(.97); }

.card .edit {
  background: transparent; color: var(--accent);
  border: none; border-radius: 10px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease;
}
.card .edit:active { background: var(--accent-soft); }

.card .contact-sm, a.contact-sm, button.contact-sm {
  padding: 5px 10px; font-size: 13px;
}

/* ── Пустое состояние ── */
.empty {
  text-align: center; color: var(--muted);
  padding: 60px 20px;
}
.empty .big { font-size: 44px; margin-bottom: 12px; }

/* ──────────────────────────────────────────
   FAB — Кнопка добавить поездку
   ────────────────────────────────────────── */
.fab {
  position: fixed; right: 18px;
  bottom: calc(68px + env(safe-area-inset-bottom));
  z-index: 6;
  width: 56px; height: 56px; border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow-accent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.fab:active {
  transform: scale(.92);
  box-shadow: 0 2px 8px rgba(31, 95, 255, .20);
}

/* ──────────────────────────────────────────
   BACKDROP И ШИТЫ / МОДАЛКИ
   ────────────────────────────────────────── */
.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10, 15, 26, .55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 26px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 -4px 32px rgba(13, 27, 42, .18);
}

/* Панель уведомлений — минимум пол-экрана, чтобы «вылезала» заметно */
#notif-sheet { min-height: 55vh; }

/* Псевдо-хендл «грабер» сверху шита — без правки HTML */
.sheet::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: -14px auto 18px;
}

.sheet h2 {
  margin: 0 0 16px;
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.sheet form {
  display: flex; flex-direction: column; gap: 12px;
}

/* ── Пикер-шит ── */
.picker-sheet {
  display: flex; flex-direction: column;
  max-height: 80vh;
  padding-top: 16px;
}

.picker-header {
  flex: 0 0 auto;
  padding: 0 0 10px 0;
}

.picker-search {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg); color: var(--text);
  padding: 11px 14px; font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.picker-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 95, 255, .15);
}

.picker-list {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}

.picker-city-heading {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: var(--muted); text-transform: uppercase;
  padding: 12px 2px 4px;
}

.picker-point {
  border: none; background: transparent; color: var(--text);
  text-align: left; font-size: 15px;
  padding: 13px 6px; cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
  border-radius: 0;
}
.picker-point:last-child { border-bottom: none; }
.picker-point:active { background: var(--accent-soft); border-radius: 8px; }

.picker-custom {
  color: var(--accent); font-weight: 600;
}

/* ──────────────────────────────────────────
   ФОРМА В ШИТЕ
   ────────────────────────────────────────── */
.role-toggle { display: flex; gap: 6px; }
.role-toggle label { flex: 1; }
.role-toggle input { display: none; }
.role-toggle span {
  display: block; text-align: center; padding: 10px 0;
  border-radius: 12px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.role-toggle input:checked + span {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border-color: var(--accent);
}

.route-row { display: flex; gap: 8px; align-items: center; }
.route-row input { flex: 1; min-width: 0; }
.route-row button:not(.picker-btn) {
  flex: 0 0 auto; width: 40px; height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg); color: var(--text);
  font-size: 16px; cursor: pointer;
  transition: background 0.15s ease;
}
.route-row button:not(.picker-btn):active { background: var(--accent-soft); }

/* ── Picker-btn ── */
.picker-btn {
  flex: 1; min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg); color: var(--text);
  padding: 10px 12px; font-size: 15px;
  text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.picker-btn:active { background: var(--accent-soft); border-color: var(--accent); }
.picker-btn.has-value { color: var(--text); }
.picker-btn.placeholder-color { color: var(--muted); }

.picker-btn-sm {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 9px;
  flex: 0 0 auto;
  font-weight: 500;
}

/* ── Инпуты ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sheet label {
  font-size: 12px; font-weight: 600;
  color: var(--muted); letter-spacing: 0.02em;
  text-transform: uppercase;
  display: flex; flex-direction: column; gap: 5px;
}

.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

input {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg); color: var(--text);
  padding: 10px 12px; font-size: 15px; width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 95, 255, .14);
}

/* ── Кнопки формы ── */
.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }

.btn {
  flex: 1; border: none; border-radius: 13px;
  padding: 14px 0; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  min-height: 48px;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn.primary:active {
  transform: scale(.97);
  background: var(--accent-strong);
  box-shadow: none;
}
.btn.secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--line);
}
.btn.secondary:active { transform: scale(.97); background: var(--line); }

.form-error { color: var(--danger); font-size: 13px; margin: 0; font-weight: 500; }
.hidden { display: none !important; }

/* ──────────────────────────────────────────
   ЗАЯВКИ / БРОНИРОВАНИЕ
   ────────────────────────────────────────── */
.booking-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; flex-wrap: wrap;
}

.btn-book {
  border: none; border-radius: 10px; padding: 8px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  min-height: 36px;
}
.btn-book:active {
  background: var(--accent-strong);
  transform: scale(.96);
  box-shadow: none;
}
.btn-book.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-book:disabled { opacity: .45; cursor: default; box-shadow: none; }

.btn-cancel-book {
  border: none; background: transparent;
  color: var(--danger); font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 6px 8px;
  transition: opacity 0.15s ease;
}
.btn-cancel-book:active { opacity: .6; }
.btn-cancel-book:disabled { opacity: .45; cursor: default; }

/* ── Статусные плашки ── */
.status-approved {
  display: inline-flex; align-items: center;
  background: #dff5e8; color: #157040;
  border-radius: 8px; padding: 3px 10px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.01em;
}
@media (prefers-color-scheme: dark) {
  .status-approved { background: #0f2d1c; color: #5acf89; }
}

.status-pending {
  display: inline-flex; align-items: center;
  background: #fff5d6; color: #9a6300;
  border-radius: 8px; padding: 3px 10px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.01em;
}
@media (prefers-color-scheme: dark) {
  .status-pending { background: #2e2407; color: #f0b429; }
}

.status-rejected {
  display: inline-flex; align-items: center;
  background: rgba(229, 72, 77, .10); color: var(--danger);
  border-radius: 8px; padding: 3px 10px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.01em;
}
@media (prefers-color-scheme: dark) {
  .status-rejected { background: rgba(255, 107, 102, .12); }
}

/* ── Приглушение карточки без мест ── */
.card-full { opacity: .55; }

/* ──────────────────────────────────────────
   БЛОК ВХОДЯЩИХ ЗАЯВОК
   ────────────────────────────────────────── */
.requests-block { margin-top: 10px; }

.requests-heading {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.requests-list { display: flex; flex-direction: column; }

.request-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.request-row:last-child { border-bottom: none; }

.request-info { display: flex; align-items: center; gap: 8px; }
.request-actions { display: flex; align-items: center; gap: 8px; }

.request-row-rejected {
  opacity: .55;
  flex-direction: row; align-items: center;
}

.req-name { font-size: 14px; font-weight: 600; flex: 0 0 auto; color: var(--text); }
.req-seats { font-size: 13px; flex: 1; min-width: 0; color: var(--muted); }

.muted-text { color: var(--muted); }

/* ──────────────────────────────────────────
   НИЖНИЙ ТАБ-БАР
   ────────────────────────────────────────── */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  min-height: 56px;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(13, 27, 42, .08);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-btn {
  flex: 1; border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer;
  color: var(--muted);
  font-size: 11px; font-weight: 600;
  padding: 8px 0;
  transition: color 0.15s ease;
}
.tab-btn.active { color: var(--accent); }
.tab-btn:active { opacity: .7; }

.tab-icon { font-size: 20px; line-height: 1; position: relative; display: inline-block; }
.tab-label { font-size: 11px; letter-spacing: 0.01em; }

/* ── Бейдж на вкладке Кабинет ── */
.cabinet-badge {
  position: absolute; top: -4px; right: -8px;
  min-width: 16px; height: 16px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  text-align: center; border-radius: 999px;
  padding: 0 3px;
  border: 2px solid var(--card);
}

/* ──────────────────────────────────────────
   КАБИНЕТ
   ────────────────────────────────────────── */
.cabinet {
  padding: 14px 14px;
  display: flex; flex-direction: column; gap: 12px;
}

.cab-header {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.cab-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; flex: 0 0 auto;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cab-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.cab-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.cab-stats {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 12px 16px;
  font-size: 14px; color: var(--muted);
}
.cab-stat-highlight { color: var(--accent); font-weight: 700; }

.cab-section { display: flex; flex-direction: column; gap: 10px; }
.cab-section-title {
  font-size: 13px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  padding: 0 2px;
  margin-top: 4px;
}
.cab-empty {
  font-size: 14px; padding: 8px 2px; color: var(--muted);
}

/* ──────────────────────────────────────────
   ДЕВ-ЧИП (отладочная кнопка)
   ────────────────────────────────────────── */
.dev-chip {
  position: fixed; left: 18px;
  bottom: calc(68px + env(safe-area-inset-bottom));
  z-index: 6;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--card); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.12s ease;
}
.dev-chip:active { transform: scale(.96); }
