:root {
  --ink: #18283c;
  --muted: #69798c;
  --line: #dce3eb;
  --paper: #f5f7fa;
  --white: #fff;
  --wine: #9d1c2e;
  --wine-dark: #781323;
  --gold: #c99b3b;
  --blue: #0f496c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 Inter, 'Segoe UI', Arial, sans-serif;
}

/* Шапка */

.topbar {
  height: 76px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100% - 1120px) / 2));
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand-logo { width: 138px; height: auto; max-height: 44px; object-fit: contain; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; }
.brand span { font-size: 12px; color: var(--muted); }

/* Вступительный блок */

.page { max-width: 900px; margin: 0 auto; padding: 54px 24px 70px; }
.intro { max-width: 690px; margin-bottom: 34px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--wine);
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 10px;
}
.intro h1 { font: 700 clamp(32px, 5vw, 52px)/1.08 Georgia, serif; margin: 0 0 14px; color: var(--ink); }
.intro p:last-child { color: var(--muted); font-size: 17px; max-width: 620px; }

/* Панели с шагами анкеты */

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 28px 30px;
  margin-bottom: 18px;
  box-shadow: 0 8px 28px #14243d09;
}
.panel-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 21px;
  margin-bottom: 25px;
}
.step { color: var(--gold); font-size: 14px; font-weight: 800; letter-spacing: 1px; }
.panel h2 { font-size: 21px; margin: 0 0 4px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }

/* Поля формы */

