:root {
  /* Основная палитра — современный indigo (B2B / fintech-trust)
     Имена var остались --green* для минимизации diff, но цвета теперь indigo */
  --green:        #4F46E5;
  --green-dark:   #3730A3;
  --green-light:  #E0E7FF;
  --green-mint:   #EEF2FF;
  --green-glow:   rgba(79, 70, 229, 0.22);

  /* Акцентный цвет — тёплый янтарь для «горячих» CTA (не меняется) */
  --accent:       #F59E0B;
  --accent-light: #FEF3C7;
  --accent-dark:  #B45309;

  /* Дополнительные оттенки (используются в карточках, бейджах) */
  --blue-light:   #DBEAFE;
  --amber-light:  #FEF3C7;
  --pink-light:   #FCE7F3;

  /* Нейтрали */
  --border:       #E5E7EB;
  --border-hover: #CBD5E1;
  --text:         #0F172A;
  --muted:        #64748B;
  --muted-light:  #94A3B8;
  --bg:           #F8FAFC;
  --white:        #FFFFFF;

  /* Геометрия — чуть мягче */
  --radius:       16px;
  --radius-sm:    10px;
  --radius-lg:    20px;

  /* Слоистые тени для глубины */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 8px 24px rgba(79, 70, 229, 0.18);

  /* Контентный контейнер */
  --container-max: 1240px;
  --container-pad: 32px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  /* Резервируем место для скроллбара всегда — чтобы при изменении
     длины контента (поиск → меньше/больше результатов) ширина страницы
     не прыгала на ширину скроллбара (~15px) */
  scrollbar-gutter: stable;
  /* Fallback для старых браузеров без scrollbar-gutter */
  overflow-y: scroll;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── TOAST NOTIFICATIONS (заменяет alert/confirm) ─── */
.toast-container {
  position: fixed; top: 16px; right: 16px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: calc(100vw - 32px); width: 360px;
  pointer-events: none;
}
.toast {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.14), 0 4px 12px rgba(15,23,42,0.08);
  display: flex; gap: 12px; align-items: flex-start;
  pointer-events: auto;
  animation: toastIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  position: relative;
}
.toast.toast--leaving { animation: toastOut 0.22s ease-in forwards; }
@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(120%); opacity: 0; }
}
.toast-icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 2px; letter-spacing: -0.1px; }
.toast-msg { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.toast-close {
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--muted-light);
  padding: 0; line-height: 1; flex-shrink: 0;
  align-self: flex-start;
}
.toast-close:hover { color: var(--text); }
.toast--err   { border-left: 4px solid #ef4444; }
.toast--err   .toast-icon { color: #ef4444; }
.toast--warn  { border-left: 4px solid #f59e0b; }
.toast--warn  .toast-icon { color: #f59e0b; }
.toast--ok    { border-left: 4px solid var(--green); }
.toast--ok    .toast-icon { color: var(--green); }
.toast--info  { border-left: 4px solid #3b82f6; }
.toast--info  .toast-icon { color: #3b82f6; }

/* Custom confirm dialog (вместо browser confirm) */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2100;
  display: flex; align-items: center; justify-content: center;
  animation: modalFade 0.2s ease;
  padding: 16px;
}
@keyframes modalFade { from { opacity: 0 } to { opacity: 1 } }
.modal-card {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  max-width: 460px; width: 100%;
  box-shadow: 0 24px 64px rgba(15,23,42,0.25);
  animation: modalPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 10px; color: var(--text); }
.modal-msg { font-size: 14px; color: var(--text); line-height: 1.55; margin-bottom: 20px; white-space: pre-wrap; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-btn {
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  padding: 9px 18px; border-radius: 10px;
  cursor: pointer; transition: background .15s, transform .1s;
  border: 1.5px solid var(--border);
  background: var(--white); color: var(--text);
}
.modal-btn:hover { transform: translateY(-1px); }
.modal-btn--primary { background: var(--green); color: var(--white); border-color: var(--green); }
.modal-btn--primary:hover { background: var(--green-dark); border-color: var(--green-dark); }

/* ─── SCROLL PROGRESS BAR (фиксированная полоска вверху страницы) ─── */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: linear-gradient(to right, var(--green) 0%, #818CF8 50%, var(--accent) 100%);
  z-index: 1000;
  transition: width 0.08s linear;
  pointer-events: none;
  box-shadow: 0 1px 6px rgba(79, 70, 229, 0.45);
}

/* ─── NAV ─── */
nav {
  position: sticky; top: 0; z-index: 100;
  padding: 0;
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 12px var(--container-pad);
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
}
.logo {
  display: inline-flex; align-items: center; gap: 11px;
  text-decoration: none; color: var(--text);
  transition: opacity .15s;
}
.logo:hover { opacity: 0.85; }

/* SVG-иконка: outline export-arrow с gradient stroke */
.logo-mark {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(79, 70, 229, 0.28));
}
.logo-mark svg { display: block; }
.logo-mark-arrow { transform-origin: center; }
/* На hover — стрелка слегка подпрыгивает (как «отправляем») */
.logo:hover .logo-mark-arrow { animation: logoArrowBob 0.55s ease; }
@keyframes logoArrowBob {
  0%, 100% { transform: translateY(0); }
  45%      { transform: translateY(-3px); }
}

/* Текст + tagline в колонку */
.logo-content {
  display: flex; flex-direction: column;
  line-height: 1.05;
  gap: 5px;
}
.logo-text {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.35px;
  color: var(--text);
  line-height: 1;
}
.logo-dot {
  color: var(--green);
  font-size: 1.15em;
  margin: 0 -0.04em;
  text-shadow: 0 0 8px rgba(79, 70, 229, 0.45);
}
.logo-tagline {
  font-size: 11px; font-weight: 500;
  color: var(--muted-light);
  letter-spacing: 0;
  line-height: 1;
}

/* На совсем узких экранах tagline скрываем — место под кнопки nav-links */
@media (max-width: 480px) {
  .logo-tagline { display: none; }
  .logo-mark svg { width: 22px; height: 22px; }
  .logo-text { font-size: 16px; }
  .logo { gap: 8px; }
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  font-size: 13.5px; color: var(--muted); text-decoration: none;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-weight: 500;
  transition: color .15s, background .15s, border-color .15s;
}
.nav-links a:hover { color: var(--text); background: var(--green-mint); }
.nav-links .nav-btn {
  border: 1.5px solid var(--border); color: var(--text); font-weight: 600;
}
.nav-links .nav-btn:hover { border-color: var(--green); color: var(--green-dark); background: var(--green-light); }

/* ─── PAGE BODY (скрыт до CTA) ─── */
#page-body {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#page-body.visible {
  flex: 1;
  display: block;
  opacity: 1;
}

/* Глобально подавляем горизонтальный скролл — countries-bar использует
   100vw + margin-left трюк, который может выходить за viewport на ширину скроллбара */
html, body { overflow-x: hidden; }

/* ─── HERO ─── */
.hero {
  flex: 1;
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  /* Сверху и снизу — белый (стыкуется с nav и footer без видимой границы),
     посередине — еле заметный лёгкий тон. Цвет идёт от blob-фигур (::before/::after). */
  background: #ffffff;
  padding-bottom: 8px;
}
/* Декоративные blob-фигуры в hero — добавляют глубины без визуального шума */
.hero::before {
  content: ''; position: absolute; top: -120px; left: -80px;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.18), transparent 70%);
  pointer-events: none; z-index: 0;
}
.hero::after {
  content: ''; position: absolute; bottom: -140px; right: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.10), transparent 70%);
  pointer-events: none; z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero-note {
  text-align: center;
  font-size: 12px; color: var(--muted-light);
  margin: 10px auto 0;
  max-width: 480px;
  line-height: 1.5;
}
.hero-inner {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px var(--container-pad) 20px;
  width: 100%; max-width: var(--container-max); margin: 0 auto;
  text-align: center;
}
/* countries-bar в hero — той же ширины, что и nav/cards/widget/footer (1240px),
   без 100vw breakout. Сохраняем «glass» эффект через blur. */
.hero-inner .countries-bar {
  width: 100%;
  margin: 12px 0 8px;
  padding: 12px 0 8px;
  border: none;
  border-radius: 0;
  background: transparent;       /* без видимой плашки за блоком стран */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
/* Внутри hero-inner у .countries-inner padding не нужен — parent уже даёт его */
.hero-inner .countries-inner { padding: 0 18px; max-width: none; }
/* countries-bar живёт ТОЛЬКО внутри hero — после клика на страну hero
   скрывается, в page-body показывается «← Изменить страну» */

/* Скрытые пилюли (страны 11-54), раскрываются по «Показать все».
   Двойная классовая селекция (.cpill.cpill--hidden) — чтобы перебить более позднее
   .cpill { display: flex }, которое объявлено ниже в файле с равной специфичностью. */
.cpill.cpill--hidden { display: none; }
.countries-track.expanded .cpill.cpill--hidden { display: flex; }

/* Кнопка «Показать все страны / Скрыть» */
.btn-show-countries {
  display: block; margin: 6px auto 0;
  font-family: inherit;
  font-size: 12.5px; font-weight: 600;
  padding: 8px 22px; border-radius: 22px;
  background: var(--white); color: var(--green-dark);
  border: 1.5px dashed var(--green);
  cursor: pointer;
  transition: background .15s, border-style .15s, transform .15s;
}
.btn-show-countries:hover {
  background: var(--green-light);
  border-style: solid;
  transform: translateY(-1px);
}

/* Заголовок страницы под back-link — описывает что происходит */
.page-intro {
  max-width: var(--container-max);
  margin: 18px auto 0;
  padding: 0 var(--container-pad);
  text-align: center;
  /* Якорь для scrollIntoView — оставляем место под sticky nav (≈56px) */
  scroll-margin-top: 70px;
}
.page-intro-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800; letter-spacing: -0.6px;
  margin-bottom: 8px; color: var(--text);
}
.page-intro-title #page-intro-country {
  background: linear-gradient(90deg, var(--green) 0%, #818CF8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-intro-sub {
  font-size: 14px; color: var(--muted);
  max-width: 620px; margin: 0 auto;
  line-height: 1.55;
}
@media (max-width: 600px) {
  .page-intro { margin-top: 14px; padding: 0 16px; }
  .page-intro-sub { font-size: 12.5px; }
}

/* «← Изменить страну» — компактный back-link над карточками виджетов */
.back-to-countries {
  display: flex; align-items: center; gap: 14px;
  max-width: var(--container-max);
  margin: 14px auto 0;
  padding: 0 var(--container-pad);
  flex-wrap: wrap;
}
.back-link {
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 18px;
  background: var(--white); color: var(--green-dark);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.back-link:hover {
  background: var(--green-light);
  border-color: var(--green);
  transform: translateX(-2px);
}
.back-current { font-size: 13px; color: var(--muted); }
.back-current strong { color: var(--text); font-weight: 700; }
@media (max-width: 600px) {
  .back-to-countries { padding: 0 16px; gap: 10px; }
  .back-current { font-size: 12px; }
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-light); color: var(--green-dark);
  font-size: 12px; font-weight: 600;
  padding: 5px 14px; border-radius: 20px; margin-bottom: 14px;
}
h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; margin-bottom: 16px;
  max-width: 720px;
}
h1 em { color: var(--green); font-style: normal; }
.hero-sub {
  color: var(--muted); font-size: 15px; max-width: 580px;
  margin: 0 0 18px; line-height: 1.55;
}
.hero-cta {
  display: flex; align-items: center; gap: 16px;
  justify-content: center; flex-wrap: wrap; margin-bottom: 32px;
}
.hero-hint { font-size: 12px; color: var(--muted-light); }

