/* =========================================================
   Cash Control — Telegram Mini App
   UI 3.0: адаптивный, аккуратный визуальный слой.
   Бизнес-логика и DOM-структура, генерируемая app.js,
   не меняются — правятся только внешний вид и анимации.
   ========================================================= */

:root {
  /* Тема Telegram — всегда в приоритете, чтобы приложение
     совпадало с темой пользователя (светлая/тёмная/кастомная). */
  --bg: var(--tg-theme-bg-color, #f4f4f5);
  --surface: var(--tg-theme-secondary-bg-color, #ffffff);
  --surface-2: var(--tg-theme-section-bg-color, #f8f8f8);
  --text: var(--tg-theme-text-color, #171717);
  --muted: var(--tg-theme-hint-color, #777777);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);

  --danger: #d84b4b;
  --success: #2f8f5c;
  --warning: #c48316;
  --border: rgba(127,127,127,.18);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 22px;
  --shadow: 0 7px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 18px 44px rgba(0,0,0,.16);

  /* Фирменная палитра Cash Control (взята из логотипа сервиса).
     Используется только для декоративных акцентов (свечения,
     градиенты, бренд-марка) — кнопки и прочие интерактивные
     элементы по-прежнему используют цвет темы Telegram. */
  --brand-navy: #16283a;
  --brand-navy-2: #21384c;
  --brand-green: #2f6b4f;
  --brand-green-2: #3f8d67;
  --brand-gold: #cf9f4f;
  --brand-gold-2: #e6bf7a;
  --brand-cyan: #4fa3c4;

  --ui-glow-a: color-mix(in srgb, var(--brand-green) 15%, transparent);
  --ui-glow-b: color-mix(in srgb, var(--brand-gold) 12%, transparent);
  --ui-glow-c: color-mix(in srgb, var(--brand-cyan) 9%, transparent);
  --ui-ease: cubic-bezier(.22, 1, .36, 1);
  --button-hover-lift: -2px;
}

/* ---------- Базовый сброс и защита от горизонтального скролла ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  background: var(--bg);
  overflow-x: hidden;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

html, body { margin: 0; padding: 0; min-height: 100%; max-width: 100%; }

body {
  position: relative;
  overflow-x: hidden;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
  background:
    radial-gradient(circle at 8% 8%, var(--ui-glow-a), transparent 32%),
    radial-gradient(circle at 92% 14%, var(--ui-glow-b), transparent 30%),
    radial-gradient(circle at 50% 98%, var(--ui-glow-c), transparent 32%),
    var(--bg);
  background-attachment: scroll;
}

/* Фоновая глубина теперь рисуется статическими radial-gradient на body.
   Убраны постоянно анимируемые fixed+blur слои: это заметно снижает GPU-нагрузку
   в Telegram WebView / iOS Safari без потери основного визуального эффекта. */
body::before, body::after { display: none; }

button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
p { margin: 0 0 8px; }

::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }

/* Аккуратные фокус-кольца для клавиатурной навигации, не мешают тапам */
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.camera-input {
  position: fixed !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* =========================================================
   Загрузочный экран (splash) — показывается мгновенно, пока
   грузится Telegram WebApp SDK и идёт авторизация. Полностью
   независим от #app и скрывается через window.__hideBootSplash().
   ========================================================= */
.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--brand-green) 40%, transparent), transparent 55%),
    radial-gradient(circle at 88% 88%, color-mix(in srgb, var(--brand-gold) 28%, transparent), transparent 52%),
    linear-gradient(160deg, var(--brand-navy) 0%, var(--brand-navy-2) 55%, #0d1a24 100%);
  transition: opacity .4s var(--ui-ease), visibility .4s var(--ui-ease);
}
.boot-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 260px;
  text-align: center;
  animation: bootIn .7s var(--ui-ease) both;
}
.boot-splash-logo-wrap {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  overflow: hidden;
  flex: none;
  box-shadow: 0 18px 40px rgba(0,0,0,.38), 0 0 0 1px rgba(255,255,255,.08) inset;
  animation: bootPulse 2.8s ease-in-out infinite;
}
.boot-splash-logo { width: 100%; height: 100%; object-fit: cover; display: block; }
.boot-splash-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: #fff;
}
.boot-splash-sub { font-size: 13px; color: rgba(255,255,255,.6); }
.boot-splash-bar {
  width: 128px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  overflow: hidden;
  margin-top: 2px;
}
.boot-splash-bar-fill {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-gold-2), var(--brand-cyan));
  animation: bootBar 1.3s ease-in-out infinite;
}
.boot-splash-hide { opacity: 0; visibility: hidden; pointer-events: none; }

/* =========================================================
   Каркас приложения
   ========================================================= */
.app { min-height: 100vh; max-width: 720px; margin: 0 auto; position: relative; }
.ui-shell { position: relative; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface) 90%, transparent),
      color-mix(in srgb, var(--surface) 70%, transparent));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: 0 8px 26px rgba(0,0,0,.04);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand > div { min-width: 0; }

.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-green), var(--brand-navy));
  color: var(--accent-text);
  font-weight: 800; font-size: 13px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand-navy) 35%, transparent);
}
.brand-mark-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff;
}
.brand-mark img {
  position: relative; z-index: 1;
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 2;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.4) 50%, transparent 70%);
  transform: translateX(-130%) skewX(-16deg);
  animation: logoSweep 1.9s var(--ui-ease) 1;
  pointer-events: none;
}

.brand-title {
  font-weight: 800; font-size: 15px; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand-subtitle {
  color: var(--muted); font-size: 12px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.icon-button {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); font-size: 20px;
  display: grid; place-items: center; cursor: pointer;
}
.icon-button.is-spinning { animation: spin .7s linear infinite; }

.hidden { display: none !important; }

.content {
  padding: 14px 14px 96px;
  max-width: 100%;
  overflow-x: hidden;
}

/* ---------- Нижняя навигация ---------- */
.bottom-nav {
  position: fixed; z-index: 30; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: min(720px, 100%);
  display: flex; gap: 2px;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  justify-content: flex-start;
  scrollbar-width: none;
}
.bottom-nav::-webkit-scrollbar { display: none; }

.nav-item {
  position: relative;
  overflow: hidden;
  flex: 1 0 66px;
  background: transparent; color: var(--muted);
  padding: 6px 2px; border-radius: 13px; cursor: pointer;
  display: grid; gap: 2px; place-items: center;
  transition: transform .2s var(--ui-ease), background .2s ease, color .2s ease;
}
.nav-item .nav-icon {
  transform: translateY(0) scale(1);
  transition: transform .2s var(--ui-ease);
}
.nav-item small {
  font-size: 9.5px; font-weight: 600;
  max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-item.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); }
.nav-item.active .nav-icon { transform: translateY(-1px) scale(1.06); }
.nav-item.active::after {
  content: "";
  position: absolute; left: 26%; right: 26%; bottom: 2px;
  height: 2px; border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: navIndicator .32s var(--ui-ease) both;
}
.nav-item:active { transform: scale(.96); }

/* =========================================================
   Карточки, сетки, статистика
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  min-width: 0;
  position: relative;
  overflow: hidden;
  transition: transform .24s var(--ui-ease), box-shadow .24s var(--ui-ease), border-color .24s ease;
}
.card-title { font-weight: 800; font-size: 16px; margin-bottom: 8px; overflow-wrap: anywhere; }
.card-subtitle { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.grid { display: grid; gap: 12px; min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  min-width: 0;
  transition: transform .24s var(--ui-ease), box-shadow .24s var(--ui-ease), border-color .24s ease;
}
.stat-label {
  color: var(--muted); font-size: 12px; margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stat-value {
  font-size: clamp(16px, 4.6vw, 20px); font-weight: 800;
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 18px 2px 10px; flex-wrap: wrap;
}
.section-head h2 { font-size: 17px; margin: 0; overflow-wrap: anywhere; }

.link-button { color: var(--accent); background: transparent; padding: 2px; cursor: pointer; font-weight: 700; }

/* =========================================================
   Кнопки
   ========================================================= */
.primary, .secondary, .danger-button {
  width: 100%; padding: 12px 14px; border-radius: 14px;
  cursor: pointer; font-weight: 800;
  position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 24%, transparent); }
.secondary { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); }
.danger-button { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); }

/* Один ненавязчивый hover-эффект вместо световых полос на кнопках. */
@media (hover: hover) {
  :is(.primary,.secondary,.danger-button,.icon-button):not(:disabled):hover {
    transform: translateY(var(--button-hover-lift));
  }
}
.primary:active, .secondary:active, .danger-button:active, .icon-button:active { transform: scale(.98); }

.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.button-row > button, .button-row > a { flex: 1; min-width: 130px; }
button:disabled, .primary:disabled, .secondary:disabled, .danger-button:disabled {
  cursor: default;
  opacity: .52;
  transform: none !important;
  filter: none !important;
  box-shadow: none;
}

.action-confirm {
  padding: 8px 2px 2px;
  text-align: center;
}
.action-confirm-icon {
  width: 58px; height: 58px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface-2)), color-mix(in srgb, var(--brand-gold) 16%, var(--surface-2)));
  font-size: 27px;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 12%, transparent);
}
.action-confirm-message {
  max-width: 560px; margin: 0 auto;
  font-size: 14px; line-height: 1.55;
  overflow-wrap: anywhere;
}
.action-confirm-actions {
  margin-top: 20px;
}

.route-preview-detail-block {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}
.route-detail-comment {
  font-weight: 500;
  white-space: pre-wrap;
}
.route-preview-photo-grid {
  margin-top: 8px;
}
.route-comment-button { width: auto !important; flex: 0 0 auto !important; min-width: 0 !important; white-space: nowrap; padding-inline: 12px; }

/* =========================================================
   Формы
   ========================================================= */
.field { display: grid; gap: 6px; margin-bottom: 12px; position: relative; min-width: 0; }
.field label { font-size: 12px; font-weight: 700; color: var(--muted); transition: color .2s ease; }
.field input, .field textarea, .field select {
  width: 100%; max-width: 100%; min-width: 0;
  padding: 12px 13px; border-radius: 13px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); outline: none;
  box-sizing: border-box; inline-size: 100%; min-inline-size: 0; max-inline-size: 100%;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field textarea { min-height: 90px; resize: vertical; }
.field:focus-within label { color: var(--accent); }
.field:focus-within input, .field:focus-within textarea, .field:focus-within select {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent),
    0 8px 22px color-mix(in srgb, var(--accent) 8%, transparent);
}

.search { margin-bottom: 10px; }
.search input {
  padding: 12px 14px 12px 40px; width: 100%; max-width: 100%; min-width: 0;
  border-radius: 14px; border: 1px solid var(--border);
  background:
    var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 13px center;
  background-size: 16px;
  color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search input:focus {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent);
}

.checkbox-field { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.checkbox-field input { width: 18px; height: 18px; flex: none; }

.suggestions {
  position: relative; z-index: 20; margin-top: 4px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-lg);
  max-height: 220px; overflow-y: auto; overflow-x: hidden;
}
.suggestion-item {
  display: block; width: 100%; max-width: 100%;
  padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border);
  background: transparent; text-align: left; font: inherit;
  overflow-wrap: anywhere;
  transition: background .15s ease;
}
.suggestion-item .meta { margin-top: 2px; }
.suggestion-item:last-child { border-bottom: 0; }
.suggestion-item:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.file-input { padding: 9px 0 !important; background: transparent !important; border: 0 !important; }

/* =========================================================
   Списки и строки
   ========================================================= */
.list { display: grid; gap: 9px; min-width: 0; }
.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px;
  cursor: pointer;
  min-width: 0;
  position: relative;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: auto 90px;
  transition: transform .22s var(--ui-ease), box-shadow .22s var(--ui-ease), border-color .22s ease, background .22s ease;
}
.list-item:active { transform: scale(.99); }

.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; row-gap: 6px; }
.row > * { min-width: 0; }
.row > *:first-child { flex: 1 1 160px; }

.title { font-weight: 800; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; overflow-wrap: anywhere; }

.amount { font-weight: 900; white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.amount.in { color: var(--success); }
.amount.out { color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 800;
  background: var(--surface-2); white-space: nowrap;
}
.badge.success { color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.badge.warning { color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.badge.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }

.empty { padding: 30px 10px; text-align: center; color: var(--muted); }

.balance-row { cursor: default; }
.balance-row .title { font-size: 14px; }
.balance-row .amount { font-size: 15px; }

.route-point-item { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); cursor: pointer; }
.route-point-item:active { opacity: .85; }

.route-number {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--brand-green) 55%, var(--accent)));
  color: var(--accent-text); font-weight: 900;
}

.map-link { color: var(--accent); font-weight: 800; text-decoration: none; }

.notice {
  padding: 11px 12px; border-radius: 13px;
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  color: var(--warning); font-size: 12px; overflow-wrap: anywhere;
}

/* =========================================================
   Профиль / аватар / детальные сетки
   ========================================================= */
.avatar {
  width: 48px; height: 48px; border-radius: 15px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, var(--surface)), color-mix(in srgb, var(--brand-gold) 16%, var(--surface)));
  color: var(--accent); font-weight: 900;
}
.profile-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.profile-head > div { min-width: 0; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.detail-cell { background: var(--surface-2); border-radius: 13px; padding: 11px; min-width: 0; }
.detail-label { color: var(--muted); font-size: 11px; }
.detail-value { margin-top: 3px; font-weight: 700; font-size: 14px; overflow-wrap: break-word; word-break: break-word; }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.photo-button { border: 0; padding: 0; background: transparent; cursor: pointer; width: 100%; display: block; border-radius: 12px; overflow: hidden; }
.photo-button:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-button img { transition: transform .45s var(--ui-ease), filter .3s ease; }
.photo-button:hover img { transform: scale(1.045); filter: saturate(1.06) contrast(1.02); }

/* =========================================================
   Hero-карточка (главный баланс)
   ========================================================= */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--accent) 16%, var(--border));
  box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 8%, transparent);
}
.hero::after {
  content: "";
  position: absolute; top: -30%; right: -12%;
  width: 200px; height: 200px; border-radius: 50%;
  background: color-mix(in srgb, var(--brand-gold) 20%, transparent);
  filter: blur(26px);
  animation: heroPulse 8s ease-in-out infinite;
  pointer-events: none;
}
.big-balance {
  font-size: clamp(24px, 7.5vw, 34px);
  font-weight: 900;
  margin: 8px 0 2px;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 10%, transparent);
}
.kicker { font-size: 12px; color: var(--muted); }

/* =========================================================
   Модальные окна и камера
   ========================================================= */
.modal-backdrop {
  position: fixed; z-index: 100; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center;
  animation: backdropIn .22s ease both;
}
.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 14px 14px calc(20px + env(safe-area-inset-bottom));
  position: relative;
  animation: modalRise .36s var(--ui-ease) both;
  box-shadow: 0 -18px 50px rgba(0,0,0,.2);
}
.modal-backdrop--fullscreen { align-items: stretch; }
.modal--fullscreen {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  box-sizing: border-box;
  border-radius: 0;
  padding-top: calc(14px + env(safe-area-inset-top));
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  box-shadow: none;
}
.modal--fullscreen::before { display: none; }
.modal-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: none; }
.modal-back-button { white-space: nowrap; }
.modal::before {
  content: "";
  position: sticky;
  top: 0;
  display: block;
  width: 36px; height: 4px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: var(--border);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; min-width: 0; }
.modal-title { font-size: 18px; font-weight: 900; min-width: 0; overflow-wrap: anywhere; }
.close { background: var(--surface-2); color: var(--text); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; flex: none; }

