/* ============================================================
   «Маршрут» — адаптивный планировщик путешествия
   Только HTML / CSS / JS, без внешних зависимостей
   ============================================================ */

/* ---------- 1. Переменные ---------- */
:root {
  /* Цвета */
  --color-bg: #F3F7FC;
  --color-surface: #FFFFFF;
  --color-text: #182B45;
  --color-text-soft: #45566B;
  --color-accent: #2E5FA3;
  --color-accent-soft: #E3EEF9;
  --color-ocean: #2C6E9B;
  --color-ocean-soft: #E6F1F8;
  --color-coral: #E17055;
  --color-coral-soft: #FDEBE5;
  --color-success: #1E9E5A;
  --color-success-soft: #E7F6EC;
  --color-warning: #E0A800;
  --color-warning-soft: #FEF6DC;
  --color-error: #D94A4A;
  --color-error-soft: #FDEBEB;
  --color-border: #E1E8F1;
  --color-skeleton: #E5EBF4;

  /* Типографика */
  --font-base: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --fs-title: 1.75rem;
  --fs-section: 1.375rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.8125rem;

  /* Отступы */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Сетка */
  --container-max: 1200px;
  --gap: 24px;
  --shadow-card: 0 6px 24px rgba(30, 42, 74, 0.07);
  --shadow-card-hover: 0 10px 32px rgba(30, 42, 74, 0.12);

  /* Скругления */
  --radius-card: 20px;
  --radius-card-sm: 16px;
  --radius-pill: 999px;

  /* Прочее */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --focus-ring: 0 0 0 3px var(--color-surface), 0 0 0 5px var(--color-accent);
}

/* ---------- 2. Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

/* ---------- 3. Общая обвязка ---------- */
.app {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-7);
}

.section {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-5) var(--space-5) var(--space-6);
  margin-top: var(--space-5);
  animation: fadeUp 0.35s ease both;
}

.section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.section__title {
  font-size: var(--fs-section);
  font-weight: 700;
  color: var(--color-text);
}

.section__subtitle {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
  margin-top: var(--space-1);
}

.section__header-actions {
  align-self: center;
}

/* ---------- 4. Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  height: 44px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-small);
  transition: background-color var(--transition-fast), transform 0.15s ease, box-shadow var(--transition-fast);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--color-accent);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(46, 95, 163, 0.3);
}

.btn--primary:hover {
  background: #24508A;
  box-shadow: 0 7px 20px rgba(46, 95, 163, 0.4);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.btn--ghost:hover {
  background: #D6E5F5;
  transform: translateY(-1px);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  height: 38px;
  padding: 0 var(--space-3);
  font-size: var(--fs-micro);
}

/* ---------- 5. Обложка ---------- */
.cover {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  color: #FFFFFF;
  min-height: 360px;
  display: flex;
  align-items: flex-end;
  box-shadow: 0 18px 52px rgba(15, 26, 60, 0.38);
  isolation: isolate;
}

/* Небо: от глубокой синевы вверху к тёплому горизонту у воды */
.cover__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle 420px at 76% 26%, rgba(255, 186, 120, 0.30), transparent 62%),
    radial-gradient(140% 90% at 50% 100%, rgba(255, 160, 110, 0.22), transparent 55%),
    linear-gradient(178deg,
      #101C46 0%,
      #1B2A5E 26%,
      #2B4585 52%,
      #35618F 72%,
      #3E7E96 100%);
}

.cover__scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Солнце у горизонта справа */
.cover__sun {
  position: absolute;
  right: 13%;
  top: 22%;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 46%,
    #FFF1CE 0%,
    #FFD98A 38%,
    #FFC069 58%,
    rgba(255, 168, 96, 0.35) 74%,
    rgba(255, 150, 90, 0) 82%);
  box-shadow: 0 0 110px 42px rgba(255, 190, 118, 0.26);
}

/* Дорожка света по воде — псевдоэлемент самого солнца,
   чтобы шлейф всегда шёл ровно под ним и растворялся без кромки */
.cover__sun::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 40%;
  width: 300px;
  height: 300px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse 40% 100% at 50% 0%,
    rgba(255, 206, 140, 0.28) 0%,
    rgba(255, 194, 128, 0.11) 44%,
    rgba(255, 190, 130, 0) 72%);
}

/* Три слоя волн; каждый шире контейнера вдвое и медленно дрейфует */
.cover__waves {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 215px;
}

.cover__wave {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 200%;
  height: 100%;
  will-change: transform;
}