/* Hero metrics (subtle, inside hero) */
.hero-metrics {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 0;
  margin-top: 16px; padding-top: 4px;
  width: 100%;
}
.hm-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 18px;
}
.hm-n { font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: -0.3px; }
.hm-l { font-size: 10px; color: var(--muted-light); margin-top: 2px; white-space: nowrap; font-weight: 500; }
.hm-sep { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }


/* ─── WHY SECTION ─── */
.section-why {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 56px 32px;
}
.why-inner { max-width: 980px; margin: 0 auto; }
.why-header { text-align: center; margin-bottom: 44px; }
.section-tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--green); background: var(--green-light);
  padding: 4px 12px; border-radius: 20px; margin-bottom: 14px;
}
.section-why h2 {
  font-size: clamp(22px, 3vw, 32px); font-weight: 800;
  letter-spacing: -0.5px; margin-bottom: 12px;
}
.why-sub { color: var(--muted); font-size: 15px; max-width: 520px; margin: 0 auto; }
.why-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.why-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, border-color .2s;
}
.why-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.why-icon { font-size: 32px; margin-bottom: 14px; }
.why-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.why-desc { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ─── COUNTRIES BAR ─── */
.countries-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 18px 0 20px;
}
.countries-inner {
  max-width: var(--container-max); margin: 0 auto;
  padding: 0 var(--container-pad);
}
.countries-header {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px;
  /* Универсальное центрирование — работает и в hero, и в page-body */
  justify-content: center; flex-wrap: wrap; text-align: center;
}
.countries-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted-light);
}
.countries-hint { font-size: 12px; color: var(--muted-light); }

.countries-track {
  display: flex; flex-wrap: wrap; gap: 8px;
  row-gap: 10px;
  overflow: visible;
  padding: 6px 8px 4px;
  /* Центрирование рядов — но safe, чтобы при минимальной ширине пилюли стартовали с левого края */
  justify-content: safe center;
}
.countries-track::-webkit-scrollbar { display: none; }

