/* ============================================================
   RZD Tracker — современный дизайн
   ============================================================ */

/* ------- Дизайн-токены ------- */
:root {
  /* Telegram theme params (заполняются JS) */
  --tg-bg: #f7f8fb;
  --tg-text: #14171a;
  --tg-hint: #8a94a6;
  --tg-link: #2f7cf6;
  --tg-button: #2f7cf6;
  --tg-button-text: #ffffff;
  --tg-section: #ffffff;
  --tg-section-text: #14171a;
  --tg-secondary-bg: #eef0f5;

  /* Производные токены */
  --surface: var(--tg-section);
  --surface-2: color-mix(in srgb, var(--tg-bg) 60%, var(--tg-section) 40%);
  --border: color-mix(in srgb, var(--tg-text) 8%, transparent);
  --border-strong: color-mix(in srgb, var(--tg-text) 14%, transparent);
  --accent: var(--tg-button);
  --accent-soft: color-mix(in srgb, var(--tg-button) 12%, transparent);
  --accent-glow: color-mix(in srgb, var(--tg-button) 28%, transparent);
  --success: #16a34a;
  --success-soft: color-mix(in srgb, #16a34a 14%, transparent);
  --danger: #ef4444;
  --danger-soft: color-mix(in srgb, #ef4444 14%, transparent);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-accent: 0 8px 24px var(--accent-glow);

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

/* Тёмная тема — две дороги:
   1) :root[data-theme="dark"] — выставляется из JS по tg.colorScheme (приоритет).
   2) @media (prefers-color-scheme: dark) — OS-fallback вне Telegram.
   Светлая тема также явная через [data-theme="light"], чтобы перекрыть OS-dark
   когда Telegram говорит light. */
:root[data-theme="dark"],
:root:not([data-theme]) {
  /* :not([data-theme]) — на случай если JS не успел выставить атрибут;
     внутри @media получит dark, иначе уйдёт в светлую (см. ниже). */
}
:root[data-theme="dark"] {
  --tg-bg: #0f1115;
  --tg-text: #f5f7fa;
  --tg-hint: #8a94a6;
  --tg-section: #181b22;
  --tg-secondary-bg: #232733;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --tg-bg: #0f1115;
    --tg-text: #f5f7fa;
    --tg-hint: #8a94a6;
    --tg-section: #181b22;
    --tg-secondary-bg: #232733;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

/* ------- Reset + типографика ------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Кнопка «← Назад» внутри вкладок (например, «Мои подписки»). Дублирует
   нативную BackButton Telegram в шапке — на случай, если у пользователя
   старая версия клиента, где её нет. */
.back-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tg-text);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
  white-space: nowrap;
}
.back-btn:hover { background: var(--surface); }
.back-btn:active { transform: scale(0.96); }

/* История цены (sparkline) в детальной карточке поезда */
.price-history {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.ph-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.ph-title { font-weight: 600; font-size: 13px; }
.ph-period { font-size: 11px; opacity: 0.6; }
.ph-svg {
  display: block;
  width: 100%;
  height: 60px;
  margin-bottom: 8px;
}
.ph-line { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.ph-area { fill: var(--accent); opacity: 0.12; }
.ph-dot { fill: var(--accent); opacity: 0.6; }
.ph-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.ph-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  padding: 4px 0;
}
.ph-stat span { opacity: 0.55; margin-bottom: 1px; }
.ph-stat b { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.ph-trend {
  font-size: 12px;
  text-align: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.ph-trend-up   { background: rgba(239,68,68,0.10); color: #ef4444; }
.ph-trend-down { background: rgba(34,197,94,0.12); color: #16a34a; }
.ph-trend-flat { background: var(--surface); opacity: 0.7; }

/* Схема плац-вагона: 9 купе × 4 + 9 секций × 2 = 54 места */
.plac-schema-wrap {
  flex-basis: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.plac-schema-title {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.7;
  margin-bottom: 6px;
}
.plac-schema-svg {
  width: 100%;
  max-height: 180px;
  display: block;
}
.seat { fill: var(--surface); stroke: var(--border); stroke-width: 0.6; transition: filter 0.12s ease; }
.seat-occupied { fill: rgba(255,255,255,0.04); }
.seat-free    { fill: #22c55e; opacity: 0.85; }
.seat-free-zh { fill: #ec4899; opacity: 0.85; }    /* розовый — женское */
.seat-free-m  { fill: #3b82f6; opacity: 0.85; }    /* синий — мужское */
.seat-free-c  { fill: #f59e0b; opacity: 0.85; }    /* янтарный — целое */
.seat-free-s  { fill: #06b6d4; opacity: 0.85; }    /* бирюзовый — смешанное */
.seat-num     { font-size: 8px; fill: rgba(0,0,0,0.7); pointer-events: none; }
.seat-lat     { stroke-dasharray: 1.5 1.5; }       /* боковые места — пунктир */
.plac-schema-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 10px;
  opacity: 0.85;
}
.plac-schema-legend .leg {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 3px;
  vertical-align: middle;
}
.leg-free { background: #22c55e; }
.leg-zh   { background: #ec4899; }
.leg-m    { background: #3b82f6; }
.leg-c    { background: #f59e0b; }
.leg-occ  { background: var(--surface); border: 1px solid var(--border); }

/* Шорткаты дат под календарём — сегодня/завтра/+неделя/+месяц */
.date-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.date-shortcut {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tg-text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.date-shortcut:hover { background: var(--surface); }
.date-shortcut:active { transform: scale(0.96); }
.date-shortcut.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--tg-bg);
  color: var(--tg-text);
  letter-spacing: -0.005em;
}
button { font: inherit; border: none; cursor: pointer; background: none; color: inherit; }
input { font: inherit; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }

/* Скроллбары — тонкие */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--tg-text) 18%, transparent);
  border-radius: 8px;
}
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Утилитарные классы
   ============================================================ */
.hidden { display: none !important; }

/* Layout */
.flex { display: flex; }
.grid { display: grid; }
.block { display: block; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Gap & spacing */
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-8 { gap: 32px; }
.space-y-1 > * + * { margin-top: 4px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }

.p-2 { padding: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.pt-4 { padding-top: 16px; }
.pb-3 { padding-bottom: 12px; }
.pb-32 { padding-bottom: 128px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }

/* Sizing */
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }

/* Typography */
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.text-center { text-align: center; }
.opacity-60 { opacity: 0.6; }
.opacity-70 { opacity: 0.7; }
.opacity-80 { opacity: 0.8; }
.opacity-0 { opacity: 0; }

/* Borders & radius */
.rounded-xl { border-radius: var(--radius-md); }
.rounded-2xl { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Цветовые алиасы */
.bg-tg-bg { background: var(--tg-bg); }
.bg-tg-section { background: var(--surface); }
.bg-tg-button { background: var(--accent); color: var(--tg-button-text); }
.text-tg-text { color: var(--tg-text); }
.text-tg-button-text { color: var(--tg-button-text); }
.text-red-500 { color: var(--danger); }

.bg-black\/40 { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.bg-black\/80 { background: rgba(20, 23, 26, 0.92); color: white; }
.text-white { color: white; }

.bottom-4 { bottom: 16px; }
.left-1\/2 { left: 50%; }
.-translate-x-1\/2 { transform: translateX(-50%); }
.z-50 { z-index: 50; }
.pointer-events-none { pointer-events: none; }
.transition { transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1); }
.transition-opacity { transition: opacity 0.22s ease; }

/* ============================================================
   Header
   ============================================================ */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 16px 12px !important;
  background: color-mix(in srgb, var(--tg-bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
header h1 > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #9c5cf6));
  color: white;
  font-size: 18px;
  margin-right: 4px;
  box-shadow: var(--shadow-accent);
}
header p { font-size: 13px; opacity: 0.6; margin-top: 2px; }

#tab-list-btn, #tab-search-btn {
  padding: 9px 14px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--tg-button-text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.18s ease;
}
#tab-list-btn:hover, #tab-search-btn:hover { box-shadow: var(--shadow-md); }
#tab-list-btn:active, #tab-search-btn:active { transform: scale(0.96); }

main { padding-top: 8px !important; }

/* ============================================================
   Cards (поля ввода Откуда/Куда/Дата)
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}
.card-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tg-hint);
  margin-bottom: 4px;
  font-weight: 600;
}
.card-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 17px;
  font-weight: 500;
  color: var(--tg-text);
  padding: 2px 0;
}
.card-input::placeholder { color: color-mix(in srgb, var(--tg-text) 35%, transparent); font-weight: 400; }

/* Swap button */
#swap-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--tg-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s;
}
#swap-btn:hover { box-shadow: var(--shadow-md); }
#swap-btn:active { transform: scale(0.92) rotate(180deg); }

/* ============================================================
   Primary button
   ============================================================ */
.primary-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 88%, black));
  color: var(--tg-button-text);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.1s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.primary-btn:hover { box-shadow: 0 12px 28px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* ============================================================
   Suggest dropdown
   ============================================================ */
.suggest {
  position: absolute;
  top: 100%;
  left: -18px;
  right: -18px;
  z-index: 30;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-top: 8px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: slideIn 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}
.suggest li {
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.suggest li:hover, .suggest li.active { background: var(--surface-2); }
.suggest li:last-child { border-bottom: none; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Train card
   ============================================================ */
.train-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.1s;
  position: relative;
  overflow: hidden;
}
.train-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.train-card:hover { box-shadow: var(--shadow-md); }
.train-card:active { transform: scale(0.99); }
.train-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
}
.train-card.selected::before { opacity: 1; }
.train-card .num {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.train-card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.train-card .seats {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.train-card.has-seats .seats {
  color: var(--success);
  background: var(--success-soft);
}
.train-card.no-seats .seats {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ============================================================
   Чипы — типы вагонов / тип места
   ============================================================ */
.car-chip {
  padding: 9px 14px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.car-chip:hover { background: var(--surface); border-color: var(--border-strong); }
.car-chip:active { transform: scale(0.97); }
.car-chip.selected {
  background: var(--accent);
  color: var(--tg-button-text);
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}

.berth-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.berth-chip:hover { border-color: var(--border-strong); }
.berth-chip input { accent-color: var(--accent); width: 18px; height: 18px; }
.berth-chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

/* ============================================================
   Подписки
   ============================================================ */
.sub-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease;
}
.sub-card:hover { box-shadow: var(--shadow-md); }

/* Swipe-to-delete: обёртка прячет фон под карточкой */
.sub-swipe {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  touch-action: pan-y;
}
.sub-swipe .sub-card {
  position: relative;
  z-index: 2;
  will-change: transform;
}
.sub-swipe-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 22px;
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sub-swipe.is-swiping .sub-swipe-bg { opacity: 1; }
.sub-swipe-bg-text {
  transform: scale(0.9);
  transition: transform 0.18s cubic-bezier(0.4,0,0.2,1);
}
.sub-swipe.is-armed .sub-swipe-bg-text { transform: scale(1.08); }

/* ============================================================
   Аналитика
   ============================================================ */
#detail-analytics {
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
#detail-analytics:empty { display: none; }
.berth-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  margin: 2px 4px 2px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
}

/* ============================================================
   Toast / loading
   ============================================================ */
#toast {
  padding: 11px 18px !important;
  border-radius: var(--radius-full) !important;
  background: rgba(20, 23, 26, 0.94) !important;
  color: white !important;
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  letter-spacing: -0.005em;
}

#loading > div {
  background: var(--surface);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  border: 1px solid var(--border);
}

/* ============================================================
   Date input — выровнять с остальными полями
   ============================================================ */
input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.5;
  filter: invert(0);
}
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"])
    input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
}

/* Flatpickr — мягко подкрашиваем под нашу палитру */
.flatpickr-calendar {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--border) !important;
}

/* ============================================================
   Разбивка по вагонам
   ============================================================ */
.cars-breakdown {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 13px;
}
.cars-breakdown-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tg-hint);
  font-weight: 600;
  margin-bottom: 6px;
}
.car-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.car-row:last-child { border-bottom: none; }
.car-row .car-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}
.car-row .car-type {
  font-weight: 500;
  color: var(--tg-text);
  opacity: 0.8;
}
.car-row .comp-line {
  flex-basis: 100%;
  font-size: 12px;
  padding: 4px 10px;
  margin-top: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tg-text);
  opacity: 0.88;
  line-height: 1.55;
}
.car-row .comp-line i { font-style: normal; font-weight: 500; }

.car-row .car-body {
  flex-basis: 100%;
  font-size: 13px;
  opacity: 0.9;
}

/* Ссылка покупки */
.buy-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--success) 92%, white),
    color-mix(in srgb, var(--success) 88%, black));
  color: white;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--success) 28%, transparent),
              inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 0.1s ease, box-shadow 0.18s;
}
.buy-link:hover {
  box-shadow: 0 10px 22px color-mix(in srgb, var(--success) 32%, transparent),
              inset 0 1px 0 rgba(255,255,255,0.22);
}
.buy-link:active { transform: scale(0.98); }
.buy-link svg { flex-shrink: 0; }