.cover__wave path {
  fill: currentColor;
}

/* drop-shadow повторяет форму волны, поэтому сдвиг на пиксель вверх
   рисует светлую кромку по гребню — пену — без второго контура */
.cover__wave--back {
  color: rgba(129, 186, 214, 0.32);
  height: 84%;
  animation: waveDrift 26s linear infinite;
}

.cover__wave--mid {
  color: rgba(41, 92, 145, 0.62);
  height: 64%;
  filter: drop-shadow(0 -1.5px 0 rgba(190, 224, 240, 0.30));
  animation: waveDrift 19s linear infinite reverse;
}

.cover__wave--front {
  color: rgba(14, 36, 78, 0.88);
  height: 46%;
  filter: drop-shadow(0 -1.5px 0 rgba(160, 205, 228, 0.38));
  animation: waveDrift 13s linear infinite;
}

@keyframes waveDrift {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Лента маршрута внизу обложки — статичные места поездки */
.cover__strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 86px;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  padding: 0 calc(var(--space-6) + 16px);
}

.cover__strip-track {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 27px;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.08));
}

.cover__strip-dot {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cover__strip-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 2px 6px rgba(8, 16, 40, 0.4);
}

.cover__strip-dot--start::before {
  background: #FFD166;
  border-color: #FFFFFF;
}

.cover__strip-dot--end::before {
  background: #FF8FA3;
  border-color: #FFFFFF;
}

.cover__strip-label {
  margin-top: 6px;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
}

.cover__content {
  position: relative;
  z-index: 2;
  padding: var(--space-7) var(--space-6) calc(var(--space-5) + 96px);
  max-width: 640px;
}

.cover__eyebrow {
  display: inline-block;
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-4);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
  box-shadow: 0 4px 16px rgba(8, 16, 40, 0.25);
  backdrop-filter: blur(8px);
}

.cover__title {
  font-size: clamp(2.25rem, 3.4vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
  text-shadow: 0 2px 24px rgba(8, 16, 40, 0.45);
}

.cover__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-5);
}

.cover__fact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-small);
  font-weight: 600;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 4px 16px rgba(8, 16, 40, 0.22);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(8px);
}

.cover__fact::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FFD166;
}

.cover__countdown {
  display: inline-flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cover__countdown-label {
  font-size: var(--fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.cover__countdown-values {
  display: flex;
  gap: var(--space-2);
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 76px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.07));
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius-card-sm);
  padding: var(--space-2) var(--space-3);
  box-shadow: 0 6px 20px rgba(8, 16, 40, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
}

.countdown-unit b {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.countdown-unit i {
  font-style: normal;
  font-size: var(--fs-micro);
  opacity: 0.8;
}

/* ---------- 6. Темп путешествия ---------- */
.pace {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: var(--space-5);
  align-items: start;
  grid-template-areas:
    "toggle summary"
    "hint   summary";
}

.pace__toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--color-bg);
  border-radius: var(--radius-pill);
  padding: var(--space-1);
  grid-area: toggle;
}

.pace__option {
  position: relative;
  z-index: 1;
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-weight: 600;
  color: var(--color-text-soft);
  transition: color var(--transition-fast);
}

.pace__option:hover {
  color: var(--color-text);
}

.pace__option[aria-selected="true"] {
  color: #FFFFFF;
}

.pace__option[aria-selected="true"]:hover {
  color: #FFFFFF;
}

.pace__option:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.pace__indicator {
  position: absolute;
  top: var(--space-1);
  bottom: var(--space-1);
  left: var(--space-1);
  width: calc(50% - var(--space-1));
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  box-shadow: 0 4px 14px rgba(46, 95, 163, 0.35);
  transition: transform var(--transition-base);
  will-change: transform;
}

.pace[data-pace="active"] .pace__indicator {
  transform: translateX(100%);
}

.pace__summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  grid-area: summary;
}

.pace__summary-item {
  background: var(--color-bg);
  border-radius: var(--radius-card-sm);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  justify-content: space-between;
  min-height: 80px;
}

.pace__label {
  font-size: var(--fs-micro);
  color: var(--color-text-soft);
}

.pace__value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pace__hint {
  grid-area: hint;
  font-size: var(--fs-small);
  color: var(--color-text-soft);
  padding: var(--space-2) 0;
}