/* ─── COUNTRY PILL ─── */
.cpill {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 22px 12px;
  min-width: 112px;
  border-radius: 16px; border: 1.5px solid var(--border);
  background: var(--white); cursor: pointer;
  white-space: nowrap; flex-shrink: 0; text-align: center;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: border-color .18s, background .18s, box-shadow .18s, transform .15s, opacity .18s;
}
.cpill:hover { transform: translateY(-1px); }
.cpill--live {
  border-color: var(--green);
  background: linear-gradient(145deg, #EEF2FF, #E0E7FF);
}
.cpill--live:hover {
  border-color: var(--green-dark);
  box-shadow: 0 4px 18px var(--green-glow);
}
.cpill--live.active {
  background: var(--green); border-color: var(--green-dark);
  box-shadow: 0 4px 20px var(--green-glow);
}
.cpill--live.active .cpill-name { color: var(--white); }
.cpill--live.active .cpill-badge--live { background: rgba(255,255,255,0.25); color: var(--white); }
.cpill--live.active .live-dot { background: var(--white); }
.cpill--soon { opacity: 0.62; }
.cpill--soon:hover { opacity: 1; border-color: var(--border-hover); box-shadow: var(--shadow-sm); }

.cpill-flag {
  display: block; width: 40px; height: 28px;
  border-radius: 5px; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  background-size: cover; flex-shrink: 0;
}
.cpill-name {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  transition: color .15s; line-height: 1.2;
  /* Фиксированная высота под 2 строки — все пилюли одной высоты,
     одностраничные названия центрируются вертикально */
  min-height: calc(2 * 1.2em);
  display: flex; align-items: center; justify-content: center;
}
.cpill--live .cpill-name { color: var(--green-dark); }
.cpill-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 8px; font-weight: 700; letter-spacing: 0.4px;
  padding: 1px 6px; border-radius: 10px; text-transform: uppercase;
}
.cpill-badge--live { background: var(--green-light); color: var(--green-dark); }
.cpill-badge--soon { background: #f3f4f6; color: var(--muted-light); }

.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ─── CARDS ─── */
.cards {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 14px;
  max-width: var(--container-max);
  margin: 28px auto 0;
  padding: 0 var(--container-pad);
}
.card {
  position: relative;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 20px 18px 18px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 4px 12px rgba(15,23,42,0.03);
  transition: transform .25s cubic-bezier(.4,0,.2,1),
              box-shadow .25s cubic-bezier(.4,0,.2,1),
              border-color .2s;
}

/* Едва заметный градиент-подложка в углу карточки (для глубины) */
.card::after {
  content: ''; position: absolute; top: -40%; right: -40%;
  width: 180px; height: 180px; border-radius: 50%;
  opacity: 0; transition: opacity .35s;
  pointer-events: none;
}
.card:nth-child(1)::after { background: radial-gradient(circle, rgba(79,70,229,0.15), transparent 70%); }
.card:nth-child(2)::after { background: radial-gradient(circle, rgba(59,130,246,0.15), transparent 70%); }
.card:nth-child(3)::after { background: radial-gradient(circle, rgba(245,158,11,0.15), transparent 70%); }
.card:nth-child(4)::after { background: radial-gradient(circle, rgba(139,92,246,0.15), transparent 70%); }

/* HOVER — лифт + цветная подложка проявляется */
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(15,23,42,0.04), 0 18px 40px rgba(15,23,42,0.10);
}
.card:hover::after { opacity: 1; }
.card:hover .card-icon-box { transform: scale(1.08) rotate(-3deg); }
.card:nth-child(1):hover { border-color: var(--green-light); }
.card:nth-child(2):hover { border-color: #BFDBFE; }
.card:nth-child(3):hover { border-color: #FDE68A; }
.card:nth-child(4):hover { border-color: #DDD6FE; }

/* ACTIVE — заметный gradient на icon-box + цветная граница + soft glow */
.card.active::after { opacity: 1; }
.card:nth-child(1).active { border-color: var(--green);  box-shadow: 0 4px 12px rgba(79,70,229,0.18), 0 16px 36px rgba(79,70,229,0.12); }
.card:nth-child(2).active { border-color: #3B82F6;       box-shadow: 0 4px 12px rgba(59,130,246,0.18), 0 16px 36px rgba(59,130,246,0.12); }
.card:nth-child(3).active { border-color: #F59E0B;       box-shadow: 0 4px 12px rgba(245,158,11,0.18), 0 16px 36px rgba(245,158,11,0.12); }
.card:nth-child(4).active { border-color: #8B5CF6;       box-shadow: 0 4px 12px rgba(139,92,246,0.18), 0 16px 36px rgba(139,92,246,0.12); }

/* Номер шага — в углу, скромный */
.card-num {
  position: absolute; top: 16px; right: 16px;
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  color: var(--muted-light);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 7px;
  transition: background .2s, color .2s;
  z-index: 1;
}
.card:nth-child(1).active .card-num { background: var(--green-light);  color: var(--green-dark); }
.card:nth-child(2).active .card-num { background: #DBEAFE;             color: #1D4ED8; }
.card:nth-child(3).active .card-num { background: var(--accent-light); color: #92400E; }
.card:nth-child(4).active .card-num { background: #EDE9FE;             color: #6D28D9; }

/* Большой цветной icon-box */
.card-icon-box {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  transition: transform .25s cubic-bezier(.4,0,.2,1),
              background .3s, box-shadow .25s;
  position: relative; z-index: 1;
}
.card:nth-child(1) .card-icon-box { background: var(--green-mint); }
.card:nth-child(2) .card-icon-box { background: #EFF6FF; }
.card:nth-child(3) .card-icon-box { background: #FFFBEB; }
.card:nth-child(4) .card-icon-box { background: #F5F3FF; }

/* Active — icon-box получает gradient и тень */
.card:nth-child(1).active .card-icon-box { background: linear-gradient(135deg, var(--green) 0%, #818CF8 100%); box-shadow: 0 6px 16px rgba(79,70,229,0.35); }
.card:nth-child(2).active .card-icon-box { background: linear-gradient(135deg, #3B82F6 0%, #60A5FA 100%);     box-shadow: 0 6px 16px rgba(59,130,246,0.35); }
.card:nth-child(3).active .card-icon-box { background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);     box-shadow: 0 6px 16px rgba(245,158,11,0.35); }
.card:nth-child(4).active .card-icon-box { background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);     box-shadow: 0 6px 16px rgba(139,92,246,0.35); }

.card-icon {
  font-size: 26px; line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
  transition: filter .25s;
}
.card.active .card-icon {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}

.card-title {
  font-size: 14.5px; font-weight: 700;
  margin-bottom: 4px; letter-spacing: -0.2px;
  position: relative; z-index: 1;
}
.card-desc {
  font-size: 12px; color: var(--muted);
  line-height: 1.5;
  position: relative; z-index: 1;
}

/* Connector — тонкая стрелка между карточками (только на десктопе) */
@media (min-width: 901px) {
  .card:not(:last-child) {
    position: relative;
  }
  .card:not(:last-child)::before {
    content: '';
    position: absolute; right: -10px; top: 50%;
    width: 8px; height: 8px;
    border-top: 2px solid var(--border);
    border-right: 2px solid var(--border);
    transform: translateY(-50%) rotate(45deg);
    z-index: 2;
    transition: border-color .2s;
  }
  .card:nth-child(1):not(:last-child)::before:where(:hover) { border-color: var(--green); }
}

/* ─── WIDGET AREA ─── */
.widget-area {
  max-width: var(--container-max);
  margin: 24px auto 32px;
  padding: 0 var(--container-pad);
  /* Чисто контейнер: бордер и фон теперь на .widget — чтобы внешний край
     совпал с другими блоками (cards/footer/nav/hero), которые используют padding-паттерн. */
}
.widget {
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  box-shadow: var(--shadow-md);
  animation: widgetIn 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.widget.hidden { display: none; }
@keyframes widgetIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.widget-header {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px;
}
.widget-icon-wrap {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  background: var(--green-light);
}
.widget-icon-wrap.c1 { background: var(--green-light); }
.widget-icon-wrap.c2 { background: var(--blue-light); }
.widget-icon-wrap.c3 { background: var(--amber-light); }
.widget-icon-wrap.c4 { background: #e0f2fe; }
.widget-title { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.widget-sub { font-size: 13px; color: var(--muted); }
.widget-badge {
  margin-left: auto; font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); padding: 3px 10px;
  border-radius: 20px; white-space: nowrap;
}

/* ─── CHAT ─── */
.chat-messages {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 16px; max-height: 420px; overflow-y: auto;
  padding-right: 4px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.msg {
  padding: 10px 14px; border-radius: 12px; font-size: 14px;
  max-width: 80%; line-height: 1.55;
  animation: fadeUp .25s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-row { display: flex; flex-direction: column; gap: 4px; }
.msg-row--bot  { align-items: flex-start; }
.msg-row--user { align-items: flex-end; }
.msg-sender {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; padding: 0 4px;
  color: var(--muted-light);
}
.msg-row--user .msg-sender { color: var(--green-dark); }

.msg.bot  { background: #f3f4f6; white-space: pre-line; }
.msg.user { background: var(--green-light); color: var(--green-dark); }

/* ─── WELCOME / ONBOARDING MSG ─── */
.msg.msg-welcome {
  background: linear-gradient(145deg, #EEF2FF 0%, #ffffff 60%, #f5f3ff 100%);
  border: 1px solid var(--green-light);
  max-width: 100%; width: 100%;
  padding: 18px 44px 20px 20px;
  white-space: normal;
  position: relative;
}
.welcome-close {
  position: absolute; top: 10px; right: 10px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.65); border: 1px solid var(--border);
  font-size: 17px; line-height: 1; color: var(--muted);
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.welcome-close:hover {
  background: var(--white); color: var(--text);
  border-color: var(--border-hover); transform: scale(1.08);
}

/* Подсказка-замена после закрытия welcome — просто текст слева, без рамки */
.chat-hint {
  align-self: flex-start;
  font-size: 13px; color: var(--muted);
  padding: 2px 4px;
  line-height: 1.55;
  animation: fadeUp .25s ease;
}

/* Панель быстрых переходов — вставляется после chat-messages, не внутри */
.msg-actions {
  width: 100%;
  margin-top: 12px;
  padding: 16px 18px 18px;
  background: linear-gradient(145deg, #EEF2FF 0%, #ffffff 60%, #f5f3ff 100%);
  border: 1.5px solid var(--green-light);
  border-radius: 14px;
  animation: fadeUp .3s ease;
  position: relative; overflow: hidden;
}
.msg-actions::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(to right, var(--green) 0%, #34d399 50%, var(--green) 100%);
}
.msg-actions-title {
  font-size: 13px; font-weight: 700;
  color: var(--text); letter-spacing: -0.2px;
  margin-bottom: 12px;
}
.msg-actions-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.action-card {
  font-family: inherit;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer; text-align: left;
  position: relative; overflow: hidden;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--green);
  box-shadow: 0 8px 20px rgba(79,70,229,0.18);
}
.action-icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.action-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.action-title {
  font-size: 12.5px; font-weight: 700; color: var(--text);
  line-height: 1.25;
}
.action-sub {
  font-size: 10.5px; color: var(--muted); font-weight: 500;
  line-height: 1.3;
}
.action-arrow {
  font-size: 16px; font-weight: 700; color: var(--muted-light);
  flex-shrink: 0; transition: color .18s, transform .18s;
}
.action-card:hover .action-arrow { color: var(--green); transform: translateX(3px); }

/* Цветовые акценты для каждой карточки */
.action-card--delivery { background: linear-gradient(160deg, #f0f9ff 0%, #ffffff 60%); }
.action-card--delivery:hover { border-color: #3b82f6; box-shadow: 0 8px 20px rgba(59,130,246,0.18); }
.action-card--delivery:hover .action-arrow { color: #3b82f6; }

.action-card--buyers { background: linear-gradient(160deg, #fef3c7 0%, #ffffff 60%); }
.action-card--buyers:hover { border-color: #f59e0b; box-shadow: 0 8px 20px rgba(245,158,11,0.18); }
.action-card--buyers:hover .action-arrow { color: #f59e0b; }

.action-card--kp {
  background: linear-gradient(160deg, var(--green-light) 0%, #ffffff 60%);
  border-color: var(--green);
}
.action-card--kp::after {
  content: '⭐ финал'; position: absolute; top: 6px; right: 8px;
  font-size: 8px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--green-dark); background: var(--white);
  padding: 2px 6px; border-radius: 8px; text-transform: uppercase;
  border: 1px solid var(--green-light);
}
.action-card--kp .action-arrow { color: var(--green); }

@media (max-width: 640px) {
  /* Чат — убираем фиксированную высоту: блок "Что дальше?" виден без внутреннего скролла */
  .chat-messages { max-height: none; overflow-y: visible; }

  .msg-actions-row { grid-template-columns: 1fr; }
  .action-card--kp::after { display: none; }

  /* Таблица покупателей — убираем объём, активность, сайт; оставляем компанию + страну + КП */
  #search-results { overflow-x: hidden; }
  .results-table th:nth-child(3),
  .results-table td:nth-child(3) { display: none; }   /* объём */
  .results-table th:nth-child(4),
  .results-table td:nth-child(4) { display: none; }   /* активность */
  .results-table th:nth-child(5),
  .results-table td:nth-child(5) { display: none; }   /* сайт */
  .results-table th, .results-table td { padding: 8px 8px; }
  .table-toolbar { flex-direction: column; align-items: flex-start; gap: 6px; }
  .paywall-banner { flex-direction: column; gap: 10px; padding: 14px 16px; }
  .paywall-lock { font-size: 22px; }
}
.welcome-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 8px; letter-spacing: -0.2px;
}
.welcome-text {
  font-size: 13px; color: var(--muted);
  line-height: 1.6; margin-bottom: 18px;
}
.welcome-steps {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: start; gap: 6px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 10px;
  margin-bottom: 14px;
}
.wstep {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 4px; min-width: 0;
}
.wstep-bubble {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: var(--white);
  border: 1.5px solid var(--border);
  margin-bottom: 4px;
}
.wstep--final .wstep-bubble { border-color: var(--green); background: var(--green-light); }
.wstep-num {
  font-size: 9px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--green);
}
.wstep-title {
  font-size: 11.5px; font-weight: 700; color: var(--text);
  line-height: 1.25;
}
.wstep-desc {
  font-size: 10.5px; color: var(--muted-light); line-height: 1.3;
}
.wstep-arrow {
  color: var(--muted-light); font-size: 14px; align-self: center;
  margin-top: 14px;
}
.welcome-cta {
  font-size: 12.5px; font-weight: 600; color: var(--green-dark);
  text-align: center; padding-top: 4px;
}
.welcome-cta--solo {
  font-size: 13.5px; margin-top: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.7);
  border: 1px dashed var(--green);
  border-radius: 10px;
}
@media (max-width: 640px) {
  .welcome-steps {
    grid-template-columns: 1fr;
    gap: 4px; padding: 12px;
  }
  .wstep {
    flex-direction: row; align-items: center; text-align: left;
    gap: 10px; padding: 6px 4px;
  }
  .wstep-bubble { margin-bottom: 0; flex-shrink: 0; width: 32px; height: 32px; font-size: 16px; }
  .wstep-num { display: none; }
  .wstep-title { font-size: 12.5px; }
  .wstep-desc { font-size: 11px; }
  .wstep-arrow { display: none; }
  .welcome-title { font-size: 14px; }
  .welcome-text { font-size: 12.5px; margin-bottom: 14px; }
}
.quick-btns-label {
  font-size: 11px; font-weight: 600; color: var(--muted-light);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 8px;
}
.quick-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.quick-btns button {
  font-size: 12px; padding: 7px 14px; border-radius: 20px;
  border: 1.5px solid var(--green); background: transparent;
  color: var(--green-dark); cursor: pointer; transition: background .15s;
  font-family: inherit;
}
.quick-btns button:hover { background: var(--green-light); }
.chat-input-row {
  display: flex; gap: 8px; position: relative;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1; font-size: 14px; padding: 11px 16px;
  border: 2px solid var(--green); border-radius: var(--radius-sm);
  background: linear-gradient(to right, #ffffff, #EEF2FF);
  box-shadow: 0 0 0 4px var(--green-glow), 0 2px 8px rgba(79,70,229,0.12);
  font-family: inherit; outline: none;
  transition: box-shadow .2s, transform .15s;
  animation: inputAttract 2.4s ease-in-out infinite;
}
.chat-input-row input::placeholder { color: var(--green-dark); opacity: 0.55; font-weight: 500; }
.chat-input-row input:focus {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 5px var(--green-glow), 0 4px 14px rgba(79,70,229,0.2);
  animation: none;
}
@keyframes inputAttract {
  0%, 100% { box-shadow: 0 0 0 4px var(--green-glow), 0 2px 8px rgba(79,70,229,0.12); }
  50%       { box-shadow: 0 0 0 8px rgba(79,70,229,0.18), 0 4px 14px rgba(79,70,229,0.22); }
}
.chat-input--highlight {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 4px var(--green-glow) !important;
  animation: inputPulse 1s ease-in-out 3;
}
@keyframes inputPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
  50%       { box-shadow: 0 0 0 7px rgba(79,70,229,0.28); }
}
.chat-input-row button {
  padding: 9px 20px; background: var(--green); color: white;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 16px; transition: opacity .15s;
}
.chat-input-row button:hover { opacity: .88; }

/* ─── SEARCH FORM ─── */
.search-form {
  display: grid; grid-template-columns: 1fr 1fr auto;
  gap: 10px; align-items: end; margin-bottom: 16px;
}

/* В виджете «Покупатели» — форма поиска оформлена как «фильтр-карточка»,
   её серый фон визуально отделяет фильтры от белого блока результатов ниже */
#w3 .search-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 24px;
}
.field label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  display: block; margin-bottom: 6px;
}
.field input, .field select {
  font-size: 14px; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  width: 100%; background: white; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus { border-color: var(--green); }

/* ─── COUNTRY SELECTED TAG ─── */
.country-selected-tag {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--muted);
  background: var(--green-light); border: 1px solid rgba(79,70,229,.2);
  border-radius: 20px; padding: 5px 12px;
  margin-bottom: 14px; width: fit-content;
}
.country-selected-tag strong { color: var(--green-dark); }

/* ─── SEARCH METRICS BAR ─── */
.search-metrics {
  display: flex; align-items: center;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 16px;
  overflow: hidden; flex-wrap: wrap;
}
.sm-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 20px; gap: 3px; flex: 1; min-width: 80px;
}
.sm-n {
  font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.5px;
  white-space: nowrap;
}
.sm-n--small { font-size: 12px; font-weight: 700; letter-spacing: 0; }
.sm-l {
  font-size: 10px; color: var(--muted-light);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
  white-space: nowrap;
}
.sm-sep { width: 1px; height: 36px; background: var(--border); flex-shrink: 0; }

/* ─── BULK ACTION BAR ─── */
.bulk-bar {
  display: flex; align-items: center; gap: 12px;
  background: #111827; color: white; border-radius: var(--radius-sm);
  padding: 11px 16px; margin-bottom: 12px; flex-wrap: wrap;
  animation: fadeUp .2s ease;
}
.bulk-count { font-size: 13px; font-weight: 600; flex: 1; }
.bulk-actions { display: flex; gap: 8px; }
.btn-bulk {
  font-size: 13px; padding: 7px 16px; background: var(--green);
  color: white; border: none; border-radius: 6px;
  cursor: pointer; font-weight: 600; font-family: inherit;
  transition: opacity .15s;
}
.btn-bulk:hover { opacity: .88; }
.btn-bulk-clear {
  font-size: 12px; padding: 7px 12px; background: transparent;
  color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px; cursor: pointer; font-family: inherit;
  transition: color .15s, border-color .15s;
}
.btn-bulk-clear:hover { color: white; border-color: white; }

/* ─── RESULTS TABLE ─── */
.results-table {
  width: 100%; border-collapse: collapse;
}
.results-table th {
  font-size: 11px; color: var(--muted-light); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); text-align: left; font-weight: 600;
}
.results-table td {
  font-size: 13px; padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6; vertical-align: middle;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:hover td { background: #f9fafb; }

input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--green); cursor: pointer;
}

/* Volume progress bar */
.vol-wrap { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.vol-bar-bg {
  flex: 1; height: 5px; background: #f3f4f6;
  border-radius: 3px; overflow: hidden;
}
.vol-bar { height: 100%; background: var(--green); border-radius: 3px; }
.vol-num { font-size: 12px; color: var(--text); font-weight: 600; white-space: nowrap; }

/* Search empty-state preview */
.search-empty {
  text-align: center;
  padding: 32px 24px 28px;
  background:
    radial-gradient(ellipse at top, rgba(79,70,229,0.06), transparent 60%),
    linear-gradient(180deg, #fbfffe 0%, #ffffff 60%);
  border: 1.5px dashed var(--green-light);
  border-radius: 16px;
}
.search-empty-icon {
  font-size: 42px; margin-bottom: 12px;
  filter: drop-shadow(0 2px 8px rgba(79,70,229,0.18));
  animation: floatY 3.4s ease-in-out infinite;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.search-empty-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 8px; letter-spacing: -0.2px;
}
.search-empty-text {
  font-size: 13px; color: var(--muted);
  margin-bottom: 18px; line-height: 1.6;
}
.search-empty-chips {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; margin-bottom: 18px;
}
.search-chip {
  font-family: inherit;
  font-size: 12.5px; font-weight: 600;
  padding: 8px 14px; border-radius: 22px;
  background: var(--white); color: var(--green-dark);
  border: 1.5px solid var(--green-light);
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.search-chip:hover {
  background: var(--green-light);
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,0.18);
}
.search-empty-hint {
  font-size: 11.5px; color: var(--muted-light);
  padding-top: 14px; border-top: 1px dashed var(--border);
}

/* Activity indicator pill */
.activity-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px 3px 8px; border-radius: 12px;
  white-space: nowrap;
}
.activity-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
}
.activity-pill--hot  { background: #EEF2FF; color: #3730A3; }
.activity-pill--hot  .activity-dot { background: #10b981; animation: pulse 1.6s ease-in-out infinite; }
.activity-pill--warm { background: #fef3c7; color: #92400e; }
.activity-pill--warm .activity-dot { background: #f59e0b; }
.activity-pill--cold { background: #f3f4f6; color: #6b7280; }
.activity-pill--cold .activity-dot { background: #9ca3af; }

/* ─── SOON TOAST ─── */
.soon-toast {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--amber-light); border: 1px solid #fbbf24;
  border-radius: var(--radius-sm); padding: 16px; font-size: 14px;
  animation: fadeUp .25s ease;
}
.soon-toast-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }

/* ─── RATES — ENHANCED ─── */
.rates-section { margin-bottom: 18px; }
.rates-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--muted-light);
  display: block; margin-bottom: 10px;
}
.rates-section .search-form { margin-bottom: 0; }

/* Route builder — visual route input replacing dropdowns-in-box */
.route-builder {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
  padding: 22px 24px 18px;
  border: 1.5px dashed var(--green-light);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at top, rgba(79,70,229,0.04), transparent 70%),
    linear-gradient(180deg, #ffffff, #fbfffe);
}
.rb-endpoint { text-align: center; min-width: 0; }
.rb-label {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--muted-light);
  margin-bottom: 6px;
}
.rb-select {
  font-family: inherit;
  font-size: 20px; font-weight: 800; color: var(--text);
  background: transparent; border: none;
  text-align: center; text-align-last: center;
  width: 100%; max-width: 100%;
  outline: none; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  padding: 4px 6px 2px;
  border-bottom: 2px solid transparent;
  letter-spacing: -0.4px;
  transition: border-color .15s, color .15s;
}
.rb-select:hover, .rb-select:focus { border-bottom-color: var(--green); color: var(--green-dark); }
.rb-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

.rb-arrow {
  display: flex; align-items: center; gap: 4px;
  padding: 0 6px 6px;
  color: var(--green);
}
.rb-arrow-line {
  width: 28px; height: 2px;
  background: linear-gradient(to right, var(--green-light), var(--green));
  border-radius: 1px;
}
.rb-arrow:last-child .rb-arrow-line:last-child {
  background: linear-gradient(to right, var(--green), var(--green-light));
}
.rb-arrow-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--white);
  border: 2px solid var(--green);
  font-size: 16px; font-weight: 700;
  color: var(--green);
  box-shadow: 0 2px 8px rgba(79,70,229,0.18);
}

.rb-weight { text-align: center; min-width: 0; }
.rb-weight-row {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 4px 6px 2px;
  border-bottom: 2px solid transparent;
  transition: border-color .15s;
}
.rb-weight-row:hover, .rb-weight-row:focus-within { border-bottom-color: var(--green); }
.rb-weight input {
  font-family: inherit;
  font-size: 20px; font-weight: 800; color: var(--text);
  background: transparent; border: none;
  text-align: center; outline: none;
  width: 60px;
  letter-spacing: -0.4px;
  -moz-appearance: textfield;
}
.rb-weight input::-webkit-outer-spin-button,
.rb-weight input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rb-weight-unit { font-size: 13px; color: var(--muted); font-weight: 600; }

/* Кнопка «Найти маршруты» — основной CTA route-builder'а */
.btn-route-search {
  display: block; margin: 14px auto 0;
  font-family: inherit;
  padding: 12px 36px; font-size: 14px; font-weight: 700;
  background: var(--green); color: var(--white);
  border: none; border-radius: 10px;
  cursor: pointer; letter-spacing: 0.2px;
  box-shadow: 0 4px 14px rgba(79,70,229,0.25);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-route-search:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79,70,229,0.32);
}
.btn-route-search--pulse {
  animation: searchPulse 1.4s ease-in-out infinite;
}
@keyframes searchPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(79,70,229,0.25); transform: scale(1); }
  50%      { box-shadow: 0 6px 24px rgba(79,70,229,0.55); transform: scale(1.04); }
}

/* Initial placeholder — показывается при первом открытии виджета доставки */
.rates-init {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px;
  background: #f9fafb;
  border: 1px dashed var(--border);
  border-radius: 12px;
  margin-top: 18px;
}
.rates-init-icon { font-size: 28px; flex-shrink: 0; }
.rates-init-title { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.rates-init-text { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Stale placeholder — показывается после смены маршрута */
.rates-stale {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 24px;
  background: linear-gradient(180deg, #fffbeb 0%, #fffefb 100%);
  border: 1.5px dashed #fbbf24;
  border-radius: 12px;
  margin-top: 18px;
}
.rates-stale-icon { font-size: 28px; flex-shrink: 0; }
.rates-stale-text { font-size: 13.5px; color: var(--text); line-height: 1.55; }
.rates-stale-text strong { color: var(--green-dark); }

@media (max-width: 768px) {
  .route-builder {
    grid-template-columns: 1fr;
    gap: 4px; padding: 14px 16px;
  }

  .rb-endpoint { text-align: center; }
  .rb-label { font-size: 10px; }

  /* Крупный шрифт select — уменьшаем до читаемого на телефоне */
  .rb-select {
    font-size: 15px; letter-spacing: 0;
    text-align: center; text-align-last: center;
    padding: 6px 4px 4px;
  }
  .rb-sub { font-size: 10.5px; }

  /* Стрелка: прячем линии, оставляем только иконку → вниз, по центру */
  .rb-arrow {
    justify-self: center;
    padding: 4px 0;
    gap: 0;
  }
  .rb-arrow-line { display: none; }
  /* Без кружка — только стрелка вниз */
  .rb-arrow-icon {
    width: auto; height: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    font-size: 20px; font-weight: 700;
    color: var(--green);
    transform: rotate(90deg);
  }

  /* Вес */
  .rb-weight { text-align: left; padding-top: 8px; border-top: 1px dashed var(--green-light); margin-top: 4px; }
  .rb-weight input { font-size: 15px; }

  /* Кнопка поиска — растягиваем на всю ширину */
  .btn-route-search { width: 100%; padding: 12px 16px; margin-top: 12px; }
}

/* Container/vehicle type selector */
.container-selector {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
}
.ctype {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 12px 8px 10px;
  cursor: pointer; text-align: center;
  font-family: inherit;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.ctype:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.ctype.active {
  border-color: var(--green); background: var(--green-light);
  box-shadow: 0 2px 10px rgba(79,70,229,0.12);
}
.ctype-visual { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 2px; }
.ctype-emoji { font-size: 22px; line-height: 1; }
.ctype-pill {
  font-size: 9px; font-weight: 700; letter-spacing: 0.4px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--text); color: var(--white);
}
.ctype.active .ctype-pill { background: var(--green); }
.ctype-name { font-size: 11.5px; font-weight: 700; color: var(--text); line-height: 1.2; }
.ctype-spec { font-size: 10px; color: var(--muted-light); }

/* Cargo + Incoterms chips */
.rates-meta { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; margin-bottom: 18px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.rchip {
  font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 18px;
  border: 1.5px solid var(--border); background: var(--white);
  color: var(--muted); cursor: pointer; user-select: none;
  transition: border-color .15s, background .15s, color .15s;
}
.rchip:hover { border-color: var(--border-hover); }
.rchip.active { border-color: var(--green); background: var(--green-light); color: var(--green-dark); }

/* Route visualization */
.route-viz {
  background: linear-gradient(145deg, #EEF2FF 0%, #ffffff 70%, #f5f3ff 100%);
  border: 1px solid var(--green-light);
  border-radius: 12px;
  padding: 18px 20px 16px;
  margin-bottom: 18px;
  display: none;
}
.route-viz.active { display: block; }
.route-viz-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.route-viz-title { font-size: 13px; font-weight: 700; color: var(--text); }
.route-viz-meta {
  font-size: 11.5px; color: var(--muted);
  background: var(--white); padding: 4px 10px; border-radius: 12px;
  border: 1px solid var(--border);
}
.route-chain {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; padding: 4px 0 6px;
  scrollbar-width: thin;
}
.route-chain::-webkit-scrollbar { height: 4px; }
.route-chain::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.route-node {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 4px; min-width: 88px;
  flex-shrink: 0; padding-top: 4px;
}
.route-node-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--green); border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--green); margin-bottom: 4px;
}
.route-node--mid .route-node-dot {
  background: var(--white); box-shadow: 0 0 0 2px var(--muted-light);
}
.route-node-city { font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.2; }
.route-node-kind { font-size: 10px; color: var(--muted-light); text-transform: uppercase; letter-spacing: 0.3px; }
.route-leg {
  flex: 1; min-width: 70px;
  display: flex; flex-direction: column; align-items: center;
  position: relative; padding-top: 10px;
}
.route-leg-line {
  width: 100%; height: 2px;
  background: linear-gradient(to right, var(--green), var(--muted-light));
}
.route-leg-icon {
  position: absolute; top: 0;
  background: var(--white); padding: 2px 10px;
  border: 1px solid var(--green-light); border-radius: 14px;
  font-size: 14px;
}
.route-leg-label {
  font-size: 10px; color: var(--muted); margin-top: 8px;
  font-weight: 600;
}

/* Rate cards — enhanced */
.rates-summary {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.rates-summary-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.rates-sort {
  margin-left: auto;
  display: flex; gap: 2px; background: #f3f4f6;
  border-radius: 18px; padding: 3px;
}
.sort-btn {
  font-size: 11px; font-weight: 600;
  padding: 5px 12px; border-radius: 16px;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-family: inherit;
  transition: background .15s, color .15s;
}
.sort-btn.active { background: var(--white); color: var(--green-dark); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

.rate-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
/* Свёрнутое состояние — показываем только первые 2 карточки */
.rate-cards.is-collapsed .rate-card:nth-child(n+3) { display: none; }

/* Кнопка «Показать ещё / Скрыть» */
.btn-show-more {
  display: block; margin: 14px auto 0;
  font-family: inherit;
  padding: 9px 22px; font-size: 12.5px; font-weight: 600;
  background: var(--white); color: var(--green-dark);
  border: 1.5px dashed var(--green);
  border-radius: 22px; cursor: pointer;
  transition: background .15s, border-style .15s, transform .15s;
}
.btn-show-more:hover {
  background: var(--green-light);
  border-style: solid;
  transform: translateY(-1px);
}

/* CTA-блок под ставками — переход к поиску покупателей */
.rates-next-cta {
  display: flex; align-items: center; gap: 14px;
  margin-top: 22px;
  padding: 16px 20px;
  background: linear-gradient(145deg, #EEF2FF 0%, #ffffff 60%, #f5f3ff 100%);
  border: 1.5px solid var(--green);
  border-radius: 14px;
  position: relative; overflow: hidden;
}
.rates-next-cta::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(to right, var(--green) 0%, #34d399 50%, var(--green) 100%);
}
.next-cta-icon {
  font-size: 28px; flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(79,70,229,0.25));
}
.next-cta-text { flex: 1; min-width: 0; }
.next-cta-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.next-cta-sub { font-size: 12px; color: var(--muted); line-height: 1.5; }
.btn-next-cta {
  font-family: inherit;
  padding: 11px 20px; font-size: 13px; font-weight: 700;
  background: var(--green); color: var(--white);
  border: none; border-radius: 10px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(79,70,229,0.25);
  transition: background .15s, transform .15s, box-shadow .15s;
}
.btn-next-cta:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79,70,229,0.35);
}
@media (max-width: 640px) {
  .rates-next-cta { flex-direction: column; align-items: stretch; text-align: center; }
  .btn-next-cta { width: 100%; }
}
.rate-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 16px 16px 14px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 11px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.rate-card:hover { border-color: var(--border-hover); box-shadow: 0 4px 14px rgba(0,0,0,0.06); transform: translateY(-1px); }
.rate-card--best { border-color: var(--green); background: linear-gradient(180deg, #EEF2FF 0%, #ffffff 60%); }
.rate-best-tag {
  position: absolute; top: 0; right: 0;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  background: var(--green); color: var(--white);
  padding: 4px 10px; border-radius: 0 12px 0 8px;
  text-transform: uppercase; margin: 0;
}
.rc-head { display: flex; align-items: center; gap: 10px; }
.rc-mode-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.rc-mode-icon.sea { background: var(--blue-light); }
.rc-mode-icon.air { background: var(--pink-light); }
.rc-mode-icon.truck { background: #EEF2FF; }
.rc-mode-icon.rail { background: #fef3c7; }
.rc-mode-info { flex: 1; min-width: 0; }
.rc-mode-label { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.rc-carrier { font-size: 11px; color: var(--muted); }
.rc-freq {
  font-size: 10px; font-weight: 600;
  background: #f3f4f6; color: var(--muted);
  padding: 4px 8px; border-radius: 10px;
  white-space: nowrap;
}

.rc-route {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text);
  background: #f9fafb; padding: 8px 10px; border-radius: 8px;
  border: 1px dashed var(--border);
}
.rc-route-pt { font-weight: 600; }
.rc-route-arrow { color: var(--muted-light); font-size: 10px; }

.rc-meta {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  font-size: 11px;
}
.rc-meta-item { display: flex; flex-direction: column; gap: 2px; }
.rc-meta-label { color: var(--muted-light); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; }
.rc-meta-val { font-weight: 700; color: var(--text); font-size: 12px; }

.rc-price-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.rc-price-block { display: flex; align-items: baseline; gap: 6px; }
.rc-price { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.rc-price-per { font-size: 11px; color: var(--muted); font-weight: 500; }
.rc-price-total {
  font-size: 12px; color: var(--green-dark); font-weight: 700;
  background: var(--green-light); padding: 3px 9px; border-radius: 8px;
  white-space: nowrap;
}

.rc-actions { display: flex; gap: 6px; }
.btn-rate {
  flex: 1; font-size: 12px; font-weight: 600;
  padding: 9px 10px; border-radius: 8px;
  border: 1.5px solid var(--green); background: var(--green); color: var(--white);
  cursor: pointer; font-family: inherit;
  transition: opacity .15s, background .15s;
}
.btn-rate:hover { opacity: 0.9; }
.btn-rate--ghost { background: transparent; color: var(--green-dark); }
.btn-rate--ghost:hover { background: var(--green-light); opacity: 1; }

/* ─── DOCUMENTS / SEND KP ─── */

/* Визуальные группы внутри виджета «Создать КП»:
   1) inputs — поля заполнения (шаблоны, прогресс, ① ② ③ ④)
   2) letter — текст сопроводительного письма (⑤)
   3) превью — kp-paper уже имеет свой shadow/border */
.kp-group {
  margin-bottom: 22px;
  padding: 22px 22px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.kp-group--inputs {
  background: linear-gradient(180deg, #f8fafc 0%, #fbfffe 100%);
}
/* Последний .doc-step внутри группы — без нижнего margin (group имеет свой padding) */
.kp-group > .doc-step:last-child { margin-bottom: 0; }

.doc-step { margin-bottom: 18px; }
.doc-step-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted-light);
  display: block; margin-bottom: 10px;
}
.doc-step-label .lbl-hint,
.field label .lbl-hint {
  font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--muted-light); font-size: 11px; margin-left: 4px;
}
.doc-form {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px;
}
.doc-form--1 { grid-template-columns: 1fr; }
.doc-form--2 { grid-template-columns: 1fr 1fr; }
.doc-form--3 { grid-template-columns: 1fr 1fr 1fr; }
.doc-form .field--full { grid-column: 1 / -1; }
.doc-form textarea {
  font-family: inherit; font-size: 13px; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  width: 100%; resize: vertical; outline: none;
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.55;
}
.doc-form textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow); }

/* Прогресс готовности КП */
.kp-progress {
  background: linear-gradient(145deg, #EEF2FF 0%, #ffffff 70%);
  border: 1px solid var(--green-light);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.kp-progress-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.kp-progress-title { font-size: 12px; font-weight: 700; color: var(--text); letter-spacing: 0.2px; }
.kp-progress-pct { font-size: 18px; font-weight: 800; color: var(--green-dark); }
.kp-progress-track {
  height: 6px; background: #e5e7eb;
  border-radius: 3px; overflow: hidden;
}
.kp-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(to right, var(--green), #34d399);
  border-radius: 3px;
  transition: width .35s ease;
}
.kp-progress-hint {
  font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.4;
}

/* Шаблоны быстрого старта */
.kp-templates { display: flex; flex-wrap: wrap; gap: 8px; }
.kp-template {
  font-family: inherit;
  font-size: 12.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 22px;
  background: var(--white); color: var(--text);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.kp-template:hover {
  border-color: var(--green);
  background: var(--green-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,0.15);
}
/* «Очистить» — нейтральный пунктирный, чтобы не конкурировал с шаблонами */
.kp-template--clear {
  margin-left: auto;
  border-style: dashed;
  color: var(--muted);
}
.kp-template--clear:hover {
  border-color: #ef4444;
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: 0 4px 12px rgba(239,68,68,0.15);
}

/* Mini-кнопки в шапке превью */
.btn-mini {
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  padding: 6px 11px; border-radius: 8px;
  background: var(--white); color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn-mini:hover { border-color: var(--green); background: var(--green-light); color: var(--green-dark); }

/* Превью КП как настоящий документ */
.kp-preview-wrap { margin: 22px 0 18px; }
.kp-preview-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.kp-preview-title > span {
  font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted-light);
}
.kp-preview-actions { display: flex; gap: 6px; }
.kp-paper {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 36px 42px 40px;
  box-shadow:
    0 1px 3px rgba(0,0,0,0.06),
    0 12px 32px rgba(0,0,0,0.08);
  position: relative;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #1f2937;
  line-height: 1.6;
  font-size: 13.5px;
}
.kp-paper::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(to right, var(--green) 0%, #34d399 50%, var(--green) 100%);
  border-radius: 4px 4px 0 0;
}
.kp-paper-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; padding-bottom: 18px;
  border-bottom: 2px solid var(--green-light); margin-bottom: 20px;
}
.kp-paper-from { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; }
.kp-paper-avatar {
  flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
  color: var(--white);
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  letter-spacing: -0.5px;
}
.kp-paper-from-text { min-width: 0; flex: 1; }
.kp-paper-from-name { font-weight: 700; font-size: 16px; color: #111827; margin-bottom: 4px; line-height: 1.2; }
.kp-paper-from-meta { font-size: 11.5px; color: #6b7280; line-height: 1.6; }
.kp-paper-meta { text-align: right; flex-shrink: 0; }
.kp-paper-meta-num { font-weight: 700; color: var(--green-dark); font-size: 14px; letter-spacing: 0.3px; margin-bottom: 4px; }
.kp-paper-meta-date { font-size: 11.5px; color: #6b7280; }

.kp-paper-to {
  background: #f9fafb; padding: 12px 16px; border-radius: 8px;
  margin-bottom: 22px; border-left: 3px solid var(--green);
}
.kp-paper-to-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #9ca3af; font-family: system-ui, sans-serif; margin-bottom: 4px; font-weight: 700; }
.kp-paper-to-name { font-weight: 700; font-size: 14px; color: #111827; }
.kp-paper-to-person { font-size: 12px; color: #6b7280; margin-top: 2px; }

.kp-paper-title {
  text-align: center;
  font-size: 19px; font-weight: 700;
  color: #111827; letter-spacing: 0.3px;
  margin-bottom: 6px;
}
.kp-paper-subtitle { text-align: center; font-size: 13px; color: #6b7280; margin-bottom: 22px; font-style: italic; }

.kp-paper-greeting { margin-bottom: 14px; font-size: 13.5px; }
.kp-paper-intro { margin-bottom: 20px; font-size: 13.5px; }

.kp-paper-section { margin-bottom: 18px; }
.kp-paper-section-label {
  font-family: system-ui, sans-serif;
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: var(--green-dark);
  margin-bottom: 8px;
  padding-bottom: 4px; border-bottom: 2px solid var(--green-light);
}

.kp-paper-table { width: 100%; border-collapse: collapse; font-family: system-ui, sans-serif; font-size: 12.5px; }
.kp-paper-table td {
  padding: 8px 10px; border-bottom: 1px dashed #e5e7eb;
  vertical-align: top;
}
.kp-paper-table td:first-child { color: #6b7280; width: 38%; }
.kp-paper-table td:last-child  { color: #111827; font-weight: 600; }
.kp-paper-table tr:last-child td { border-bottom: none; }

.kp-paper-description {
  font-family: system-ui, sans-serif;
  background: #fffbeb; border-left: 3px solid #f59e0b;
  padding: 10px 14px; border-radius: 0 6px 6px 0;
  font-size: 12.5px; color: #78350f; line-height: 1.6;
  white-space: pre-wrap;
}

.kp-paper-list {
  font-family: system-ui, sans-serif;
  margin: 0; padding-left: 22px;
  font-size: 12.5px; color: #374151; line-height: 1.7;
}
.kp-paper-list li { padding: 2px 0; }
.kp-paper-list li::marker { color: var(--green); font-weight: 700; }
.kp-paper-list strong { color: var(--green-dark); }

.kp-paper-text {
  font-family: system-ui, sans-serif;
  font-size: 12.5px; color: #374151; line-height: 1.65;
}

.kp-paper-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-family: system-ui, sans-serif;
}
.kp-paper-tag {
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 14px;
  background: var(--green-light); color: var(--green-dark);
  border: 1px solid var(--green);
}

.kp-paper-price-block {
  background: linear-gradient(145deg, var(--green-light) 0%, #ffffff 100%);
  border: 1.5px solid var(--green);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  font-family: system-ui, sans-serif;
  margin-bottom: 20px;
}
.kp-paper-price-label { font-size: 11px; color: var(--green-dark); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; }
.kp-paper-price-value { font-size: 22px; font-weight: 800; color: #064e3b; letter-spacing: -0.3px; }
.kp-paper-price-terms { font-size: 11.5px; color: #3730A3; font-weight: 600; }

/* ─── Таблица позиций (Спецификация) ─── */
.kp-paper-items {
  width: 100%; border-collapse: collapse;
  font-family: system-ui, sans-serif; font-size: 12.5px;
  border-radius: 8px; overflow: hidden;
  border: 1px solid #e5e7eb;
}
.kp-paper-items thead th {
  background: #f9fafb;
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; color: #6b7280;
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
.kp-paper-items tbody td {
  padding: 12px;
  border-bottom: 1px dashed #e5e7eb;
  vertical-align: top;
}
.kp-paper-items tbody tr:last-child td { border-bottom: 1px solid #e5e7eb; }
.kp-paper-items .ip-num { width: 32px; color: #9ca3af; font-weight: 700; }
.kp-paper-items .ip-name { color: #111827; line-height: 1.45; }
.kp-paper-items .ip-qty  { width: 110px; color: #374151; white-space: nowrap; text-align: right; }
.kp-paper-items .ip-sum  { width: 140px; color: #111827; text-align: right; font-size: 13px; white-space: nowrap; }
.kp-paper-items tfoot td {
  padding: 14px 12px;
  background: linear-gradient(135deg, var(--green-light) 0%, #EEF2FF 100%);
  font-size: 13px; font-weight: 700;
}
.kp-paper-items .ip-total-label {
  text-align: right; text-transform: uppercase;
  letter-spacing: 0.5px; font-size: 11px; color: var(--green-dark);
}
.kp-paper-items .ip-total-sum {
  text-align: right; font-size: 16px;
  color: #064e3b; letter-spacing: -0.2px;
  white-space: nowrap;
}

/* ─── Подпись + Печать ─── */
.kp-paper-footer {
  margin-top: 28px; padding-top: 20px;
  border-top: 2px solid var(--green-light);
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px; flex-wrap: wrap;
  position: relative;
}
.kp-paper-signature { flex: 1; min-width: 200px; font-size: 12.5px; }
.kp-paper-sig-label { color: #9ca3af; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; font-family: system-ui, sans-serif; margin-bottom: 6px; }
.kp-paper-sig-line {
  border-bottom: 1.5px solid #9ca3af;
  height: 26px; margin-bottom: 6px;
  max-width: 240px;
}
.kp-paper-sig-name { font-weight: 700; color: #111827; font-size: 13px; }
.kp-paper-sig-meta { font-size: 11.5px; color: #6b7280; margin-top: 2px; }
.kp-paper-sig-contact { font-size: 11px; color: var(--green-dark); margin-top: 4px; font-family: system-ui, sans-serif; }

/* Нижний колонтитул */
.kp-paper-finefoot {
  margin-top: 20px; padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 11px; color: #9ca3af;
  text-align: center; letter-spacing: 0.2px;
}

.kp-paper-empty {
  text-align: center; color: #9ca3af; font-style: italic;
  padding: 32px 0; font-size: 13px; font-family: system-ui, sans-serif;
}

@media (max-width: 700px) {
  /* Группы кп-формы: меньше padding на мобиле */
  .kp-group { padding: 16px 14px 4px; }

  /* Ужимаем сам лист и предотвращаем выход контента за ширину */
  .kp-paper { padding: 20px 14px 22px; overflow-x: hidden; }
  .kp-paper * { max-width: 100%; }
  .kp-paper-head { flex-direction: column; gap: 14px; align-items: stretch; }
  .kp-paper-from { flex-direction: row; }
  .kp-paper-meta { text-align: left; }

  /* Длинные строки (e-mail/название компании) переносим без overflow */
  .kp-paper-from-meta,
  .kp-paper-sig-contact,
  .kp-paper-from-name,
  .kp-paper-to-name { word-break: break-word; overflow-wrap: anywhere; }

  /* Таблица позиций — даём всему wrap, никаких nowrap, фиксированных width нет */
  .kp-paper-items { font-size: 11.5px; table-layout: fixed; width: 100%; }
  .kp-paper-items thead th { padding: 6px 6px; font-size: 9px; }
  .kp-paper-items tbody td { padding: 10px 6px; word-break: break-word; }
  .kp-paper-items .ip-num  { width: 8%; }
  .kp-paper-items .ip-name { width: 42%; }
  .kp-paper-items .ip-qty  { width: 22%; white-space: normal; font-size: 11px; text-align: right; }
  .kp-paper-items .ip-sum  { width: 28%; white-space: normal; font-size: 11.5px; text-align: right; }
  .kp-paper-items .ip-total-sum { white-space: normal; font-size: 13px; }
  .kp-paper-items .ip-total-label { font-size: 10px; }

  /* Параметры (таблица условий) — тоже даём перенос */
  .kp-paper-table { table-layout: fixed; width: 100%; }
  .kp-paper-table td { word-break: break-word; }
  .kp-paper-table td:first-child { width: 42%; }

  /* Подпись + footer */
  .kp-paper-footer { flex-direction: column-reverse; align-items: center; gap: 16px; }
  .kp-paper-signature { width: 100%; text-align: center; min-width: 0; }
  .kp-paper-sig-line { margin: 0 auto 6px; max-width: 100%; }
  .kp-paper-finefoot { font-size: 10.5px; word-break: break-word; }

  .doc-form--3 { grid-template-columns: 1fr; }
  .doc-form--2 { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════
   ПЕЧАТЬ — только .kp-paper, никаких форм/nav/footer
   Используется через window.print() → пользователь сохраняет в PDF
   ═══════════════════════════════════════════════════════════════════ */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; }
  body * { visibility: hidden; }
  .kp-paper, .kp-paper * { visibility: visible; }
  /* Сама бумага — в нормальном потоке (не absolute), чтобы корректно разбивалось на страницы.
     max-width = A4 минус поля (210mm - 28mm) = 182mm — содержимое не разъезжается. */
  .kp-paper {
    position: absolute; left: 0; top: 0; right: 0;
    width: 100%; max-width: 182mm;
    margin: 0 auto;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    background: #fff !important;
    font-size: 11.5pt;
    color: #111;
  }
  .kp-paper::before { display: none !important; }
  /* Запрещаем разрыв ключевых блоков на странице */
  .kp-paper-head,
  .kp-paper-title,
  .kp-paper-subtitle,
  .kp-paper-to,
  .kp-paper-section-label,
  .kp-paper-items thead,
  .kp-paper-footer { page-break-inside: avoid; break-inside: avoid; }
  /* Скрываем UI-элементы которые не должны попасть в PDF */
  .scroll-progress, nav, .footer { display: none !important; }
}
.doc-section-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px;
}
.doc-types { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-type {
  font-size: 12px; padding: 7px 14px; border-radius: 20px;
  border: 1.5px solid var(--border); color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
  font-family: inherit;
}
.doc-type:hover { border-color: var(--border-hover); }
.doc-type.sel { border-color: #d97706; background: var(--amber-light); color: #92400e; }
.doc-type--required {
  cursor: default; position: relative;
  border-color: var(--green) !important; background: var(--green-light) !important; color: var(--green-dark) !important;
}
.doc-type--required::after {
  content: '★ обязательно';
  position: absolute; top: -8px; right: 6px;
  font-size: 8px; font-weight: 700; letter-spacing: 0.4px;
  background: var(--green); color: var(--white);
  padding: 2px 6px; border-radius: 8px; text-transform: lowercase;
}

.doc-letter {
  width: 100%; padding: 12px 14px;
  font-family: inherit; font-size: 13px; line-height: 1.55;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: #fdfdfd; resize: vertical; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.doc-letter:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow); }

.btn-send { width: 100%; justify-content: center; margin-top: 8px; }

/* Send status messages */
.send-status { margin-top: 14px; }
.send-status--err {
  font-size: 13px; font-weight: 600;
  padding: 12px 16px;
  background: #fee2e2;
  border: 1.5px solid #fca5a5;
  color: #7f1d1d;
  border-radius: 10px;
}
.send-status--loading {
  font-size: 13px; padding: 12px 14px;
  background: #EEF2FF; border: 1px solid var(--green-light); color: var(--green-dark);
  border-radius: 8px;
  display: flex; align-items: center; gap: 10px;
}
.loader-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); animation: pulse 1s ease-in-out infinite;
}
.send-status--ok {
  border: 1.5px solid var(--green);
  background: linear-gradient(180deg, var(--green-light) 0%, #ffffff 80%);
  border-radius: 12px; padding: 16px 18px;
}
.send-status-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.send-status-title {
  font-size: 15px; font-weight: 700; color: var(--green-dark);
  margin: 0;
}
.send-status-demo {
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px;
  background: var(--accent-light); color: var(--accent-dark);
  border: 1px solid #FCD34D;
  cursor: help;
}
.send-status-body { font-size: 12.5px; color: var(--text); line-height: 1.7; }
.ss-row { padding: 3px 0; }
.ss-key { color: var(--muted); margin-right: 4px; }
.ss-pill {
  display: inline-block; font-size: 11px; font-weight: 600;
  background: var(--white); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 10px; margin: 2px 2px 2px 0;
}
.send-status-hint {
  font-size: 12px; color: var(--muted); margin-top: 12px;
  padding-top: 10px; border-top: 1px dashed var(--border);
}

.doc-preview {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px; margin-bottom: 20px;
}
.doc-preview-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px;
}
.doc-preview-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--border);
  gap: 12px;
}
.doc-preview-row:last-child { border-bottom: none; }
.doc-preview-row span:first-child { color: var(--muted); flex-shrink: 0; }
.doc-preview-row span:last-child { font-weight: 500; text-align: right; }

/* ─── BUTTONS ─── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 24px; background: var(--green); color: white; border: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: opacity .15s, box-shadow .15s;
  box-shadow: 0 2px 8px var(--green-glow);
}
.btn-primary:hover { opacity: .88; box-shadow: 0 4px 14px var(--green-glow); }
.btn-primary:active { transform: scale(.97); }
.btn-accent {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 24px; background: #7c3a5a; color: white; border: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: opacity .15s;
  box-shadow: 0 2px 8px rgba(124,58,90,.2);
}
.btn-accent:hover { opacity: .88; }
.btn-accent:active { transform: scale(.97); }
.btn-lg { padding: 14px 32px; font-size: 15px; }

/* ─── STUB NOTE ─── */
.stub-note {
  font-size: 12px; color: var(--muted); margin-top: 20px;
  padding: 10px 16px; background: #f9fafb; border-radius: var(--radius-sm);
  border-left: 3px solid var(--border); line-height: 1.6;
}
.stub-note code {
  font-family: 'SF Mono','Cascadia Code',monospace; font-size: 11.5px;
  background: #f0f0f0; padding: 1px 6px; border-radius: 4px; color: #374151;
}

/* ─── FOOTER ─── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 16px 0;
}
.footer-min {
  max-width: var(--container-max); margin: 0 auto;
  padding: 0 var(--container-pad);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.footer-logo {
  font-size: 15px; font-weight: 800; letter-spacing: -0.3px;
  text-decoration: none; color: var(--text);
}
.footer-logo span { color: var(--green); }
.footer-links { display: flex; gap: 20px; }
.footer-links a {
  font-size: 13px; color: var(--muted); text-decoration: none; transition: color .15s;
}
.footer-links a:hover { color: var(--text); }
.footer-copy { font-size: 12px; color: var(--muted-light); white-space: nowrap; }

/* ─── TABLE TOOLBAR ─── */
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
}
.table-count {
  font-size: 11px; font-weight: 700; color: var(--muted-light);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.table-actions { display: flex; gap: 6px; }
.btn-table-action {
  font-size: 12px; padding: 5px 12px;
  border: 1.5px solid var(--border); background: var(--white);
  color: var(--muted); border-radius: 6px; cursor: pointer;
  font-family: inherit; transition: border-color .15s, color .15s, background .15s;
}
.btn-table-action:hover { border-color: var(--green); color: var(--green); background: var(--green-light); }

/* Баннер «база по soon-стране в разработке» — над таблицей результатов */
.results-soon-notice {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: 13px; color: #78350f;
  line-height: 1.55;
}
.results-soon-notice strong { color: #92400e; }

/* ─── PAYWALL BANNER ─── */
.paywall-banner {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #f8fafc, #EEF2FF);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-top: 14px;
  padding: 18px 20px; flex-wrap: wrap;
}
.paywall-lock { font-size: 28px; flex-shrink: 0; }
.paywall-text {
  display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 160px;
}
.paywall-text strong { font-size: 14px; color: var(--text); }
.paywall-text span { font-size: 12px; color: var(--muted); }
.btn-paywall {
  font-size: 13px; padding: 9px 20px;
  background: var(--green); color: white; border: none;
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 600;
  font-family: inherit; white-space: nowrap;
  box-shadow: 0 2px 8px var(--green-glow);
  transition: opacity .15s;
}
.btn-paywall:hover { opacity: .88; }

/* Ссылки в навигации в режиме «скоро»: визуально полноценные,
   при клике — toast «раздел в разработке». Никаких бейджей и приглушения. */
.nav-soon { cursor: pointer; }

/* ─── SPIN ANIMATION ─── */
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── ВИДЖЕТ ДОСТАВКИ: реальные ставки (rates.json) ─── */
.rates-disclaimer {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 16px 0 4px;
  padding: 10px 14px;
  background: #FEFCE8;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #713F12;
}
.rates-disclaimer-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.rates-disclaimer-text strong { font-weight: 600; }
.rates-updated {
  font-size: 11px; color: var(--muted);
  margin-top: 6px;
  text-align: right;
  font-style: italic;
}
.rates-result {
  margin-top: 4px;
}
.rates-result-head {
  font-size: 13px;
  color: var(--text);
  padding: 12px 0 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.rates-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 760px) {
  .rates-cards { grid-template-columns: 1fr; gap: 10px; }
}
.rate-card--available,
.rate-card--missing {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
  display: flex; flex-direction: column;
  gap: 6px;
  transition: border-color .15s, box-shadow .15s;
}
.rate-card--available {
  border-color: #C7D2FE;
  background: linear-gradient(180deg, #ffffff 0%, #fbfaff 100%);
}
.rate-card--available:hover {
  border-color: var(--green, #4F46E5);
  box-shadow: 0 6px 18px -8px rgba(79, 70, 229, 0.25);
}
.rate-card--missing {
  background: #fafafa;
  border-style: dashed;
}
.rate-card-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px;
}
.rate-card-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.rate-card-icon--muted { opacity: 0.4; filter: grayscale(0.7); }
.rate-card-titlewrap { flex: 1; min-width: 0; }
.rate-card-type {
  font-size: 14px; font-weight: 600;
  color: var(--text);
}
.rate-card-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}
.rate-card-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.rate-card-badge--off {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}
.rate-card-price {
  font-size: 26px;
  font-weight: 700;
  color: var(--green-dark, #3730A3);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-top: 6px;
}
.rate-card-unit {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.rate-card-meta {
  font-size: 12.5px;
  color: var(--text);
  margin-top: 4px;
}
.rate-card-more {
  font-size: 12px;
  color: var(--green, #4F46E5);
  font-weight: 500;
  margin-top: 6px;
}
.rate-card-note {
  font-size: 11.5px;
  color: var(--muted);
  padding: 8px 10px;
  background: #f9fafb;
  border-left: 2.5px solid #C7D2FE;
  border-radius: 4px;
  margin-top: 8px;
  line-height: 1.4;
}

/* Карточка «запросить ставку» */
.rate-missing-body {
  display: flex; flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.rate-missing-title {
  font-size: 14px;
  font-weight: 600;
  color: #b45309;
}
.rate-missing-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.rate-missing-form {
  display: flex; gap: 6px;
  margin-top: 6px;
}
.rate-missing-input {
  flex: 1;
  font: inherit; font-size: 13px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: #fff;
}
.rate-missing-input:focus { border-color: var(--green, #4F46E5); }
.rate-missing-btn {
  font: inherit; font-size: 12px; font-weight: 600;
  background: var(--green, #4F46E5);
  color: white;
  border: none;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.rate-missing-btn:hover { background: var(--green-dark, #3730A3); }

/* Блок запроса ориентиров (когда нет ставок или есть только часть) */
.rates-request-block {
  display: flex; align-items: flex-start; gap: 14px;
  margin: 20px 0 4px;
  padding: 20px;
  background: linear-gradient(135deg, #EEF2FF 0%, #FEFCE8 100%);
  border: 1px solid #C7D2FE;
  border-radius: 14px;
}
.rates-request-block--compact {
  margin-top: 14px;
  padding: 16px;
  background: #fafafa;
  border-color: var(--border);
}
.rates-request-icon { font-size: 28px; flex-shrink: 0; line-height: 1; }
.rates-request-body { flex: 1; min-width: 0; }
.rates-request-title {
  font-size: 15px; font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.rates-request-block--compact .rates-request-title { font-size: 13.5px; }
.rates-request-text {
  font-size: 13px; color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.rates-request-block--compact .rates-request-text { font-size: 12.5px; margin-bottom: 10px; }
.rates-request-block .rate-missing-form { max-width: 480px; }

/* Сноска про другие типы транспорта */
.rates-other-types {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 8px;
  margin-top: 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rates-other-link {
  font: inherit; font-size: 12px; font-weight: 600;
  color: var(--green, #4F46E5);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}
.rates-other-link:hover { text-decoration: underline; }

/* Загрузка */
.rates-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 40px 16px;
  font-size: 13px;
  color: var(--muted);
}
.rates-loading-spinner {
  width: 16px; height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--green, #4F46E5);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── LEGAL PAGES (оферта, политика, оплата и т.д.) ─── */
.legal-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}
.legal-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  text-decoration: none;
  margin-bottom: 24px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: background .15s, color .15s;
}
.legal-back:hover { background: #f9fafb; color: var(--text); }
.legal-page h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.4px;
}
.legal-page .legal-meta {
  font-size: 13px; color: var(--muted);
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.legal-page h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text);
}
.legal-page h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 8px;
}
.legal-page p { margin-bottom: 12px; }
.legal-page ul, .legal-page ol {
  margin: 8px 0 16px 24px;
}
.legal-page li { margin-bottom: 6px; }
.legal-page a { color: var(--green); }
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.legal-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.legal-table tr:last-child td { border-bottom: none; }
.legal-table td:first-child {
  background: #f9fafb;
  color: var(--muted);
  font-size: 13px;
  width: 240px;
  font-weight: 500;
}
.legal-table td:last-child { font-weight: 500; color: var(--text); }
.legal-note {
  margin: 16px 0;
  padding: 12px 16px;
  background: #f9fafb;
  border-left: 3px solid var(--green);
  border-radius: 6px;
  font-size: 14px;
  color: var(--muted);
}
.pay-systems {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin: 16px 0 24px;
}
.pay-sys {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  background: #fff;
  display: inline-flex; align-items: center; gap: 8px;
}
.pay-sys-logo {
  font-size: 18px; line-height: 1;
}

/* ─── ФУТЕР ─── */
.footer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.footer-inner {
  max-width: 880px; margin: 0 auto;
  padding: 16px 32px 14px;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
/* Ссылки */
.footer-links-row {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: 4px 14px;
}
.footer-links-row a {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  padding: 4px 0;
  white-space: nowrap;
  transition: color .15s;
}
.footer-links-row a:hover { color: var(--green); }
.footer-dot {
  color: #d1d5db;
  font-size: 13px;
  user-select: none;
}
/* Платёжные системы */
.footer-paysys {
  display: inline-flex; gap: 8px; flex-wrap: wrap;
  align-items: center; justify-content: center;
}
.paysys-badge {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.paysys-visa { color: #1A1F71; }
.paysys-mc   { color: #EB001B; }
.paysys-mir  { color: #0B6BCB; }
/* Копирайт */
.footer-bottom {
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted);
}
@media (max-width: 768px) {
  .footer-inner { padding: 12px 16px 10px; gap: 8px; }
  .footer-links-row { gap: 2px 10px; }
  .footer-links-row a { font-size: 12.5px; }
  .footer-dot { font-size: 12px; }
}

/* ─── ДРОПДАУН ПОДСКАЗОК ТН ВЭД (под полем поиска) ─── */
.tnved-field { position: relative; }
.tnved-suggest {
  position: absolute;
  top: 100%; left: 0; right: 0;
  z-index: 50;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.18),
              0 2px 6px rgba(15, 23, 42, 0.06);
  max-height: 360px;
  overflow-y: auto;
  font-size: 13px;
  animation: tsFadeIn .12s ease-out;
}
@keyframes tsFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ts-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background .1s;
}
.ts-item:last-of-type { border-bottom: none; }
.ts-item:hover, .ts-item.active {
  background: #EEF2FF;
}
.ts-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green-dark, #3730A3);
  background: #EEF2FF;
  padding: 2px 8px;
  border-radius: 4px;
  flex: 0 0 auto;
  margin-top: 1px;
}
.ts-item.active .ts-code,
.ts-item:hover  .ts-code { background: #C7D2FE; }
.ts-desc {
  flex: 1; min-width: 0;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ts-desc mark {
  background: #fef08a;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
.ts-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 18px 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.ts-loading-spinner {
  width: 14px; height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--green, #4F46E5);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.ts-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.ts-empty-icon { margin-right: 6px; opacity: .6; }
.ts-total {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--muted);
  background: #f9fafb;
  border-top: 1px solid var(--border);
}
.ts-total kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
}

/* ─── SKELETON LOADERS (для поиска покупателей) ─── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton-wrap { padding: 4px 0 8px; }
.skeleton-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.skel-pill {
  height: 14px; width: 160px;
  border-radius: 7px;
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 40%, #f3f4f6 80%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel-pill--metrics {
  height: 56px; width: 100%;
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.skel-table { width: 100%; border-collapse: collapse; }
.skel-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #f3f4f6;
}
.skel-line {
  height: 11px; border-radius: 6px;
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 40%, #f3f4f6 80%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel-line + .skel-line { margin-top: 6px; }
.skel-line--40 { width: 40%; }
.skel-line--60 { width: 60%; }
.skel-line--70 { width: 70%; }
.skel-line--90 { width: 90%; }
.skel-line--small { height: 8px; opacity: .7; }
.skel-pill-inline {
  display: inline-block; vertical-align: middle;
  height: 18px; width: 64px; border-radius: 9px;
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 40%, #f3f4f6 80%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel-btn {
  display: inline-block;
  height: 24px; width: 48px; border-radius: 6px;
  background: linear-gradient(90deg, #e5e7eb 0%, #d1d5db 40%, #e5e7eb 80%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}

/* ─── CONFETTI CANVAS (полноэкранный overlay при отправке КП) ─── */
.confetti-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9998;
}

/* ─── STATUS PILL В НАВИГАЦИИ ─── */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 11px; font-weight: 600; line-height: 1;
  color: #047857;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 20px;
  letter-spacing: 0.2px;
  cursor: default;
  transition: opacity .2s;
}
.status-pill--off {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}
.status-pill--checking {
  color: var(--muted);
  background: #f9fafb;
  border-color: var(--border);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: statusPing 1.8s ease-out infinite;
}
.status-pill--off .status-dot {
  background: #f97316;
  animation: none;
}
.status-pill--checking .status-dot {
  background: var(--muted);
  animation: none;
}
@keyframes statusPing {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@media (max-width: 640px) {
  .status-pill .status-pill-text { display: none; }
  .status-pill { padding: 6px; }
}

/* ─── COUNTUP ANIMATION (для hero-метрик) ─── */
.hm-n {
  transition: color .25s;
}
.hm-n--animating {
  color: var(--green);
}

/* ─── KP-PAPER HOVER (живая бумага) ─── */
.kp-paper {
  transition: transform .3s cubic-bezier(.2,.7,.3,1.2), box-shadow .3s;
  will-change: transform;
}
.kp-paper:hover {
  transform: translateY(-3px) rotate(-0.25deg);
  box-shadow:
    0 18px 40px -12px rgba(15, 23, 42, 0.18),
    0 4px 12px -4px rgba(15, 23, 42, 0.08);
}
@media (max-width: 768px) {
  .kp-paper:hover { transform: none; box-shadow: 0 4px 12px rgba(0,0,0,.05); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2,1fr); }
  .why-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  /* Nav: убираем outer padding (он создавал двойной отступ — у nav-inner свой) */
  nav { padding: 0; }
  .nav-inner { padding: 10px 16px; }
  .hero { padding-bottom: 4px; }
  .hero-inner { padding: 20px 16px 12px; }
  .hero-tag { margin-bottom: 14px; padding: 4px 12px; font-size: 11px; }
  h1 { font-size: clamp(22px, 6vw, 30px); margin-bottom: 10px; }
  .hero-sub { font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
  .hero-inner .countries-bar { margin: 4px calc(50% - 50vw) 4px; padding: 10px 0 8px; }
  .countries-header { margin-bottom: 8px; }
  .countries-label { font-size: 9.5px; }
  .countries-hint { font-size: 10.5px; }
  .countries-track { padding: 4px 2px 6px; }
  .cpill { padding: 9px 14px 7px; min-width: 90px; gap: 4px; border-radius: 12px; }
  .cpill-flag { width: 32px; height: 22px; }
  .cpill-name { font-size: 11.5px; min-height: calc(2 * 1.18em); }
  .cpill-badge { font-size: 7.5px; padding: 1px 5px; gap: 2px; }
  .hero-note { font-size: 11px; margin-top: 4px; max-width: 320px; line-height: 1.4; }
  .hero-metrics { margin-top: 10px; padding-top: 4px; }
  .hm-item { padding: 0 8px; }
  .hm-n { font-size: 12px; }
  .hm-l { font-size: 9px; }
  .section-why { padding: 40px 16px; }
  .why-cards { grid-template-columns: 1fr; gap: 14px; }
  .countries-inner { padding: 0 16px; }
  .cards { grid-template-columns: repeat(2,1fr); gap: 12px; padding: 12px 16px; }
  .card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
  }
  .card::before, .card::after { display: none; }
  /* На мобиле — цветная левая полоска для индикации */
  .card { border-left-width: 3px; }
  .card:nth-child(1) { border-left-color: var(--green); }
  .card:nth-child(2) { border-left-color: #3b82f6; }
  .card:nth-child(3) { border-left-color: #f59e0b; }
  .card:nth-child(4) { border-left-color: #8b5cf6; }
  .card:nth-child(1).active { background: #EEF2FF; }
  .card:nth-child(2).active { background: #eff6ff; }
  .card:nth-child(3).active { background: #fffbeb; }
  .card:nth-child(4).active { background: #f5f3ff; }
  .card-num { display: none; }
  .card-icon-box {
    width: 38px; height: 38px;
    border-radius: 10px;
    margin-bottom: 0; flex-shrink: 0;
  }
  .card-icon { font-size: 18px; }
  .card-title { font-size: 12.5px; margin-bottom: 0; line-height: 1.25; }
  .card-desc { display: none; }
  /* Снимаем base padding 32 — иначе widget уже карточек */
  .widget-area { margin: 12px 16px 24px; padding: 0; }
  .widget { padding: 20px 16px; }
  .search-form { grid-template-columns: 1fr; }
  .doc-form { grid-template-columns: 1fr; }
  .rate-cards { grid-template-columns: 1fr; }
  .container-selector { grid-template-columns: repeat(3, 1fr); }
  .rates-meta { grid-template-columns: 1fr; gap: 14px; }
  .rc-meta { grid-template-columns: 1fr 1fr; }
  .route-viz { padding: 14px 12px; }
  .route-node { min-width: 78px; }
  .rates-summary { gap: 8px; }
  .rates-sort { margin-left: 0; width: 100%; justify-content: center; }
  /* Footer: outer padding убираем — у footer-min есть свой */
  .footer { padding: 14px 0; }
  .footer-min { padding: 0 16px; }
  .footer-links { display: none; }
  .footer-copy { font-size: 11px; }
}
@media (max-width: 480px) {
  h1 { font-size: 26px; letter-spacing: -0.5px; }
  .hm-item { padding: 0 8px; }
  .hm-n { font-size: 12px; }
  .hm-l { font-size: 9px; }
  /* Метрики покупателей — 3 в строке + 4-я («крупнейший») во всю ширину снизу */
  .search-metrics {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    background: var(--white);
    padding: 0;
  }
  .sm-sep { display: none; }
  .sm-item {
    flex: none; min-width: 0;
    padding: 12px 6px;
    align-items: center; text-align: center;
    background: transparent;
    border: none;
  }
  /* 4-я метрика («крупнейший») — отдельная строка во всю ширину */
  .sm-item:last-of-type {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    padding-top: 12px;
  }
  .sm-n { font-size: 14px; }
  .sm-n--small { font-size: 12px; line-height: 1.2; }
  .sm-l { font-size: 9px; }

  /* Таблица покупателей — компания + страна + КП */
  .results-table { table-layout: fixed; width: 100%; }
  .results-table td:nth-child(1) { width: 50%; word-break: break-word; }
  .results-table td:nth-child(2) { width: 25%; }
  .results-table td:nth-child(6) { width: 25%; text-align: right; }

  /* Доставка — контейнеры в 2 колонки вместо 3 */
  .container-selector { grid-template-columns: repeat(2, 1fr); }

  /* Карточка ставки — мета в 2 колонки */
  .rc-meta { grid-template-columns: 1fr 1fr; }

  /* Виджет — минимальные отступы */
  .widget { padding: 16px 12px; }
  .widget-area { margin: 10px 10px 20px; }
  .cards { padding: 10px; gap: 6px; }
}
