/* ============ GoToBus — дизайн-система ============ */
:root {
  --navy-900: #08182e;
  --navy-800: #0e2a47;
  --navy-700: #16395c;
  --brand-600: #1657ff;
  --brand-500: #2f6bff;
  --brand-100: #e6edff;
  --amber-500: #ffb400;
  --amber-100: #fff4d6;
  --green-600: #12a150;
  --green-100: #e3f7ec;
  --red-600: #e5484d;
  --red-100: #fdeced;
  --gray-900: #101828;
  --gray-700: #344054;
  --gray-500: #667085;
  --gray-400: #98a2b3;
  --gray-300: #d0d5dd;
  --gray-200: #e4e7ec;
  --gray-100: #f2f4f7;
  --gray-50: #f9fafb;
  --white: #fff;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow: 0 4px 8px -2px rgba(16, 24, 40, .1), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --container: 1200px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --header-h: 68px;
  /* Відступи під «вуса» та смугу Home на iPhone (працюють завдяки
     viewport-fit=cover у метатегу viewport). */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Safari у ландшафті сам збільшує шрифти — вимикаємо. */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-50);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* Страховка від горизонтального скролу: clip, а не hidden, щоб не зламати
     position: sticky у шапки та фільтрів. */
  overflow-x: clip;
}
/* Сірий прямокутник при тапі на iOS замінюємо на власне підсвічування. */
button, a, summary, [role='button'], .seat, .thread-item { -webkit-tap-highlight-color: rgba(22, 87, 255, .12); }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.15; letter-spacing: -.03em; font-family: var(--font-display); }
h1 { font-size: clamp(2.1rem, 1.2rem + 2.6vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 1.15rem + 1.4vw, 2.3rem); font-weight: 800; }
h3 { font-size: 1.22rem; font-weight: 700; }
h4 { font-weight: 700; }
.logo, .btn, .stat-card .value, .trip-price, .timeline .time { font-family: var(--font-display); }
p { margin: 0 0 1em; }
small { font-size: .82rem; }

.container {
  width: 100%; max-width: var(--container); margin: 0 auto;
  padding-left: max(20px, var(--safe-l)); padding-right: max(20px, var(--safe-r));
}
.muted { color: var(--gray-500); }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grow { flex: 1; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 14px; }