.grid { display: grid; gap: 22px 20px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

label { display: block; font-weight: 650; font-size: 14px; }
label input, label select { display: block; margin-top: 7px; }
label[hidden] { display: none; }

input, select {
  appearance: none;
  width: 100%;
  height: 48px;
  border: 1px solid #cbd5df;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0 14px;
  outline: 0;
  transition: .18s;
}
select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
input:focus, select:focus { border-color: var(--wine); box-shadow: 0 0 0 3px #9d1c2e16; }

.req { color: var(--wine); }

/* Почта с кнопкой «Подтвердить» */

.input-with-action { display: flex; gap: 8px; margin-top: 7px; }
.input-with-action input { margin-top: 0; min-width: 0; }
.verify-button {
  flex: none;
  height: 48px;
  border: 1px solid var(--wine);
  border-radius: 2px;
  background: #fff;
  color: var(--wine);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  padding: 0 16px;
  cursor: pointer;
}
.verify-button:not(:disabled):hover { background: #9d1c2e0d; }
.verify-button:disabled { opacity: .5; cursor: default; }
.verified { display: block; margin-top: 4px; color: #2e7d4f; font-size: 12px; font-weight: 650; }
.verified[hidden] { display: none; }
.error { display: block; color: var(--wine); font-size: 12px; min-height: 16px; }
.hint { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.checkbox-field { display: flex; align-items: center; gap: 10px; min-height: 48px; align-self: end; }
.checkbox-field input { width: 18px; height: 18px; margin: 0; appearance: auto; accent-color: var(--wine); }
.autocomplete-field { position: relative; z-index: 2; }
.autocomplete-field:focus-within { z-index: 10; }
.suggestion-list {
  position: absolute;
  top: calc(100% - 14px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  z-index: 20;
  background: var(--white);
  border: 1px solid #cbd5df;
  box-shadow: 0 10px 24px #14243d24;
}
.suggestion-list[hidden] { display: none; }
.suggestion-option {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.suggestion-option:last-child { border-bottom: 0; }
.suggestion-option:hover, .suggestion-option:focus { background: #f1f4f7; outline: 0; }
.suggestion-primary, .suggestion-secondary {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggestion-primary { font-size: 13px; font-weight: 650; }
.suggestion-secondary { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.suggestion-option:hover .suggestion-primary,
.suggestion-option:hover .suggestion-secondary,
.suggestion-option:focus .suggestion-primary,
.suggestion-option:focus .suggestion-secondary { white-space: normal; overflow: visible; }

/* Кнопки и итоги */

.actions { display: flex; gap: 14px; align-items: center; margin-top: 28px; }
.primary, .secondary {
  height: 48px;
  border-radius: 2px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  padding: 0 22px;
}
.primary { border: 1px solid var(--wine); background: var(--wine); color: #fff; }
.primary:not(:disabled):hover { background: var(--wine-dark); }
.primary:disabled { opacity: .6; cursor: default; }
.primary span { font-size: 20px; margin-left: 12px; }
.secondary { border: 1px solid var(--line); background: transparent; color: var(--muted); }

.privacy { font-size: 12px; color: var(--muted); margin: 13px 0 0; }
.submit-hint { margin: 10px 0 0; color: var(--wine); }
.submit-hint[hidden] { display: none; }

/* Окно ввода кода подтверждения почты */

.code-dialog {
  width: min(440px, calc(100% - 32px));
  border: 0;
  border-radius: 4px;
  padding: 28px 30px;
  color: var(--ink);
  box-shadow: 0 24px 60px #14243d33;
}
.code-dialog::backdrop { background: #18283c80; }
.code-dialog h2 { font-size: 21px; margin: 0 0 8px; }
.code-dialog p { margin: 0 0 18px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.code-dialog p strong { color: var(--ink); }
#emailCode { font-size: 22px; letter-spacing: 6px; text-align: center; }
.dialog-actions { display: flex; gap: 12px; margin-top: 10px; }
.link-button {
  display: block;
  margin-top: 16px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--blue);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.link-button:disabled { color: var(--muted); cursor: default; }

/* Полноэкранный экран благодарности после отправки */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 24px;
  text-align: center;
}
.overlay[hidden] { display: none; }
.overlay-check { width: 88px; height: 88px; margin: 0 auto 24px; color: var(--wine); }
.overlay-check svg { width: 100%; height: 100%; display: block; }
.overlay h2 { font: 700 clamp(30px, 5vw, 42px)/1.15 Georgia, serif; margin: 0 0 12px; color: var(--ink); }
.overlay p { margin: 0; color: var(--muted); font-size: 16px; max-width: 420px; }

/* Подвал */

footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
  padding: 22px max(24px, calc((100% - 1120px) / 2));
  font-size: 12px;
}
.footer-logo { width: 92px; height: auto; max-height: 30px; object-fit: contain; }

/* Согласие на cookie в правом нижнем углу */

.cookie-banner {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  width: min(380px, calc(100% - 32px));
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--wine);
  padding: 20px 22px;
  box-shadow: 0 16px 44px #14243d26;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner h2 { font-size: 16px; margin: 0 0 6px; }
.cookie-banner p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.cookie-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cookie-actions .primary, .cookie-actions .secondary { height: 40px; padding: 0 16px; font-size: 14px; }
.footer-link { display: inline; margin: 0 0 0 auto; font-size: 12px; }

/* Мобильная версия.
   Внимание: у .topbar намеренно нет мобильного переопределения (height:auto) —
   в исходном CSS это правило перекрывалось поздними базовыми копиями селектора
   и фактически никогда не применялось; сохраняем фактический вид страницы. */

@media (max-width: 680px) {
  .page { padding: 38px 16px 52px; }
  .panel { padding: 22px 18px; }
  .two { grid-template-columns: 1fr; }
  .intro h1 { font-size: 38px; }
  .actions { flex-direction: column; align-items: stretch; }
  .primary, .secondary { width: 100%; }
  .dialog-actions { flex-direction: column; }
  .code-dialog { padding: 24px 18px; }
  footer { padding: 18px 20px; flex-direction: column; }
  .footer-link { margin: 0; }
  .cookie-banner { right: 16px; bottom: 16px; }
  .cookie-actions .primary, .cookie-actions .secondary { flex: 1 1 100%; }
}