/* ---------- 7. Маршрут по дням ---------- */
.route__days-wrap {
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.route__days {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
}
.route__days::-webkit-scrollbar {
  display: none;
}

.route__days-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.15s ease;
}
.route__days-fade--left {
  left: 0;
  background: linear-gradient(to right, var(--color-surface), transparent);
  opacity: 0;
}
.route__days-fade--right {
  right: 0;
  background: linear-gradient(to left, var(--color-surface), transparent);
  opacity: 0;
}

.route__days-skeleton {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}
.route__days-skeleton--visible {
  display: flex;
}
.route__days-skeleton span {
  flex: 0 0 72px;
  height: 48px;
  background: var(--color-skeleton);
  border-radius: var(--radius-card-sm);
  animation: skeletonPulse 1.4s ease-in-out infinite;
}
.route__days-skeleton span:nth-child(2) { animation-delay: 0.1s; }
.route__days-skeleton span:nth-child(3) { animation-delay: 0.2s; }
.route__days-skeleton span:nth-child(4) { animation-delay: 0.3s; }
.route__days-skeleton span:nth-child(5) { animation-delay: 0.4s; }

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.route__day-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 72px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-card-sm);
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.route__day-tab:hover {
  transform: translateY(-2px);
  background: #F1EFE9;
}

.route__day-tab:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.route__day-tab--active {
  background: var(--color-accent);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(46, 95, 163, 0.3);
  animation: tabPop 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.route__day-tab--active:hover {
  background: var(--color-accent);
}

.route__day-tab b {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.route__day-tab i {
  font-style: normal;
  font-size: var(--fs-micro);
  opacity: 0.85;
}

.route__day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  animation: fadeUp 0.35s ease both;
}

.route__day-city {
  font-size: var(--fs-section);
  font-weight: 700;
}

.route__day-date {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-pill);
}

/* Таймлайн */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-left: var(--space-6);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--color-border);
  border-radius: 2px;
}

.event {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  background: var(--color-bg);
  border-radius: var(--radius-card-sm);
  padding: var(--space-4);
  animation: fadeUp 0.3s ease both;
  transition: box-shadow var(--transition-base), transform var(--transition-base), background-color var(--transition-fast);
}

.event:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.event--current {
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft), var(--shadow-card);
}

.event--current .event__title::after {
  content: " · сейчас";
  color: var(--color-accent);
  font-weight: 600;
}

.event::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-6) + 4px);
  top: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.event--current::before {
  transform-origin: center;
  animation: dotPulse 1.6s ease-in-out infinite;
  background: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent), 0 0 0 6px var(--color-accent-soft);
}

.event--category-accommodation::before { background: var(--color-ocean); box-shadow: 0 0 0 2px var(--color-ocean); }
.event--category-fun::before { background: var(--color-coral); box-shadow: 0 0 0 2px var(--color-coral); }
.event--category-food::before { background: var(--color-success); box-shadow: 0 0 0 2px var(--color-success); }
.event--category-transport::before { background: var(--color-warning); box-shadow: 0 0 0 2px var(--color-warning); }

.event__time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
  min-width: 48px;
}

.event__body {
  flex: 1 1 220px;
}

.event__title {
  font-weight: 600;
  font-size: var(--fs-body);
}

.event__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.event__meta span {
  font-size: var(--fs-micro);
  color: var(--color-text-soft);
}

.event__cost {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.event__cost--free {
  color: var(--color-success);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-micro);
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge--confirmed {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge--pending {
  background: var(--color-warning-soft);
  color: #9A641C;
}

.badge--static {
  background: var(--color-bg);
  color: var(--color-text-soft);
}

/* Состояния маршрута */
.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-5);
}

.state-box__icon {
  font-size: 2.5rem;
  line-height: 1;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-error-soft);
  color: var(--color-error);
}

.state-box__icon--empty {
  background: var(--color-ocean-soft);
  color: var(--color-ocean);
}

/* Глобальная ошибка */
.app-error {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-top: var(--space-5);
  animation: fadeUp 0.35s ease both;
}

.app-error__inner {
  max-width: 520px;
  margin: 0 auto;
}

.state-box__title {
  font-size: var(--fs-section);
  font-weight: 700;
}

.state-box__text {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
  max-width: 340px;
}

.state-box .btn {
  margin-top: var(--space-3);
}

.state-box .btn:focus-visible {
  outline-offset: 3px;
}

/* Скелетоны */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-skeleton);
  border-radius: var(--radius-card-sm);
  min-height: 56px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.85),
    rgba(255, 255, 255, 0));
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}