/* Сетка чипов берт — flex-wrap, чтобы 5+ чипов располагались без поломки */
.berth-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.berth-chips .berth-chip { width: 100%; }
.berth-chip.is-hidden { display: none !important; }

/* ============================================================
   Беджи поезда (фирменный/скорый/Сапсан и т.п.)
   ============================================================ */
.train-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}
.train-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.train-brand {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 2px;
  letter-spacing: -0.005em;
}
.train-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.4;
  border: 1px solid transparent;
}
.badge-firm {
  background: linear-gradient(135deg, #ffd54f, #ffb300);
  color: #5a3d00;
  box-shadow: 0 2px 6px rgba(255, 179, 0, 0.32);
}
.badge-speed {
  background: color-mix(in srgb, #ec4899 14%, transparent);
  color: #ec4899;
  border-color: color-mix(in srgb, #ec4899 24%, transparent);
}
.badge-fast {
  background: color-mix(in srgb, #2f7cf6 14%, transparent);
  color: #2f7cf6;
  border-color: color-mix(in srgb, #2f7cf6 24%, transparent);
}
.badge-pass {
  background: color-mix(in srgb, var(--tg-text) 8%, transparent);
  color: var(--tg-text);
  border-color: var(--border);
  opacity: 0.85;
}
.badge-default {
  background: var(--surface-2);
  color: var(--tg-text);
  border-color: var(--border);
}
.badge-name {
  background: color-mix(in srgb, #16a34a 14%, transparent);
  color: #16a34a;
  border-color: color-mix(in srgb, #16a34a 24%, transparent);
}

/* Подсветка карточки, когда ввод отклонён (нет подходящего города) */
.card:has(.card-input.input-rejected) {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 4px var(--danger-soft), var(--shadow-md);
  animation: shake 0.32s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  0%, 100%   { transform: translateX(0); }
  15%        { transform: translateX(-6px); }
  30%        { transform: translateX(6px); }
  45%        { transform: translateX(-4px); }
  60%        { transform: translateX(4px); }
  75%        { transform: translateX(-2px); }
  90%        { transform: translateX(2px); }
}

/* ============================================================
   Опции покупки билета (РЖД / Туту / Я.Путешествия)
   ============================================================ */
.buy-options {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px 14px;
}
.buy-options-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tg-hint);
  font-weight: 600;
  margin-bottom: 10px;
}
.buy-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* Каждая ссылка */
.buy-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--tg-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: transform 0.1s ease, box-shadow 0.18s ease, border-color 0.18s;
}
.buy-link:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.buy-link:active { transform: scale(0.98); }
.buy-link .buy-icon {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 18px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.buy-link .buy-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  line-height: 1.25;
}
.buy-link .buy-text b { font-size: 14px; font-weight: 600; }
.buy-link .buy-sub {
  font-size: 11px;
  color: var(--tg-hint);
  font-weight: 400;
}
.buy-link .buy-arrow {
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.18s, transform 0.18s;
}
.buy-link:hover .buy-arrow { opacity: 0.8; transform: translate(2px, -2px); }

/* Акценты для каждого партнёра */
.buy-link-primary {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 8%, var(--surface)),
    var(--surface));
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
}
.buy-link-primary .buy-icon {
  background: var(--accent-soft);
  color: var(--accent);
}
.buy-link-yandex .buy-icon {
  background: color-mix(in srgb, #fc3f1d 14%, transparent);
}

/* Информационный баннер */
.info-banner {
  padding: 10px 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  color: var(--tg-text);
  opacity: 0.9;
}

/* Карточка подписки (улучшенная) */
.sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.sub-num {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
/* Когда .sub-num — кнопка копирования. Сбрасываем стандартные button-стили. */
button.sub-num-copy {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.12s ease;
}
button.sub-num-copy::after {
  content: "📋";
  font-size: 12px;
  opacity: 0.45;
  transition: opacity 0.12s ease;
}
button.sub-num-copy:hover::after { opacity: 0.85; }
button.sub-num-copy:active { transform: scale(0.97); }
.sub-seats {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.seats-positive {
  background: var(--success-soft);
  color: var(--success);
}
.seats-zero {
  background: var(--surface-2);
  color: var(--tg-hint);
  border: 1px solid var(--border);
}
.sub-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sub-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.sub-chip-btn {
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.12s ease, transform 0.08s ease;
}
.sub-chip-btn:hover { background: var(--surface); }
.sub-chip-btn:active { transform: scale(0.96); }
.sub-actions {
  display: flex;
  gap: 8px;
}
.sub-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tg-text);
  transition: transform 0.1s ease, box-shadow 0.18s, border-color 0.18s;
}
.sub-btn:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.sub-btn:active { transform: scale(0.97); }
.sub-btn:disabled { opacity: 0.5; cursor: wait; }
.sub-btn-check {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}
.sub-btn-del {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--border));
}

/* ============================================================
   Аналитика: сводка + гистограмма
   ============================================================ */
.analytics-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 8%, var(--surface-2)),
    var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.analytics-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.analytics-text { flex: 1; min-width: 0; }