/* ---------- Банер техробіт ---------- */
.maintenance-bar {
  background: linear-gradient(90deg, #ffcf4d, var(--amber-500));
  color: #4a3200;
  font-weight: 600;
  font-size: .92rem;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.maintenance-bar .container {
  display: flex; align-items: center; gap: 14px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap;
}
.maintenance-bar .icon { display: inline-flex; }
.maintenance-bar .mt-text { flex: 1; min-width: 240px; }
.maintenance-bar button {
  background: #4a3200; color: #fff; border: 0; border-radius: 999px;
  padding: 7px 16px; font-weight: 600; font-size: .85rem; cursor: pointer; white-space: nowrap;
}
.maintenance-bar button:hover { background: #2f2000; }

/* ---------- Хедер ---------- */
.site-header { background: var(--navy-800); color: #fff; position: sticky; top: 0; z-index: 40; }
.site-header .container { display: flex; align-items: center; gap: 28px; height: var(--header-h); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: #fff; letter-spacing: -.03em; }
.logo:hover { text-decoration: none; }
.logo svg { flex: none; }
.logo-text { display: inline-flex; letter-spacing: -.035em; }
.logo-text span { color: var(--amber-500); }

/* ---------- Іконки ---------- */
.icon { flex: none; vertical-align: -.18em; }
.btn .icon { margin-right: -2px; }
[data-icon] { display: inline-flex; align-items: center; }
.icon-badge {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: var(--brand-100); color: var(--brand-600);
}
.icon-badge.amber { background: var(--amber-100); color: #8a5b00; }
.icon-badge.green { background: var(--green-100); color: var(--green-600); }
.icon-badge.navy { background: #e7ecf5; color: var(--navy-800); }
.amenity { display: inline-flex; align-items: center; gap: 5px; }
.amenity .icon { color: var(--gray-500); }
.main-nav { display: flex; gap: 20px; margin-left: 10px; }
.main-nav a { color: rgba(255, 255, 255, .82); font-weight: 500; font-size: .95rem; }
.main-nav a:hover, .main-nav a.active { color: #fff; text-decoration: none; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-500);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff;
}
.user-chip {
  display: flex; align-items: center; gap: 9px; background: rgba(255, 255, 255, .1);
  padding: 5px 12px 5px 5px; border-radius: 999px; color: #fff; font-size: .9rem; font-weight: 600;
}
.user-chip:hover { background: rgba(255, 255, 255, .18); text-decoration: none; }
.burger { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
.nav-auth { display: none; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 11px 20px;
  font-family: var(--font); font-size: .95rem; font-weight: 650; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .06s; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover { background: #0f47db; }
.btn-accent { background: var(--amber-500); color: #3a2800; }
.btn-accent:hover { background: #ecA400; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.btn-outline { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-success { background: var(--green-600); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: .85rem; border-radius: 7px; }
.btn-lg { padding: 14px 28px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Форми ---------- */
label { display: block; font-size: .84rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font-family: var(--font); font-size: .95rem; color: var(--gray-900);
  padding: 11px 13px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 16px; position: relative; }
.form-error { color: var(--red-600); font-size: .85rem; margin-top: 6px; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: .9rem; font-weight: 500; color: var(--gray-700); }
.checkbox input { width: auto; margin-top: 3px; }

/* ---------- Картки ---------- */
.card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.section { padding: 56px 0; }
.section-head { margin-bottom: 26px; }
.section-head p { color: var(--gray-500); margin: 0; }

/* ---------- Бейджі ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 650; background: var(--gray-100); color: var(--gray-700);
}
.badge-pending { background: var(--amber-100); color: #8a5b00; }
.badge-confirmed, .badge-paid { background: var(--green-100); color: #0a6b36; }
.badge-cancelled { background: var(--red-100); color: #a8161b; }
.badge-open { background: var(--brand-100); color: #12409f; }
.badge-closed { background: var(--gray-100); color: var(--gray-500); }

/* ---------- Головна: hero ---------- */
.hero {
  background:
    linear-gradient(180deg, rgba(8, 24, 46, .86), rgba(8, 24, 46, .92)),
    radial-gradient(1000px 400px at 80% -10%, #2f6bff55, transparent),
    var(--navy-900);
  color: #fff; padding: 64px 0 120px;
  /* Розмиті кола аврори завширшки 460px виходили за межі екрана і робили
     всю сторінку горизонтально прокручуваною. */
  position: relative; overflow: hidden;
}
.hero h1 { color: #fff; max-width: 720px; }
.hero p.lead { color: rgba(255, 255, 255, .75); font-size: 1.1rem; max-width: 620px; }
.hero-stats { display: flex; gap: 34px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 1.5rem; }
.hero-stats span { color: rgba(255, 255, 255, .7); font-size: .88rem; }

/* Пошукова форма */
.search-card {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 20px;
  display: grid; grid-template-columns: 1.3fr 1.3fr 1fr .8fr auto; gap: 12px; align-items: end;
}
.search-card.floating { margin-top: -70px; position: relative; z-index: 5; }
.search-card .field { margin: 0; }
.swap-btn {
  position: absolute; right: -20px; top: 30px; z-index: 3; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--gray-300); background: #fff; cursor: pointer; display: grid; place-items: center;
  box-shadow: var(--shadow-sm); font-size: .95rem; color: var(--gray-700);
}
.swap-btn:hover { background: var(--gray-50); }
.autocomplete { position: relative; }
.suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; z-index: 20;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 260px; overflow-y: auto;
}
.suggestions div { padding: 9px 13px; cursor: pointer; font-size: .92rem; display: flex; gap: 8px; align-items: center; }
.suggestions div:hover, .suggestions div.active { background: var(--brand-100); }
.suggestions .flag { font-size: 1rem; }

/* ---------- Плитки ---------- */
.grid { display: grid; gap: 18px; align-items: stretch; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.route-tile { display: flex; flex-direction: column; height: 100%; padding: 18px; border-radius: var(--radius); border: 1px solid var(--gray-200); background: #fff; transition: box-shadow .15s, transform .15s; color: inherit; }
.route-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.route-tile .cities { font-weight: 700; font-size: .98rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.route-tile .cities span { white-space: nowrap; }
.route-tile .meta { color: var(--gray-500); font-size: .85rem; margin-top: 4px; }
.route-tile .price { margin-top: auto; padding-top: 12px; font-weight: 800; color: var(--brand-600); font-size: 1.1rem; }

.feature { padding: 22px; border-radius: var(--radius); background: #fff; border: 1px solid var(--gray-200); }
.feature .ico { width: 46px; height: 46px; border-radius: 13px; background: var(--brand-100); color: var(--brand-600); display: grid; place-items: center; margin-bottom: 12px; }

/* ---------- Результати пошуку ---------- */
.search-layout { display: grid; grid-template-columns: 270px 1fr; gap: 24px; align-items: start; }
.filters { position: sticky; top: calc(var(--header-h) + 20px); }
.filter-group + .filter-group { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--gray-200); }
.filter-group h4 { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); margin-bottom: 12px; }

.trip-card { padding: 20px; display: grid; grid-template-columns: 1fr 210px; gap: 22px; margin-bottom: 14px; }
.trip-main { min-width: 0; }
.trip-carrier { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.carrier-logo { width: 38px; height: 38px; border-radius: 10px; background: var(--navy-800); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .95rem; }
.carrier-name { font-weight: 650; }
.rating { color: var(--amber-500); font-weight: 700; font-size: .85rem; }
.timeline { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.timeline .time { font-size: 1.45rem; font-weight: 750; line-height: 1.1; }
.timeline .city { font-size: .9rem; color: var(--gray-700); font-weight: 600; }
.timeline .station { font-size: .78rem; color: var(--gray-400); max-width: 190px; }
.timeline .line { position: relative; text-align: center; color: var(--gray-500); font-size: .8rem; }
.timeline .line::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--gray-200);
}
.timeline .line span { position: relative; background: #fff; padding: 0 10px; }
.amenities { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.amenity { font-size: .76rem; color: var(--gray-600, #52606d); background: var(--gray-100); padding: 3px 9px; border-radius: 6px; }
.trip-side { border-left: 1px dashed var(--gray-200); padding-left: 20px; display: flex; flex-direction: column; justify-content: center; gap: 10px; text-align: right; }
.trip-price { font-size: 1.75rem; font-weight: 800; }
.trip-price small { font-size: .9rem; font-weight: 600; color: var(--gray-500); }
.seats-left { font-size: .82rem; color: var(--gray-500); }
.seats-left.low { color: var(--red-600); font-weight: 600; }
.trip-card.sold-out { opacity: .72; }
.trip-card.sold-out .trip-price { color: var(--gray-500); }

/* ---------- Схема місць ---------- */
.bus-layout { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; }
.bus-body { display: grid; grid-template-columns: repeat(5, 40px); gap: 8px; justify-content: center; }
.seat {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--gray-300); background: #fff;
  font-size: .8rem; font-weight: 650; color: var(--gray-700); cursor: pointer; display: grid; place-items: center;
}
.seat:hover:not(.taken) { border-color: var(--brand-500); background: var(--brand-100); }
.seat.taken { background: var(--gray-200); color: var(--gray-400); cursor: not-allowed; border-style: dashed; }
.seat.selected { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.seat.aisle { visibility: hidden; }
.seat-legend { display: flex; gap: 18px; justify-content: center; margin-top: 16px; font-size: .82rem; color: var(--gray-500); }
.seat-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: -2px; margin-right: 6px; border: 1px solid var(--gray-300); }

/* ---------- Таблиці ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--gray-500); padding: 11px 14px; border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
table.data td { padding: 13px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
table.data tr:hover td { background: var(--gray-50); }
/* Кнопок у рядку заявки багато (статуси + квиток + коментар) — переносимо, а не женемо таблицю в горизонтальний скрол */
table.data td.actions { text-align: right; }
table.data td.actions > * { display: inline-flex; margin: 2px 0 2px 6px; white-space: nowrap; }

/* ---------- Чат ---------- */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60; width: 58px; height: 58px; border-radius: 50%;
  background: var(--brand-600); color: #fff; border: 0; cursor: pointer;
  box-shadow: 0 10px 26px rgba(22, 87, 255, .4); display: grid; place-items: center;
}
.chat-fab:hover { background: #0f47db; }
.chat-fab .dot {
  position: absolute; top: 4px; right: 4px; min-width: 20px; height: 20px; border-radius: 999px;
  background: var(--red-600); color: #fff; font-size: .72rem; display: grid; place-items: center; padding: 0 5px;
}
.chat-panel {
  position: fixed; right: 22px; bottom: 92px; z-index: 60; width: 370px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 130px); background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--gray-200);
}
.chat-head { background: var(--navy-800); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.chat-head .status { font-size: .78rem; color: #8fe3b0; }
.chat-head button { margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; }
.chat-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: var(--gray-50); display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: .9rem; line-height: 1.45; word-break: break-word; }
.msg .text { display: block; white-space: pre-wrap; }
.msg .who { display: block; font-size: .72rem; opacity: .7; margin-bottom: 2px; font-weight: 600; }
.msg .at { display: block; font-size: .68rem; opacity: .6; margin-top: 3px; text-align: right; }
.msg.in { background: #fff; border: 1px solid var(--gray-200); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: var(--brand-600); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--gray-200); background: #fff; }
.chat-form textarea { min-height: 42px; max-height: 110px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.chat-empty { text-align: center; color: var(--gray-500); font-size: .88rem; padding: 24px; }

/* ---------- Вкладення в чаті ---------- */
.chat-attach { flex: 0 0 auto; align-self: flex-end; padding: 9px; color: var(--gray-500); }
.chat-attach:hover:not(:disabled) { color: var(--brand-600); background: var(--brand-100); }
.chat-attach:disabled { opacity: .5; cursor: progress; }
.chat-file {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 7px; padding: 8px 10px;
  border: 1px solid var(--gray-200); border-radius: 10px; background: var(--gray-50);
  color: var(--gray-900); font: inherit; font-size: .82rem; text-align: left; cursor: pointer;
}
.chat-file:hover:not(:disabled) { border-color: var(--brand-500); background: var(--brand-100); }
.chat-file:disabled { opacity: .6; cursor: progress; }
.chat-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chat-file-size { color: var(--gray-500); font-size: .74rem; flex: 0 0 auto; }
.chat-file.is-ticket { border-color: var(--amber-500); background: var(--amber-100); }
.chat-file.is-ticket:hover:not(:disabled) { border-color: var(--amber-500); background: #ffeab8; }
/* у вихідній (синій) бульбашці плитка має лишатися читабельною */
.msg.out .chat-file { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .32); color: #fff; }
.msg.out .chat-file:hover:not(:disabled) { background: rgba(255, 255, 255, .24); border-color: #fff; }
.msg.out .chat-file-size { color: rgba(255, 255, 255, .75); }
.msg.out .chat-file.is-ticket { background: var(--amber-100); border-color: var(--amber-500); color: var(--gray-900); }
.msg.out .chat-file.is-ticket .chat-file-size { color: var(--gray-500); }

/* ---------- Квиток у кабінеті ---------- */
.ticket-issued {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-top: 12px; padding: 12px 14px; border: 1px solid var(--amber-500);
  border-radius: var(--radius); background: var(--amber-100);
}
.ticket-issued-info { display: flex; align-items: center; gap: 11px; }
.ticket-issued-info .icon-badge { width: 38px; height: 38px; background: #fff; color: var(--gray-900); }
.ticket-issued-title { font-weight: 700; font-size: .95rem; }
.ticket-pending {
  display: flex; align-items: center; gap: 7px; margin-top: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); background: var(--gray-50); color: var(--gray-500); font-size: .85rem;
}

/* ---------- Адмінка ---------- */
.admin-layout { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - var(--header-h)); }
@supports (height: 100dvh) { .admin-layout { min-height: calc(100dvh - var(--header-h)); } }
.admin-side { background: var(--navy-900); padding: 22px 14px; }
.admin-side a {
  display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: 9px;
  color: rgba(255, 255, 255, .72); font-size: .93rem; font-weight: 550; margin-bottom: 3px; cursor: pointer;
}
.admin-side a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.admin-side a.active { background: var(--brand-600); color: #fff; }
.admin-side .side-title { color: var(--gray-400); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 14px 13px 6px; }
.admin-main { padding: 26px 30px; background: var(--gray-50); min-width: 0; }
.stat-card { padding: 18px 20px; }
.stat-card .label { color: var(--gray-500); font-size: .82rem; font-weight: 600; }
.stat-card .value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; }
.stat-card .hint { font-size: .8rem; color: var(--gray-400); }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.bar-chart .bar { flex: 1; background: var(--brand-100); border-radius: 5px 5px 0 0; position: relative; min-height: 3px; }
.bar-chart .bar > span { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: .72rem; color: var(--gray-500); }
.bar-chart .bar.hot { background: var(--brand-600); }
.chart-x { display: flex; gap: 6px; margin-top: 6px; }
.chart-x span { flex: 1; text-align: center; font-size: .68rem; color: var(--gray-400); }

.admin-chat { display: grid; grid-template-columns: 300px 1fr; height: 620px; overflow: hidden; }
.thread-list { border-right: 1px solid var(--gray-200); overflow-y: auto; min-height: 0; }
.thread-item { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); cursor: pointer; }
.thread-item:hover { background: var(--gray-50); }
.thread-item.active { background: var(--brand-100); }
.thread-item .tname { font-weight: 650; font-size: .92rem; display: flex; justify-content: space-between; gap: 8px; }
.thread-item .tlast { color: var(--gray-500); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-pill { background: var(--red-600); color: #fff; border-radius: 999px; font-size: .7rem; padding: 1px 7px; font-weight: 700; }
.admin-chat-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ---------- Табs, alerts ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--gray-200); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px;
  font-family: var(--font); font-size: .93rem; font-weight: 600; color: var(--gray-500); cursor: pointer;
}
.tabs button.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 16px; }
.alert-info { background: var(--brand-100); color: #12409f; }
.alert-warn { background: var(--amber-100); color: #7a5200; }
.alert-error { background: var(--red-100); color: #a8161b; }
.alert-success { background: var(--green-100); color: #0a6b36; }

.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy-800); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: .9rem; animation: slidein .2s ease-out;
}
.toast.error { background: var(--red-600); }
.toast.success { background: var(--green-600); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.skeleton { background: linear-gradient(90deg, var(--gray-100), var(--gray-200), var(--gray-100)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); height: 120px; margin-bottom: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Футер ---------- */
.site-footer { background: var(--navy-900); color: rgba(255, 255, 255, .68); padding: 48px 0 28px; margin-top: 60px; }
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: 14px; }
.site-footer a { color: rgba(255, 255, 255, .68); display: block; padding: 4px 0; font-size: .9rem; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 30px; padding-top: 20px; font-size: .84rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Адаптив ---------- */
@media (max-width: 980px) {
  h1 { font-size: 2rem; }
  .search-card { grid-template-columns: 1fr 1fr; }
  .search-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .admin-layout { grid-template-columns: 1fr; }
  /* min-width: 0 обовʼязковий: без нього grid-елемент не стискається нижче
     власного вмісту, і рядок навігації розтягував усю сторінку по горизонталі. */
  .admin-side { display: flex; overflow-x: auto; padding: 10px; gap: 6px; min-width: 0; scrollbar-width: none; }
  .admin-side::-webkit-scrollbar { display: none; }
  .admin-side .side-title { display: none; }
  .admin-chat { grid-template-columns: 1fr; height: auto; }
  .thread-list { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--gray-200); }
}
@media (max-width: 720px) {
  .main-nav { display: none; }
  .burger { display: block; }
  .main-nav.open {
    display: flex; flex-direction: column; position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--navy-800); padding: 14px 20px; gap: 6px; z-index: 30;
  }
  .search-card { grid-template-columns: 1fr; }
  .trip-card { grid-template-columns: 1fr; }
  .trip-side { border-left: 0; border-top: 1px dashed var(--gray-200); padding-left: 0; padding-top: 14px; text-align: left; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; gap: 8px; }
  .timeline .line::before { display: none; }
  .chat-panel { right: 8px; left: 8px; width: auto; bottom: 84px; }
}

/* ---------- Перемикач мови ---------- */
.lang-picker { position: relative; }
.lang-current {
  display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .12); border: 0;
  color: #fff; font-family: var(--font); font-size: .82rem; font-weight: 700; padding: 7px 12px;
  border-radius: 999px; cursor: pointer;
}
.lang-current:hover { background: rgba(255, 255, 255, .2); }
.lang-current .caret { font-size: .7rem; opacity: .8; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--gray-200); padding: 6px; min-width: 176px; z-index: 50;
}
.lang-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; background: none; border: 0; cursor: pointer;
  font-family: var(--font); font-size: .9rem; font-weight: 600; color: var(--gray-700);
  padding: 8px 10px; border-radius: 8px; text-align: left;
}
.lang-menu button:hover { background: var(--gray-100); }
.lang-menu button.active { background: var(--brand-100); color: var(--brand-600); }

/* ---------- Сторінка бронювання ---------- */
.booking-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.summary-card { position: sticky; top: calc(var(--header-h) + 20px); }
.summary-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: .92rem; }
.summary-row.total { border-top: 1px solid var(--gray-200); margin-top: 8px; padding-top: 14px; font-size: 1.15rem; font-weight: 800; }
.page-head { background: var(--navy-800); color: #fff; padding: 28px 0; }
.page-head h1 { color: #fff; font-size: 1.7rem; margin: 0; }
.page-head .sub { color: rgba(255, 255, 255, .7); font-size: .95rem; }
.auth-page { display: grid; place-items: center; padding: 48px 20px; }
.auth-card { width: 100%; max-width: 440px; padding: 32px; }
.help-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.accordion { border: 1px solid var(--gray-200); border-radius: var(--radius); background: #fff; overflow: hidden; }
.accordion + .accordion { margin-top: 10px; }
.accordion summary { padding: 16px 20px; font-weight: 650; cursor: pointer; list-style: none; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: '+'; float: right; color: var(--gray-400); font-size: 1.2rem; line-height: 1; }
.accordion[open] summary::after { content: '−'; }
.accordion .content { padding: 0 20px 18px; color: var(--gray-700); font-size: .93rem; }
.step { display: flex; gap: 14px; }
.step .num {
  width: 34px; height: 34px; min-width: 34px; border-radius: 50%; background: var(--brand-600); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
@media (max-width: 980px) {
  .booking-layout { grid-template-columns: 1fr; }
  .summary-card { position: static; }
  .help-grid { grid-template-columns: 1fr; }
}


/* ---------- Модальні вікна ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(8, 24, 46, .55); z-index: 90;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; animation: modalin .16s ease-out;
}
@keyframes modalin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--gray-200); }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-close { margin-left: auto; background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--gray-500); }
.modal-close:hover { color: var(--gray-900); }
.modal-body { padding: 20px 22px 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.sub-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.sub-tabs button {
  background: #fff; border: 1px solid var(--gray-300); border-radius: 999px; padding: 7px 16px;
  font-family: var(--font); font-size: .88rem; font-weight: 600; color: var(--gray-700); cursor: pointer;
}
.sub-tabs button.active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

/* ---------- Згоди та юридичні документи ---------- */
.consent-box { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 0 27px; font-size: .82rem; }
.legal-doc { max-width: 820px; margin: 0 auto; }
.legal-doc h2 { font-size: 1.25rem; margin-top: 32px; }
.legal-doc h3 { font-size: 1.02rem; margin-top: 22px; }
.legal-doc p, .legal-doc li { color: var(--gray-700); font-size: .95rem; }
.legal-doc ul { padding-left: 20px; }
.legal-doc table.data td { vertical-align: top; }
.cookie-bar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 80; background: #fff;
  border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 18px 20px; display: flex; gap: 18px; align-items: center; max-width: 900px; margin: 0 auto;
}
.cookie-bar .cookie-text { flex: 1; min-width: 220px; }
.cookie-bar h4 { margin: 0 0 4px; font-size: 1rem; }
.cookie-bar p { margin: 0; font-size: .88rem; color: var(--gray-500); }
.cookie-bar .row { flex-wrap: wrap; }
@media (max-width: 720px) { .cookie-bar { flex-direction: column; align-items: stretch; bottom: 90px; } }


/* ============ Рух і анімації ============ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes floatSoft { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -14px, 0); } }
@keyframes auroraShift {
  0%   { transform: translate3d(-6%, -4%, 0) scale(1); }
  50%  { transform: translate3d(6%, 6%, 0) scale(1.12); }
  100% { transform: translate3d(-6%, -4%, 0) scale(1); }
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes shine { from { transform: translateX(-120%) skewX(-18deg); } to { transform: translateX(320%) skewX(-18deg); } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(22, 87, 255, .45); } 70% { box-shadow: 0 0 0 16px rgba(22, 87, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 87, 255, 0); } }
@keyframes dashRun { to { stroke-dashoffset: -260; } }

/* поява елементів під час прокручування */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); will-change: opacity, transform; }
.reveal.in-view { opacity: 1; transform: none; }
.reveal-stagger > * { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.reveal-stagger.in-view > * { opacity: 1; transform: none; }
.reveal-stagger.in-view > *:nth-child(1) { transition-delay: .04s; }
.reveal-stagger.in-view > *:nth-child(2) { transition-delay: .10s; }
.reveal-stagger.in-view > *:nth-child(3) { transition-delay: .16s; }
.reveal-stagger.in-view > *:nth-child(4) { transition-delay: .22s; }
.reveal-stagger.in-view > *:nth-child(5) { transition-delay: .28s; }
.reveal-stagger.in-view > *:nth-child(6) { transition-delay: .34s; }
.reveal-stagger.in-view > *:nth-child(7) { transition-delay: .40s; }
.reveal-stagger.in-view > *:nth-child(8) { transition-delay: .46s; }

/* ============ Шапка: липкий стан ============ */
.site-header { transition: background .3s var(--ease), box-shadow .3s var(--ease), backdrop-filter .3s var(--ease); }
.site-header.scrolled { background: rgba(10, 32, 56, .88); backdrop-filter: saturate(160%) blur(14px); box-shadow: 0 8px 26px -14px rgba(0, 0, 0, .7); }
.main-nav a { position: relative; }
.main-nav a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: -6px; height: 2px;
  background: var(--amber-500); border-radius: 2px; transition: right .28s var(--ease);
}
.main-nav a:hover::after, .main-nav a.active::after { right: 0; }

/* ============ Кнопки ============ */
.btn { position: relative; overflow: hidden; }
.btn-primary, .btn-accent { box-shadow: 0 6px 18px -8px rgba(22, 87, 255, .8); }
.btn-primary:hover, .btn-accent:hover { transform: translateY(-1px); }
.btn-accent:hover { box-shadow: 0 8px 22px -8px rgba(255, 180, 0, .9); }
.btn-lg::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 45%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .32), transparent);
  animation: shine 4.5s var(--ease) infinite; animation-delay: 1.4s;
}

/* ============ Hero ============ */
.hero { position: relative; overflow: hidden; }
.hero > .container { position: relative; z-index: 2; }
.hero-aurora { position: absolute; inset: -20% -10% auto -10%; height: 130%; pointer-events: none; z-index: 0; }
.hero-aurora span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  animation: auroraShift 18s ease-in-out infinite;
}
.hero-aurora span:nth-child(1) { width: 460px; height: 460px; left: 4%; top: 6%; background: #2f6bff; }
.hero-aurora span:nth-child(2) { width: 380px; height: 380px; right: 12%; top: 0; background: #1f4ed8; animation-duration: 22s; animation-direction: reverse; }
.hero-aurora span:nth-child(3) { width: 300px; height: 300px; right: 28%; bottom: 8%; background: #ffb400; opacity: .22; animation-duration: 26s; }
.hero-grid {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 30% 20%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 30% 20%, #000 0%, transparent 72%);
}
.hero h1 { animation: fadeUp .8s var(--ease-out) both; }
.hero p.lead { animation: fadeUp .8s var(--ease-out) .12s both; }
.hero-stats { animation: fadeUp .8s var(--ease-out) .22s both; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; animation: fadeUp .8s var(--ease-out) .3s both; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
  color: rgba(255, 255, 255, .9); font-size: .82rem; font-weight: 600;
}
.hero-badge .icon { color: var(--amber-500); }
.hero-route { position: absolute; right: 24px; top: 96px; width: 390px; opacity: .45; z-index: 1; pointer-events: none; animation: floatSoft 9s ease-in-out infinite; }
.hero-route path.line { stroke-dasharray: 10 8; animation: dashRun 12s linear infinite; }
.search-card { animation: fadeUp .8s var(--ease-out) .34s both; transition: box-shadow .3s var(--ease); }
.search-card:focus-within { box-shadow: 0 22px 50px -18px rgba(16, 24, 40, .35); }
.swap-btn { transition: transform .45s var(--ease), background .2s; }
.swap-btn.spin { transform: rotate(180deg); }

/* ============ Картки ============ */
.route-tile, .feature, .card { transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .25s var(--ease); }
.route-tile:hover { transform: translateY(-4px); box-shadow: 0 18px 34px -20px rgba(16, 24, 40, .5); border-color: #c9d6ff; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature .ico { transition: transform .35s var(--ease), background .25s; }
.feature:hover .ico { transform: scale(1.08) rotate(-4deg); background: var(--brand-600); color: #fff; }
.trip-card { animation: fadeUp .5s var(--ease-out) both; }
.trip-card:hover { box-shadow: 0 16px 32px -22px rgba(16, 24, 40, .55); border-color: #c9d6ff; }
.step .num { transition: transform .3s var(--ease); }
.step:hover .num { transform: scale(1.12); }

/* ============ Стрічка перевізників ============ */
.marquee { overflow: hidden; position: relative; padding: 6px 0; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; gap: 46px; width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item { display: inline-flex; align-items: center; gap: 10px; color: var(--gray-500); font-weight: 700; font-family: var(--font-display); font-size: 1.02rem; white-space: nowrap; }
.marquee-item .icon { color: var(--brand-600); }
.marquee-item small { font-weight: 600; color: var(--gray-400); }

/* ============ Смуга довіри ============ */
.trust-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.trust-item { display: flex; gap: 12px; align-items: flex-start; }
.trust-item .icon-badge { width: 40px; height: 40px; border-radius: 11px; }
.trust-item b { display: block; font-family: var(--font-display); font-size: .98rem; }
.trust-item span { font-size: .85rem; color: var(--gray-500); }

/* ============ Смуга заклику ============ */
.cta-band {
  background: linear-gradient(115deg, var(--navy-800), #16409b 55%, #2f6bff);
  color: #fff; border-radius: var(--radius-lg); padding: 38px 40px; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.cta-band::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.cta-band h2 { color: #fff; margin: 0 0 6px; }
.cta-band p { margin: 0; color: rgba(255, 255, 255, .78); }
.cta-band .row { position: relative; z-index: 2; margin-left: auto; }

/* ============ Лічильники ============ */
.hero-stats b { font-variant-numeric: tabular-nums; font-family: var(--font-display); }

/* ============ Нагору ============ */
.to-top {
  position: fixed; right: 22px; bottom: 92px; z-index: 55; width: 44px; height: 44px; border-radius: 50%;
  background: #fff; border: 1px solid var(--gray-200); color: var(--gray-700); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transform: translateY(10px); transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--brand-600); border-color: #c9d6ff; }

/* чат привертає увагу, коли є непрочитані */
.chat-fab.has-unread { animation: pulseRing 2.4s var(--ease) infinite; }

@media (max-width: 980px) {
  /* Три елементи смуги вміщаються в три колонки і на планшеті; нижче 720px
     вона перебудовується в один стовпець. */
  .hero-route { display: none; }
}
@media (max-width: 720px) {
  .trust-strip { grid-template-columns: 1fr; }
  .cta-band { padding: 26px 22px; }
  .cta-band .row { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal, .reveal-stagger > * { opacity: 1 !important; transform: none !important; }
}


/* ============ Футер ============ */
.footer-grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr 1.3fr; gap: 26px; }
.pay-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pay-row span {
  font-size: .74rem; font-weight: 700; letter-spacing: .02em; color: rgba(255, 255, 255, .72);
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 6px; padding: 5px 9px;
}
.site-footer a { transition: color .2s var(--ease), transform .2s var(--ease); }
.site-footer a:hover { transform: translateX(2px); }
@media (max-width: 980px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* сторінка проявляється під час завантаження */
body { animation: fadeIn .35s var(--ease-out) both; }
.page-head h1 { animation: fadeUp .55s var(--ease-out) both; }
.page-head .sub { animation: fadeUp .55s var(--ease-out) .08s both; }
.auth-card { animation: fadeUp .5s var(--ease-out) both; }
table.data tbody tr { transition: background .18s var(--ease); }
.accordion { transition: box-shadow .25s var(--ease), border-color .25s var(--ease); }
.accordion[open] { box-shadow: var(--shadow-sm); border-color: #c9d6ff; }
.badge { transition: transform .2s var(--ease); }
.thread-item { transition: background .18s var(--ease); }

/* ---------- Точки посадки та висадки ---------- */
.trip-boarding {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 14px; padding: 10px 12px; background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
}
.boarding-info { display: flex; gap: 9px; align-items: flex-start; min-width: 0; }
.boarding-ico {
  display: grid; place-items: center; width: 26px; height: 26px; min-width: 26px; border-radius: 8px;
  background: var(--brand-100); color: var(--brand-600);
}
.boarding-text { min-width: 0; }
.boarding-name { font-size: .88rem; line-height: 1.35; }
.boarding-name .muted { font-weight: 500; }
.boarding-sub { font-size: .8rem; color: var(--gray-500); }
.platform-badge {
  display: inline-block; margin-left: 7px; padding: 1px 8px; border-radius: 999px;
  background: var(--amber-100); color: #7a5200; font-size: .74rem; font-weight: 700;
  text-transform: lowercase; vertical-align: 1px;
}
.link-btn {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0;
  color: var(--brand-600); font-family: var(--font); font-size: .85rem; font-weight: 650; cursor: pointer;
  white-space: nowrap;
}
.link-btn:hover { text-decoration: underline; }

.stop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.stop-block { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px; background: #fff; }
.stop-head { display: flex; gap: 10px; align-items: flex-start; }
.stop-dot {
  width: 30px; height: 30px; min-width: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-100); color: var(--brand-600);
}
.stop-dot.dropoff { background: var(--green-100); color: var(--green-600); }
.stop-role { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); font-weight: 700; }
.stop-name { font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1.25; }
.stop-meta { font-size: .82rem; color: var(--gray-500); margin-top: 2px; }
.stop-landmark {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 9px 11px;
  background: var(--gray-50); border-radius: var(--radius-sm); font-size: .84rem; color: var(--gray-700);
}
.stop-landmark .icon { color: var(--brand-600); min-width: 14px; margin-top: 2px; }
.stop-links { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.stop-osm { font-size: .82rem; color: var(--gray-500); }

.boarding-notes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 7px; }
.boarding-notes li { display: flex; gap: 9px; align-items: flex-start; font-size: .86rem; color: var(--gray-700); }
.boarding-notes .icon { color: var(--brand-600); min-width: 14px; margin-top: 3px; }
.summary-stop { text-align: right; max-width: 190px; font-size: .86rem; }

/* ---------- Карта ---------- */
.trip-map { margin-top: 14px; }
.trip-map.hidden { display: none !important; }
.map-tabs { display: flex; gap: 6px; margin-bottom: 9px; flex-wrap: wrap; }
.map-tabs button {
  background: var(--gray-100); border: 1px solid transparent; border-radius: 999px; cursor: pointer;
  font-family: var(--font); font-size: .8rem; font-weight: 650; color: var(--gray-700); padding: 5px 13px;
}
.map-tabs button:hover { background: var(--gray-200); }
.map-tabs button.active { background: var(--brand-100); border-color: #bfd0ff; color: var(--brand-600); }
.map-canvas {
  height: 300px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--gray-200); background: var(--gray-100);
}
.map-box { z-index: 0; }               /* щоб плитки не перекривали чат і шапку */
.map-loading {
  height: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  color: var(--gray-500); font-size: .88rem;
}
.map-offline { height: auto; background: #fff; border-style: dashed; }
.map-fallback { padding: 14px; }
.map-fallback-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap;
}
.map-fallback-row + .map-fallback-row { border-top: 1px solid var(--gray-200); }
.map-fallback-row > div { flex: 1; min-width: 160px; }
.map-pin-dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: var(--brand-600); border: 2.5px solid #fff; box-shadow: 0 4px 10px rgba(8, 24, 46, .35);
  position: relative;
}
.map-pin-dot.dropoff { background: var(--green-600); }
.map-pin-dot::after {
  content: ''; position: absolute; bottom: -5px; left: 50%; width: 10px; height: 10px;
  transform: translateX(-50%) rotate(45deg); background: inherit;
  border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff; border-radius: 0 0 3px 0;
}
.map-popup { font-family: var(--font); min-width: 170px; }
.map-popup-role { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); font-weight: 700; }
.map-popup-sub { color: var(--gray-500); font-size: .82rem; margin: 2px 0 6px; }
.leaflet-container { font-family: var(--font); }

@media (max-width: 760px) {
  .stop-grid { grid-template-columns: 1fr; }
  .map-canvas { height: 240px; }
  .trip-boarding { align-items: flex-start; }
  .summary-stop { max-width: 60%; }
}
.cell-stops { font-size: .8rem; line-height: 1.5; max-width: 230px; }
.cell-stops .icon { color: var(--gray-400); vertical-align: -2px; }

/* ============================================================
   Мобільні пристрої
   Правила зібрані в одному місці й свідомо йдуть останніми, щоб
   перекривати компонентні стилі вище без боротьби зі специфічністю.
   ============================================================ */

/* Шрифт менше 16px у полі змушує Safari зумити сторінку при фокусі,
   і користувач лишається на «збільшеній» верстці. */
@media (max-width: 860px) {
  input, select, textarea { font-size: 16px; }
  .chat-form textarea { font-size: 16px; }
}

/* Пальцю потрібно ≈44px (Apple HIG). Тут вирівнюємо все, що клікається. */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 8px 14px; }
  .tabs button, .sub-tabs button, .map-tabs button { min-height: 44px; }
  .lang-menu button { min-height: 44px; }
  .accordion summary { padding: 15px 18px; min-height: 48px; }
  .site-footer a { padding: 9px 0; }
  .seat { width: 44px; height: 44px; }
  .bus-body { grid-template-columns: repeat(5, 44px); gap: 9px; }
  .swap-btn { width: 40px; height: 40px; }
  .modal-close { width: 44px; height: 44px; }
  /* Сам квадратик маленький, але клікається весь рядок: .checkbox — це label. */
  .checkbox input[type='checkbox'] { width: 20px; height: 20px; }
  .maintenance-bar button { min-height: 42px; }
  .logo { min-height: 44px; }
  /* «Показати на карті» — справжня дія в картці рейсу, а не виноска. */
  .link-btn { min-height: 40px; padding: 8px 0; }
  .filters-toggle { min-height: 48px; }
  /* Посилання на карти в картці посадки та власні кнопки Leaflet (за
     замовчуванням 30px) — теж цілі для пальця. */
  .stop-links a { min-height: 40px; display: inline-flex; align-items: center; }
  /* Стилі Leaflet підключаються з CDN у рантаймі, тобто після цього файлу:
     при рівній специфічності перемагають вони, тож беремо на клас більше. */
  .leaflet-touch .leaflet-bar a.leaflet-control-zoom-in,
  .leaflet-touch .leaflet-bar a.leaflet-control-zoom-out,
  .leaflet-bar a.leaflet-control-zoom-in,
  .leaflet-bar a.leaflet-control-zoom-out {
    width: 40px; height: 40px; line-height: 38px; font-size: 1.35rem;
  }
}

@media (max-width: 720px) {
  :root { --header-h: 60px; }

  /* ---- Шапка ---- */
  .site-header .container { gap: 10px; }
  .burger { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -6px; }
  .logo { font-size: 1.1rem; }
  .logo svg { width: 30px; height: 30px; }
  .header-actions { gap: 6px; }
  /* Кнопки входу/реєстрації переїхали в меню — у рядку вони не вміщалися. */
  .header-actions .btn { display: none; }
  .user-chip { padding: 4px; gap: 0; }
  .user-chip .chip-name { display: none; }
  .lang-current { min-height: 40px; padding: 8px 10px; }
  .lang-current span:not(.caret) { font-size: .8rem; }
  .main-nav.open {
    /* .main-nav має margin-left: 10px для десктопного рядка — у розкритій
       панелі він зсував її на 10px і обрізав по правому краю. */
    margin-left: 0;
    padding: 10px max(16px, var(--safe-l)) 16px max(16px, var(--safe-r));
    box-shadow: 0 18px 30px -18px rgba(8, 24, 46, .8);
  }
  /* .main-nav a (0,1,1) перебиває колір варіантів кнопок (0,1,0), тож текст
     ставав білим і на світлих кнопках зникав. */
  .main-nav .nav-auth .btn-ghost { color: #fff; }
  .main-nav .nav-auth .btn-accent { color: #3a2800; }
  .main-nav .nav-auth .btn-outline { color: var(--gray-700); }
  /* Тільки пункти навігації — прямі діти меню. Кнопки входу лежать у
     .nav-auth і мають лишити власні відступи, інакше стають 27px замість 44. */
  .main-nav.open > a { padding: 12px 4px 12px 12px; font-size: 1rem; border-radius: 6px; }
  /* Підкреслення активного пункту в рядку розтягується на всю ширину панелі
     й читається як розділювач — у стовпчику мітка йде збоку. */
  .main-nav.open > a::after { display: none; }
  .main-nav.open > a.active { box-shadow: inset 3px 0 0 var(--amber-500); }
  .main-nav.open .nav-auth {
    display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .14);
  }

  /* ---- Банер техробіт ---- */
  .maintenance-bar { font-size: .84rem; }
  .maintenance-bar { font-size: .82rem; }
  .maintenance-bar .container { gap: 8px; padding-top: 9px; padding-bottom: 9px; align-items: flex-start; }
  .maintenance-bar .icon { margin-top: 1px; }
  /* flex-basis: 0, а не auto: з auto довгий текст не вміщався в рядок з
     іконкою і переносився цілком, лишаючи іконку на окремому рядку. */
  .maintenance-bar .mt-text { min-width: 0; flex: 1 1 0; }
  .maintenance-bar button { width: auto; padding: 8px 14px; font-size: .8rem; }

  /* ---- Hero ---- */
  .hero { padding: 34px 0 76px; }
  .hero p.lead { font-size: 1rem; }
  .hero-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 10px; margin-top: 20px; }
  .hero-stats b { font-size: 1.3rem; }
  .hero-stats span { font-size: .82rem; }
  .hero-badges { gap: 8px; margin-top: 18px; }
  .hero-badge { font-size: .76rem; padding: 6px 11px; }
  .hero-aurora span { filter: blur(50px); }

  /* ---- Форма пошуку ---- */
  .search-card { padding: 16px; border-radius: var(--radius); }
  .search-card.floating { margin-top: -52px; }
  .search-card .btn { width: 100%; }
  /* У стовпчик кнопка обміну міст стає суфіксом поля «Звідки». */
  .swap-btn { right: 7px; top: 31px; transform: rotate(90deg); background: var(--gray-50); }
  .swap-btn.spin { transform: rotate(270deg); }
  .search-card .field.autocomplete:first-of-type input { padding-right: 52px; }

  /* ---- Загальні відступи ---- */
  .section { padding: 34px 0; }
  .card-pad { padding: 16px; }
  .page-head { padding: 18px 0; }
  .page-head h1 { font-size: 1.35rem; }
  .page-head .sub { font-size: .88rem; }
  .auth-page { padding: 24px 16px; }
  .auth-card { padding: 22px; }
  .marquee-track { gap: 28px; }
  .cta-band { padding: 22px 18px; }
  .cta-band .btn { width: 100%; }

  /* ---- Результати пошуку ---- */
  .filters-toggle { display: flex; }
  .filters { display: none; }
  .filters.open { display: block; }
  .trip-card { padding: 16px; }
  .timeline .time { font-size: 1.25rem; }
  .timeline .station { max-width: none; }
  /* Ціна і кнопка в один рядок — інакше картка рейсу задирається вгору. */
  .trip-side {
    flex-direction: row; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; row-gap: 12px;
  }
  .trip-side .btn { flex: 1 1 150px; }
  .trip-price { font-size: 1.5rem; }

  /* ---- Таблиці ---- */
  table.data { font-size: .85rem; }
  table.data th { padding: 9px 11px; }
  table.data td { padding: 11px 11px; }
  .cell-stops { max-width: 180px; }

  /* ---- Вкладки, які не влазять у рядок ---- */
  .tabs, .sub-tabs, .map-tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    /* Щоб перший і останній таб не липли до краю екрана під час скролу. */
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar, .sub-tabs::-webkit-scrollbar, .map-tabs::-webkit-scrollbar { display: none; }
  .tabs button, .sub-tabs button, .map-tabs button { flex: 0 0 auto; }

  /* ---- Адмінка ---- */
  .admin-main { padding: 18px 14px; }
  .admin-side { gap: 6px; }
  .admin-side a { flex: 0 0 auto; white-space: nowrap; }
  /* Показники короткі — тримаємо їх по два в рядок, інакше дашборд
     перетворюється на п'ять екранів прокрутки. */
  .admin-main .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 14px 16px; }
  .stat-card .value { font-size: 1.4rem; }
  .stat-card .label { font-size: .78rem; }
  .stat-card .hint { font-size: .74rem; }
  .bar-chart { height: 120px; }
  .admin-chat { height: auto; }
  /* 14 підписів осі по «05.09» не вміщаються у 360px і розтягували всю
     сторінку (grid-елемент не стискається нижче min-content вмісту).
     font-size: 0 у кожного другого прибирає його з min-content, лишаючи
     позицію в сітці — вісь читається кожним другим днем. */
  .chart-x span { min-width: 0; overflow: hidden; }
  .chart-x span:nth-child(even) { font-size: 0; }

  /* ---- Чат: на телефоні це нижній шит на весь екран ---- */
  .chat-fab {
    right: max(16px, var(--safe-r)); bottom: calc(16px + var(--safe-b));
    width: 54px; height: 54px;
  }
  .chat-panel {
    left: 0; right: 0; bottom: 0; width: auto; max-width: none;
    height: 88vh; max-height: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: var(--safe-b);
  }
  .chat-body { padding: 14px; }
  .msg { max-width: 88%; }
  /* На iPhone нагору повертає тап по статус-бару, тож окрема кнопка тут
     лише перекриває контент поруч із кнопкою чату. */
  .to-top { display: none; }

  /* ---- Плашка cookie ---- */
  .cookie-bar {
    left: max(10px, var(--safe-l)); right: max(10px, var(--safe-r));
    bottom: calc(80px + var(--safe-b)); padding: 16px;
  }
  .cookie-bar p { font-size: .84rem; }
  .cookie-bar .row { flex-direction: row; align-items: stretch; gap: 8px; }
  .cookie-bar .btn { flex: 1 1 0; min-width: 0; padding: 12px 10px; }

  /* ---- Повідомлення й модальні вікна ---- */
  .toast-wrap { left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); }
  .toast { font-size: .88rem; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh; overflow-y: auto; padding-bottom: var(--safe-b);
  }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }

  /* ---- Юридичні документи ---- */
  .legal-doc h2 { font-size: 1.12rem; margin-top: 26px; }
  .legal-doc p, .legal-doc li { font-size: .92rem; }
  .legal-doc ul { padding-left: 18px; }

  /* ---- Футер ---- */
  .site-footer { padding: 34px 0 calc(20px + var(--safe-b)); margin-top: 40px; }
  .footer-bottom { flex-direction: column; gap: 6px; }
}

/* dvh точніший за vh на iOS: 100vh там включає панелі браузера, і низ
   шита виявляється під ними. */
@supports (height: 100dvh) {
  @media (max-width: 720px) {
    .chat-panel { height: 88dvh; }
    .modal { max-height: 92dvh; }
  }
}

/* Кнопка «Фільтри» існує лише на вузьких екранах. */
.filters-toggle {
  display: none; width: 100%; align-items: center; justify-content: space-between;
  margin-bottom: 14px; font-weight: 650;
}
.filters-toggle .filters-caret { transition: transform .2s var(--ease); }
.filters-toggle.open .filters-caret { transform: rotate(180deg); }

/* Дуже вузькі екрани (iPhone SE, 375px і менше). */
@media (max-width: 380px) {
  body { font-size: 14.5px; }
  .hero-stats { gap: 12px 8px; }
  .hero-stats b { font-size: 1.2rem; }
  .logo-text { font-size: 1rem; }
  .bus-body { grid-template-columns: repeat(5, 40px); gap: 7px; }
  .seat { width: 40px; height: 40px; }
  .trip-price { font-size: 1.35rem; }
  .card-pad { padding: 14px; }
}

/* Телефон у ландшафті: шит на 88vh перетворюється на щілину, тож чат
   розкриваємо на всю висоту, а декоративну висоту hero прибираємо. */
@media (max-height: 480px) and (orientation: landscape) {
  .hero { padding: 24px 0 60px; }
  .chat-panel { height: 100vh; border-radius: 0; }
  .to-top { display: none; }
}