.skeleton--title { width: 40%; height: 24px; margin-bottom: var(--space-3); }
.skeleton--line { width: 100%; height: 56px; }
.skeleton--block { width: 100%; height: 120px; }
.skeleton--circle { width: 200px; height: 200px; border-radius: 50%; margin: 0 auto; }
.skeleton--sm { width: 100%; height: 44px; }

/* ---------- 8. Бюджет ---------- */
.budget {
  display: grid;
  grid-template-columns: minmax(280px, 400px) 1fr;
  gap: var(--space-6);
  align-items: center;
}

.budget__chart-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.budget__chart {
  position: relative;
  flex: 0 0 auto;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: conic-gradient(var(--color-accent) 0deg);
  transition: transform var(--transition-base);
}

.budget__chart--animate {
  animation: chartPop 0.55s ease both;
}

.budget__chart:hover {
  transform: scale(1.03);
}

.budget__chart::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid var(--color-accent);
  opacity: 0;
  animation: chartPulse 2.6s ease-in-out infinite;
}

.budget__chart::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: var(--color-surface);
}

.budget__chart-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.budget__chart-total-label {
  font-size: var(--fs-micro);
  color: var(--color-text-soft);
}

.budget__chart-total {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.budget__chart-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: 300px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--fs-small);
  animation: fadeUp 0.35s ease both;
}

.budget__chart-legend .legend-item:nth-child(2) { animation-delay: 40ms; }
.budget__chart-legend .legend-item:nth-child(3) { animation-delay: 80ms; }
.budget__chart-legend .legend-item:nth-child(4) { animation-delay: 120ms; }

.legend-item__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-soft);
}

.legend-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend-item__value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.budget__summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.budget__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.budget__row-label {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
}

.budget__row-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 1.0625rem;
}

.budget__row--total .budget__row-value {
  font-size: 1.375rem;
  font-weight: 800;
}

.budget__row--left .budget__row-value {
  color: var(--color-success);
}

.budget__progress {
  height: 10px;
  background: var(--color-bg);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.budget__progress-bar {
  display: block;
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-accent), #5A8BD1);
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.budget__progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: shimmerBar 2.4s ease-in-out infinite;
}

.budget__categories {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.budget-cat {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-small);
}

.budget-cat__dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.budget-cat__name {
  color: var(--color-text);
  font-weight: 500;
}

.budget-cat__percent {
  color: var(--color-text-soft);
  font-variant-numeric: tabular-nums;
}

.budget-cat__bar {
  grid-column: 2 / 4;
  height: 6px;
  background: var(--color-bg);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.budget-cat__bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  width: 0%;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 9. Бронирования ---------- */
.bookings__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.booking-card {
  background: var(--color-bg);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  animation: fadeUp 0.35s ease both;
}

.booking-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.booking-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.booking-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-card-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  flex: 0 0 auto;
}

.booking-card__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1 1 auto;
}

.booking-card--type-hotel .booking-card__icon { background: var(--color-ocean-soft); color: var(--color-ocean); }
.booking-card--type-train .booking-card__icon { background: var(--color-success-soft); color: var(--color-success); }
.booking-card--type-excursion .booking-card__icon { background: var(--color-coral-soft); color: var(--color-coral); }

.booking-card__type {
  font-size: var(--fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-soft);
}

.booking-card__title {
  font-weight: 700;
  font-size: 1.0625rem;
  margin-top: var(--space-1);
}

.booking-card__details {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
}

.booking-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.booking-card__date {
  font-size: var(--fs-micro);
  color: var(--color-text-soft);
}

/* ---------- 10. Чек-лист ---------- */
.checklist__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.checklist__tab {
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--color-text-soft);
  transition: background-color var(--transition-fast), color var(--transition-fast), transform 0.15s ease;
}

.checklist__tab:hover {
  background: #F1EFE9;
  transform: translateY(-1px);
}

.checklist__tab:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.checklist__tab::after {
  content: attr(data-count);
  margin-left: var(--space-2);
  font-size: var(--fs-micro);
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}

.checklist__tab--active {
  background: var(--color-accent);
  color: #FFFFFF;
}

.checklist__tab--active::after {
  background: rgba(255, 255, 255, 0.22);
}

.checklist__items {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-card-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast), opacity var(--transition-fast), box-shadow var(--transition-fast), transform 0.15s ease;
}