.analytics-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.analytics-sub {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 1px;
}
.analytics-stats {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.analytics-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  opacity: 0.7;
}
.analytics-stat b {
  font-size: 13px;
  margin-top: 1px;
  opacity: 1;
  color: var(--tg-text);
  font-weight: 700;
}

/* Гистограмма */
.hist-svg {
  width: 100%;
  height: 120px;
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.hist-bar {
  fill: color-mix(in srgb, var(--accent) 65%, transparent);
  transition: fill 0.18s;
}
.hist-bar:hover { fill: var(--accent); }
.hist-bar-median {
  fill: var(--accent);
}
.hist-axis {
  stroke: var(--border);
  stroke-width: 1;
}
.hist-label {
  font-size: 10px;
  fill: var(--tg-hint);
  font-family: inherit;
}

/* Чип таймзоны (например, "МСК+2") */
.tz-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--tg-hint);
  vertical-align: middle;
  margin: 0 2px;
  white-space: nowrap;
}

.train-times { flex: 1; }
.train-time-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
}
.train-time-arrow { opacity: 0.4; margin: 0 2px; }
.train-time { font-weight: 500; }

/* Прямая кнопка "Открыть на РЖД" для случаев без деталей */
.direct-rzd-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 8%, var(--surface)),
    var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin-top: 10px;
  transition: transform 0.1s, box-shadow 0.18s, border-color 0.18s;
}
.direct-rzd-btn:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.direct-rzd-btn:active { transform: scale(0.98); }

