/* Design tokens shared by every partner theme (docs/design_mkb/ui_kit_page1.png) */
:root {
  --text-disabled: #77746F;
  --text-error: #B3261E;
  --text-on-inverse: #FFFFFF;
  --text-on-inverse-secondary: #B9B7B3;
  --text-primary: #3C3C3C;
  --text-secondary: #707372;
  --text-strong: #1A1A1A;

  --bg-disabled: #F0EEEA;
  --bg-error-subtle: #FBEDEC;
  --bg-inverse: #3C3C3C;
  --bg-page: #FFFFFF;
  --bg-subtle: #FAF8F5;
  --bg-surface: #FFFFFF;

  --border-default: #DDD8D1;
  --border-disabled: #B9B7B3;
  --border-error: #B3261E;
  --border-strong: #8F8C87;
  --border-subtle: #E7E7E7;

  --progress-track: #DDD8D1;

  --action-on-primary: #FFFFFF;
  --action-on-primary-disabled: #707372;
  --action-primary: #3C3C3C;
  --action-primary-disabled: #DDD8D1;

  --icon-error: #B3261E;

  --font-primary: 'Gotham Pro', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-card: 16px;
  --radius-field: 10px;
  --radius-button: 10px;
}

/* Partner theme: поверхность внешнего вида партнёра расширена с <title> до
   {CSS-тема по data-partner, статические ассеты партнёра, партнёр-текстовые
   поля} — см. AD в architecture-anketa.md (plan-zenit-view-and-texts.md).
   data-partner на <html> (internal/view/layout.templ) выбирает один из
   блоков ниже; остальной CSS ссылается только на переменные, значения —
   данные партнёра, не код. */
[data-partner="mkb"] {
  --text-accent: #8A6232;
  --border-focus: #C39664;
  --accent-primary: #C39664;
  --icon-accent: #8A6232;
  --logo-on-light: url('brand/mkb/logo-dark.svg');
  --logo-on-dark: url('brand/mkb/logo-light.svg');
  --hero-bg: url('brand/mkb/hero.jpg');
}

[data-partner="zenit"] {
  --text-accent: #393B4D;
  --border-focus: #393B4D;
  --accent-primary: #393B4D;
  --icon-accent: #393B4D;
  --logo-on-light: url('brand/zenit/logo-dark.svg');
  --logo-on-dark: url('brand/zenit/logo-light.svg');
  --hero-bg: url('brand/zenit/hero.png');
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-primary);
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-accent); }

/* ---- Layout shell: header bar + two-column desktop / stacked mobile ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-subtle);
}
.topbar .logo-mkb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-strong);
}
.topbar .logo-mkb svg { flex-shrink: 0; filter: invert(1); }
.topbar .sep { color: var(--border-strong); margin: 0 4px; }
.topbar .logo-prime { font-weight: 700; letter-spacing: 0.04em; font-size: 15px; }

/* brand-logo: партнёр-логотип одним ассетом (иконка + название партнёра +
   × PRIME), переключается через --logo-on-light/--logo-on-dark по
   data-partner. Используется вместо .logo-mkb на экранах, параметризованных
   под партнёра (card_check, already_registered) — остальные экраны пока
   сохраняют .logo-mkb как есть (deferred-work.md). */
.brand-logo { background-repeat: no-repeat; background-position: left center; }
.topbar .brand-logo { width: 132px; height: 22px; background-image: var(--logo-on-light); background-size: contain; }
.hero-top .brand-logo, .mobile-cover .brand-logo { width: 120px; height: 20px; background-image: var(--logo-on-dark); background-size: contain; }

/* desktop split screen lives only above tablet breakpoint via .shell--split */
.shell {
  min-height: calc(100vh - 73px);
  display: flex;
  flex-direction: column;
}
.shell--split { flex-direction: row; }

.panel-form {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 48px 32px 32px;
}
.panel-form-inner { width: 100%; max-width: 536px; }

.panel-hero {
  display: none;
  position: relative;
  flex: 1;
  background: linear-gradient(180deg, rgba(20,16,12,0.05) 40%, rgba(10,8,6,0.78) 100%), var(--hero-bg) center/cover no-repeat;
  color: var(--text-on-inverse);
  padding: 32px;
}
.panel-hero .hero-top { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.panel-hero .hero-bottom { position: absolute; left: 32px; bottom: 40px; right: 32px; }
.panel-hero .hero-rule { width: 32px; height: 2px; background: var(--accent-primary); margin-bottom: 16px; }
.panel-hero h2 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; font-weight: 700; }
.panel-hero p { margin: 0; color: var(--text-on-inverse-secondary); font-size: 15px; }