.checklist-item:hover {
  background: #F4F2EC;
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.checklist-item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.checklist-item:active {
  transform: scale(0.99);
}

.checklist-item--checked {
  opacity: 0.65;
}

.checklist-item__checkbox {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin-top: 2px;
  border: 2px solid var(--color-border);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 0.8rem;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform 0.15s ease;
}

.checklist-item--checked .checklist-item__checkbox {
  background: var(--color-success);
  border-color: var(--color-success);
  animation: checkPop 0.2s ease;
}

.checklist-item__text {
  font-size: var(--fs-small);
  line-height: 1.4;
}

.checklist-item--checked .checklist-item__text {
  text-decoration: line-through;
}

.checklist__progress {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
}

.checklist__progress b {
  color: var(--color-success);
}

/* Форма добавления своих задач */
.checklist__add {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.checklist__add-input {
  flex: 1 1 auto;
  height: 44px;
  padding: 0 var(--space-3);
  font-family: inherit;
  font-size: var(--fs-small);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.checklist__add-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

/* ---------- 11. Раздел «Мои поездки» ---------- */
.section--trips .section__header {
  align-items: center;
}
.trips-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.trips-header__date {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
}

/* ---------- 12. Модалки ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal[hidden] {
  display: none;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 26, 60, 0.5);
  animation: fadeIn 0.25s ease both;
}
.modal__body {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card-hover);
  animation: fadeUp 0.3s ease both;
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}
.modal__title {
  font-size: var(--fs-section);
  font-weight: 700;
}
.modal__close {
  font-size: 1.75rem;
  line-height: 1;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-text-soft);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.modal__close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
.modal__close:focus-visible,
.modal__backdrop:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.modal__content {
  padding: var(--space-5);
}

.trips-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.trips-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-card-sm);
  border: 1px solid transparent;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.trips-list__item--active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}
.trips-list__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.trips-list__name {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trips-list__meta {
  font-size: var(--fs-micro);
  color: var(--color-text-soft);
}
.trips-list__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}
.trips-list__badge {
  font-size: var(--fs-micro);
  font-weight: 600;
  color: var(--color-accent);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-pill);
}
.trips-list__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text-soft);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.trips-list__icon-btn:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.trips-list__icon-btn--del:hover {
  background: var(--color-error-soft);
  color: var(--color-error);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.form-label {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--color-text-soft);
}
.form-input {
  height: 46px;
  padding: 0 var(--space-3);
  font-family: inherit;
  font-size: var(--fs-small);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

/* ---------- 13. Мобильный режим «Сегодня» ---------- */
.today {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  margin-top: var(--space-5);
  animation: fadeUp 0.35s ease both;
}

.today__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.today__title {
  font-size: var(--fs-section);
  font-weight: 700;
}

.today__date {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
}

.today__card {
  background: var(--color-bg);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.today__card-label {
  display: block;
  font-size: var(--fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-soft);
  margin-bottom: var(--space-3);
}

.today__card-main {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.today__event-time {
  font-size: 1.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
  line-height: 1.1;
}

.today__event-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.today__event-title {
  font-weight: 700;
  font-size: 1.0625rem;
}

.today__event-place {
  font-size: var(--fs-small);
  color: var(--color-text-soft);
}

.today__card--event {
  position: relative;
}

.today__card--event .badge {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
}

.today__task-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.today__task-text {
  font-weight: 600;
}

.today__task-cat {
  font-size: var(--fs-micro);
  color: var(--color-text-soft);
  text-transform: capitalize;
}

/* ---------- 12. Toast ---------- */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-text);
  color: #FFFFFF;
  border-radius: var(--radius-card-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-small);
  box-shadow: var(--shadow-card-hover);
  animation: toastIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  min-width: 240px;
  max-width: 320px;
}

.toast::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  background: var(--color-accent);
  animation: toastTimer 2.6s linear forwards;
}

.toast--success {
  border-left: 4px solid var(--color-success);
}

.toast--info {
  border-left: 4px solid var(--color-accent);
}

.toast--error {
  border-left: 4px solid var(--color-error);
}

.toast--success::after {
  background: var(--color-success);
}

.toast--info::after {
  background: var(--color-accent);
}

.toast--error::after {
  background: var(--color-error);
}

.toast__icon {
  font-size: 1.1rem;
  flex: 0 0 auto;
}

.toast--leaving {
  animation: toastOut 0.3s ease forwards;
}

/* ---------- 14. Нижняя навигация ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 20px rgba(30, 42, 74, 0.08);
  padding: var(--space-2) var(--space-4) calc(var(--space-2) + env(safe-area-inset-bottom));
  animation: fadeUp 0.3s ease both;
}

.bottom-nav[hidden] {
  display: none;
}

.today[hidden] {
  display: none;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) 0;
  color: var(--color-text-soft);
  transition: color var(--transition-fast);
}

.bottom-nav__item--active {
  color: var(--color-accent);
}

.bottom-nav__item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.bottom-nav__icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav__label {
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---------- 15. Адаптив: планшет (≤768px) ---------- */
@media (max-width: 768px) {
  :root {
    --fs-title: 1.5rem;
    --fs-section: 1.25rem;
  }

  .app {
    padding: var(--space-4) var(--space-3) var(--space-6);
  }

  .pace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "toggle"
      "hint"
      "summary";
  }

  .pace__summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .budget {
    grid-template-columns: 1fr;
  }

  .budget__chart-wrap {
    flex-direction: row;
    justify-content: space-around;
  }

  .budget__chart-legend {
    max-width: 180px;
  }

  .cover {
    min-height: 300px;
  }

  .cover__sun {
    width: 104px;
    height: 104px;
    right: 10%;
    top: 16%;
  }

  .cover__sun::after {
    width: 230px;
    height: 230px;
  }

  .cover__waves {
    height: 175px;
  }

  .cover__title {
    font-size: 1.875rem;
  }

  .countdown-unit {
    min-width: 60px;
  }
}

/* ---------- 16. Адаптив: мобильный (≤600px) ---------- */
@media (max-width: 600px) {
  .cover__strip {
    display: none;
  }

  .app {
    padding: var(--space-3) var(--space-3) 120px;
  }

  .cover {
    min-height: 260px;
    border-radius: 24px;
  }

  /* На узком экране солнце уходит в верхний угол и уменьшается,
     иначе его ореол перекрывает заголовок и плашки */
  .cover__sun {
    width: 72px;
    height: 72px;
    right: 9%;
    top: 9%;
  }

  .cover__sun::after {
    width: 150px;
    height: 150px;
  }

  .cover__waves {
    height: 130px;
  }

  .cover__content {
    padding: var(--space-6) var(--space-4) var(--space-5);
  }

  .cover__title {
    font-size: 1.625rem;
  }

  .countdown-unit {
    min-width: 52px;
    padding: var(--space-2);
  }

  .countdown-unit b {
    font-size: 1.375rem;
  }

  .section {
    padding: var(--space-4) var(--space-4) var(--space-5);
  }

  .section__header {
    flex-direction: column;
  }

  .pace__summary {
    grid-template-columns: 1fr;
  }

  .budget__chart-wrap {
    flex-direction: column;
  }

  .event {
    padding: var(--space-3);
  }

  .today__card-main {
    gap: var(--space-3);
  }

  .toast-container {
    left: var(--space-3);
    top: var(--space-3);
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .checklist__add {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ---------- 17. Анимации ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

@keyframes tabPop {
  from { transform: scale(0.96); }
  to { transform: scale(1); }
}

@keyframes chartPulse {
  0% { opacity: 0; transform: scale(0.96); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.04); }
}

@keyframes shimmerBar {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

@keyframes toastTimer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes checkPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes chartPop {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}

.countdown-unit--done b {
  font-size: 1.5rem;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  /* Волны замирают на исходной фазе, а не съезжают в конец анимации */
  .cover__wave {
    animation: none !important;
    transform: none !important;
  }
}

/* ---------- 18. Мобильная нижняя навигация (десктоп-скролл) ---------- */
html {
  scroll-behavior: smooth;
}
/* ============================================================
   19. Доработки: сетка на широком экране, редактирование,
       модальные окна и состояния бюджета
   ============================================================ */

/* Универсальное скрытие: у .cover собственный display:flex,
   без этого правила секция не пряталась в состоянии ошибки */
[hidden] {
  display: none !important;
}

/* Фон не должен прокручиваться под открытым окном */
body.is-modal-open {
  overflow: hidden;
}

/* ---------- Кнопки-иконки: удалить событие, бронь, задачу ---------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--color-text-soft);
  opacity: 0.55;
  transition: background-color var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
}

.icon-btn:hover,
.icon-btn:focus-visible {
  opacity: 1;
}

.icon-btn--del:hover,
.icon-btn--del:focus-visible {
  background: var(--color-error-soft);
  color: var(--color-error);
}

.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.checklist-item__del {
  margin-left: auto;
}

.booking-card__del {
  margin-left: auto;
  margin-top: -4px;
}

/* ---------- Кнопка опасного действия ---------- */
.btn--danger {
  background: var(--color-error);
  color: #FFFFFF;
}

.btn--danger:hover {
  background: #C33F3F;
}

/* ---------- Формы и окна ---------- */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-small);
  color: var(--color-text-soft);
  cursor: pointer;
  margin-top: var(--space-2);
}

.form-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

select.form-input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--color-text-soft) 50%),
                    linear-gradient(135deg, var(--color-text-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: var(--space-6);
}

.modal__note {
  display: inline-block;
  font-size: var(--fs-micro);
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  margin-bottom: var(--space-4);
}

.modal__text {
  font-size: var(--fs-body);
  color: var(--color-text-soft);
  margin-bottom: var(--space-5);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.modal--confirm .modal__body {
  max-width: 440px;
}

/* ---------- Пустые состояния ---------- */
.state-box__actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
}

.state-box--inline {
  grid-column: 1 / -1;
  padding: var(--space-6) var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-card-sm);
}