/* Чипы типов вагонов на карточке поезда (список) */
.cartype-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.cartype-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  white-space: nowrap;
  font-weight: 500;
}
.cartype-chip b { font-weight: 600; }
.cartype-chip .ct-price {
  opacity: 0.6;
  font-weight: 400;
  font-size: 11px;
}

/* Сводный блок «Свободно по полкам» в детальной карточке */
.berth-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 6px 0 4px;
}
.berth-summary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
}
.berth-summary-item b {
  font-weight: 700;
  color: var(--accent);
}
.berth-summary-item span {
  opacity: 0.7;
  font-size: 12px;
}

/* Баннер: «открыто вне Telegram» */
.no-tg-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #fef3c7, #fde68a);
  border-bottom: 1px solid #f59e0b;
  color: #78350f;
  font-size: 13px;
  line-height: 1.4;
}
.no-tg-icon { font-size: 20px; flex-shrink: 0; }
.no-tg-text { flex: 1; }
.no-tg-text a {
  color: #b45309;
  font-weight: 700;
  text-decoration: underline;
}

.no-tg-detail {
  font-family: -apple-system, "SF Mono", Menlo, monospace;
  font-size: 11px;
  opacity: 0.75;
  display: inline-block;
  margin: 2px 0 6px;
}
.no-tg-steps {
  margin: 6px 0 0 18px;
  padding: 0;
}
.no-tg-steps li { margin-bottom: 2px; }