.route-comment-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}
.driver-manager-comment {
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  font-weight: 800;
}
.manager-comment-text {
  margin-top: 5px;
  font-weight: 500;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.route-detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.route-detail-point-title {
  margin: 4px 0 22px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.route-preview-detail-block--large {
  margin-top: 18px;
}

.route-preview-detail-block--large .detail-label {
  font-size: 15px;
  font-weight: 800;
}

.route-preview-detail-block--large .detail-value {
  margin-top: 7px;
  font-size: 17px;
  line-height: 1.5;
}

.route-preview-detail-block--large .route-detail-comment {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.route-edit-context {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.route-edit-context .detail-value {
  margin-top: 5px;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 750;
}

.camera-backdrop {
  position: fixed; z-index: 300; inset: 0;
  background: rgba(0,0,0,.8);
  display: flex; align-items: stretch; justify-content: center;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
  animation: backdropIn .22s ease both;
}
.camera-modal {
  width: min(720px, 100%); margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center;
  padding: 16px 0; color: #fff;
  animation: modalRise .36s var(--ui-ease) both;
}
.camera-modal .modal-head { flex: 0 0 auto; }
.camera-preview-wrap {
  position: relative; overflow: hidden; border-radius: 18px;
  background: #000; min-height: 240px; display: grid; place-items: center;
}
.camera-video { display: block; width: 100%; max-height: 68vh; object-fit: cover; background: #000; }
.camera-status {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  margin: 0; padding: 8px 10px; border-radius: 10px;
  background: rgba(0,0,0,.55); color: #fff; overflow-wrap: anywhere;
}
.camera-canvas { display: none; }
.camera-modal .close { background: rgba(255,255,255,.16); color: #fff; }
.camera-modal .secondary { background: rgba(255,255,255,.14); color: #fff; }
.camera-modal .primary { color: var(--accent-text); }

/* =========================================================
   Индикаторы: загрузка, тосты
   ========================================================= */
.page-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 56px 10px; color: var(--muted); font-size: 13px;
  animation: pageEnter .4s var(--ui-ease) both;
}
.spinner {
  width: 28px; height: 28px; margin: 0;
  border: 3px solid color-mix(in srgb, var(--accent) 16%, transparent);
  border-top-color: var(--accent);
  border-right-color: color-mix(in srgb, var(--brand-gold) 65%, var(--accent));
  border-radius: 50%;
  animation: spin .8s linear infinite;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 16%, transparent);
}
.toast {
  position: fixed; z-index: 200; left: 50%; bottom: 90px;
  transform: translate(-50%,10px);
  background: #202124; color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .22s var(--ui-ease);
  max-width: calc(100% - 28px);
  text-align: center;
  overflow-wrap: anywhere;
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 34px rgba(0,0,0,.18);
}
.toast.show { opacity: 1; transform: translate(-50%,0); }

/* =========================================================
   Пагинация
   ========================================================= */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.pagination button:disabled { opacity: .45; cursor: default; }
.pagination .secondary { min-width: 36px; padding: 8px 10px; width: auto; }
.pagination .pagination-page.active { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.pagination-page, .pagination-nav { width: auto; min-width: 36px; max-width: none; flex: 0 0 auto; padding: 8px 10px; }
.pagination-ellipsis { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; color: var(--muted); font-weight: 700; }
.pagination-meta { text-align: center; color: var(--muted); font-size: 12px; margin-left: 4px; }

/* =========================================================
   Плавное появление содержимого страниц
   ========================================================= */
#main { min-width: 0; }
#main > * { animation: pageEnter .46s var(--ui-ease) both; min-width: 0; max-width: 100%; }
#main > *:nth-child(2) { animation-delay: .03s; }

/* Быстрые действия на главной странице должны появляться сразу,
   без compositing/animation-задержки в мобильных WebView. */
#main > .quick-actions {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
.quick-actions {
  content-visibility: visible;
  contain: none;
}

#main > *:nth-child(3) { animation-delay: .06s; }
#main > *:nth-child(4) { animation-delay: .09s; }
#main > *:nth-child(5) { animation-delay: .12s; }
#main > *:nth-child(6) { animation-delay: .15s; }

.list > .list-item, .grid > .card, .grid > .stat, .stats > .stat {
  animation: none;
}

/* Никаких движущихся бликов на карточках и пунктах меню. */
@media (hover:hover) and (pointer:fine) {
  .card:hover, .list-item:not(:disabled):hover, .stat:hover {
    box-shadow:0 14px 32px rgba(0,0,0,.08);
    border-color:color-mix(in srgb, var(--accent) 20%, var(--border));
  }
  button.list-item:not(:disabled):hover { transform:translateY(var(--button-hover-lift)); }
}

/* =========================================================
   Ключевые кадры
   ========================================================= */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes itemRise {
  from { opacity: 0; transform: translateY(7px) scale(.994); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modalRise {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes navIndicator { from { transform: scaleX(.2); opacity: .2; } to { transform: scaleX(1); opacity: 1; } }
@keyframes logoSweep { from { transform: translateX(-130%) skewX(-16deg); } to { transform: translateX(130%) skewX(-16deg); } }
@keyframes heroPulse { 0%,100% { transform: scale(.94); opacity: .45; } 50% { transform: scale(1.06); opacity: .75; } }
@keyframes ambientFloatA { from { transform: translate3d(-2vw,-1vh,0) scale(.96); } to { transform: translate3d(10vw,8vh,0) scale(1.08); } }
@keyframes ambientFloatB { from { transform: translate3d(2vw,4vh,0) scale(1); } to { transform: translate3d(-9vw,-7vh,0) scale(1.06); } }
@keyframes bootIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes bootPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes bootBar { 0% { transform: translateX(-130%); } 60%,100% { transform: translateX(280%); } }

/* =========================================================
   Адаптивность
   ========================================================= */

/* Планшеты / широкие экраны */
@media (min-width: 600px) {
  .stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .content { padding-left: 20px; padding-right: 20px; }
}

/* Телефоны */
@media (max-width: 599px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .grid-2 { grid-template-columns: minmax(0,1fr); }

  .field input, .field textarea, .field select, .search input {
    width: 100%; max-width: 100%; min-width: 0; font-size: 16px;
  }
  .field input[type="date"], .field input[type="datetime-local"], .field input[type="month"] {
    display: block; box-sizing: border-box !important;
    width: 100% !important; max-width: 100% !important; min-width: 0 !important;
    inline-size: 100% !important; min-inline-size: 0 !important; max-inline-size: 100% !important;
    padding-inline: 10px !important; font-size: 16px !important;
  }
  .card { min-width: 0; }


  /* На тач-устройствах hover-эффекты не нужны — оставляем только активные состояния */
  .primary:hover, .secondary:hover, .danger-button:hover, .icon-button:hover { transform: none; filter: none; }
}

/* Совсем маленькие экраны (старые Android, iPhone SE и т.п.) */
@media (max-width: 359px) {
  .content { padding-left: 10px; padding-right: 10px; }
  .card, .list-item, .stat { padding: 12px; }
  .brand-title { font-size: 14px; }
  .nav-item small { display: none; }
  .nav-item { padding: 8px 2px; }
  .boot-splash-title { font-size: 18px; }
}

/* Большие/десктопные окна — сдержанно расширяем воздух, не меняя пропорций */
@media (min-width: 900px) {
  .app { max-width: 760px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  body::before, body::after { display: none; }
}

/* Водительский экран маршрута */
.driver-full-route-wrap {
  display: flex;
  justify-content: center;
  padding: 14px 0 calc(4px + env(safe-area-inset-bottom));
}
.driver-full-route-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  padding: 9px 12px;
  font-size: 13px;
  text-decoration: none;
  border-radius: 10px;
}

.driver-manager-comment .manager-comment-text {
  margin-top: 7px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
}

.modal-head-actions {
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: max-content;
}
.modal-back-button {
  flex: 0 0 auto;
  padding: 8px 11px;
  font-size: 13px;
  line-height: 1.1;
}
.modal-head-actions .close {
  flex: 0 0 34px;
}

/* Route photo viewer: arrows + swipe-friendly full image */
.route-photo-viewer {
  width: 100%;
}
.route-photo-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  touch-action: pan-y;
}
.route-photo-viewer-image {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  margin: 0 auto;
}
.route-photo-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0 0 4px;
  z-index: 2;
  backdrop-filter: blur(8px);
}
.route-photo-arrow--prev { left: 10px; }
.route-photo-arrow--next { right: 10px; }
.route-photo-counter {
  margin-top: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

/* =========================================================
   Детальный просмотр денежных операций
   ========================================================= */
.transaction-detail {
  display: grid;
  gap: 14px;
}

.transaction-detail-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--surface-2), color-mix(in srgb, var(--accent) 5%, var(--surface)));
}

.transaction-detail-summary-main {
  min-width: 0;
}

.transaction-detail-type {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 5px;
}

.transaction-detail-amount {
  font-size: clamp(27px, 8vw, 38px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.transaction-detail-status {
  flex: 0 0 auto;
  max-width: 48%;
  white-space: normal;
  text-align: center;
  justify-content: center;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.25;
}

.transaction-detail-info {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.transaction-detail-row {
  display: grid;
  gap: 5px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
}

.transaction-detail-row:last-child {
  border-bottom: 0;
}

.transaction-detail-row-label,
.transaction-detail-section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.transaction-detail-row-value {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.transaction-detail-section {
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.transaction-detail-description {
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.transaction-detail-actions {
  margin-top: 2px;
}

.transaction-receipt-grid {
  margin-top: 10px;
}

.transaction-photo-hint {
  margin-top: 8px;
}

.transaction-receipt-viewer .route-photo-stage {
  min-height: min(62vh, 520px);
}

@media (max-width: 460px) {
  .transaction-detail-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .transaction-detail-status {
    max-width: 100%;
    width: fit-content;
  }
}

/* =========================================================
   Операции ИП · синхронизация с МоимСкладом
   ========================================================= */
.ep-sync-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.ep-sync-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 10%, transparent);
}
.ep-sync-dot--synced { background: var(--success); color: var(--success); }
.ep-sync-dot--pending { background: var(--danger); color: var(--danger); }
.ep-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 48%;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 900;
  text-align: center;
}
.ep-sync-badge--synced {
  background: color-mix(in srgb, var(--success) 11%, var(--surface));
  color: var(--success);
}
.ep-sync-badge--pending {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}
.ep-sync-error {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border));
  border-radius: 15px;
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.ep-moysklad-result {
  display: grid;
  gap: 10px;
}
.ep-moysklad-result-row {
  display: grid;
  gap: 3px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.ep-moysklad-result-row:first-of-type { margin-top: 2px; }
.ep-moysklad-result-row span { color: var(--muted); font-size: 12px; font-weight: 700; }
.ep-moysklad-result-row strong { font-size: 14px; line-height: 1.4; }
.ep-locked-note { line-height: 1.45; text-align: center; }
.ep-sync-loading {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
  font-weight: 700;
}
.ep-sync-preview { display: grid; gap: 14px; }
.ep-sync-instruction { font-weight: 900; line-height: 1.4; }
.ep-moysklad-candidates { display: grid; gap: 10px; }
.ep-moysklad-candidate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s var(--ui-ease);
}
.ep-moysklad-candidate:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}
.ep-moysklad-candidate input { margin-top: 3px; accent-color: var(--accent); }
.ep-moysklad-candidate-body { min-width: 0; display: grid; gap: 5px; }
.ep-moysklad-candidate-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.ep-moysklad-candidate-meta { color: var(--muted); font-size: 12px; line-height: 1.35; }
.ep-moysklad-candidate-reason { color: var(--text); font-size: 12px; line-height: 1.35; }
.ep-recommended {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  color: var(--success);
  font-size: 10px;
  font-weight: 900;
}
.ep-sync-warning {
  padding: 11px 12px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--brand-gold) 10%, var(--surface-2));
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 460px) {
  .ep-sync-badge { max-width: 100%; width: fit-content; }
}

.report-operation-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}
.ep-sync-line--inline {
  display: inline-flex;
  margin-top: 0;
}

/* МойСклад V4: ручной выбор контрагента, поиск и существующие платежи */
.ep-sync-context-box,
.ep-sync-notice {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.ep-sync-context-box span { color: var(--muted); font-size: 12px; font-weight: 700; }
.ep-sync-context-box strong { line-height: 1.35; }
.ep-sync-notice { color: var(--text); line-height: 1.45; }
.ep-counterparty-search {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  align-items: stretch;
}
.ep-counterparty-search input { min-width: 0; }
.ep-counterparty-choice { align-items: center; }
.ep-choice-warning {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 900;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.ep-partial-payment,
.ep-payment-date-shift {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 900;
  color: var(--brand-gold);
  background: color-mix(in srgb, var(--brand-gold) 12%, transparent);
}
.ep-partial-after {
  color: var(--success);
  font-size: 12px;
  line-height: 1.35;
}
.ep-manual-match-note {
  padding: 9px 10px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--brand-gold) 8%, transparent);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.ep-moysklad-candidate--disabled { opacity: .7; cursor: default; }
.ep-moysklad-candidate--disabled:has(input:checked) { border-color: var(--border); }
.ep-empty-state {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  line-height: 1.45;
}
.ep-remember-choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.ep-remember-choice input { margin-top: 3px; accent-color: var(--accent); }
.ep-remember-choice span { display: grid; gap: 4px; min-width: 0; }
.ep-remember-choice strong { line-height: 1.3; }
.ep-remember-choice small { color: var(--muted); line-height: 1.4; }
.ep-sync-subtitle { margin-top: 4px; font-weight: 900; font-size: 15px; }
.ep-existing-payments { display: grid; gap: 10px; }
.ep-existing-payment {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.ep-existing-payment-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.ep-existing-payment-head > span { display: flex; gap: 5px; flex-wrap: wrap; }
.ep-existing-payment-purpose { font-size: 12px; line-height: 1.4; color: var(--text); }
.ep-link-existing-payment { margin-top: 3px; width: 100%; }
.ep-recent-documents {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}
.ep-recent-documents summary { cursor: pointer; font-weight: 900; }
.ep-recent-documents[open] summary { margin-bottom: 10px; }
.ep-change-counterparty { width: 100%; }

@media (max-width: 520px) {
  .ep-counterparty-search { grid-template-columns: 1fr; }
}

/* =========================================================
   🎃 Сезонная тема «Хэллоуин»
   Включается только классом .theme-halloween, который MiniApp
   получает из /api/bot/theme/. Обычный дизайн выше не изменён.
   ========================================================= */
html.theme-halloween {
  --bg: #09060d;
  --surface: #15101c;
  --surface-2: #1c1425;
  --text: #f7f0e8;
  --muted: #b7a9bd;
  --accent: #ff7a00;
  --accent-text: #160b03;
  --danger: #ff5364;
  --success: #48c982;
  --warning: #ffb02e;
  --border: rgba(255, 132, 34, .18);
  --shadow: 0 10px 28px rgba(0,0,0,.34);
  --shadow-lg: 0 24px 58px rgba(0,0,0,.5);
  --brand-navy: #140b1d;
  --brand-navy-2: #251233;
  --brand-green: #594b1c;
  --brand-green-2: #8a6a1b;
  --brand-gold: #ff7a00;
  --brand-gold-2: #ffb13b;
  --brand-cyan: #a04cff;
  --ui-glow-a: rgba(255, 102, 0, .16);
  --ui-glow-b: rgba(140, 54, 255, .15);
  --ui-glow-c: rgba(106, 255, 92, .07);
  background: #09060d;
  color-scheme: dark;
}

body.theme-halloween {
  background:
    radial-gradient(circle at 84% 6%, rgba(132, 54, 214, .22), transparent 26%),
    radial-gradient(circle at 12% 18%, rgba(255, 100, 0, .14), transparent 28%),
    radial-gradient(circle at 58% 88%, rgba(64, 185, 91, .07), transparent 28%),
    linear-gradient(180deg, #0c0711 0%, #09060d 48%, #07050a 100%);
  background-attachment: scroll;
}

body.theme-halloween::before {
  top: -12vw;
  left: -12vw;
  background: rgba(255, 94, 0, .13);
  opacity: .72;
  filter: blur(82px);
}
body.theme-halloween::after {
  right: -10vw;
  bottom: -12vw;
  background: rgba(121, 45, 198, .14);
  opacity: .7;
  filter: blur(82px);
}

.theme-halloween .app {
  z-index: 2;
}

.theme-halloween .topbar {
  background:
    linear-gradient(180deg, rgba(20, 11, 29, .97), rgba(12, 8, 17, .9));
  border-bottom-color: rgba(255, 122, 0, .2);
  box-shadow: 0 10px 30px rgba(0,0,0,.32), 0 1px 0 rgba(255,122,0,.05) inset;
}
.theme-halloween .topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,122,0,.72), rgba(154,71,255,.55), transparent);
  box-shadow: 0 0 12px rgba(255,122,0,.26);
  pointer-events: none;
}
.theme-halloween .brand-title::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 10px;
  margin-left: 7px;
  vertical-align: 1px;
  border-radius: 48% 48% 44% 44%;
  background: radial-gradient(circle at 50% 60%, #ffb04a 0 16%, #ff7a00 35% 70%, #8a2d00 100%);
  box-shadow: 0 0 8px rgba(255,122,0,.55), inset 0 0 0 1px rgba(255,206,137,.18);
}
.theme-halloween .brand-subtitle { color: #a899b1; }
.theme-halloween .brand-mark {
  background: linear-gradient(145deg, #2b1238, #130c1b 55%, #40210d);
  box-shadow: 0 9px 24px rgba(0,0,0,.45), 0 0 20px rgba(255,122,0,.18);
}
.theme-halloween .brand-mark::after {
  background: linear-gradient(120deg, transparent 30%, rgba(255,151,52,.42) 50%, transparent 70%);
}
.theme-halloween .icon-button,
.theme-halloween .close {
  background: #21162a;
  border: 1px solid rgba(255,122,0,.14);
  box-shadow: 0 8px 20px rgba(0,0,0,.26);
}

.theme-halloween .bottom-nav {
  background: rgba(16, 10, 22, .94);
  border-top-color: rgba(255,122,0,.2);
  box-shadow: 0 -12px 34px rgba(0,0,0,.3);
}
.theme-halloween .nav-item.active {
  color: #ff922f;
  background: rgba(255,122,0,.11);
}
.theme-halloween .nav-item.active::after {
  background: #ff7a00;
  box-shadow: 0 0 12px rgba(255,122,0,.72);
}

.theme-halloween .card,
.theme-halloween .stat,
.theme-halloween .list-item,
.theme-halloween .route-point-item,
.theme-halloween .transaction-detail-summary,
.theme-halloween .transaction-detail-section,
.theme-halloween .ep-moysklad-candidate,
.theme-halloween .ep-existing-payment,
.theme-halloween .ep-recent-documents,
.theme-halloween .ep-sync-context-box,
.theme-halloween .ep-sync-notice,
.theme-halloween .ep-remember-choice {
  background:
    linear-gradient(145deg, rgba(31, 19, 39, .94), rgba(18, 13, 24, .97));
  border-color: rgba(255, 128, 28, .16);
  box-shadow: 0 10px 28px rgba(0,0,0,.26), 0 1px 0 rgba(255,255,255,.025) inset;
}
.theme-halloween .card::after,
.theme-halloween .stat::after {
  content: "";
  position: absolute;
  width: 72px; height: 72px;
  right: -32px; top: -34px;
  border: 1px solid rgba(255,122,0,.11);
  border-radius: 50%;
  box-shadow:
    0 0 0 12px rgba(255,122,0,.025),
    0 0 0 28px rgba(142,58,210,.018);
  pointer-events: none;
}
.theme-halloween .card-title,
.theme-halloween .modal-title,
.theme-halloween .section-head h2 {
  text-shadow: 0 0 18px rgba(255,122,0,.08);
}

.theme-halloween .hero {
  background:
    radial-gradient(circle at 88% 18%, rgba(255,129,27,.17), transparent 34%),
    radial-gradient(circle at 20% 80%, rgba(139,63,207,.12), transparent 38%),
    linear-gradient(145deg, #201329, #15101c 62%, #120d18);
  border-color: rgba(255,122,0,.24);
  box-shadow: 0 16px 42px rgba(0,0,0,.36), 0 0 28px rgba(255,122,0,.06);
}
.theme-halloween .hero::before {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 8px;
  width: 82px;
  height: 54px;
  opacity: .095;
  background:
    radial-gradient(ellipse at 50% 47%, rgba(255,125,28,.95) 0 7%, transparent 8%),
    radial-gradient(ellipse at 35% 47%, rgba(255,125,28,.95) 0 5%, transparent 6%),
    radial-gradient(ellipse at 65% 47%, rgba(255,125,28,.95) 0 5%, transparent 6%),
    linear-gradient(155deg, transparent 0 42%, rgba(255,122,0,.32) 43% 45%, transparent 46% 100%);
  filter: blur(.2px) drop-shadow(0 0 12px rgba(255,122,0,.22));
  pointer-events: none;
}
.theme-halloween .hero::after {
  background: rgba(255,122,0,.16);
  filter: blur(28px);
}
.theme-halloween .big-balance {
  text-shadow: 0 0 24px rgba(255,122,0,.12);
}

.theme-halloween .primary {
  background: linear-gradient(135deg, #ff8c24, #ff6900);
  color: #1a0d04;
  box-shadow: 0 12px 26px rgba(255,105,0,.2), 0 0 0 1px rgba(255,183,91,.16) inset;
}
.theme-halloween .secondary {
  background: linear-gradient(135deg, rgba(129,58,184,.16), rgba(255,122,0,.09));
  color: #ff9a3e;
  border: 1px solid rgba(255,122,0,.16);
}
.theme-halloween .danger-button {
  background: rgba(255,72,86,.1);
  border: 1px solid rgba(255,72,86,.18);
}
.theme-halloween .field input,
.theme-halloween .field textarea,
.theme-halloween .field select,
.theme-halloween .search input {
  background-color: #120d18;
  border-color: rgba(255,122,0,.15);
}
.theme-halloween .field:focus-within input,
.theme-halloween .field:focus-within textarea,
.theme-halloween .field:focus-within select,
.theme-halloween .search input:focus {
  border-color: rgba(255,132,34,.52);
  box-shadow: 0 0 0 3px rgba(255,122,0,.08), 0 10px 26px rgba(0,0,0,.18);
}
.theme-halloween .suggestions {
  background: #17101e;
  border-color: rgba(255,122,0,.18);
}
.theme-halloween .suggestion-item:hover { background: rgba(255,122,0,.08); }

.theme-halloween .modal-backdrop { background: rgba(3, 1, 5, .72); }
.theme-halloween .modal {
  background:
    radial-gradient(circle at 80% 0%, rgba(119,45,178,.09), transparent 32%),
    #120d18;
  border-top: 1px solid rgba(255,122,0,.18);
  box-shadow: 0 -22px 64px rgba(0,0,0,.52);
}
.theme-halloween .modal::before {
  background: linear-gradient(90deg, #733fb4, #ff7a00);
  box-shadow: 0 0 11px rgba(255,122,0,.24);
}
.theme-halloween .modal--fullscreen { border-top: 0; }

.theme-halloween .notice {
  background: rgba(125,57,170,.09);
  border-color: rgba(156,88,218,.2);
}
.theme-halloween .badge.warning,
.theme-halloween .ep-sync-warning {
  background: rgba(255,146,37,.08);
}
.theme-halloween .ep-sync-error {
  background: rgba(255,74,86,.075);
  border-color: rgba(255,74,86,.25);
}
.theme-halloween .toast {
  background: rgba(28,17,35,.96);
  border: 1px solid rgba(255,122,0,.2);
  box-shadow: 0 18px 40px rgba(0,0,0,.45), 0 0 22px rgba(255,122,0,.08);
}
.theme-halloween .spinner {
  border-color: rgba(255,122,0,.18);
  border-top-color: #ff7a00;
  border-right-color: #9548d6;
  box-shadow: 0 0 20px rgba(255,122,0,.15);
}
.theme-halloween ::selection { background: rgba(255,122,0,.3); }

/* Splash тоже меняется, но только после получения серверного переключателя. */
.theme-halloween .boot-splash {
  background:
    radial-gradient(circle at 18% 12%, rgba(255,100,0,.22), transparent 46%),
    radial-gradient(circle at 82% 82%, rgba(127,48,186,.24), transparent 46%),
    linear-gradient(155deg, #1b0d24 0%, #0c0711 58%, #060408 100%);
}
.theme-halloween .boot-splash-title::after { content: ""; }
.theme-halloween .boot-splash-bar-fill {
  background: linear-gradient(90deg, #8c42c3, #ff7a00, #ffc45f);
}

/* ---------- Кинематографичный декоративный слой Halloween ---------- */
.halloween-decor {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  contain: layout paint style;
}
.halloween-moon {
  position: absolute;
  top: max(72px, calc(env(safe-area-inset-top) + 46px));
  right: -46px;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 34%, rgba(255,239,198,.92) 0 5%, transparent 6%),
    radial-gradient(circle at 62% 55%, rgba(109,73,70,.17) 0 9%, transparent 10%),
    radial-gradient(circle at 42% 71%, rgba(109,73,70,.14) 0 6%, transparent 7%),
    radial-gradient(circle, #ffd890 0%, #e4933d 67%, #8f421d 100%);
  opacity: .17;
  box-shadow: 0 0 66px rgba(255,137,42,.25), 0 0 120px rgba(143,55,201,.12);
  filter: saturate(.88);
}
.halloween-web {
  position: absolute;
  width: 148px;
  height: 148px;
  opacity: .19;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23f1e8ef' stroke-opacity='.88' stroke-width='1.05'%3E%3Cpath d='M0 0h160M0 0v160M0 0l160 160M0 0l80 160M0 0l160 80'/%3E%3Cpath d='M20 0A20 20 0 0 1 0 20M41 0A41 41 0 0 1 0 41M66 0A66 66 0 0 1 0 66M95 0A95 95 0 0 1 0 95M127 0A127 127 0 0 1 0 127M159 0A159 159 0 0 1 0 159'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 0 7px rgba(210,181,228,.1));
}
.halloween-web--left { top: 0; left: 0; }
.halloween-web--right { top: 0; right: 0; transform: scaleX(-1); }

/* Паук без emoji */
.halloween-spider-thread {
  position: absolute;
  top: 0;
  right: 8%;
  width: 1px;
  height: 150px;
  background: linear-gradient(#d9ced9, rgba(217,206,217,.12));
  opacity: .42;
  transform-origin: top;
  animation: halloweenThreadSway 6s ease-in-out infinite alternate;
}
.halloween-spider-shape {
  position: absolute;
  left: 50%;
  bottom: -28px;
  width: 34px;
  height: 36px;
  transform: translateX(-50%);
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.65));
  animation: halloweenSpiderDrop 9s ease-in-out infinite;
}
.halloween-spider-shape .spider-body,
.halloween-spider-shape .spider-head {
  position: absolute;
  left: 50%;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 30%, #3b303e, #0a080d 66%);
  border: 1px solid rgba(255,133,39,.08);
}
.halloween-spider-shape .spider-body { width: 18px; height: 22px; top: 10px; transform: translateX(-50%); }
.halloween-spider-shape .spider-head { width: 12px; height: 11px; top: 3px; transform: translateX(-50%); }
.halloween-spider-shape .spider-head::before,
.halloween-spider-shape .spider-head::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #ff5d16;
  box-shadow: 0 0 5px #ff4a00;
}
.halloween-spider-shape .spider-head::before { left: 2px; }
.halloween-spider-shape .spider-head::after { right: 2px; }
.spider-leg { position: absolute; width: 17px; height: 1px; background: #161119; transform-origin: 0 50%; top: 15px; left: 17px; }
.spider-leg--1 { transform: rotate(-155deg); }
.spider-leg--2 { transform: rotate(-130deg) translateY(-3px); }
.spider-leg--3 { transform: rotate(-105deg) translateY(-5px); }
.spider-leg--4 { transform: rotate(-75deg) translateY(-4px); }
.spider-leg--5 { transform: rotate(-25deg); }
.spider-leg--6 { transform: rotate(0deg) translateY(-3px); }
.spider-leg--7 { transform: rotate(25deg) translateY(-5px); }
.spider-leg--8 { transform: rotate(55deg) translateY(-4px); }

/* Тыквы теперь векторные, а не emoji */
.halloween-pumpkin {
  position: absolute;
  width: 74px;
  opacity: .24;
  filter: drop-shadow(0 0 18px rgba(255,103,0,.17));
}
.halloween-pumpkin-svg { display: block; width: 100%; overflow: visible; }
.pumpkin-body { fill: #b4450b; stroke: rgba(255,153,48,.7); stroke-width: 1.6; }
.pumpkin-stem { fill: #3a2d17; }
.pumpkin-groove { fill: none; stroke: rgba(89,25,4,.58); stroke-width: 3; stroke-linecap: round; }
.pumpkin-face { fill: #14080a; filter: drop-shadow(0 0 5px rgba(255,145,34,.35)); }
.halloween-pumpkin--left { left: -24px; bottom: 78px; transform: rotate(10deg); }
.halloween-pumpkin--right { right: -27px; top: 43%; width: 64px; transform: rotate(-12deg); opacity: .15; }

/* Летучие мыши — собственный SVG-силуэт с крыльями */
.halloween-bat-svg { width: 100%; height: auto; overflow: visible; color: #050407; filter: drop-shadow(0 5px 8px rgba(0,0,0,.65)); }
.halloween-bat-svg path { vector-effect: non-scaling-stroke; }
.halloween-bat-wing path { fill: #050407; stroke: #211b25; stroke-width: 1.3; }
.halloween-bat-body { fill: #030204; stroke: #261f2a; stroke-width: 1.2; }
.halloween-bat-head { fill: #020203; }
.halloween-bat-chest { fill: #0d0a10; opacity: .9; }
.halloween-bat-eye { fill: #ff4315; filter: drop-shadow(0 0 3px #ff4e00); }
.halloween-bat-wing { transform-box: fill-box; will-change: transform; }
.halloween-bat-wing--left { transform-origin: 100% 56%; animation: halloweenWingLeft .36s cubic-bezier(.55,.08,.45,.92) infinite alternate; }
.halloween-bat-wing--right { transform-origin: 0% 56%; animation: halloweenWingRight .36s cubic-bezier(.55,.08,.45,.92) infinite alternate; }
@keyframes halloweenWingLeft { from { transform: rotate(2deg) scaleY(1); } to { transform: rotate(13deg) scaleY(.62); } }
@keyframes halloweenWingRight { from { transform: rotate(-2deg) scaleY(1); } to { transform: rotate(-13deg) scaleY(.62); } }

.halloween-ambient-bat {
  position: absolute;
  left: -92px;
  width: 64px;
  top: 18%;
  opacity: .28;
  transform: translate3d(0,0,0) rotate(-8deg);
  animation: halloweenBatFlight 20s linear infinite;
}
.halloween-ambient-bat--2 { top: 28%; width: 48px; animation-duration: 25s; animation-delay: -8s; opacity: .22; }
.halloween-ambient-bat--3 { top: 12%; width: 78px; animation-duration: 31s; animation-delay: -18s; opacity: .18; }
.halloween-ambient-bat--4 { top: 40%; width: 42px; animation-duration: 34s; animation-delay: -5s; opacity: .15; }

/* Полноценные скелеты с туловищем и движущимися руками */
.halloween-skeleton {
  position: absolute;
  width: 118px;
  opacity: .105;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.65));
  animation: halloweenSkeletonPeek 11s ease-in-out infinite;
}
.halloween-skeleton--left { left: -53px; top: 31%; transform: rotate(8deg); }
.halloween-skeleton--right { right: -54px; bottom: 8%; transform: scaleX(-1) rotate(5deg); animation-delay: -5.4s; }
.halloween-skeleton-svg { display: block; width: 100%; overflow: visible; }
.halloween-skeleton-svg .bone-fill { fill: #d9d1ca; stroke: #7d7477; stroke-width: 1.2; }
.halloween-skeleton-svg .socket { fill: #0a070c; }
.halloween-skeleton-svg .jaw { fill: #bfb7b1; stroke: #6d6467; stroke-width: 1; }
.halloween-skeleton-svg .teeth { fill: none; stroke: #62595d; stroke-width: 1.2; }
.halloween-skeleton-svg .bone-line { fill: none; stroke: #d4cbc5; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.halloween-skeleton-svg .bone-line.thin { stroke-width: 3.5; }
.halloween-skeleton-svg .joint { fill: #cbc3bd; }
.halloween-skeleton-svg .skeleton-eye-glow { fill: #ff5b19; filter: drop-shadow(0 0 5px #ff3b00); animation: halloweenSkeletonEye 4.8s ease-in-out infinite; }
.halloween-skeleton-head { transform-box: fill-box; transform-origin: 50% 90%; animation: halloweenSkeletonHead 4.6s ease-in-out infinite; }
.halloween-skeleton-arm { transform-box: fill-box; }
.halloween-skeleton-arm--left { transform-origin: 82% 10%; animation: halloweenSkeletonArmLeft 3.2s ease-in-out infinite alternate; }
.halloween-skeleton-arm--right { transform-origin: 18% 10%; animation: halloweenSkeletonArmRight 3.6s ease-in-out infinite alternate; }
.halloween-skeleton.is-reacting .halloween-skeleton-svg { animation: halloweenSkeletonReact .92s cubic-bezier(.2,.85,.25,1); }
.halloween-skeleton.is-reacting { opacity: .27; }
@keyframes halloweenSkeletonPeek { 0%,100% { translate: 0 22px; } 48%,64% { translate: 0 -8px; } }
@keyframes halloweenSkeletonHead { 0%,100% { transform: rotate(-4deg); } 45% { transform: rotate(8deg); } 62% { transform: rotate(1deg); } }
@keyframes halloweenSkeletonArmLeft { from { transform: rotate(-8deg); } to { transform: rotate(19deg); } }
@keyframes halloweenSkeletonArmRight { from { transform: rotate(7deg); } to { transform: rotate(-18deg); } }
@keyframes halloweenSkeletonEye { 0%,72%,100% { opacity: .25; } 78%,90% { opacity: 1; } }
@keyframes halloweenSkeletonReact { 0% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-16px) rotate(-3deg); } 48% { transform: translateY(-7px) rotate(4deg); } 100% { transform: translateY(0) rotate(0); } }

.halloween-eyes {
  position: absolute;
  display: flex;
  gap: 8px;
  opacity: 0;
  animation: halloweenEyes 13s ease-in-out infinite;
}
.halloween-eyes i {
  position: relative;
  display: block;
  width: 12px;
  height: 7px;
  overflow: hidden;
  border-radius: 70% 70% 55% 55%;
  background: linear-gradient(180deg, #ffbb4b, #ff4d13 70%);
  box-shadow: 0 0 10px rgba(255,71,0,.82);
  transform: rotate(8deg) skewX(-12deg);
}
.halloween-eyes i:last-child { transform: rotate(-8deg) skewX(12deg); }
.halloween-eyes i b { position:absolute; width:3px; height:6px; left:4px; top:1px; border-radius:50%; background:#13070a; }
.halloween-eyes--1 { left: 8%; top: 59%; }
.halloween-eyes--2 { right: 9%; top: 72%; animation-delay: -6s; transform: scale(.82); }

.halloween-fog {
  position: absolute;
  width: 74vw;
  height: 140px;
  border-radius: 50%;
  filter: blur(42px);
  opacity: .052;
  background: #c5a7d6;
  animation: halloweenFog 18s ease-in-out infinite alternate;
}
.halloween-fog--1 { left: -28vw; bottom: 14%; }
.halloween-fog--2 { right: -32vw; top: 42%; animation-delay: -8s; }

@keyframes halloweenBatFlight {
  0%   { transform: translate3d(-12vw, 0, 0) rotate(-10deg) scale(.72); }
  22%  { transform: translate3d(31vw, -26px, 0) rotate(7deg) scale(1); }
  46%  { transform: translate3d(63vw, 14px, 0) rotate(-5deg) scale(.88); }
  72%  { transform: translate3d(91vw, -32px, 0) rotate(7deg) scale(1.08); }
  100% { transform: translate3d(124vw, -5px, 0) rotate(-7deg) scale(.82); }
}
@keyframes halloweenSpiderDrop {
  0%, 14%, 100% { transform: translate(-50%, -84px) rotate(-5deg); }
  30%, 70% { transform: translate(-50%, 0) rotate(5deg); }
  84% { transform: translate(-50%, -28px) rotate(-4deg); }
}
@keyframes halloweenThreadSway { from { transform: rotate(-1.2deg); } to { transform: rotate(1.8deg); } }
@keyframes halloweenEyes { 0%,52%,60%,100% { opacity:0; } 54%,58% { opacity:.82; } }
@keyframes halloweenFog { from { transform:translate3d(-8vw,10px,0) scale(.9); } to { transform:translate3d(16vw,-12px,0) scale(1.15); } }

/* ---------- Эффект глубины: стая летит ИЗ центра НА пользователя ---------- */
.halloween-intro-bats,
.halloween-click-eyes,
.halloween-click-bat,
.newyear-click-sparkles {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
  user-select: none;
}
.halloween-intro-bats {
  inset: 0;
  overflow: hidden;
  perspective: 760px;
  transform-style: preserve-3d;
  background: radial-gradient(circle at 50% 46%, rgba(255,83,0,.085), transparent 17%);
}
.halloween-intro-vortex {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle, rgba(255,92,0,.24), rgba(76,21,88,.13) 34%, transparent 70%);
  box-shadow: 0 0 40px rgba(255,85,0,.13), 0 0 95px rgba(118,43,173,.13);
  animation: halloweenVortex 1.25s ease-out both;
}
.halloween-intro-bat {
  position: absolute;
  left: 50%;
  top: 46%;
  width: var(--size);
  opacity: 0;
  will-change: transform, opacity, filter;
  animation: halloweenBatTowardUser var(--dur) cubic-bezier(.12,.72,.12,1) var(--delay) both;
}
.halloween-intro-bat .halloween-bat-svg { filter: drop-shadow(0 8px 12px rgba(0,0,0,.72)); }
.halloween-intro-bat--hero { z-index: 2; }
.halloween-intro-bat--hero .halloween-bat-eye { fill:#ff2f0b; filter:drop-shadow(0 0 5px #ff2f00); }
@keyframes halloweenBatTowardUser {
  0% { opacity:0; transform:translate(-50%,-50%) translate3d(0,0,-500px) rotate(0deg) scale(.08); filter:blur(3.5px); }
  12% { opacity:.92; filter:blur(1.6px); }
  52% { opacity:.98; transform:translate(calc(-50% + var(--mx)),calc(-50% + var(--my))) translateZ(40px) rotate(var(--rot-mid)) scale(1.2); filter:blur(0); }
  82% { opacity:.96; }
  100% { opacity:0; transform:translate(calc(-50% + var(--tx)),calc(-50% + var(--ty))) translateZ(260px) rotate(var(--rot)) scale(5.6); filter:blur(1.2px); }
}
@keyframes halloweenVortex { 0%{opacity:0;transform:translate(-50%,-50%) scale(.3)} 38%{opacity:1} 100%{opacity:0;transform:translate(-50%,-50%) scale(2.1)} }

/* Глаза реагируют на нажатия и переводят взгляд к центру экрана */
.halloween-click-eyes {
  display: flex;
  gap: 10px;
  transform-origin: center;
  animation: halloweenClickEyesReveal 1.85s ease-out both;
}
.halloween-click-gloom {
  position:absolute;
  left:-28px;
  top:-19px;
  width:95px;
  height:48px;
  border-radius:50%;
  background:radial-gradient(ellipse, rgba(0,0,0,.82), transparent 68%);
  filter:blur(5px);
}
.halloween-click-eyes > i {
  position:relative;
  display:block;
  width:18px;
  height:11px;
  overflow:hidden;
  clip-path: polygon(0 48%, 20% 18%, 58% 8%, 100% 42%, 72% 91%, 26% 84%);
  background:linear-gradient(180deg,#ffd06a 0%,#ff5a16 57%,#d52600 100%);
  box-shadow:0 0 12px rgba(255,66,0,.92),0 0 26px rgba(255,65,0,.42);
}
.halloween-click-eyes b:not(.halloween-click-embers b) {
  position:absolute;
  width:4px;
  height:8px;
  left:7px;
  top:2px;
  border-radius:50%;
  background:#120609;
  box-shadow:0 0 2px rgba(0,0,0,.9);
  animation:halloweenPupilWatch 1.15s ease-in-out both;
}
.halloween-click-embers { position:absolute; inset:0; }
.halloween-click-embers > b {
  position:absolute;
  left:28px;
  top:8px;
  width:3px;
  height:3px;
  border-radius:50%;
  background:#ff8a1e;
  box-shadow:0 0 8px #ff5100;
  animation:halloweenEmber .8s ease-out calc(var(--i) * 45ms) both;
}
@keyframes halloweenClickEyesReveal {
  0% { opacity:0; transform:scale(.35); filter:blur(4px); }
  18%,64% { opacity:.98; transform:scale(1); filter:blur(0); }
  71% { opacity:.14; transform:scaleY(.08); }
  79% { opacity:.94; transform:scaleY(1); }
  100% { opacity:0; transform:scale(.88); filter:blur(1px); }
}
@keyframes halloweenPupilWatch { 0%{transform:translate(0,0)} 42%,72%{transform:translate(var(--pupil-x),var(--pupil-y))} 100%{transform:translate(0,0)} }
@keyframes halloweenEmber { 0%{opacity:0;transform:translate(0,0) scale(.4)} 25%{opacity:1} 100%{opacity:0;transform:translate(var(--ex),var(--ey)) scale(1.15)} }

.halloween-click-bat {
  width:62px;
  transform:translate(-50%,-50%);
  animation:halloweenClickBat 1.05s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes halloweenClickBat { 0%{opacity:0;transform:translate(-50%,-50%) scale(.18) rotate(-8deg)} 28%{opacity:.9} 100%{opacity:0;transform:translate(calc(-50% + var(--fly-x)),-115px) scale(1.45) rotate(12deg)} }

@media (max-width: 520px) {
  .halloween-moon { width:116px; height:116px; right:-44px; opacity:.14; }
  .halloween-web { width:112px; height:112px; opacity:.15; }
  .halloween-spider-thread { right:5%; height:128px; opacity:.31; }
  .halloween-pumpkin { width:58px; }
  .halloween-skeleton { width:96px; opacity:.085; }
  .halloween-skeleton--left { left:-48px; }
  .halloween-skeleton--right { right:-49px; }
  .halloween-ambient-bat { transform:scale(.86); }
}

/* Если пользователь отключил анимации в админке или в ОС включено
   «Уменьшение движения», сохраняем оформление, но ничего не двигаем. */
html.halloween-no-motion .halloween-decor,
html.halloween-no-motion .halloween-decor *,
html.halloween-no-motion .halloween-decor *::before,
html.halloween-no-motion .halloween-decor *::after,
html.halloween-no-motion .halloween-intro-bats *,
html.halloween-no-motion .halloween-click-eyes *,
html.halloween-no-motion .halloween-click-bat * {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
}
@media (prefers-reduced-motion: reduce) {
  .theme-halloween .halloween-decor *,
  .theme-halloween .halloween-intro-bats *,
  .theme-halloween .halloween-click-eyes *,
  .theme-halloween .halloween-click-bat * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* =========================================================
   🎄 Сезонная тема «Новый год»
   ========================================================= */
html.theme-new-year {
  --bg: #071823;
  --surface: #0d2532;
  --surface-2: #123343;
  --text: #f4fbff;
  --muted: #a9c1cc;
  --accent: #57d7ff;
  --accent-text: #04151f;
  --danger: #ff6676;
  --success: #53d69a;
  --warning: #ffd166;
  --border: rgba(138, 223, 255, .18);
  --shadow: 0 10px 28px rgba(0, 8, 16, .32);
  --shadow-lg: 0 24px 58px rgba(0, 8, 16, .48);
  --brand-navy: #0c2534;
  --brand-navy-2: #10374a;
  --brand-green: #0d4d42;
  --brand-green-2: #14725c;
  --brand-gold: #ffd15c;
  --brand-gold-2: #fff1a7;
  --brand-cyan: #63dcff;
  --ui-glow-a: rgba(88, 214, 255, .15);
  --ui-glow-b: rgba(72, 240, 199, .1);
  --ui-glow-c: rgba(255, 211, 96, .08);
  background: #071823;
  color-scheme: dark;
}
body.theme-new-year {
  background:
    radial-gradient(circle at 84% 8%, rgba(71, 199, 255, .18), transparent 27%),
    radial-gradient(circle at 8% 21%, rgba(28, 196, 151, .11), transparent 29%),
    radial-gradient(circle at 52% 90%, rgba(255, 226, 125, .07), transparent 30%),
    linear-gradient(180deg, #0a1d2a 0%, #071823 52%, #06141d 100%);
  background-attachment: scroll;
}
body.theme-new-year::before {
  top: -13vw; left: -10vw;
  background: rgba(53, 203, 255, .12);
  opacity: .72;
  filter: blur(86px);
}
body.theme-new-year::after {
  right: -11vw; bottom: -14vw;
  background: rgba(39, 221, 168, .1);
  opacity: .66;
  filter: blur(88px);
}
.theme-new-year .app { z-index: 2; }
.theme-new-year .topbar {
  background: linear-gradient(180deg, rgba(12,37,52,.97), rgba(8,27,39,.92));
  border-bottom-color: rgba(105, 219, 255, .2);
  box-shadow: 0 10px 30px rgba(0,8,16,.3), 0 1px 0 rgba(255,255,255,.04) inset;
}
.theme-new-year .topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88,214,255,.7), rgba(255,220,107,.55), transparent);
  box-shadow: 0 0 12px rgba(88,214,255,.25);
  pointer-events: none;
}
.theme-new-year .brand-title::after { content: "  🎄"; font-size: .88em; filter: drop-shadow(0 0 6px rgba(255,220,105,.42)); }
.theme-new-year .brand-subtitle { color: #9fb9c4; }
.theme-new-year .brand-mark {
  background: linear-gradient(145deg, #123c4f, #0b2837 58%, #15483e);
  box-shadow: 0 9px 24px rgba(0,8,16,.42), 0 0 20px rgba(78,214,255,.13);
}
.theme-new-year .icon-button,
.theme-new-year .close {
  background: #11303f;
  border: 1px solid rgba(103,219,255,.14);
  box-shadow: 0 8px 20px rgba(0,8,16,.24);
}
.theme-new-year .bottom-nav {
  background: rgba(8, 28, 39, .95);
  border-top-color: rgba(102,219,255,.18);
  box-shadow: 0 -12px 34px rgba(0,8,16,.28);
}
.theme-new-year .nav-item.active { color: #67dcff; background: rgba(77,203,245,.11); }
.theme-new-year .nav-item.active::after { background: #63dbff; box-shadow: 0 0 12px rgba(91,220,255,.7); }
.theme-new-year .card,
.theme-new-year .stat,
.theme-new-year .list-item,
.theme-new-year .route-point-item,
.theme-new-year .transaction-detail-summary,
.theme-new-year .transaction-detail-section,
.theme-new-year .ep-moysklad-candidate,
.theme-new-year .ep-existing-payment,
.theme-new-year .ep-recent-documents,
.theme-new-year .ep-sync-context-box,
.theme-new-year .ep-sync-notice,
.theme-new-year .ep-remember-choice {
  background: linear-gradient(145deg, rgba(16,49,64,.94), rgba(10,31,43,.97));
  border-color: rgba(106,219,255,.16);
  box-shadow: 0 10px 28px rgba(0,8,16,.24), 0 1px 0 rgba(255,255,255,.03) inset;
}
.theme-new-year .card::after,
.theme-new-year .stat::after {
  content: "❄";
  position: absolute;
  right: 12px;
  top: 8px;
  color: rgba(189,235,255,.055);
  font-size: 42px;
  line-height: 1;
  pointer-events: none;
}
.theme-new-year .hero {
  background:
    radial-gradient(circle at 88% 18%, rgba(88,214,255,.16), transparent 34%),
    radial-gradient(circle at 20% 82%, rgba(49,211,157,.1), transparent 38%),
    linear-gradient(145deg, #103447, #0b2736 64%, #09212e);
  border-color: rgba(105,219,255,.23);
  box-shadow: 0 16px 42px rgba(0,8,16,.34), 0 0 28px rgba(82,214,255,.055);
}
.theme-new-year .hero::before {
  content: "❄";
  position: absolute;
  right: 16px;
  bottom: 10px;
  font-size: 56px;
  color: rgba(224,247,255,.05);
  transform: rotate(9deg);
  pointer-events: none;
}
.theme-new-year .hero::after { background: rgba(82,214,255,.13); filter: blur(28px); }
.theme-new-year .big-balance { text-shadow: 0 0 24px rgba(84,215,255,.1); }
.theme-new-year .primary {
  background: linear-gradient(135deg, #6ee2ff, #3ebce9);
  color: #05202b;
  box-shadow: 0 12px 26px rgba(51,185,232,.18), 0 0 0 1px rgba(193,244,255,.18) inset;
}
.theme-new-year .secondary {
  background: linear-gradient(135deg, rgba(54,193,230,.14), rgba(38,208,158,.08));
  color: #80e6ff;
  border: 1px solid rgba(102,219,255,.16);
}
.theme-new-year .field input,
.theme-new-year .field textarea,
.theme-new-year .field select,
.theme-new-year .search input {
  background-color: #09212d;
  border-color: rgba(103,219,255,.15);
}
.theme-new-year .field:focus-within input,
.theme-new-year .field:focus-within textarea,
.theme-new-year .field:focus-within select,
.theme-new-year .search input:focus {
  border-color: rgba(105,223,255,.48);
  box-shadow: 0 0 0 3px rgba(81,210,247,.075), 0 10px 26px rgba(0,8,16,.16);
}
.theme-new-year .suggestions { background: #0b2735; border-color: rgba(103,219,255,.18); }
.theme-new-year .suggestion-item:hover { background: rgba(86,213,250,.08); }
.theme-new-year .modal-backdrop { background: rgba(1, 10, 16, .7); }
.theme-new-year .modal {
  background: radial-gradient(circle at 80% 0%, rgba(62,211,255,.075), transparent 32%), #0a2330;
  border-top: 1px solid rgba(105,219,255,.18);
  box-shadow: 0 -22px 64px rgba(0,8,16,.5);
}
.theme-new-year .modal::before { background: linear-gradient(90deg, #3ccf9e, #5edcff, #ffe48a); box-shadow: 0 0 11px rgba(86,218,255,.23); }
.theme-new-year .modal--fullscreen { border-top: 0; }
.theme-new-year .notice { background: rgba(54,186,220,.085); border-color: rgba(95,215,246,.2); }
.theme-new-year .toast {
  background: rgba(11,39,52,.96);
  border: 1px solid rgba(101,220,255,.2);
  box-shadow: 0 18px 40px rgba(0,8,16,.43), 0 0 22px rgba(86,216,255,.07);
}
.theme-new-year .spinner {
  border-color: rgba(102,219,255,.16);
  border-top-color: #64ddff;
  border-right-color: #54d2a5;
  box-shadow: 0 0 20px rgba(82,215,255,.13);
}
.theme-new-year ::selection { background: rgba(84,214,255,.28); }
.theme-new-year .boot-splash {
  background:
    radial-gradient(circle at 18% 12%, rgba(64,207,255,.2), transparent 46%),
    radial-gradient(circle at 82% 82%, rgba(45,208,160,.17), transparent 46%),
    linear-gradient(155deg, #0d2c3b 0%, #071a25 58%, #05121a 100%);
}
.theme-new-year .boot-splash-title::after { content: " 🎄"; }
.theme-new-year .boot-splash-bar-fill { background: linear-gradient(90deg, #38c997, #61dcff, #ffe486); }

/* ---------- Новый год: декоративный слой ---------- */
.newyear-decor {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  contain: strict;
}
.newyear-aurora {
  position: absolute;
  width: 70vw;
  height: 22vh;
  border-radius: 50%;
  filter: blur(52px);
  opacity: .045;
  will-change: transform;
  animation: newyearAurora 12s ease-in-out infinite alternate;
}
.newyear-aurora--one { left: -18vw; top: 16%; background: #57dfff; }
.newyear-aurora--two { right: -22vw; top: 48%; background: #53d7a4; animation-delay: -5s; }
@keyframes newyearAurora { from { transform: translate3d(-4vw,0,0) scale(.95); } to { transform: translate3d(12vw,3vh,0) scale(1.12); } }
.newyear-garland {
  position: absolute;
  top: max(70px, calc(env(safe-area-inset-top) + 47px));
  left: -2%; right: -2%;
  height: 34px;
  border-top: 2px solid rgba(31,77,67,.72);
  transform: rotate(-1deg);
}
.newyear-garland i {
  position: absolute;
  left: calc((var(--i) + .45) * 7.15%);
  top: -1px;
  width: 8px; height: 13px;
  border-radius: 50% 50% 48% 48%;
  transform-origin: 50% -3px;
  background: hsl(calc(var(--i) * 67deg), 86%, 67%);
  box-shadow: 0 0 9px currentColor, 0 0 15px currentColor;
  animation: newyearBulbGlow 1.7s ease-in-out calc(var(--i) * -120ms) infinite alternate;
}
.newyear-garland i::before {
  content: "";
  position: absolute;
  left: 3px; top: -5px;
  width: 2px; height: 5px;
  background: rgba(190,210,201,.75);
}
@keyframes newyearBulbGlow { from { opacity: .28; transform: scale(.82); } to { opacity: .92; transform: scale(1.06); } }
.newyear-snowfield { position: absolute; inset: 0; overflow: hidden; }
.newyear-snowflake {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: -36px;
  font-size: var(--size);
  line-height: 1;
  color: rgba(227,247,255,.82);
  text-shadow: 0 0 7px rgba(167,230,255,.34);
  opacity: .7;
  will-change: transform, opacity;
  animation: newyearSnowFall var(--dur) linear var(--delay) infinite;
}
@keyframes newyearSnowFall {
  0% { transform: translate3d(0,-8vh,0) rotate(0deg); opacity: 0; }
  10% { opacity: .72; }
  100% { transform: translate3d(var(--drift),112vh,0) rotate(310deg); opacity: .14; }
}
.newyear-santa {
  position: absolute;
  left: -160px;
  top: 18%;
  white-space: nowrap;
  font-size: 24px;
  opacity: .26;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.35));
  will-change: transform, opacity;
  animation: newyearSantaFlight 26s linear -9s infinite;
}
.newyear-santa span { display: inline-block; transform: scaleX(-1); }
.newyear-santa b { font-weight: 400; }
@keyframes newyearSantaFlight {
  0% { transform: translate3d(-14vw, 3vh, 0) rotate(-3deg) scale(.76); opacity: 0; }
  10% { opacity: .32; }
  46% { transform: translate3d(58vw, -4vh, 0) rotate(2deg) scale(.9); }
  88% { opacity: .28; }
  100% { transform: translate3d(130vw, 2vh, 0) rotate(-2deg) scale(.76); opacity: 0; }
}
.newyear-snowman {
  position: absolute;
  right: -15px;
  bottom: 76px;
  width: 106px;
  height: 168px;
  opacity: .15;
  filter: drop-shadow(0 8px 9px rgba(0,10,18,.32));
  transform: scale(.88);
}
.newyear-snowman-piece,
.newyear-snowman-hat,
.newyear-snowman-arm { position: absolute; will-change: transform, opacity; }
.newyear-snowman-bottom {
  left: 24px; bottom: 0; width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff 0, #e5f5fb 58%, #b8d8e4 100%);
  animation: snowmanBottomBreak 13s ease-in-out infinite;
}
.newyear-snowman-middle {
  left: 31px; bottom: 51px; width: 57px; height: 57px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff 0, #e7f7fc 59%, #bedce7 100%);
  animation: snowmanMiddleBreak 13s ease-in-out infinite;
}
.newyear-snowman-middle i { position: absolute; left: 27px; width: 5px; height: 5px; background: #193341; border-radius: 50%; }
.newyear-snowman-middle i:first-child { top: 20px; }.newyear-snowman-middle i:last-child { top: 34px; }
.newyear-snowman-head {
  left: 37px; bottom: 98px; width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff 0, #e9f8fc 60%, #c2dfe9 100%);
  animation: snowmanHeadBreak 13s ease-in-out infinite;
}
.newyear-snowman-head .eye { position: absolute; top: 15px; width: 4px; height: 4px; border-radius: 50%; background: #183341; }
.newyear-snowman-head .eye-a { left: 12px; }.newyear-snowman-head .eye-b { right: 12px; }
.newyear-snowman-head .nose { position: absolute; left: 22px; top: 21px; width: 18px; height: 5px; background: #f68a32; clip-path: polygon(0 0,100% 50%,0 100%); }
.newyear-snowman-hat {
  left: 39px; bottom: 136px; width: 43px; height: 18px; border-radius: 3px 3px 1px 1px;
  background: #17303d; border-bottom: 5px solid #243f4c;
  animation: snowmanHatBreak 13s ease-in-out infinite;
}
.newyear-snowman-arm { width: 34px; height: 2px; bottom: 86px; background: #70543d; transform-origin: center; }
.newyear-snowman-arm--left { left: 6px; transform: rotate(20deg); animation: snowmanArmLeft 13s ease-in-out infinite; }
.newyear-snowman-arm--right { right: -5px; transform: rotate(-22deg); animation: snowmanArmRight 13s ease-in-out infinite; }
@keyframes snowmanHeadBreak { 0%,38%,78%,100%{transform:translate3d(0,0,0) rotate(0)} 49%,63%{transform:translate3d(18px,24px,0) rotate(52deg)} }
@keyframes snowmanMiddleBreak { 0%,38%,78%,100%{transform:translate3d(0,0,0) rotate(0)} 49%,63%{transform:translate3d(-14px,14px,0) rotate(-19deg)} }
@keyframes snowmanBottomBreak { 0%,38%,78%,100%{transform:translate3d(0,0,0)} 49%,63%{transform:translate3d(5px,4px,0) scale(.96)} }
@keyframes snowmanHatBreak { 0%,38%,78%,100%{transform:translate3d(0,0,0) rotate(0)} 49%,63%{transform:translate3d(28px,38px,0) rotate(72deg)} }
@keyframes snowmanArmLeft { 0%,38%,78%,100%{transform:rotate(20deg)} 49%,63%{transform:translate3d(-10px,18px,0) rotate(78deg)} }
@keyframes snowmanArmRight { 0%,38%,78%,100%{transform:rotate(-22deg)} 49%,63%{transform:translate3d(11px,20px,0) rotate(-82deg)} }
.newyear-snowbank { position: absolute; bottom: -26px; height: 75px; border-radius: 50%; background: rgba(225,246,255,.07); filter: blur(.3px); }
.newyear-snowbank--left { left: -16%; width: 64%; transform: rotate(4deg); }
.newyear-snowbank--right { right: -14%; width: 70%; transform: rotate(-3deg); }

.newyear-click-sparkles { width: 1px; height: 1px; }
.newyear-click-sparkles i {
  position: absolute;
  left: 0; top: 0;
  font-style: normal;
  font-size: 13px;
  color: #dff8ff;
  text-shadow: 0 0 8px rgba(111,224,255,.7), 0 0 14px rgba(255,225,108,.35);
  opacity: 0;
  will-change: transform, opacity;
  animation: newyearSparklePop 1.05s ease-out calc(var(--i) * 32ms) 1 both;
}
.newyear-intro-sparkles i { font-size: 18px; animation-duration: 1.9s; }
@keyframes newyearSparklePop {
  0% { opacity: 0; transform: rotate(calc(var(--i) * 49deg)) translateY(0) scale(.35); }
  18% { opacity: .95; }
  100% { opacity: 0; transform: rotate(calc(var(--i) * 49deg)) translateY(-46px) scale(1.12); }
}

@media (max-width: 520px) {
  .newyear-garland { top: max(63px, calc(env(safe-area-inset-top) + 43px)); }
  .newyear-snowman { right: -28px; bottom: 67px; transform: scale(.73); opacity: .13; }
  .newyear-santa { font-size: 21px; opacity: .23; }
}

/* Единый выключатель сезонного motion + системное Reduce Motion. */
html.seasonal-no-motion .halloween-decor *,
html.seasonal-no-motion .newyear-decor *,
html.seasonal-no-motion .halloween-intro-bats *,
html.seasonal-no-motion .halloween-click-eyes *,
html.seasonal-no-motion .newyear-click-sparkles * {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
}
@media (prefers-reduced-motion: reduce) {
  .theme-new-year .newyear-decor *,
  .theme-new-year .newyear-click-sparkles *,
  .theme-halloween .halloween-intro-bats *,
  .theme-halloween .halloween-click-eyes * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* =========================================================
   HALLOWEEN CINEMATIC V2
   Художественная тема: глубокая сцена, стекло, свет и настоящая
   перспектива вместо «декора-наклеек». Этот блок намеренно идёт
   после первой Halloween-темы и переопределяет только её.
   ========================================================= */

body.theme-halloween {
  --h2-orange: #ff8b2b;
  --h2-orange-hot: #ff5a12;
  --h2-amber: #ffc264;
  --h2-purple: #7c3db6;
  --h2-surface: rgba(17, 10, 20, .78);
  --h2-surface-strong: rgba(18, 10, 21, .91);
  --h2-line: rgba(255, 132, 39, .24);
  --h2-line-soft: rgba(255, 132, 39, .13);
  --h2-shadow: 0 18px 50px rgba(0,0,0,.44);
  background: #050306;
  color-scheme: dark;
}

body.theme-halloween::before,
body.theme-halloween::after {
  display: none;
}

.theme-halloween .app {
  isolation: isolate;
  background: transparent;
}

/* --- сцена --- */
.halloween-decor--v2 {
  z-index: 0;
  contain: strict;
  background: #050306;
}
.halloween-scene-back {
  position: absolute;
  inset: -3%;
  background:
    linear-gradient(180deg, rgba(0,0,0,.02), rgba(2,1,3,.18) 44%, rgba(2,1,3,.70) 84%, #020102 100%),
    url('/static/assets/halloween/cinematic-scene.svg') center top / cover no-repeat;
  filter: saturate(.96) contrast(1.06) brightness(.87);
  transform: scale(1.035);
}
.halloween-scene-vignette {
  position:absolute;
  inset:0;
  background:
    radial-gradient(ellipse at 50% 32%, transparent 0 28%, rgba(0,0,0,.10) 52%, rgba(0,0,0,.57) 100%),
    linear-gradient(90deg, rgba(0,0,0,.38), transparent 18%, transparent 82%, rgba(0,0,0,.38));
}
.halloween-scene-light {
  position:absolute;
  border-radius:50%;
  /* A radial gradient is far cheaper to composite than a large blurred blend layer. */
  filter:none;
  mix-blend-mode:normal;
  opacity:.18;
}
.halloween-scene-light--a {
  width:64vw; height:46vw; max-width:520px; max-height:390px;
  right:-18vw; top:12vh;
  background:radial-gradient(ellipse, rgba(255,108,25,.58) 0%, rgba(255,108,25,.26) 32%, transparent 72%);
}
.halloween-scene-light--b {
  width:58vw; height:50vw; max-width:500px; max-height:430px;
  left:-26vw; top:42vh;
  background:radial-gradient(ellipse, rgba(106,48,162,.48) 0%, rgba(106,48,162,.22) 32%, transparent 72%);
  opacity:.13;
}

.halloween-web { opacity:.09; width:132px; height:132px; filter:none; }
.halloween-web--left { top:calc(env(safe-area-inset-top) + 54px); left:-12px; }
.halloween-web--right { top:36%; right:-28px; }

/* --- меньше объектов, но каждый читается как часть сцены --- */
.halloween-ambient-bat {
  opacity:.20;
  width:68px;
  top:20%;
  left:-90px;
  animation-duration:28s;
  filter:drop-shadow(0 8px 12px rgba(0,0,0,.8));
}
.halloween-ambient-bat--2 {
  top:39%;
  width:48px;
  opacity:.13;
  animation-duration:34s;
  animation-delay:-13s;
}
.halloween-ambient-bat--3,
.halloween-ambient-bat--4 { display:none; }

.halloween-bat-svg {
  color:#030204;
  overflow:visible;
  filter:drop-shadow(0 8px 14px rgba(0,0,0,.8));
}
.halloween-bat-wing-fill {
  fill:url(#batMembrane);
  stroke:#2c202a;
  stroke-width:1.35;
}
.halloween-bat-wing-bone {
  fill:none;
  stroke:#5a3f4e;
  stroke-width:1.15;
  opacity:.38;
  stroke-linecap:round;
}
.halloween-bat-body { fill:#030204; stroke:#251a24; stroke-width:1.2; }
.halloween-bat-head { fill:#020102; }
.halloween-bat-chest { fill:#120b13; opacity:.78; }
.halloween-bat-eye {
  fill:#ff3b0d;
  filter:drop-shadow(0 0 3px #ff2c00) drop-shadow(0 0 7px rgba(255,65,0,.8));
}
.halloween-bat-wing { transform-box:fill-box; will-change:transform; }
.halloween-bat-wing--left {
  transform-origin:100% 62%;
  animation:h2WingLeft .31s cubic-bezier(.44,.05,.56,.95) infinite alternate;
}
.halloween-bat-wing--right {
  transform-origin:0% 62%;
  animation:h2WingRight .31s cubic-bezier(.44,.05,.56,.95) infinite alternate;
}
@keyframes h2WingLeft {
  from { transform:rotate(-2deg) scaleY(1); }
  to { transform:rotate(20deg) scaleY(.46) skewY(4deg); }
}
@keyframes h2WingRight {
  from { transform:rotate(2deg) scaleY(1); }
  to { transform:rotate(-20deg) scaleY(.46) skewY(-4deg); }
}

/* Скелет — видимый персонаж, но за рабочим интерфейсом */
.halloween-skeleton {
  opacity:.22;
  width:166px;
  filter:drop-shadow(0 18px 24px rgba(0,0,0,.82));
  animation:h2SkeletonBreathe 9s ease-in-out infinite;
}
.halloween-skeleton--right {
  right:-88px;
  bottom:84px;
  top:auto;
  transform:scaleX(-1) rotate(3deg);
}
.halloween-skeleton--left {
  left:-94px;
  top:55%;
  width:142px;
  transform:rotate(7deg);
  opacity:.12;
  animation-delay:-4.2s;
}
.halloween-skeleton-svg .bone-fill { fill:#cbc1b7; stroke:#665d61; stroke-width:1.25; }
.halloween-skeleton-svg .jaw { fill:#b3aaa2; stroke:#5d5559; }
.halloween-skeleton-svg .bone-line { stroke:#c9c0b7; }
.halloween-skeleton-svg .socket { fill:#090508; }
.halloween-skeleton-svg .skeleton-eye-glow {
  fill:#ff4611;
  filter:drop-shadow(0 0 5px #ff2e00) drop-shadow(0 0 12px rgba(255,60,0,.7));
}
.halloween-skeleton.is-reacting { opacity:.34; }
@keyframes h2SkeletonBreathe {
  0%,100% { translate:0 10px; }
  50% { translate:0 -7px; }
}

.halloween-pumpkin-cluster {
  position:absolute;
  left:-34px;
  bottom:52px;
  width:190px;
  opacity:.38;
  filter:drop-shadow(0 16px 30px rgba(0,0,0,.78));
  transform:rotate(1deg);
}

.halloween-embers { position:absolute; inset:0; overflow:hidden; }
.halloween-ember {
  position:absolute;
  left:calc(var(--x) * 1%);
  top:calc(var(--y) * 1%);
  width:var(--size); height:var(--size);
  border-radius:50%;
  background:#ff8a27;
  box-shadow:0 0 8px rgba(255,81,0,.95);
  opacity:0;
  animation:h2EmberFloat var(--dur) ease-in-out var(--delay) infinite;
}
@keyframes h2EmberFloat {
  0%,100% { opacity:0; transform:translate3d(0,18px,0) scale(.5); }
  20% { opacity:.45; }
  70% { opacity:.16; }
  92% { opacity:0; transform:translate3d(9px,-72px,0) scale(1.25); }
}

.halloween-fog {
  border-radius:50%;
  background:radial-gradient(ellipse, rgba(212,183,212,.7) 0%, rgba(212,183,212,.3) 35%, transparent 72%);
  filter:none;
  opacity:.055;
  animation:h2Fog 18s ease-in-out infinite alternate;
}
.halloween-fog--1 { width:92vw; height:128px; left:-42vw; bottom:20%; }
.halloween-fog--2 { width:88vw; height:112px; right:-42vw; top:42%; animation-delay:-7s; }
.halloween-fog--3 { width:110vw; height:92px; left:-8vw; bottom:2%; animation-delay:-12s; opacity:.04; }
@keyframes h2Fog { from{transform:translate3d(-7vw,8px,0) scale(.92)} to{transform:translate3d(15vw,-5px,0) scale(1.12)} }

/* --- интерфейс теперь не «поверх картинки», а часть одной сцены --- */
.theme-halloween .topbar {
  background:linear-gradient(180deg, rgba(7,4,9,.985), rgba(10,5,12,.975));
  border-bottom:1px solid rgba(255,130,36,.17);
  box-shadow:0 16px 42px rgba(0,0,0,.34), inset 0 -1px 0 rgba(255,149,62,.035);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
.theme-halloween .topbar::after {
  height:1px;
  background:linear-gradient(90deg, transparent 4%, rgba(255,101,17,.06), rgba(255,143,44,.82) 42%, rgba(112,48,157,.48) 72%, transparent 96%);
  box-shadow:0 0 14px rgba(255,105,18,.22);
}
.theme-halloween .brand-title {
  letter-spacing:.01em;
  text-shadow:0 2px 12px rgba(0,0,0,.8);
}
.theme-halloween .brand-title::after {
  width:6px; height:6px; margin-left:8px; vertical-align:2px;
  background:#ff741d;
  box-shadow:0 0 9px #ff5f0e, 0 0 18px rgba(255,95,14,.5);
}
.theme-halloween .brand-subtitle { color:#9a8f9d; }
.theme-halloween .icon-button,
.theme-halloween .close {
  background:linear-gradient(145deg, rgba(40,23,43,.76), rgba(16,9,18,.92));
  border:1px solid rgba(255,135,39,.16);
  box-shadow:0 10px 28px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.025);
}

.theme-halloween .content {
  background:linear-gradient(180deg, rgba(5,3,6,.08), rgba(5,3,6,.26) 70%, rgba(5,3,6,.38));
}

.theme-halloween .card,
.theme-halloween .stat,
.theme-halloween .list-item,
.theme-halloween .route-point-item,
.theme-halloween .transaction-detail-summary,
.theme-halloween .transaction-detail-section,
.theme-halloween .ep-moysklad-candidate,
.theme-halloween .ep-existing-payment,
.theme-halloween .ep-recent-documents,
.theme-halloween .ep-sync-context-box,
.theme-halloween .ep-sync-notice,
.theme-halloween .ep-remember-choice {
  background:
    radial-gradient(circle at 90% -12%, rgba(119,51,158,.13), transparent 35%),
    linear-gradient(145deg, rgba(29,16,32,.97), rgba(13,8,15,.985));
  border:1px solid rgba(255,130,37,.19);
  box-shadow:
    0 20px 46px rgba(0,0,0,.34),
    0 1px 0 rgba(255,255,255,.025) inset,
    0 0 0 1px rgba(114,50,150,.025) inset;
  /* Do not sample/blur the moving backdrop for EVERY list row. */
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
.theme-halloween .card::after,
.theme-halloween .stat::after { display:none; }
.theme-halloween .card::before,
.theme-halloween .stat::before,
.theme-halloween .list-item::before,
.theme-halloween .transaction-detail-section::before {
  content:"";
  position:absolute;
  left:16px; right:16px; top:0;
  height:1px;
  background:linear-gradient(90deg, transparent, rgba(255,153,64,.22), transparent);
  pointer-events:none;
}

.theme-halloween .hero {
  background:
    radial-gradient(circle at 74% 22%, rgba(255,117,25,.14), transparent 31%),
    radial-gradient(circle at 18% 100%, rgba(115,51,161,.16), transparent 38%),
    linear-gradient(145deg, rgba(38,19,34,.88), rgba(15,8,17,.94));
  border:1px solid rgba(255,131,35,.28);
  box-shadow:
    0 24px 58px rgba(0,0,0,.42),
    0 0 36px rgba(255,93,12,.045),
    inset 0 1px 0 rgba(255,188,102,.055);
}
.theme-halloween .hero::before {
  right:-20px; bottom:-30px; width:150px; height:150px;
  border-radius:50%; opacity:.22;
  background:radial-gradient(circle, rgba(255,116,27,.48) 0, rgba(255,116,27,.10) 34%, transparent 68%);
  filter:blur(4px);
}
.theme-halloween .big-balance { text-shadow:0 5px 28px rgba(0,0,0,.72), 0 0 24px rgba(255,123,32,.08); }

.theme-halloween .section-head h2,
.theme-halloween .modal-title {
  font-family:Georgia, 'Times New Roman', serif;
  letter-spacing:.005em;
  font-weight:700;
  text-shadow:0 4px 18px rgba(0,0,0,.65), 0 0 22px rgba(255,112,20,.07);
}

.theme-halloween .primary {
  background:
    linear-gradient(180deg, rgba(255,178,80,.18), transparent 30%),
    linear-gradient(135deg, #ff941f, #ff6710 58%, #de3e08);
  color:#160904;
  border:1px solid rgba(255,202,124,.30);
  box-shadow:
    0 14px 30px rgba(255,84,7,.22),
    0 0 24px rgba(255,105,14,.09),
    inset 0 1px 0 rgba(255,236,197,.30);
  text-shadow:0 1px 0 rgba(255,226,181,.18);
}
.theme-halloween .secondary {
  background:linear-gradient(145deg, rgba(67,30,76,.38), rgba(35,15,27,.72));
  border:1px solid rgba(255,128,35,.23);
  color:#ff9b40;
  box-shadow:0 12px 28px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.02);
}
.theme-halloween .bottom-nav {
  background:linear-gradient(180deg, rgba(13,7,15,.97), rgba(7,4,9,.99));
  border-top:1px solid rgba(255,126,32,.18);
  box-shadow:0 -16px 44px rgba(0,0,0,.42);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
.theme-halloween .nav-item { color:#9d929f; }
.theme-halloween .nav-item.active {
  color:#ff9b3b;
  background:radial-gradient(circle at 50% 22%, rgba(255,120,23,.16), rgba(255,120,23,.04) 58%, transparent 72%);
}
.theme-halloween .nav-item.active::after {
  background:#ff7919;
  box-shadow:0 0 8px #ff5c0d, 0 0 18px rgba(255,95,12,.48);
}

.theme-halloween .modal-backdrop {
  background:rgba(2,1,3,.82);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
.theme-halloween .modal {
  background:
    radial-gradient(circle at 76% -8%, rgba(100,44,135,.16), transparent 31%),
    linear-gradient(180deg, rgba(23,12,27,.96), rgba(9,5,11,.985));
  border-top:1px solid rgba(255,133,38,.24);
  box-shadow:0 -30px 90px rgba(0,0,0,.70), 0 0 44px rgba(255,93,11,.035);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
.theme-halloween .modal::before {
  width:58px;
  height:4px;
  background:linear-gradient(90deg, #7d3cad, #ff7b1e 72%, #ffc16a);
  box-shadow:0 0 14px rgba(255,104,19,.30);
}

.theme-halloween .field input,
.theme-halloween .field textarea,
.theme-halloween .field select,
.theme-halloween .search input {
  background:rgba(8,5,10,.76);
  border-color:rgba(255,128,33,.17);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.018);
}
.theme-halloween .field:focus-within input,
.theme-halloween .field:focus-within textarea,
.theme-halloween .field:focus-within select,
.theme-halloween .search input:focus {
  border-color:rgba(255,143,43,.58);
  box-shadow:0 0 0 3px rgba(255,105,17,.08), 0 14px 34px rgba(0,0,0,.28), 0 0 20px rgba(255,89,8,.06);
}

/* Status/синхронизация: свет будто изнутри карточки */
.theme-halloween .ep-sync-badge--synced,
.theme-halloween .badge.success {
  background:linear-gradient(145deg, rgba(33,135,80,.19), rgba(16,75,48,.12));
  border:1px solid rgba(62,218,127,.13);
  color:#55d88d;
  box-shadow:0 0 22px rgba(47,183,105,.07);
}
.theme-halloween .ep-sync-badge--pending,
.theme-halloween .ep-sync-error {
  background:linear-gradient(145deg, rgba(132,28,39,.15), rgba(62,14,26,.11));
  border-color:rgba(255,74,80,.24);
}
.theme-halloween .transaction-detail-summary .amount.in,
.theme-halloween .amount.in { text-shadow:0 0 18px rgba(61,218,121,.13); }
.theme-halloween .transaction-detail-summary .amount.out,
.theme-halloween .amount.out { text-shadow:0 0 18px rgba(255,72,77,.12); }

/* success/confirm экран получает почти «постерную» сцену */
.theme-halloween .action-confirm {
  position:relative;
  overflow:hidden;
  border-radius:22px;
  padding:26px 18px 22px;
  background:
    radial-gradient(circle at 50% 10%, rgba(255,127,30,.15), transparent 34%),
    linear-gradient(180deg, rgba(31,16,29,.66), rgba(10,6,12,.84));
  border:1px solid rgba(255,133,39,.17);
}
.theme-halloween .action-confirm::before {
  content:"";
  position:absolute; inset:auto -18% -45px -18%; height:130px;
  background:radial-gradient(ellipse, rgba(218,185,222,.11), transparent 68%);
  filter:blur(16px);
}
.theme-halloween .action-confirm-icon {
  width:68px; height:68px;
  background:radial-gradient(circle, rgba(255,137,35,.24), rgba(255,88,9,.10) 54%, rgba(0,0,0,.24));
  border:1px solid rgba(255,171,74,.26);
  box-shadow:0 0 25px rgba(255,91,8,.15), inset 0 0 22px rgba(255,120,18,.10);
}

/* --- intro: слой не превращается в «стикеры поверх интерфейса» --- */
.halloween-cinematic-intro {
  position:fixed;
  inset:0;
  z-index:10020;
  overflow:hidden;
  pointer-events:none;
  perspective:900px;
  transform-style:preserve-3d;
}
.halloween-intro-dim {
  position:absolute; inset:0;
  background:radial-gradient(circle at 54% 33%, rgba(255,94,8,.055), rgba(0,0,0,.20) 35%, rgba(0,0,0,.63) 100%);
  opacity:0;
}
.halloween-intro-depth {
  position:absolute;
  left:54%; top:33%;
  width:5px; height:5px;
  border-radius:50%;
  transform:translate(-50%,-50%);
  box-shadow:0 0 80px 28px rgba(255,75,5,.10), 0 0 140px 60px rgba(91,35,125,.07);
}
.halloween-intro-glow {
  position:absolute;
  left:54%; top:33%;
  width:62px; height:62px;
  border-radius:50%;
  transform:translate(-50%,-50%) scale(.2);
  background:radial-gradient(circle, rgba(255,184,78,.46), rgba(255,75,5,.14) 28%, rgba(105,40,137,.10) 48%, transparent 72%);
  filter:blur(3px);
  opacity:0;
}
.halloween-intro-bat-v2 {
  position:absolute;
  transform-origin:50% 50%;
  will-change:transform, opacity;
  /* Overrides animated blur on weak GPUs, leaving the flight itself untouched. */
  filter:none !important;
}
.halloween-intro-bat-v2 .halloween-bat-svg--intro-v2 {
  width:100%;
  display:block;
  filter:none;
}
.halloween-intro-bat-v2--hero {
  z-index:4;
}
.halloween-intro-bat-v2--hero .halloween-bat-eye {
  fill:#ff2807;
  filter:drop-shadow(0 0 5px #ff2500) drop-shadow(0 0 14px rgba(255,46,0,.92));
}
.halloween-intro-bat-v2--hero .halloween-bat-wing--left,
.halloween-intro-bat-v2--hero .halloween-bat-wing--right {
  animation-duration:.24s;
}

/* Нажатие: глаза остаются редким, локальным эффектом, а не постоянным декором */
.halloween-click-eyes {
  z-index:10010;
  filter:drop-shadow(0 7px 12px rgba(0,0,0,.74));
}
.halloween-click-eyes > i {
  width:17px; height:10px;
  background:linear-gradient(180deg,#ffd25f,#ff5b15 56%,#d52700);
  box-shadow:0 0 12px rgba(255,56,0,.84),0 0 26px rgba(255,69,0,.30);
}

/* На небольших экранах сцена остаётся атмосферной, но не съедает контент. */
@media (max-width: 520px) {
  .halloween-scene-back { background-position:58% top; }
  .halloween-web { width:102px; height:102px; opacity:.065; }
  .halloween-skeleton--left { display:none; }
  .halloween-skeleton--right { width:146px; right:-84px; bottom:78px; opacity:.16; }
  .halloween-pumpkin-cluster { width:152px; left:-45px; bottom:58px; opacity:.28; }
  .halloween-ambient-bat { width:54px; opacity:.13; }
  .halloween-ambient-bat--2 { width:39px; opacity:.10; }
  .theme-halloween .card,
  .theme-halloween .stat,
  .theme-halloween .list-item,
  .theme-halloween .transaction-detail-summary,
  .theme-halloween .transaction-detail-section {
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
  }
}

html.halloween-no-motion .halloween-scene-back,
html.halloween-no-motion .halloween-skeleton,
html.halloween-no-motion .halloween-ambient-bat,
html.halloween-no-motion .halloween-fog,
html.halloween-no-motion .halloween-ember,
html.halloween-no-motion .halloween-bat-wing,
html.halloween-no-motion .halloween-eyes {
  animation:none !important;
}

/* Cinematic success moment after MoySklad sync */
.halloween-sync-success {
  position:fixed;
  inset:0;
  z-index:10040;
  pointer-events:none;
  overflow:hidden;
  opacity:0;
  transition:opacity .24s ease;
}
.halloween-sync-success.is-visible { opacity:1; }
.halloween-sync-success.is-leaving { opacity:0; transition-duration:.5s; }
.halloween-sync-success__shade {
  position:absolute; inset:0;
  background:
    radial-gradient(circle at 50% 58%, rgba(255,109,18,.10), transparent 28%),
    rgba(2,1,3,.76);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
}
.halloween-sync-success__fog {
  position:absolute;
  width:90vw; height:140px;
  max-width:720px;
  border-radius:50%;
  background:#c9afcf;
  filter:blur(48px);
  opacity:.12;
  animation:h2SuccessFog 2s ease-in-out both;
}
.halloween-sync-success__fog--a { left:-30vw; bottom:16%; }
.halloween-sync-success__fog--b { right:-32vw; bottom:6%; animation-delay:.15s; }
@keyframes h2SuccessFog { from{transform:translateX(-12vw) scale(.8);opacity:0} 35%{opacity:.13} to{transform:translateX(28vw) scale(1.2);opacity:0} }
.halloween-sync-success__skeleton {
  position:absolute;
  left:50%;
  bottom:-36px;
  width:min(52vw, 220px);
  transform:translateX(-126%) translateY(70px) rotate(-5deg);
  opacity:0;
  filter:drop-shadow(0 22px 30px rgba(0,0,0,.86));
  animation:h2SuccessSkeleton 1.85s cubic-bezier(.16,.75,.17,1) .08s both;
}
.halloween-sync-success__skeleton .halloween-skeleton-svg { width:100%; }
@keyframes h2SuccessSkeleton {
  0% { opacity:0; transform:translateX(-126%) translateY(80px) rotate(-8deg); }
  24%,75% { opacity:.92; transform:translateX(-126%) translateY(0) rotate(-3deg); }
  100% { opacity:0; transform:translateX(-126%) translateY(24px) rotate(-5deg); }
}
.halloween-sync-success__board {
  position:absolute;
  left:50%; top:52%;
  width:min(72vw, 310px);
  transform:translate(-50%,-50%) scale(.72) rotate(-1.5deg);
  padding:24px 24px 22px;
  text-align:center;
  border-radius:20px;
  color:#ffc171;
  background:
    linear-gradient(180deg, rgba(255,157,61,.08), transparent 32%),
    linear-gradient(145deg, rgba(42,19,17,.96), rgba(15,8,11,.98));
  border:1px solid rgba(255,131,31,.40);
  box-shadow:
    0 28px 70px rgba(0,0,0,.72),
    0 0 36px rgba(255,86,6,.14),
    inset 0 1px 0 rgba(255,214,151,.08);
  opacity:0;
  animation:h2SuccessBoard 1.75s cubic-bezier(.18,.82,.16,1) .15s both;
}
.halloween-sync-success__board::before,
.halloween-sync-success__board::after {
  content:"";
  position:absolute;
  top:10px; bottom:10px;
  width:6px;
  border:1px solid rgba(255,118,23,.28);
  border-left:0; border-right:0;
}
.halloween-sync-success__board::before { left:9px; }
.halloween-sync-success__board::after { right:9px; }
.halloween-sync-success__check {
  width:58px; height:58px;
  display:grid; place-items:center;
  margin:0 auto 12px;
  border-radius:50%;
  font:900 34px/1 system-ui, sans-serif;
  color:#ffd191;
  border:2px solid rgba(255,137,34,.70);
  box-shadow:0 0 18px rgba(255,98,12,.34), inset 0 0 24px rgba(255,98,12,.11);
}
.halloween-sync-success__board strong {
  font-family:Georgia, 'Times New Roman', serif;
  font-size:clamp(22px, 6.5vw, 30px);
  line-height:1.06;
  text-shadow:0 0 18px rgba(255,97,10,.25);
}
@keyframes h2SuccessBoard {
  0% { opacity:0; transform:translate(-50%,-42%) scale(.68) rotate(-3deg); filter:blur(3px); }
  24%,78% { opacity:1; transform:translate(-50%,-50%) scale(1) rotate(-1deg); filter:blur(0); }
  100% { opacity:0; transform:translate(-50%,-56%) scale(.96) rotate(0); filter:blur(1px); }
}

/* A little more of the cinematic scene lives inside the main home card */
.theme-halloween .hero {
  background-image:
    linear-gradient(90deg, rgba(26,13,25,.93) 0%, rgba(21,10,18,.88) 52%, rgba(9,5,10,.74) 100%),
    url('/static/assets/halloween/cinematic-scene.svg');
  background-size:auto, 148% auto;
  background-position:center, 69% 22%;
  background-repeat:no-repeat;
}

html.halloween-no-motion .halloween-sync-success,
html.halloween-no-motion .halloween-sync-success * {
  animation:none !important;
  transition:none !important;
}

/* =========================================================
   Desktop / полноэкранный режим
   На телефоне сохраняются прежние пропорции, а на широком экране CashControl
   перестаёт выглядеть как узкая телефонная колонка посреди пустого viewport.
   ========================================================= */
@media (min-width: 900px) {
  .app {
    width: min(1180px, calc(100% - 40px));
    max-width: 1180px;
  }

  .topbar {
    padding-left: 22px;
    padding-right: 22px;
    border-left: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
    border-right: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  }

  .content {
    padding: 20px 24px 108px;
  }

  .bottom-nav {
    width: min(1180px, calc(100% - 40px));
    padding-left: 14px;
    padding-right: 14px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
  }

  .nav-item {
    flex-basis: 86px;
  }

  .nav-item small {
    max-width: 94px;
    font-size: 10px;
  }

  .modal-backdrop:not(.modal-backdrop--fullscreen) {
    align-items: center;
    padding: 24px;
  }

  .modal-backdrop:not(.modal-backdrop--fullscreen) .modal {
    width: min(900px, calc(100vw - 48px));
    border-radius: 24px;
    max-height: min(88vh, 920px);
    padding: 18px 20px 22px;
  }

  .camera-modal {
    width: min(920px, calc(100vw - 48px));
  }

  /* Декорации темы остаются вокруг рабочего контейнера, а не разъезжаются
     по краям огромного монитора. */
  .theme-halloween .halloween-skeleton--right {
    right: max(18px, calc((100vw - 1180px) / 2 - 76px));
  }
  .theme-halloween .halloween-skeleton--left {
    left: max(18px, calc((100vw - 1180px) / 2 - 70px));
  }
  .theme-halloween .halloween-pumpkin-cluster {
    left: max(-18px, calc((100vw - 1180px) / 2 - 88px));
  }
  .theme-halloween .halloween-scene-light--a {
    right: max(-120px, calc((100vw - 1180px) / 2 - 220px));
  }
  .theme-halloween .halloween-scene-light--b {
    left: max(-180px, calc((100vw - 1180px) / 2 - 250px));
  }
}

@media (min-width: 1280px) {
  .app {
    width: min(1240px, calc(100% - 64px));
    max-width: 1240px;
  }
  .bottom-nav {
    width: min(1240px, calc(100% - 64px));
  }
  .content {
    padding-left: 30px;
    padding-right: 30px;
  }
  .theme-halloween .halloween-scene-back {
    /* Не растягиваем иллюстрацию бесконечно на 2K/4K: сохраняем композицию. */
    background-size: max(1500px, 100vw) auto;
    background-position: center top;
  }
}

/* =========================================================
   Browser Telegram login / access denied
   ========================================================= */
.browser-gate {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(circle at 50% -10%, rgba(28,106,168,.22), transparent 42%),
    radial-gradient(circle at 85% 90%, rgba(35,153,101,.13), transparent 38%),
    #0a0d12;
  color: #f7f8fb;
}

.browser-gate__ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .55;
  background:
    linear-gradient(115deg, transparent 15%, rgba(255,255,255,.025) 42%, transparent 62%),
    radial-gradient(circle at 25% 20%, rgba(58,164,255,.10), transparent 28%);
}

.browser-gate__card {
  position: relative;
  width: min(460px, 100%);
  padding: 34px 30px 30px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(28,34,44,.92), rgba(12,15,21,.97));
  box-shadow: 0 32px 90px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  text-align: center;
}

.browser-gate__logo {
  width: 78px;
  height: 78px;
  margin: 0 auto 18px;
  border-radius: 23px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  box-shadow: 0 14px 36px rgba(0,0,0,.35);
}
.browser-gate__logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.browser-gate__eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #81c7ff; }
.browser-gate h1 { margin: 8px 0 10px; font-size: clamp(27px, 5vw, 36px); line-height: 1.08; }
.browser-gate p { margin: 0 auto 24px; max-width: 390px; color: #aeb8c7; line-height: 1.55; font-size: 15px; }

.browser-gate__telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border-radius: 16px;
  color: #fff;
  text-decoration: none;
  font-weight: 850;
  font-size: 16px;
  background: linear-gradient(135deg, #2aabee, #1788d3);
  box-shadow: 0 16px 34px rgba(25,145,218,.25), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .18s ease, filter .18s ease;
}
.browser-gate__telegram:hover { transform: translateY(-1px); filter: brightness(1.06); }
.browser-gate__telegram:active { transform: scale(.985); }
.browser-gate__telegram-icon {
  width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.16); font-size: 15px;
}
.browser-gate__hint { margin-top: 15px; color: #778395; font-size: 12px; line-height: 1.5; }
.browser-gate__status {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 15px; border-radius: 14px;
  color: #ff9c9c; background: rgba(174,42,52,.12); border: 1px solid rgba(255,93,103,.20);
  font-size: 13px; font-weight: 750; line-height: 1.4;
}
.browser-gate__status span { width: 9px; height: 9px; flex: none; border-radius: 50%; background: #ff5662; box-shadow: 0 0 12px rgba(255,69,83,.72); }

/* Browser gate наследует сезонное настроение, но не показывает приватный UI. */
.theme-halloween .browser-gate {
  background:
    radial-gradient(circle at 70% 18%, rgba(255,111,24,.18), transparent 36%),
    radial-gradient(circle at 20% 82%, rgba(98,43,137,.17), transparent 38%),
    #050306;
}
.theme-halloween .browser-gate__card {
  border-color: rgba(255,130,35,.20);
  background: linear-gradient(150deg, rgba(31,16,32,.94), rgba(9,5,11,.98));
  box-shadow: 0 34px 100px rgba(0,0,0,.62), 0 0 40px rgba(255,92,12,.05);
}
.theme-halloween .browser-gate__eyebrow { color: #ff9638; }
.theme-new-year .browser-gate {
  background:
    radial-gradient(circle at 25% 10%, rgba(73,166,255,.22), transparent 38%),
    radial-gradient(circle at 78% 82%, rgba(76,224,206,.12), transparent 34%),
    #06101d;
}

@media (max-width: 520px) {
  .browser-gate { padding: 16px; }
  .browser-gate__card { padding: 28px 20px 24px; border-radius: 24px; }
}

/* =========================================================
   Browser auth v2: phone/password + registration
   ========================================================= */
.browser-gate__card { width: min(500px, 100%); }
.browser-auth-form { display: grid; gap: 13px; margin-top: 4px; text-align: left; }
.browser-auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.browser-auth-field { display: grid; gap: 7px; min-width: 0; }
.browser-auth-field > span { color: #aeb8c7; font-size: 12px; font-weight: 800; text-align: left; }
.browser-auth-field input {
  width: 100%; min-width: 0; min-height: 50px; padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.11); border-radius: 14px;
  outline: none; color: #f8fafc; background: rgba(6,9,14,.58);
  font: inherit; font-size: 15px; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.browser-auth-field input:focus {
  border-color: rgba(74,174,255,.58); background: rgba(6,10,17,.82);
  box-shadow: 0 0 0 3px rgba(42,171,238,.10);
}
.browser-gate__primary,
.browser-gate__secondary,
.browser-gate__link {
  appearance: none; -webkit-appearance: none; border: 0; font: inherit; cursor: pointer;
}
.browser-gate__primary {
  display: flex; width: 100%; min-height: 52px; align-items: center; justify-content: center;
  padding: 12px 18px; border-radius: 16px; color: #07101a; font-size: 15px; font-weight: 900;
  background: linear-gradient(135deg, #8bd1ff, #36aef4);
  box-shadow: 0 14px 30px rgba(35,159,229,.20), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}
.browser-gate__primary:not(:disabled):hover { transform: translateY(var(--button-hover-lift)); }
.browser-gate__primary:active { transform: scale(.988); }
.browser-gate__primary:disabled { opacity: .58; cursor: wait; transform: none; }
.browser-gate__secondary {
  display: flex; width: 100%; min-height: 49px; align-items: center; justify-content: center;
  padding: 11px 16px; border-radius: 15px; color: #dbe4ef; font-weight: 850;
  border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.045);
}
.browser-gate__link {
  margin: 16px auto 0; padding: 8px 10px; color: #8dd2ff; background: transparent;
  font-size: 14px; font-weight: 850;
}
.browser-gate__divider { display: flex; align-items: center; gap: 10px; margin: 17px 0; color: #667386; font-size: 12px; }
.browser-gate__divider::before, .browser-gate__divider::after { content:""; height: 1px; flex: 1; background: rgba(255,255,255,.08); }
.browser-gate__error {
  margin: 0 0 14px; padding: 11px 13px; border-radius: 13px; text-align: left;
  color: #ffb1b6; background: rgba(187,45,58,.12); border: 1px solid rgba(255,90,104,.20);
  font-size: 13px; line-height: 1.45;
}
.browser-auth-password-hint { margin: -2px 2px 2px; color: #778395; font-size: 11px; line-height: 1.45; }
.browser-gate__actions { display: grid; gap: 10px; margin-top: 18px; }

.theme-halloween .browser-auth-field input {
  border-color: rgba(255,132,42,.15); background: rgba(10,5,12,.68);
}
.theme-halloween .browser-auth-field input:focus { border-color: rgba(255,139,50,.55); box-shadow: 0 0 0 3px rgba(255,112,22,.09); }
.theme-halloween .browser-gate__primary { color: #1d0e03; background: linear-gradient(135deg, #ffb44f, #ff7417); box-shadow: 0 15px 34px rgba(255,105,18,.20); }
.theme-halloween .browser-gate__link { color: #ffad57; }

.theme-new-year .browser-gate__primary { color: #04131e; background: linear-gradient(135deg, #8fe8ff, #5ab8ff); }

/* =========================================================
   Profile v2: view mode + explicit editing/password actions
   ========================================================= */
.profile-data-list { display: grid; margin-top: 4px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.profile-data-row { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr); gap: 14px; align-items: center; padding: 13px 14px; background: color-mix(in srgb, var(--surface-2) 72%, transparent); }
.profile-data-row + .profile-data-row { border-top: 1px solid var(--border); }
.profile-data-row span { color: var(--muted); font-size: 12px; font-weight: 700; }
.profile-data-row strong { min-width: 0; text-align: right; overflow-wrap: anywhere; font-size: 14px; }
.profile-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.profile-action-link { text-decoration: none; display: flex; align-items: center; justify-content: center; }
.profile-actions > :last-child:nth-child(3) { grid-column: 1 / -1; }
.password-policy-note { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 11px; line-height: 1.45; }
.profile-edit-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }

@media (max-width: 520px) {
  .browser-auth-grid, .profile-edit-grid { grid-template-columns: 1fr; }
  .profile-actions { grid-template-columns: 1fr; }
  .profile-actions > :last-child:nth-child(3) { grid-column: auto; }
  .profile-data-row { grid-template-columns: 1fr; gap: 4px; }
  .profile-data-row strong { text-align: left; }
}

/* =========================================================
   Пагинация
   ========================================================= */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 4px;
}
.pagination__button {
  min-width: 104px;
}
.pagination__button:disabled {
  opacity: .45;
  cursor: default;
  transform: none !important;
}
.pagination__status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 420px) {
  .pagination { gap: 6px; }
  .pagination__button { min-width: 92px; padding-left: 10px; padding-right: 10px; }
  .pagination__status { font-size: 11px; }
}

/* =========================================================
   Performance guardrails for touch/mobile devices
   Heavy backdrop blurs are visually expensive in Telegram WebView/iOS Safari.
   The scene stays cinematic, but the most costly real-time filters are lighter.
   ========================================================= */
@media (max-width: 760px) and (pointer: coarse) {
  .theme-halloween .topbar,
  .theme-halloween .bottom-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .theme-halloween .card,
  .theme-halloween .stat,
  .theme-halloween .list-item,
  .theme-halloween .route-point-item,
  .theme-halloween .transaction-detail-summary,
  .theme-halloween .transaction-detail-section,
  .theme-halloween .ep-moysklad-candidate,
  .theme-halloween .ep-existing-payment,
  .theme-halloween .ep-recent-documents,
  .theme-halloween .ep-sync-context-box,
  .theme-halloween .ep-sync-notice,
  .theme-halloween .ep-remember-choice {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .theme-halloween .modal {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .theme-halloween .modal-backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .halloween-fog { filter: blur(38px); }
}


/* Тяжёлые blurred pseudo-layers отключены и в сезонных темах: глубина остаётся
   за счёт фоновых градиентов и специализированной сцены темы. */
body.theme-halloween::before, body.theme-halloween::after,
body.theme-new-year::before, body.theme-new-year::after { display: none !important; }

/* Базовые performance guardrails для touch/WebView. */
@media (max-width: 760px) and (pointer: coarse) {
  .topbar, .bottom-nav {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  #main > * { animation-duration: .18s; }
}


/* =========================================================
   Audit 2026-10-05: accessibility, compact navigation, forms
   ========================================================= */
:root {
  --status-success-text: #0a6b3c;
  --status-warning-text: #7a4a00;
  --status-danger-text: #a3172a;
}

.icon-button,
.close {
  min-width: 44px;
  min-height: 44px;
}

.bottom-nav {
  overflow-x: hidden;
  justify-content: stretch;
}

.nav-item {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
}

.nav-item small {
  font-size: 11px;
  max-width: 76px;
}

.nav-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.badge.success {
  color: var(--status-success-text);
  background: color-mix(in srgb, var(--success) 18%, var(--surface));
}
.badge.warning {
  color: var(--status-warning-text);
  background: color-mix(in srgb, var(--warning) 22%, var(--surface));
}
.badge.danger {
  color: var(--status-danger-text);
  background: color-mix(in srgb, var(--danger) 18%, var(--surface));
}

.modal-open {
  overflow: hidden;
  /* touch-action:none on body also forbids swiping inside a nested route modal. */
  touch-action: auto;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 16px;
}

.modal-actions > * {
  min-width: 120px;
}

.form-error {
  color: var(--status-danger-text);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border));
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
  margin-bottom: 10px;
}

.segment {
  flex: 1 1 0;
  min-height: 42px;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

.transaction-type-segmented,
.transaction-counterparty-segmented {
  margin-bottom: 0;
}

.transaction-type-segmented .segment {
  min-width: 0;
  padding: 10px 8px;
  font-size: 14px;
}

.transaction-counterparty-segmented .segment {
  min-width: 0;
  padding: 10px 10px;
  font-size: 14px;
}

#counterpartyUserField .suggestions {
  margin-top: 8px;
}

#counterpartyUserMeta {
  margin-top: 6px;
}

.filter-chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: none;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid transparent;
  font-weight: 750;
  white-space: nowrap;
}

.filter-chip.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.transaction-list-item {
  width: 100%;
  text-align: left;
  color: inherit;
}

.transaction-review-card { display: grid; gap: 8px; min-width: 0; }
.transaction-review-card > .transaction-list-item { width: 100%; }
.transaction-review-actions { padding: 0 2px 4px; }
.transaction-review-actions > button { min-width: 0; }

.transaction-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.quick-actions--compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
}

.quick-action-sign {
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

.stats--single {
  grid-template-columns: 1fr;
}

.route-tab-active {
  border-color: var(--accent) !important;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)) !important;
  color: var(--accent) !important;
}

.more-menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 20px;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: inherit;
}

.more-menu-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
  color: var(--accent);
  display: grid;
  place-items: center;
}

.more-menu-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.more-menu-copy { min-width: 0; }
.more-menu-chevron { color: var(--muted); font-size: 28px; line-height: 1; }

@media (prefers-color-scheme: dark) {
  :root {
    --status-success-text: #77e8ad;
    --status-warning-text: #ffd27a;
    --status-danger-text: #ff9eac;
  }
}

@media (max-width: 420px) {
  .nav-item small { font-size: 10.5px; }
  .quick-actions--compact { grid-template-columns: 1fr 1fr; }
}

.primary, .secondary, .danger-button, .link-button { min-height: 44px; }

.suggestion-empty {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

@media (min-width: 1024px) {
  .content {
    scroll-behavior: smooth;
  }
}

/* =========================================================
   Driver route: child delivery points linked to a parent stop
   ========================================================= */
.driver-linked-points-alert {
  margin-top: 14px;
  padding: 14px;
  border: 2px solid color-mix(in srgb, var(--warning) 70%, var(--border));
  border-radius: 16px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--warning) 18%, var(--surface)),
      color-mix(in srgb, var(--accent) 8%, var(--surface))
    );
  box-shadow: 0 8px 22px color-mix(in srgb, var(--warning) 16%, transparent);
}

.driver-linked-points-alert__heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 900;
  color: var(--text);
}

.driver-linked-points-alert__icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--warning) 28%, transparent);
}

.driver-linked-points-alert__list {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}

.driver-linked-points-alert__item {
  padding: 10px 11px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
}

.driver-linked-points-alert__name {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 900;
  color: var(--text);
}

.driver-linked-points-alert__client,
.driver-linked-points-alert__address {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 650;
}

.driver-linked-points-alert--compact {
  margin-top: 9px;
  padding: 10px 11px;
  border-width: 1px;
  box-shadow: none;
}

.driver-linked-points-alert--compact .driver-linked-points-alert__heading {
  font-size: 13px;
}

.driver-linked-points-alert--compact .driver-linked-points-alert__icon {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
  font-size: 14px;
}

.driver-linked-points-alert--compact .driver-linked-points-alert__list {
  margin-top: 7px;
  gap: 5px;
}

.driver-linked-points-alert--compact .driver-linked-points-alert__item {
  padding: 7px 8px;
}

.driver-linked-points-alert--compact .driver-linked-points-alert__name {
  font-size: 13px;
}

/* Seasonal themes keep the alert prominent without hard-coded theme colors. */
.theme-halloween .driver-linked-points-alert {
  border-color: rgba(255, 143, 56, .74);
  background: linear-gradient(135deg, rgba(255, 112, 24, .15), rgba(77, 25, 76, .45));
  box-shadow: 0 8px 24px rgba(255, 103, 20, .13);
}

.theme-new-year .driver-linked-points-alert {
  border-color: rgba(93, 211, 255, .58);
  background: linear-gradient(135deg, rgba(26, 146, 191, .16), rgba(16, 66, 91, .42));
}

/* Route management: preserve scroll while updating individual point rows. */
#managedRoutePoints { overflow-anchor: none; }
#managedRoutePoints .managed-route-point {
  cursor: default;
  transform: none;
  animation: none;
  /* The global 90px intrinsic-size estimate caused jumps for taller route rows. */
  content-visibility: visible;
  contain-intrinsic-size: none;
  transition: background-color .12s ease;
}
.route-point-item { content-visibility: visible; contain-intrinsic-size: none; }
.modal:has(#managedRoutePoints) { overflow-anchor: none; }
#managedRoutePoints .managed-route-point:active { transform: none; }
#managedRoutePoints .managed-route-actions { position: relative; z-index: 1; }
#managedRoutePoints .managed-route-comment { margin-top: 6px; overflow-wrap: anywhere; }
.modal { touch-action: pan-y; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
@media (min-width: 768px) { .modal { scrollbar-gutter: stable; } }
.route-children {
  margin-top: 9px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.route-children summary { cursor: pointer; font-weight: 750; line-height: 1.35; }
.route-children ul { margin: 8px 0 0; padding-left: 16px; }
.route-children li { margin: 4px 0; line-height: 1.35; }
.route-children li span { display: block; color: var(--muted); font-weight: 400; }
.route-point-item[role="button"] { cursor: pointer; }
.route-point-item[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.browser-gate__back { display: inline-flex; width: auto; margin: 0 auto 10px 0; padding: 6px 0; }

/* ================= Рассылка / уведомления ================= */
.topbar { position:relative; }
.notification-bell { position:relative; display:grid; place-items:center; flex-shrink:0; }
.notification-badge {
  position:absolute; top:-4px; right:-5px; display:grid; place-items:center;
  min-width:18px; height:18px; padding:0 4px; border-radius:20px;
  font-size:10px; line-height:1; font-weight:800; color:white; background:var(--danger);
  box-shadow:0 1px 5px rgba(0,0,0,.2);
}
.notification-panel {
  position:absolute; top:calc(100% + 8px); right:10px; z-index:220;
  width:min(390px, calc(100vw - 20px)); max-height:min(72vh, 650px);
  background:var(--surface); color:var(--text); border:1px solid var(--border);
  border-radius:16px; box-shadow:var(--shadow-lg); overflow:hidden;
}
.bc-notification-top { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:14px; border-bottom:1px solid var(--border); }
.bc-notification-scroll { overflow:auto; max-height:min(62vh, 550px); overscroll-behavior:contain; }
.bc-notification { padding:12px 14px; border-bottom:1px solid var(--border); }
.bc-notification.bc-unread { background:color-mix(in srgb,var(--accent) 7%,var(--surface)); border-left:3px solid var(--accent); }
.bc-notification-title { font-size:14px; font-weight:800; margin-bottom:6px; overflow-wrap:anywhere; }
.bc-notification-body { white-space:pre-wrap; font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
.bc-notification-footer { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:8px; color:var(--muted); }
.bc-empty { padding:22px 14px; text-align:center; }
.bc-card .field { display:block; margin-bottom:12px; }
.bc-card .field > span { display:block; margin-bottom:5px; font-weight:700; }
.bc-card .field textarea { width:100%; min-height:135px; resize:vertical; }
.bc-card .field input[type="file"] { width:100%; font-size:13px; padding:10px; }
.bc-card input[type="radio"], .bc-card input[type="checkbox"] { accent-color:var(--accent); }
.bc-chooser { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin:10px 0 16px; }
#bcUserChooser { display:block; }
.bc-check { display:inline-flex; gap:7px; align-items:center; font-size:13px; padding:7px 10px; border:1px solid var(--border); border-radius:10px; background:var(--surface-2); cursor:pointer; }
.bc-chips { display:flex; flex-wrap:wrap; gap:6px; margin:9px 0; }
.bc-chip { cursor:pointer; border-radius:30px; padding:6px 10px; font-size:12px; font-weight:700; background:color-mix(in srgb,var(--accent) 13%,var(--surface)); border:1px solid var(--border); color:var(--text); }
.bc-results { display:grid; max-height:200px; overflow:auto; gap:4px; }
.bc-user-result { display:flex; gap:10px; justify-content:space-between; text-align:left; cursor:pointer; padding:10px; border-radius:9px; background:var(--surface-2); }
.bc-user-result:hover { background:color-mix(in srgb,var(--accent) 12%,var(--surface)); }
.bc-user-result small, .bc-char-count { color:var(--muted); }
.bc-file-preview { border:1px solid var(--border); border-radius:12px; margin:10px 0; padding:10px; display:grid; gap:10px; }
.bc-media { display:block; width:min(100%, 350px); max-height:260px; object-fit:contain; margin:10px 0; border-radius:10px; background:var(--surface-2); }
.bc-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.bc-actions button { flex:1; min-width:125px; }
.bc-history { display:grid; gap:10px; }
.bc-history-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
.bc-history-heading strong { overflow-wrap:anywhere; }
.bc-history-body { white-space:pre-wrap; overflow-wrap:anywhere; font-size:13px; color:var(--muted); max-height:100px; overflow:auto; }
.bc-status { border-radius:30px; padding:5px 9px; font-size:11px; font-weight:700; background:var(--surface-2); border:1px solid var(--border); }
.bc-status--sent { color:var(--success); }
.bc-status--error, .bc-status--cancelled { color:var(--danger); }
.bc-status--sending { color:var(--warning); }
@media (max-width: 450px) { .notification-panel { right:0; } .bc-card { padding:12px; } .bc-actions button { min-width:105px; } }
@media (prefers-reduced-motion:reduce) { :is(.primary,.secondary,.danger-button,.icon-button):hover { transform:none !important; } }
.bc-gate-inbox { margin-top:22px; text-align:left; max-height:45vh; overflow:auto; }
.bc-gate-title { font-size:16px; font-weight:800; margin-bottom:12px; }
.bc-gate-item { padding:12px 0; border-top:1px solid var(--border); display:grid; gap:7px; }
.bc-gate-item p { white-space:pre-wrap; font-size:13px; overflow-wrap:anywhere; }
.bc-gate-item small { color:var(--muted); }
.bc-gate-item button { justify-self:start; }

/* Ссылка-кнопка в рассылке и личных уведомлениях. */
.bc-button-group { margin:16px 0; padding:14px; border:1px solid var(--border); border-radius:12px; background:var(--surface-2); }
.bc-button-group .card-title { margin-bottom:5px; }
.bc-button-group .card-subtitle { margin-bottom:12px; }
.bc-button-preview { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:10px; }
.bc-inline-link { display:inline-flex; align-items:center; justify-content:center; max-width:100%; padding:9px 14px; border-radius:10px; background:var(--accent); color:#fff; font-size:13px; font-weight:700; text-decoration:none; overflow-wrap:anywhere; text-align:center; transition:transform .18s ease; }
.bc-inline-link:hover { color:#fff; transform:translateY(-2px); }
.bc-inline-preview { cursor:default; }
.bc-inline-preview:hover { transform:none; }
.bc-history-link, .bc-notification-link { margin:4px 0 10px; }
.bc-gate-item .bc-inline-link { justify-self:start; }
@media (prefers-reduced-motion:reduce) { .bc-inline-link:hover { transform:none; } }

/* Route invoice readiness / persistent driver alerts. */
.invoice-readiness-stats {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0;}
.invoice-readiness-stats .stat {min-width:0;padding:12px 7px;text-align:center;}
.invoice-readiness-stats .stat-value {font-size:clamp(1.1rem,3.4vw,1.45rem);}
.invoice-readiness-stats .stat-label {font-size:.78rem;overflow-wrap:anywhere;}
.invoice-readiness-result {margin:12px 0;}
.invoice-office-ok {margin:10px 0;border-color:var(--success,#2aa56d);}
#driverInvoiceNotifications {margin-bottom:14px;}
#driverInvoiceNotifications .notice {margin-top:10px;}
#driverInvoiceNotifications button {width:auto;margin-top:8px;}
#driverInvoiceReadinessButton {margin-top:10px;width:100%;}
#managedInvoiceReadinessButton {max-width:100%;}
@media (max-width:400px) {.invoice-readiness-stats .stat {padding:9px 5px;}}

/* Клиенты → Справочники: связи точек с МойСклад (изолировано от остальных страниц). */
#client-directory[hidden], #client-mappings-container[hidden], .cm-root [hidden] { display: none !important; }
.cm-top-tabs, .cm-type-tabs, .cm-link-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.cm-top-tabs > button, .cm-type-tabs > button, .cm-link-tabs > button {
  width: auto; min-width: 0; flex: 1 1 115px; padding: 11px 12px;
}
.cm-link-tabs > button { flex-basis: 95px; }
.cm-top-tabs button.active, .cm-root button.active {
  border-color: var(--accent); background: var(--surface-2);
}
.cm-root { min-width: 0; }
.cm-root > .card { min-width: 0; }
.cm-root h3 { margin: 0 0 10px; }
.cm-root .meta, .cm-point-info, .cm-remote > span { overflow-wrap: anywhere; }
.cm-search-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 12px 0; }
.cm-search-line > input {
  width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px;
  border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); box-sizing: border-box;
}
.cm-search-line > button, .cm-pages > button, .cm-editor-head > button,
.cm-point > button, .cm-remote > button, .cm-alias > button, .cm-unlink {
  width: auto; min-width: 70px; max-width: 100%; flex: 0 0 auto;
}
.cm-point, .cm-remote, .cm-alias { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cm-point-info { min-width: 0; }
.cm-point-info > strong { display: block; line-height: 1.45; }
.cm-binding { margin-top: 5px; font-size: .85rem; color: var(--muted); }
.cm-binding.cm-is-linked { color: var(--text); }
.cm-pages { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; margin-top: 12px; }
.cm-pages > button { width: 44px; min-width: 44px; padding: 10px; }
.cm-pages > span { text-align: center; font-size: .87rem; color: var(--muted); }
.cm-editor { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.cm-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cm-editor-head > h3 { min-width: 0; overflow-wrap: anywhere; }
.cm-label { display: block; font-weight: 600; margin-top: 14px; }
.cm-remote-results { max-height: 320px; overflow-y: auto; }
.cm-unlink { margin-top: 12px; }
.cm-alias-group { margin-top: 20px; }
.cm-alias-group > strong { display: block; margin-bottom: 8px; }
.cm-alias > span { min-width: 0; overflow-wrap: anywhere; }
.cm-alias > button { min-width: 42px; }
@media (max-width: 460px) {
  .cm-point, .cm-remote, .cm-alias { gap: 6px; }
  .cm-point > button, .cm-remote > button, .cm-search-line > button { padding: 9px; min-width: 68px; }
  .cm-root > .card { padding: 12px; }
}
#main .section-head .link-button[hidden] { display: none !important; }

/* Route invoice readiness: readable addresses and per-point no-invoice confirmation. */
.invoice-readiness-result .invoice-point-address, .invoice-approved-list .invoice-point-address { margin: 6px 0 4px; overflow-wrap: anywhere; }
.invoice-readiness-result .invoice-approve-button { width: auto; max-width: 100%; margin-top: 12px; }
.invoice-approved-list { margin-top: 12px; display: grid; gap: 8px; }
@media (max-width: 520px) { .invoice-readiness-result .invoice-approve-button { width: 100%; } }


/* Driver route UI: separate navigation, document check and its results.
   These selectors are scoped to the driver modal, not management screens. */
.driver-route-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
}
.driver-route-tools > .card { margin-bottom: 0; }
.driver-route-tool,
.driver-route-result-panel { min-width: 0; }
.driver-route-tool-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-bottom: 14px;
}
.driver-route-tool-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  font-size: 20px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
}
.driver-route-tool-copy { min-width: 0; }
.driver-route-tool-copy h3,
.driver-route-result-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.driver-route-tool-copy p,
.driver-route-result-head p,
.driver-route-tool-unavailable {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.driver-route-navigation .driver-full-route-link,
.driver-route-documents #driverInvoiceReadinessButton {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  text-decoration: none;
  box-sizing: border-box;
}
.driver-route-tool-unavailable {
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 12px;
}
.driver-route-result-panel[hidden] { display: none !important; }
.driver-route-result-head { margin-bottom: 12px; }
.driver-route-result-panel .invoice-readiness-result {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}
.driver-route-result-panel .invoice-readiness-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 14px;
}
.driver-route-result-panel .invoice-readiness-stats .stat-label {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.4;
}
.driver-route-result-panel .invoice-readiness-result details { min-width: 0; }
.driver-route-result-panel .invoice-readiness-result summary {
  cursor: pointer;
  font-weight: 700;
  padding: 10px 0;
  line-height: 1.5;
}
.driver-route-result-panel .invoice-readiness-result .list-item { min-width: 0; }
@media (max-width: 580px) {
  .driver-route-result-panel .invoice-readiness-stats { grid-template-columns: 1fr; gap: 8px; }
  .driver-route-result-panel .invoice-readiness-stats .stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    padding: 10px 14px;
  }
  .driver-route-result-panel .invoice-readiness-stats .stat-label {
    font-size: 13px;
    margin: 0;
    flex: 1;
  }
  .driver-route-result-panel .invoice-readiness-stats .stat-value {
    flex: 0 0 auto;
    font-size: 18px;
  }
}


/* Balances: visible debt warning in every CashControl color theme. */
.bank-balances-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bank-debt-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 8px 17px;
  border: 1px solid #7f1d1d;
  border-radius: 12px;
  background: #b91c1c;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(127, 29, 29, .2);
}

/* Route viewer for manager+ / admin: simple cards, without editor controls. */
.route-preview-driver-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
  margin: 16px 0;
}
.route-preview-driver-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  text-align: left;
  color: var(--text);
  cursor: pointer;
}
.route-preview-driver-card:hover { border-color: var(--accent); }
.route-preview-driver-card:focus-visible,
.route-preview-point-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.route-preview-driver-title { font-weight: 750; font-size: 1.05rem; overflow-wrap: anywhere; }
.route-preview-driver-meta { color: var(--muted); font-size: .85rem; }
.route-preview-driver-open { color: var(--accent); font-weight: 700; margin-top: 5px; }
.route-preview-actions { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,230px),1fr)); gap: 10px; margin: 16px 0; }
.route-preview-actions > * { width: 100%; min-width: 0; }
.route-preview-point-list { display: grid; gap: 10px; }
.route-preview-point-row { min-width: 0; }
.route-preview-point-open {
  display: flex; align-items: flex-start; justify-content: space-between;
  width: 100%; min-width: 0; gap: 10px;
  border: 0; background: transparent; color: inherit; text-align: left;
  padding: 0; cursor: pointer;
}
.route-preview-point-main { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.route-preview-point-main .title, .route-preview-point-main .meta { overflow-wrap: anywhere; }
.route-preview-point-open .badge { flex: 0 0 auto; }
.route-preview-comment-indicator { margin-top: 8px; color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.route-preview-comment-form { margin-top: 12px; display: grid; gap: 8px; }
.route-preview-comment-form textarea { width: 100%; min-height: 80px; }
.route-preview-comment-form button { width: 100%; }
@media (max-width: 520px) {
  .route-preview-driver-list { grid-template-columns: minmax(0, 1fr); }
  .route-preview-actions { grid-template-columns: minmax(0, 1fr); }
  .route-preview-point-open { flex-wrap: wrap; }
}

/* Route date shortcut controls; no seasonal theme changes. */
.route-quick-dates { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.route-quick-dates button { min-height:35px; padding:7px 13px; font-size:13px; }
.route-quick-dates button.active { border-color:var(--accent); color:var(--accent); font-weight:800; background:color-mix(in srgb,var(--accent) 10%,var(--surface)); }

/* Personal notifications: separate full-screen route, not a popup. */
.bc-notification-open { display:grid; text-align:left; gap:6px; width:100%; border:0; padding:0; color:var(--text); background:transparent; cursor:pointer; }
.bc-notification-open small { color:var(--muted); font-size:12px; }
.bc-notification-all { padding:12px 14px; border-top:1px solid var(--border); }
.bc-notification-all button { width:100%; }
.bc-inbox-list { padding:0; overflow:hidden; }
.bc-inbox-row { display:grid; width:100%; text-align:left; gap:6px; padding:15px 16px; border:0; border-bottom:1px solid var(--border); color:var(--text); background:var(--surface); cursor:pointer; }
.bc-inbox-row:last-child { border-bottom:0; }
.bc-inbox-row:hover, .bc-gate-notification:hover { background:var(--surface-2); }
.bc-inbox-row.bc-unread { border-left:3px solid var(--accent); background:color-mix(in srgb,var(--accent) 7%,var(--surface)); }
.bc-inbox-row strong { overflow-wrap:anywhere; font-size:15px; }
.bc-inbox-row span { font-size:13px; overflow-wrap:anywhere; }
.bc-inbox-row small { font-size:12px; color:var(--muted); }
.bc-inbox-pagination { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; margin:14px 0 24px; }
.bc-inbox-pagination span { color:var(--muted); font-size:13px; }
.bc-inbox-actions { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:14px; }
.bc-inbox-detail { display:grid; gap:14px; }
.bc-inbox-detail h3 { overflow-wrap:anywhere; margin:0; }
.bc-inbox-detail-body { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.55; }
.bc-inbox-detail-media .bc-media { width:min(100%, 620px); max-height:65vh; }
.bc-gate-notification { width:100%; background:transparent; text-align:left; color:var(--text); cursor:pointer; }
.bc-gate-notification span { font-size:13px; overflow-wrap:anywhere; }
.bc-gate-all { margin-top:12px; width:100%; }

/* GPS trail selection on dispatcher map. */
.cc-driver-track-choice {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}
.cc-driver-track-choice .title,
.cc-driver-track-choice .meta { display: block; }
.cc-driver-track-choice:hover { border-color: var(--accent); }
.cc-driver-track-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.cc-track-action { color: var(--accent); font-weight: 650; }
.cc-driver-track-toolbar { align-items: center; margin-top: 12px; }
.cc-driver-track-toolbar > .meta { flex: 1 1 220px; }
.cc-driver-track-toolbar button { padding: 9px 13px; border: 1px solid var(--border); border-radius: 10px; }

.cc-driver-track-choice:disabled { cursor: default; opacity: .78; }
.cc-driver-track-choice:disabled:hover { border-color: var(--border); }

/* Mobile MiniApp: prevent browser-level page scaling, keep natural scrolling.
   The Leaflet map has its own local zoom controls and touch handling. */
@media (pointer: coarse) {
  html, body, .ui-shell { touch-action: pan-x pan-y; }
  .ui-shell button, .ui-shell a, .ui-shell [role="button"] { touch-action: manipulation; }
  .leaflet-container { touch-action: none !important; }
}
@media screen and (max-width: 900px) {
  /* iOS Safari zooms the whole document when focusing inputs below 16px. */
  input, select, textarea { font-size: 16px !important; }
}

/* Historical route timing summary: adapts to narrow Telegram WebApps. */
.route-archive-statistics { display: grid; gap: 9px; }
.route-archive-stat-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; font-size: 14px; }
.route-archive-stat-row strong { font-weight: 650; text-align: right; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .route-archive-stat-row { display: grid; grid-template-columns: 1fr; gap: 2px; }
  .route-archive-stat-row strong { text-align: left; }
}