/* ---------- Перерасход бюджета ---------- */
.budget__progress-bar--over {
  background: var(--color-error) !important;
}

.budget__summary--over .budget__row--left .budget__row-value {
  color: var(--color-error);
}

/* ---------- Двухколоночная раскладка на широком экране ---------- */
@media (min-width: 1200px) {
  :root {
    --container-max: 1400px;
    /* Единственное число, которым регулируется высота нижних панелей */
    --panel-h: 600px;
  }

  .app {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    /* Поездка, обложка и темп — по содержимому; две нижние пары — фиксированной высоты */
    grid-template-rows: auto auto auto var(--panel-h) var(--panel-h);
    gap: var(--gap);
    align-items: stretch;
  }

  /* В сетке вертикальный ритм задаёт gap, а не margin секций */
  .app > * {
    margin-top: 0;
  }

  #section-trips,
  #section-cover,
  #section-pace,
  #section-today,
  #app-error {
    grid-column: 1 / -1;
  }

  /* Ряды заданы явно, чтобы колонки шли независимо друг от друга.
     При автоматическом размещении секция во всю ширину обрывала бы
     правую колонку и под маршрутом оставалась дыра почти в 1000 px.
     Ряды 1–3 занимают поездка, обложка и темп. */
  #section-route {
    grid-column: 1;
    grid-row: 4;
  }

  #section-bookings {
    grid-column: 1;
    grid-row: 5;
  }

  #section-budget {
    grid-column: 2;
    grid-row: 4;
  }

  #section-checklist {
    grid-column: 2;
    grid-row: 5;
  }

  /* ---------- Панели: заголовок закреплён, содержимое прокручивается ----------
     min-height: 0 обязателен — без него флекс-элемент не даёт содержимому
     сжаться ниже своей естественной высоты и скролл не появляется. */
  #section-route,
  #section-budget,
  #section-bookings,
  #section-checklist {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #section-route .section__header,
  #section-budget .section__header,
  #section-bookings .section__header,
  #section-checklist .section__header {
    flex: 0 0 auto;
  }

  /* Маршрут: вкладки дней остаются на месте, прокручивается лента событий */
  #section-route .route,
  #section-checklist .checklist {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  #section-route .route__days-wrap,
  #section-checklist .checklist__tabs,
  #section-checklist .checklist__add,
  #section-checklist .checklist__progress {
    flex: 0 0 auto;
  }

  #section-route .route__content,
  #section-checklist .checklist__items,
  #section-budget .budget,
  #section-bookings .bookings__list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* место под полосу прокрутки, чтобы тени карточек не обрезались */
    padding-right: var(--space-2);
    margin-right: calc(-1 * var(--space-2));
  }

  /* Бюджет и брони прижимаются к верху панели, а не растягиваются по центру */
  #section-budget .budget {
    align-items: start;
    align-content: start;
  }

  #section-bookings .bookings__list {
    align-content: start;
  }

  #section-checklist .checklist__items {
    margin-bottom: var(--space-4);
  }

  /* Колонка маршрута уже, чем страница: название события должно переноситься
     само, иначе на границе 1200 px кнопка удаления срывается на вторую строку */
  #section-route .event__body {
    flex: 1 1 140px;
    min-width: 0;
  }

  #section-route .event__time,
  #section-route .event__right,
  #section-route .event__del {
    flex: 0 0 auto;
  }

  /* Заглушка «День без событий» встаёт по центру панели, а не липнет к верху */
  #section-route .route__content {
    display: flex;
    flex-direction: column;
  }

  #section-route .route__content .state-box {
    margin-block: auto;
  }

  /* Аккуратная тонкая полоса прокрутки вместо системной */
  #section-route .route__content,
  #section-checklist .checklist__items,
  #section-budget .budget,
  #section-bookings .bookings__list {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
  }

  #section-route .route__content::-webkit-scrollbar,
  #section-checklist .checklist__items::-webkit-scrollbar,
  #section-budget .budget::-webkit-scrollbar,
  #section-bookings .bookings__list::-webkit-scrollbar {
    width: 8px;
  }

  #section-route .route__content::-webkit-scrollbar-track,
  #section-checklist .checklist__items::-webkit-scrollbar-track,
  #section-budget .budget::-webkit-scrollbar-track,
  #section-bookings .bookings__list::-webkit-scrollbar-track {
    background: transparent;
  }

  #section-route .route__content::-webkit-scrollbar-thumb,
  #section-checklist .checklist__items::-webkit-scrollbar-thumb,
  #section-budget .budget::-webkit-scrollbar-thumb,
  #section-bookings .bookings__list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-pill);
  }

  #section-route .route__content:hover::-webkit-scrollbar-thumb,
  #section-checklist .checklist__items:hover::-webkit-scrollbar-thumb,
  #section-budget .budget:hover::-webkit-scrollbar-thumb,
  #section-bookings .bookings__list:hover::-webkit-scrollbar-thumb {
    background: #C9D4E3;
  }

  /* В узкой правой колонке круговая диаграмма и легенда встают друг под друга */
  .budget {
    grid-template-columns: 1fr;
  }

  .budget__chart-wrap {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
  }
}