/* Pro-модалка */
.pro-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}
.pro-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px 22px 18px;
  margin: 16px;
  max-width: 360px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: popIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pro-modal-icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 10px;
}
.pro-modal-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.pro-modal-text {
  font-size: 14px;
  line-height: 1.45;
  opacity: 0.85;
  margin-bottom: 18px;
}
.pro-modal-cta {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fbbf24, #d97706);
  color: #422006;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.32);
  margin-bottom: 8px;
  border: none;
  cursor: pointer;
}
.pro-modal-cta:active { transform: scale(0.98); }
.pro-modal-close {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--tg-hint);
  font-size: 13px;
  cursor: pointer;
}
.pro-modal-close:hover { color: var(--tg-text); }

/* Модалка выбора гендера купе (чекбоксы) */
.gender-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}
.gender-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 18px 14px;
  margin: 16px;
  max-width: 360px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.gender-modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.gender-modal-hint {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 14px;
  line-height: 1.4;
}
.gender-modal-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.gender-modal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.gender-modal-row:hover { background: var(--surface); }
.gender-modal-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.gender-modal-row:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.gender-modal-emoji { font-size: 18px; flex-shrink: 0; }
.gender-modal-label { font-size: 14px; }
.gender-modal-actions {
  display: flex;
  gap: 8px;
}
.gender-modal-clear, .gender-modal-save {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
}
.gender-modal-clear {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tg-text);
}
.gender-modal-save {
  background: var(--accent);
  color: #fff;
}
.gender-modal-clear:active, .gender-modal-save:active { transform: scale(0.97); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.92) translateY(8px); } to { opacity: 1; transform: scale(1); } }

