/* ==========================================================================
   сдэккалькулятор.рф — дизайн-система

   Сознательно НЕ похож на cdekmsk.ru: там сайт-продавец (воздух, крупные
   обещания, форма заявки), здесь сайт-инструмент. Отсюда: тёмная шапка,
   плотная сетка, меньшие скругления, калькулятор занимает первый экран
   целиком. Задача посетителя — быстро получить цифру, а не читать.
   ========================================================================== */

:root {
  --brand: #1ab248;          /* зелёный СДЭК — только действия и акценты */
  --brand-dark: #128a38;
  --brand-soft: #eaf8ef;

  --ink: #12161c;
  --ink-2: #4c545e;
  --ink-3: #838d98;
  --line: #e2e7ec;
  --bg: #ffffff;
  --bg-2: #f4f6f8;
  --dark: #12161c;           /* шапка и подвал */
  --dark-2: #1c222a;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 2px 12px rgba(18, 22, 28, .06);
  --shadow-lg: 0 16px 48px rgba(18, 22, 28, .16);
  --wrap: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { line-height: 1.22; margin: 0 0 14px; letter-spacing: -0.015em; }
h1 { font-size: 38px; font-weight: 800; }
h2 { font-size: 28px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 14px; }
.lead { font-size: 18px; color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 14px; }

section { padding: 56px 0; }
section.tinted { background: var(--bg-2); }
.section-head { margin-bottom: 28px; max-width: 780px; }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; font-size: 16px; font-weight: 600; font-family: inherit;
  border: 1.5px solid transparent; border-radius: var(--radius);
  cursor: pointer; transition: .14s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-lg { padding: 16px 30px; font-size: 17px; }
.btn-block { width: 100%; }

/* ---------- Тёмная шапка ---------- */

.header { background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 60; }
.header-in { display: flex; align-items: center; gap: 22px; height: 62px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo-img { height: 20px; width: auto; filter: brightness(0) invert(1); }
.logo-txt { color: #fff; font-weight: 700; font-size: 15px; white-space: nowrap; }
.logo-txt span { color: var(--brand); }

.nav { display: flex; gap: 20px; margin-left: auto; }
.nav a { color: rgba(255,255,255,.78); font-size: 15px; font-weight: 500; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; text-decoration: none; }

.burger { display: none; width: 40px; height: 40px; border: 0; background: none;
          cursor: pointer; padding: 9px; margin-left: auto; }
.burger span { display: block; height: 2px; background: #fff; margin: 5px 0; border-radius: 2px; }

/* ---------- Первый экран: калькулятор ---------- */

.hero { background: linear-gradient(180deg, var(--dark) 0%, var(--dark-2) 100%);
        color: #fff; padding: 44px 0 64px; }
.hero h1 { color: #fff; font-size: 34px; max-width: 780px; }
.hero .lead { color: rgba(255,255,255,.72); max-width: 680px; margin-bottom: 28px; }

.calc-card {
  background: #fff; color: var(--ink); border-radius: var(--radius-lg);
  padding: 26px; box-shadow: var(--shadow-lg);
}
/* Между «Откуда» и «Куда» — кнопка обмена городов местами. Колонка auto
   в середине: поля остаются равной ширины, кнопка занимает ровно себя.
   align-self: end прижимает её к нижнему краю строки — то есть к линии
   полей ввода, а не к подписям над ними. */
.calc-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px;
            align-items: start; }
.city-swap {
  align-self: end; margin-bottom: 12px;      /* 12px — как .field margin-bottom */
  width: 44px; height: 47px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: var(--ink-2);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: color .14s, border-color .14s, transform .14s;
}
.city-swap:hover { color: var(--brand); border-color: var(--brand); }
.city-swap:focus-visible { outline: none; border-color: var(--brand); }
.city-swap:active { transform: scale(.94); }
.calc-dims { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 4px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2);
               margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; font-size: 16px; font-family: inherit;
  color: var(--ink); background: #fff; border: 1.5px solid var(--line);
  border-radius: var(--radius); transition: border-color .14s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); }

.city-wrap { position: relative; }
.city-list {
  display: none; position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 250px; overflow-y: auto; margin-top: 4px;
}
.city-option { display: block; width: 100%; text-align: left; background: none;
               border: 0; padding: 11px 14px; font: inherit; font-size: 15px;
               color: var(--ink); cursor: pointer; }
.city-option:hover { background: var(--brand-soft); color: var(--brand-dark); }

/* Строка под калькулятором: виджет отдаём бесплатно, и напомнить об этом
   уместнее всего там, где человек только что калькулятором воспользовался.
   Живёт внутри CALC_FORM, поэтому появляется на всех страницах с расчётом.
   ⚠ В сам виджет не попадает: widget.html собирает форму из кусков
   CALC_FORM до этой строки — рекламировать виджет внутри виджета незачем. */
.calc-promo { margin: 12px 0 0; font-size: 14px; color: rgba(255,255,255,.72);
  text-align: center; }
.calc-promo a { color: #fff; text-decoration: underline; }
.calc-promo a:hover { color: #fff; opacity: .85; }
/* На светлых страницах (не в тёмном hero) — обычный текст. */
section:not(.hero) .calc-promo { color: var(--ink-3); }
section:not(.hero) .calc-promo a { color: var(--brand); }

/* Кнопки маршрута на карточке пункта: главное действие страницы. */
.pvz-route { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 6px; }
.pvz-route .btn { padding: 11px 18px; font-size: 15px; }

/* Строка-приглашение в шапке страницы карты. */
.hero-promo { margin: 14px 0 0; font-size: 15px; color: rgba(255,255,255,.72); }
.hero-promo a { color: #fff; text-decoration: underline; }

/* ---------- Результаты расчёта ---------- */

.result { margin-top: 24px; }
.result-error { color: #c0392b; font-weight: 500; }

/* Таблица тарифов. Ширины заданы явно: без них браузер прижимает «Срок»
   и «Стоимость» вплотную к названию, и таблица читается как каша. */
.tariffs { width: 100%; border-collapse: collapse; table-layout: auto; }
.tariffs th, .tariffs td { padding: 14px 16px; text-align: left; font-size: 15px;
                           border-bottom: 1px solid var(--line); vertical-align: middle; }
.tariffs th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
              color: var(--ink-3); font-weight: 700;
              border-bottom: 1.5px solid var(--line); padding-bottom: 10px; }
.tariffs th:last-child, .tariffs td.sum { text-align: right; }
.tariffs td.name { font-weight: 500; padding-left: 0; }
.tariffs th:first-child { padding-left: 0; }
.tariffs td.term { color: var(--ink-2); white-space: nowrap; width: 110px;
                   text-align: center; }
.tariffs th:nth-child(2) { text-align: center; }
.tariffs td.sum { font-weight: 700; font-size: 18px; white-space: nowrap;
                  width: 130px; padding-right: 0; letter-spacing: -0.01em; }
.tariffs tbody tr:hover td { background: var(--bg-2); }
.tariffs tbody tr.best td { background: var(--brand-soft); }
.tariffs tbody tr.best td.sum { color: var(--brand-dark); }
.tariffs tbody tr:last-child td { border-bottom: 0; }

.badge-best { display: inline-block; margin-left: 10px; padding: 3px 9px;
              background: var(--brand); color: #fff; border-radius: 20px;
              font-size: 11px; font-weight: 700; vertical-align: middle;
              white-space: nowrap; }

.table-scroll { overflow-x: auto; }
/* Таблица сроков (/sroki.html) не помещается на телефоне в 4 колонки, поэтому
   лежит в .table-scroll. Числовые колонки — nowrap: перенос «3–4» на две
   строки превращает диапазон в набор цифр. */
.table-scroll table { min-width: 520px; }
.table-scroll td + td, .table-scroll th + th { white-space: nowrap; }
/* Строка-подзаголовок с названием зоны внутри таблицы. */
.prose tr.zone-row th { background: var(--brand-soft); color: var(--brand-dark);
                        font-size: 12px; text-transform: uppercase;
                        letter-spacing: .06em; }
/* Уточнение под названием колонки («Экспресс» под «Из Москвы»). */
.th-sub { display: block; margin-top: 2px; font-size: 12px; font-weight: 400;
          color: var(--ink-3); text-transform: none; letter-spacing: 0; }

.calc-note { margin-top: 20px; padding: 18px 20px; background: var(--brand-soft);
             border-radius: var(--radius); }
.calc-note p { color: var(--ink-2); font-size: 15px; margin-bottom: 14px; }
.calc-note b { color: var(--ink); }

@media (max-width: 620px) {
  .tariffs th, .tariffs td { padding: 12px 8px; font-size: 14px; }
  .tariffs td.sum { font-size: 16px; width: 96px; }
  .tariffs td.term { width: 78px; font-size: 13px; }
  .badge-best { display: block; margin: 6px 0 0; width: fit-content; }
}

/* ---------- Карточки ---------- */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
        padding: 20px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--ink-2); font-size: 15px; margin-bottom: 0; }

.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
        padding: 18px 20px; }
.stat b { display: block; font-size: 30px; font-weight: 800; line-height: 1.1;
          color: var(--ink); letter-spacing: -0.02em; }
.stat span { font-size: 14px; color: var(--ink-3); }

/* ---------- Пункты выдачи ---------- */

.pvz-search { width: 100%; padding: 14px 16px; font-size: 16px; font-family: inherit;
              border: 1.5px solid var(--line); border-radius: var(--radius);
              margin-bottom: 18px; }
.pvz-search:focus { outline: none; border-color: var(--brand); }

.pvz-list { display: grid; gap: 12px; }
.pvz {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  background: #fff; display: grid; grid-template-columns: 1fr auto; gap: 12px;
}
.pvz-addr { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.pvz-meta { font-size: 14px; color: var(--ink-2); }
.pvz-meta i { font-style: normal; color: var(--ink-3); }
.pvz-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
       background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.tag.green { background: var(--brand-soft); color: var(--brand-dark); }
.pvz-code { font-size: 12px; color: var(--ink-3); font-family: ui-monospace, monospace;
            white-space: nowrap; }
.pvz-more { text-align: center; margin-top: 20px; }

/* ---------- Карта ---------- */

#map { height: 460px; width: 100%; border-radius: var(--radius);
       border: 1px solid var(--line); z-index: 1; }
#map.map-single { height: 320px; }
.map-note { margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.leaflet-popup-content { font-size: 14px; line-height: 1.45; }

/* ---------- Карточка одного пункта ---------- */

.pvz-hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 26px; align-items: start; }
.pvz-facts { list-style: none; margin: 0 0 20px; padding: 0; }
.pvz-facts li { display: grid; grid-template-columns: 150px 1fr; gap: 12px;
                padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.12);
                font-size: 15px; }
.pvz-facts b { color: rgba(255,255,255,.6); font-weight: 500; }
.pvz-facts span { color: #fff; }
.pvz-facts a { color: #fff; text-decoration: underline; }

.schedule { width: 100%; border-collapse: collapse; }
.schedule td { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.schedule td:last-child { text-align: right; color: var(--ink-2); white-space: nowrap; }
.schedule tr.today td { font-weight: 700; color: var(--brand-dark); }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photos img { border-radius: var(--radius); border: 1px solid var(--line);
              width: 100%; height: 150px; object-fit: cover; }

.nearby { display: grid; gap: 10px; }
.nearby a { display: flex; justify-content: space-between; gap: 12px;
            padding: 12px 14px; border: 1px solid var(--line);
            border-radius: var(--radius); color: var(--ink); background: #fff; }
.nearby a:hover { border-color: var(--brand); text-decoration: none; }
.nearby span { color: var(--ink-3); font-size: 14px; white-space: nowrap; }

@media (max-width: 960px) {
  .pvz-hero { grid-template-columns: 1fr; }
  #map { height: 340px; }
  .photos { grid-template-columns: repeat(2, 1fr); }
  .pvz-facts li { grid-template-columns: 120px 1fr; gap: 8px; font-size: 14px; }
}

/* Города */
.city-search-wrap { max-width: 560px; margin-top: 22px; }
.city-search-wrap .pvz-search { margin-bottom: 0; }
.city-empty { display: none; padding: 18px 20px; background: var(--brand-soft);
              border-radius: var(--radius); color: var(--ink-2); font-size: 15px; }
.city-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.city-link { display: flex; justify-content: space-between; align-items: center;
             gap: 10px; padding: 12px 14px; border: 1px solid var(--line);
             border-radius: var(--radius); background: #fff; color: var(--ink); }
.city-link:hover { border-color: var(--brand); text-decoration: none; color: var(--brand-dark); }
.city-link b { font-weight: 600; font-size: 15px; }
.city-link span { font-size: 13px; color: var(--ink-3); }

/* ---------- Контент ---------- */

.prose { max-width: 760px; }
.prose h2 { font-size: 24px; margin-top: 36px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 20px; color: var(--ink-2); }
.prose li { margin-bottom: 7px; }
.prose table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.prose th, .prose td { padding: 11px 13px; border: 1px solid var(--line);
                       text-align: left; font-size: 15px; }
.prose th { background: var(--bg-2); font-weight: 600; }

.callout { background: var(--brand-soft); border-left: 3px solid var(--brand);
           border-radius: 0 var(--radius) var(--radius) 0; padding: 16px 20px; margin: 20px 0; }
.callout p:last-child { margin-bottom: 0; }

.crumbs { padding: 16px 0 0; font-size: 13px; color: var(--ink-3); }
.crumbs a { color: var(--ink-3); }
.crumbs span { margin: 0 7px; }

/* ---------- Блок «для бизнеса» ---------- */

.biz {
  background: var(--dark); color: #fff; border-radius: var(--radius-lg);
  padding: 34px 38px; display: grid; grid-template-columns: 1fr auto;
  gap: 24px; align-items: center;
}
.biz h2 { color: #fff; margin-bottom: 8px; font-size: 24px; }
.biz p { color: rgba(255,255,255,.72); margin: 0; max-width: 640px; font-size: 15px; }

/* ---------- FAQ ---------- */

.faq-item { border-bottom: 1px solid var(--line); }
.faq-q { width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
         padding: 18px 40px 18px 0; position: relative; font-size: 17px;
         font-weight: 600; color: var(--ink); font-family: inherit; }
.faq-q::after { content: "+"; position: absolute; right: 6px; top: 50%;
                transform: translateY(-50%); font-size: 24px; font-weight: 400;
                color: var(--brand); line-height: 1; }
.faq-item.open .faq-q::after { content: "–"; }
.faq-a { display: none; padding: 0 40px 20px 0; color: var(--ink-2); }
.faq-item.open .faq-a { display: block; }

/* ---------- Подвал ---------- */

.footer { background: var(--dark); color: rgba(255,255,255,.66); padding: 44px 0 26px;
          font-size: 14px; }
.footer a { color: rgba(255,255,255,.66); }
.footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px;
               padding-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.1); }
.footer h4 { color: #fff; font-size: 15px; margin: 0 0 12px; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 8px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px;
                 padding-top: 20px; font-size: 13px; color: rgba(255,255,255,.45); }

/* ---------- Адаптив ---------- */

@media (max-width: 960px) {
  h1 { font-size: 28px; }
  .hero h1 { font-size: 26px; }
  h2 { font-size: 23px; }
  section { padding: 40px 0; }

  .nav { display: none; }
  .nav.open { display: flex; flex-direction: column; gap: 0;
              position: absolute; top: 62px; left: 0; right: 0; background: var(--dark);
              padding: 6px 20px 14px; }
  .nav.open a { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .burger { display: block; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .city-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .biz { grid-template-columns: 1fr; padding: 26px; }
  .pvz { grid-template-columns: 1fr; }
  .pvz-code { order: -1; }
}

@media (min-width: 620px) and (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  /* Поля встают друг под друга — стрелки разворачиваем вертикально,
     иначе горизонтальная стрелка между вертикальными полями сбивает с толку. */
  .calc-row { grid-template-columns: 1fr; }
  .city-swap { justify-self: center; align-self: auto;
               width: 47px; height: 40px; margin: -6px 0 10px; }
  .city-swap svg { transform: rotate(90deg); }
  .calc-dims { grid-template-columns: repeat(2, 1fr); }
  .city-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .calc-card { padding: 18px; }
  .wrap { padding: 0 16px; }
  .btn { width: 100%; }
  .logo-txt { font-size: 14px; }
}

/* «Отправить адрес» на карточке пункта выдачи. Человек чаще всего ищет ПВЗ
   не себе, а чтобы скинуть точку клиенту или курьеру, — поэтому кнопки
   стоят сразу под фактами, а не в подвале страницы. */
.share { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.18); }
.share-title { font-size: 13px; color: rgba(255,255,255,.62); margin-bottom: 8px; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.08); color: #fff; font-size: 14px;
  font-family: inherit; text-decoration: none; cursor: pointer;
  transition: background .14s, border-color .14s;
}
.share-btn:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); }
.share-btn svg { width: 17px; height: 17px; flex: none; }
.share-btn.is-done { background: var(--ok, #1f7a3a); border-color: transparent; }
/* На светлом фоне (карточка пункта вне «hero») кнопки другие */
.prose .share, section:not(.hero) .share { border-top-color: var(--line); }
section:not(.hero) .share-title { color: var(--ink-3); }
section:not(.hero) .share-btn { border-color: var(--line); background: #fff;
  color: var(--ink); }
section:not(.hero) .share-btn:hover { border-color: var(--brand); color: var(--brand); }

.city-search-note { margin: 10px 0 0; font-size: 13px; color: rgba(255,255,255,.6); }
.city-link i { font-style: normal; font-weight: 400; color: var(--ink-3);
               font-size: 13px; display: block; margin-top: 2px; }
/* Легенда карты: цвет и форма меток. Пункт выдачи — зелёная коробка,
   постамат — синие ячейки; на карте это разные значки, а не оттенки. */
.map-legend { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.lg { display: inline-block; width: 13px; height: 13px; border-radius: 50% 50% 50% 0;
      transform: rotate(-45deg); vertical-align: -2px; margin-right: 4px;
      border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.lg-pvz { background: var(--brand); }
.lg-post { background: #2d6cdf; }
/* Ссылка на официальный сайт СДЭК в подвале. Открывается в новой вкладке:
   посетитель, который ушёл читать про компанию, не должен терять расчёт,
   набранный в калькуляторе. rel="noopener" — чтобы открытая страница
   не получила доступ к нашему окну через window.opener. */
.footer-official { display: inline-flex; align-items: center; gap: 6px;
                   color: #fff; font-weight: 600; font-size: 14px;
                   border-bottom: 1px solid rgba(255,255,255,.3); }
.footer-official:hover { color: var(--brand); border-color: var(--brand);
                         text-decoration: none; }