/* ---------- Шапка секции: заголовок и подзаголовок в колонку,
     действия — справа. Раньше flex со space-between отбрасывал
     подзаголовок к правому краю, а на мобильном центрировал заголовок ---------- */
.section__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "subtitle actions";
  align-items: start;
  gap: var(--space-1) var(--space-4);
}

.section__title,
.trips-header {
  grid-area: title;
}

.section__subtitle {
  grid-area: subtitle;
  margin-top: 0;
}

.section__header-actions {
  grid-area: actions;
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.section--trips .section__header {
  align-items: center;
}

@media (max-width: 600px) {
  .section__header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "subtitle"
      "actions";
    gap: var(--space-1);
  }

  .section__header-actions {
    justify-self: start;
    margin-top: var(--space-3);
  }

  .section--trips .section__header {
    align-items: start;
  }
}

/* ---------- 19. Верхняя навигация ---------- */
:root {
  --topbar-h: 64px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--transition-base), background var(--transition-base);
}

/* Тень появляется только когда страницу прокрутили */
.topbar--stuck {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 20px rgba(30, 42, 74, 0.08);
}

.topbar__inner {
  max-width: var(--container-max);
  min-height: var(--topbar-h);
  margin: 0 auto;
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

/* --- Логотип --- */
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.01em;
  border-radius: var(--radius-pill);
}