@media (min-width: 1024px) {
  .shell--split { flex-direction: row; }
  .panel-hero { display: block; flex: 0 0 48%; }
  .panel-form { flex: 0 0 52%; padding: 64px; }
  /* On desktop the hero panel carries its own logo; the shared top bar is mobile/tablet only */
  body.has-hero .topbar { display: none; }
}

/* ---- Back link ---- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 24px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

/* ---- Headline + step progress (desktop: text back-link above, "Шаг N из 3" bar below headline) ---- */
.headline { font-size: 32px; line-height: 1.3; font-weight: 700; color: var(--text-strong); margin: 0 0 20px; }
.step-indicator { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; font-size: 13px; color: var(--text-secondary); }
.step-indicator .track { flex: 1; display: flex; gap: 8px; }
.step-indicator .seg { height: 4px; border-radius: 2px; background: var(--progress-track); flex: 1; }
.step-indicator .seg.done, .step-indicator .seg.active { background: var(--accent-primary); }

/* ---- Mobile/tablet topline: circular back button + bar + "N/3" fraction, above headline ---- */
.mobile-topline { display: none; }
@media (max-width: 1023px) {
  .back-link, .panel-form .step-indicator { display: none; }
  .mobile-topline { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
  .mobile-topline .mtl-back {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    background: var(--bg-subtle); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
  }
  .mobile-topline .mtl-track { flex: 1; display: flex; gap: 8px; }
  .mobile-topline .seg { height: 4px; border-radius: 2px; background: var(--progress-track); flex: 1; }
  .mobile-topline .seg.done, .mobile-topline .seg.active { background: var(--accent-primary); }
  .mobile-topline .mtl-frac { font-size: 15px; font-weight: 700; color: var(--text-secondary); white-space: nowrap; }
  .mobile-topline .mtl-frac b { color: var(--text-accent); }
}

/* ---- Card ---- */
.card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 32px;
  background: var(--bg-surface);
}
.card h1 { font-size: 20px; margin: 0 0 8px; color: var(--text-strong); }
.card .hint { font-size: 14px; color: var(--text-secondary); line-height: 1.4; margin: 0 0 20px; }

/* ---- Fields ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.field input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  color: var(--text-primary);
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-field);
  background: var(--bg-surface);
  outline: none;
}
.field input::placeholder { color: var(--text-disabled); }
.field input:focus { border-color: var(--border-focus); }
.field.with-icon { position: relative; }
.field.with-icon input { padding-left: 44px; }
.field.with-icon .field-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--icon-accent); }
.field.has-error label { color: var(--text-error); }
.field.has-error input { border-color: var(--border-error); }
.field-error { font-size: 13px; color: var(--text-error); margin: 6px 0 0; }

/* ---- Checkbox / consent ---- */
.consent { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-primary); margin-bottom: 20px; }
.consent input[type="checkbox"] {
  width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px;
  accent-color: var(--action-primary);
}
.consent.has-error + .field-error,
.consent.has-error { color: var(--text-error); }
.consent.has-error input { outline: 1px solid var(--border-error); }

/* ---- Buttons ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 15px 20px;
  border-radius: var(--radius-button);
  border: none;
  cursor: pointer;
}
.btn-primary { background: var(--action-primary); color: var(--action-on-primary); }
.btn-primary[disabled] { background: var(--action-primary-disabled); color: var(--action-on-primary-disabled); cursor: not-allowed; }
.btn-primary .spinner { display: none; }
.btn-primary.is-loading .spinner { display: inline-block; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Captcha widget: spacing wrapper around the real Yandex SmartCaptcha
   widget, which renders and styles itself once captcha.js loads ---- */
.captcha-widget {
  margin-bottom: 16px;
}

/* ---- Legacy mock captcha markup (kept for other mockup pages) ---- */
.captcha {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-field);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.captcha .box {
  width: 24px; height: 24px; border-radius: 4px;
  border: 1px solid var(--border-disabled);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.captcha.checked .box { background: #2E7D32; border-color: #2E7D32; position: relative; }
.captcha.checked .box::after {
  content: ''; position: absolute; left: 7px; top: 3px;
  width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.captcha .title { font-weight: 700; font-size: 14px; margin: 0 0 2px; }
.captcha .sub { font-size: 12px; color: var(--text-secondary); margin: 0 0 2px; }
.captcha .brand { font-size: 11px; color: var(--text-disabled); margin: 0; }

/* ---- Alert banner (card verification error) ---- */
.alert {
  display: flex;
  gap: 12px;
  background: var(--bg-error-subtle);
  border: 1px solid var(--border-error);
  border-radius: var(--radius-field);
  padding: 16px;
  margin-bottom: 16px;
}
.alert .icon { color: var(--icon-error); flex-shrink: 0; margin-top: 2px; }
.alert .title { font-weight: 700; font-size: 14px; margin: 0 0 4px; color: var(--text-primary); }
.alert .text { font-size: 14px; color: var(--text-primary); margin: 0; line-height: 1.4; }
.alert .text a { font-weight: 600; }

.inline-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-error);
  margin: 12px 0 0;
}

/* ---- OTP code inputs ---- */
.otp-row { display: flex; gap: 12px; margin-bottom: 4px; }
.otp-row input {
  width: 56px; height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-field);
  color: var(--text-strong);
}
.otp-row input:focus { border-color: var(--border-focus); }
.otp-row.has-error input {
  border-color: var(--border-error);
  background: var(--bg-error-subtle);
  color: var(--text-error);
}