/* Дружелюбная пустая выдача "будем отслеживать" */
.empty-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.45;
}
.empty-result-icon { font-size: 28px; flex-shrink: 0; }

/* Бейдж источника аналитики */
.analytics-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.analytics-badge-route {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.analytics-badge-any {
  background: color-mix(in srgb, #fbbf24 18%, transparent);
  color: #b45309;
}

/* Футер аналитики с тогглом */
.analytics-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.analytics-toggle {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.analytics-toggle:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
}
.analytics-toggle:active { transform: scale(0.97); }

/* Pause/Resume — состояние подписки */
.sub-card.sub-paused {
  opacity: 0.65;
  border-style: dashed;
  background: var(--surface-2);
}
.sub-paused .sub-num { text-decoration: line-through; }
.sub-paused .sub-filters { opacity: 0.6; }

.seats-paused {
  background: color-mix(in srgb, var(--tg-text) 8%, transparent);
  color: var(--tg-text);
  font-style: italic;
  opacity: 0.85;
}

.sub-btn-pause {
  background: color-mix(in srgb, #f59e0b 14%, transparent);
  color: #b45309;
  border-color: color-mix(in srgb, #f59e0b 28%, var(--border));
}
.sub-btn-resume {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
  flex: 1.5;
}

.sub-btn-del {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 9px 10px;
}

/* Альтернативные даты */
.alt-dates {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.alt-date-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--tg-text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.alt-date-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}
.alt-date-btn:active { transform: scale(0.99); }
.alt-date-btn b { color: var(--accent); }
.alt-date-when {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.alt-date-iso {
  font-size: 12px;
  opacity: 0.65;
}
.alt-date-count {
  font-size: 13px;
  white-space: nowrap;
}

/* Skeleton loaders */
.skeleton-block {
  padding: 8px 0;
}
.skel {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    color-mix(in srgb, var(--surface-2) 60%, var(--surface)) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
.skel-line { height: 14px; }
.skel.w-40 { width: 40%; }
.skel.w-50 { width: 50%; }
.skel.w-60 { width: 60%; }
.skel.w-70 { width: 70%; }
@keyframes skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Заголовок секции с refresh-кнопкой */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.refresh-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tg-text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1), background 0.18s;
}
.refresh-btn:hover { background: var(--surface); }
.refresh-btn:active { background: var(--accent-soft); }
.refresh-btn.is-spinning { animation: spin 0.7s linear; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Pull-to-refresh */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, -60px);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tg-text);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
}
.ptr-indicator.is-animating {
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.2s;
}
.ptr-indicator .ptr-icon {
  display: inline-block;
  transition: transform 0.15s ease-out;
}
.ptr-indicator.is-loading .ptr-icon {
  animation: spin 0.7s linear infinite;
}