.topbar__brand:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Точка и «хвост» маршрута — та же метафора, что на обложке */
.topbar__brand-mark {
  position: relative;
  width: 22px;
  height: 10px;
  flex-shrink: 0;
}

.topbar__brand-mark::before {
  content: "";
  position: absolute;
  inset: 4px 0 4px 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-ocean), var(--color-accent));
}

.topbar__brand-mark::after {
  content: "";
  position: absolute;
  top: 0;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-coral);
  box-shadow: 0 0 0 3px var(--color-coral-soft);
}

/* --- Ссылки на разделы --- */
.topbar__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-right: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar__nav::-webkit-scrollbar {
  display: none;
}

.topbar__link {
  position: relative;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-text-soft);
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.topbar__link:hover {
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.topbar__link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.topbar__link--active {
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

/* --- Заглушка профиля --- */
.topbar__profile {
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  line-height: 0;
  transition: transform var(--transition-fast);
}

.topbar__profile:hover {
  transform: translateY(-1px);
}

.topbar__profile:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.topbar__avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--color-ocean), var(--color-accent));
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(46, 95, 163, 0.28);
}

/* Липкая шапка не должна перекрывать заголовок секции при переходе по якорю */
.section,
.cover,
.today {
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}

@media (max-width: 768px) {
  .topbar__inner {
    gap: var(--space-4);
    padding: var(--space-2) var(--space-3);
  }

  .topbar__link {
    padding: var(--space-2);
  }
}

/* На телефоне работает нижняя навигация — верхняя убирается */
@media (max-width: 600px) {
  .topbar__nav {
    display: none;
  }

  .topbar__inner {
    justify-content: space-between;
  }

  .topbar__brand {
    margin-right: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar,
  .topbar__profile {
    transition: none;
  }
}