.resend { font-size: 14px; color: var(--text-secondary); margin-top: 20px; }
.resend b { color: var(--text-primary); }
.resend a { font-weight: 700; }

/* ---- Fullscreen status (already registered / technical error / loading) ---- */
.status-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
}
.status-screen.align-left { align-items: flex-start; text-align: left; max-width: 420px; }
.status-icon {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
}
.status-icon.warn { background: var(--bg-subtle); color: var(--accent-primary); border: 1px solid var(--accent-primary); }
.status-icon.error { background: var(--bg-error-subtle); color: var(--text-error); }
.status-icon.success { background: var(--bg-subtle); color: var(--accent-primary); border: 1px solid var(--accent-primary); }
.status-screen h1 { font-size: 24px; margin: 0 0 12px; color: var(--text-strong); }
.status-screen p { font-size: 15px; color: var(--text-secondary); margin: 0; line-height: 1.5; }
.status-screen .btn { max-width: 320px; margin-top: 28px; }

/* ---- Welcome screen ---- */
.welcome-check {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--bg-subtle); border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
}
.welcome-title { font-size: 28px; font-weight: 700; color: var(--text-strong); margin: 0 0 8px; line-height: 1.25; }
.welcome-sub { font-size: 16px; color: var(--text-secondary); margin: 0 0 24px; }
.benefit-cols { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px; }
@media (min-width: 640px) {
  .benefit-cols { grid-template-columns: 1fr 1fr; }
}
.benefit-box { border-radius: 14px; padding: 20px; }
.benefit-box.filled { background: var(--bg-subtle); }
.benefit-box.outline { border: 1px solid var(--border-subtle); }
.benefit-box h3 { font-size: 15px; margin: 0 0 14px; }
.benefit-item { display: flex; gap: 12px; margin-bottom: 14px; font-size: 14px; line-height: 1.4; }
.benefit-item:last-child { margin-bottom: 0; }
.benefit-icon {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--accent-primary); color: var(--icon-accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.store-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.store-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--action-primary); color: var(--action-on-primary);
  border-radius: 10px; padding: 10px 16px;
}
.store-btn .label-s { display: block; font-size: 10px; color: var(--text-on-inverse-secondary); }
.store-btn .label-m { display: block; font-size: 14px; font-weight: 700; }
.section-title { font-size: 16px; font-weight: 700; margin: 0 0 16px; }
.telegram-label { font-size: 13px; color: var(--text-secondary); margin: 16px 0 8px; }
.telegram-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent-primary); font-size: 14px; font-weight: 600;
  text-decoration: none;
}
.telegram-link:hover { text-decoration: underline; }
.phone-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent-primary); font-size: 14px; font-weight: 600;
  text-decoration: none; margin-top: 16px;
}
.phone-link:hover { text-decoration: underline; }
.phone-caption { font-size: 13px; color: var(--text-secondary); margin: 4px 0 0; }

/* ---- Mobile hero cover (first screen only on narrow viewports) ---- */
.mobile-cover {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(20,16,12,0.1) 35%, rgba(8,6,4,0.82) 100%), url('assets/hero.jpg') center/cover no-repeat;
  color: var(--text-on-inverse);
  display: flex;
  flex-direction: column;
  padding: 24px;
}
.mobile-cover .hero-top { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.mobile-cover .hero-bottom { margin-top: auto; }
.mobile-cover .hero-rule { width: 32px; height: 2px; background: var(--accent-primary); margin-bottom: 16px; }
.mobile-cover h2 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; font-weight: 700; }
.mobile-cover p { margin: 0 0 24px; color: var(--text-on-inverse-secondary); font-size: 15px; }
.mobile-cover .btn-primary { background: #fff; color: var(--text-strong); }
@media (min-width: 1024px) {
  .mobile-cover { display: none; }
}

.container-narrow { padding: 24px; max-width: 600px; margin: 0 auto; width: 100%; }

.phone-mask-row { display: flex; gap: 0; }

footer.legal-link {
  text-align: center;
  padding: 24px;
  font-size: 13px;
}
footer.legal-link a { color: var(--text-secondary); }
