/* Сборка из app.css: python3 scripts/build_auth_css.py. Не редактировать. */
:root {
  /* Бренд: фиолетовый Киммерийца */
  --brand-50:  #f1eeff;
  --brand-100: #e4dcff;
  --brand-200: #cbbcff;
  --brand-300: #ad95ff;
  --brand-400: #8f6dff;
  --brand-500: #6c4bf4;
  --brand-600: #5b39e3;
  --brand-700: #4a2cc0;
  --brand-800: #3b249a;
  --brand-900: #2d1c74;

  /* Нейтральные */
  --n-0:   #ffffff;
  --n-25:  #fcfcfd;
  --n-50:  #f7f8fa;
  --n-100: #eff1f5;
  --n-200: #e3e6ec;
  --n-300: #cbd0da;
  --n-400: #9aa2b1;
  --n-500: #6f7787;
  --n-600: #545c6b;
  --n-700: #3d4451;
  --n-800: #272c36;
  --n-900: #171b22;
  --n-950: #0e1116;

  /* Смысловые */
  --ok-50:  #e8f7f0;  --ok-500:  #0fa968;  --ok-600:  #0b8b55;
  --warn-50:#fff6e6;  --warn-500:#e8930c;  --warn-600:#c47708;
  --err-50: #fdecec;  --err-500: #dc3f42;  --err-600: #bd2f32;
  --info-50:#e9f1fe;  --info-500:#2f7ae5;  --info-600:#2263c4;

  /* Поверхности (светлая тема) */
  --bg:          var(--n-50);
  --bg-soft:     var(--n-100);
  --surface:     var(--n-0);
  --surface-2:   var(--n-25);
  --surface-3:   var(--n-100);
  --border:      var(--n-200);
  --border-strong: var(--n-300);
  --text:        var(--n-900);
  --text-muted:  var(--n-500);
  --text-soft:   var(--n-600);
  --text-invert: var(--n-0);
  --accent:      var(--brand-500);
  --accent-hover:var(--brand-600);
  --accent-soft: var(--brand-50);
  --accent-text: var(--brand-700);
  --ring:        color-mix(in srgb, var(--brand-500) 35%, transparent);

  /* Скругления */
  --r-xs: 6px;  --r-sm: 8px;  --r-md: 12px;
  --r-lg: 16px; --r-xl: 22px; --r-full: 999px;

  /* Тени */
  --sh-xs: 0 1px 2px rgba(16, 20, 28, .05);
  --sh-sm: 0 1px 3px rgba(16, 20, 28, .07), 0 1px 2px rgba(16, 20, 28, .04);
  --sh-md: 0 4px 12px rgba(16, 20, 28, .08), 0 2px 4px rgba(16, 20, 28, .04);
  --sh-lg: 0 12px 32px rgba(16, 20, 28, .10), 0 4px 8px rgba(16, 20, 28, .04);
  --sh-xl: 0 24px 56px rgba(16, 20, 28, .14);

  /* Шаг сетки */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;

  /* Раскладка */
  --header-h: 64px;
  --sidebar-w: 320px;
  --container: 1200px;
  --container-narrow: 760px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: 160ms;
}

/* Тёмная тема: включается системно либо тумблером (data-theme на <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          var(--n-950);
    --bg-soft:     #12161d;
    --surface:     #161a22;
    --surface-2:   #1b202a;
    --surface-3:   #222834;
    --border:      #2a313d;
    --border-strong: #3a4351;
    --text:        #eef1f6;
    --text-muted:  #8d97a8;
    --text-soft:   #aab3c2;
    --accent:      var(--brand-400);
    --accent-hover:var(--brand-300);
    --accent-soft: rgba(143, 109, 255, .14);
    --accent-text: var(--brand-200);
    --ok-50:   rgba(15, 169, 104, .14);
    --warn-50: rgba(232, 147, 12, .14);
    --err-50:  rgba(220, 63, 66, .14);
    --info-50: rgba(47, 122, 229, .14);
    --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-sm: 0 1px 3px rgba(0, 0, 0, .45);
    --sh-md: 0 4px 14px rgba(0, 0, 0, .5);
    --sh-lg: 0 12px 34px rgba(0, 0, 0, .55);
    --sh-xl: 0 24px 60px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --bg: var(--n-950);       --bg-soft: #12161d;
  --surface: #161a22;       --surface-2: #1b202a;   --surface-3: #222834;
  --border: #2a313d;        --border-strong: #3a4351;
  --text: #eef1f6;          --text-muted: #8d97a8;  --text-soft: #aab3c2;
  --accent: var(--brand-400); --accent-hover: var(--brand-300);
  --accent-soft: rgba(143, 109, 255, .14); --accent-text: var(--brand-200);
  --ok-50: rgba(15,169,104,.14);  --warn-50: rgba(232,147,12,.14);
  --err-50: rgba(220,63,66,.14);  --info-50: rgba(47,122,229,.14);
  --sh-xs: 0 1px 2px rgba(0,0,0,.4);   --sh-sm: 0 1px 3px rgba(0,0,0,.45);
  --sh-md: 0 4px 14px rgba(0,0,0,.5);  --sh-lg: 0 12px 34px rgba(0,0,0,.55);
  --sh-xl: 0 24px 60px rgba(0,0,0,.6);
}

/* ---------------------------------------------------------------- 2. База */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05" 1, "ss03" 1;
}

img, video, canvas { display: block; max-width: 100%; height: auto; }

/* Иконки: размер приходит атрибутами из макроса, но height:auto из правила выше
   его бы обнулило — поэтому у .icon пропорции фиксируем явно. .icon-lg/.icon-xl
   для акцентных мест (карточки преимуществ, шаги), .icon-sm для плотных списков. */
svg { display: block; }
.icon { flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 34px; height: 34px; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: none; border-top: 1px solid var(--border); margin: var(--s-6) 0; }

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: var(--accent-soft); color: var(--accent-text); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: var(--s-3) var(--s-5);
  border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- 3. Типографика */
h1, h2, h3, h4, h5 {
  font-weight: 680;
  line-height: 1.22;
  letter-spacing: -.019em;
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: clamp(1.75rem, 1.3rem + 1.9vw, 2.6rem); letter-spacing: -.028em; }
h2 { font-size: clamp(1.35rem, 1.15rem + .85vw, 1.85rem); letter-spacing: -.022em; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.03rem; letter-spacing: -.012em; }

.eyebrow {
  font-size: .74rem; font-weight: 640; letter-spacing: .085em;
  text-transform: uppercase; color: var(--accent-text);
}
.lead { font-size: 1.1rem; line-height: 1.62; color: var(--text-soft); text-wrap: pretty; }
.muted { color: var(--text-muted); }
.text-ok { color: var(--ok-600); }
.preserve-lines { white-space: pre-line; }
.small { font-size: .85rem; }
.xs { font-size: .78rem; }
.mono { font-family: var(--font-mono); font-size: .88em; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- 4. Кнопки */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 10px 18px; min-height: 42px;
  font-size: .94rem; font-weight: 570; letter-spacing: -.006em; line-height: 1;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--r-md);
  text-decoration: none; white-space: nowrap; user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              opacity var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled, .btn[aria-disabled="true"] {
  opacity: .5; pointer-events: none;
}
.btn svg { width: 17px; height: 17px; flex: none; }

.btn-primary {
  --btn-bg: var(--accent); --btn-fg: #fff; --btn-bd: transparent;
  box-shadow: var(--sh-sm);
}
.btn-primary:hover { --btn-bg: var(--accent-hover); box-shadow: var(--sh-md); }

.btn-secondary { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong); }
.btn-secondary:hover { --btn-bg: var(--surface-3); }

.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent-text); --btn-bd: transparent; }
.btn-soft:hover { --btn-bg: color-mix(in srgb, var(--accent) 16%, transparent); }

.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text-soft); --btn-bd: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-3); --btn-fg: var(--text); }

/* Вход через Telegram — фирменный голубой Telegram, одинаковый в обеих темах */
.btn-telegram { --btn-bg: #2aabee; --btn-fg: #fff; --btn-bd: transparent; }
.btn-telegram:hover { --btn-bg: #229ed9; }
.btn-danger { --btn-bg: var(--err-500); --btn-fg: #fff; --btn-bd: transparent; }
.btn-danger:hover { --btn-bg: var(--err-600); }

.btn-danger-soft { --btn-bg: var(--err-50); --btn-fg: var(--err-600); --btn-bd: transparent; }
.btn-danger-soft:hover { --btn-bg: color-mix(in srgb, var(--err-500) 18%, transparent); }

.btn-sm { padding: 6px 12px; min-height: 34px; font-size: .86rem; border-radius: var(--r-sm); }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 14px 26px; min-height: 52px; font-size: 1.02rem; border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 38px; min-height: 38px; }
.btn-icon.btn-sm { width: 32px; min-height: 32px; }

/* Кнопка в состоянии отправки (htmx) */
.btn.htmx-request { opacity: .65; pointer-events: none; }
.btn.htmx-request::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 5. Формы */
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: var(--s-5); }
.label { font-size: .875rem; font-weight: 560; color: var(--text); }
.label .req { color: var(--err-500); margin-left: 2px; }
.hint { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }
.error-text { font-size: .82rem; color: var(--err-500); font-weight: 520; }

.input, .textarea, .select {
  width: 100%; padding: 11px 14px; min-height: 44px;
  font-size: .95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--n-400); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--n-400); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--err-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err-500) 18%, transparent);
}
.input:disabled, .textarea:disabled, .select:disabled {
  background: var(--surface-3); color: var(--text-muted); cursor: not-allowed;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.textarea-lg { min-height: 260px; }
.textarea-quiz-prompt { min-height: 48px; max-height: 120px; resize: none; overflow-y: auto; }
.select {
  appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f7787' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.input-group { display: flex; gap: var(--s-2); }
.input-group .input { flex: 1; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-xs);
}

/* ---------------------------------------------------------------- 8. Уведомления */
.alert {
  display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md); font-size: .92rem; line-height: 1.55;
  border: 1px solid transparent;
}
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert-title { font-weight: 620; display: block; margin-bottom: 2px; }
.alert-ok   { background: var(--ok-50);   color: var(--ok-600);   border-color: color-mix(in srgb, var(--ok-500) 25%, transparent); }
.alert-warn { background: var(--warn-50); color: var(--warn-600); border-color: color-mix(in srgb, var(--warn-500) 25%, transparent); }
.alert-err  { background: var(--err-50);  color: var(--err-600);  border-color: color-mix(in srgb, var(--err-500) 25%, transparent); }
.alert-info { background: var(--info-50); color: var(--info-600); border-color: color-mix(in srgb, var(--info-500) 25%, transparent); }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700;
         color: var(--text); letter-spacing: -.02em; font-size: 1.04rem;
         flex: 0 1 auto; min-width: 0; }
.brand > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .95rem;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-500) 35%, transparent);
}
.brand-sub { font-size: .72rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0; display: block; }

/* Авторизация */
.auth-shell {
  min-height: 100dvh; display: grid; grid-template-columns: 1fr;
  place-items: center; padding: var(--s-8) var(--s-5);
  background:
    radial-gradient(1000px 520px at 12% -12%, var(--accent-soft), transparent 62%),
    radial-gradient(760px 420px at 92% 108%, color-mix(in srgb, var(--brand-300) 16%, transparent), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 428px; }
.auth-card .card { padding: var(--s-8); box-shadow: var(--sh-lg); }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); margin-bottom: var(--s-6); }
.auth-logo h1 { font-size: 1.4rem; }
.auth-alt { text-align: center; margin-top: var(--s-6); font-size: .9rem; color: var(--text-muted); }

/* Утилиты */
.hidden { display: none !important; }
.block { display: block; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.mt-0{margin-top:0}.mt-2{margin-top:var(--s-2)}.mt-3{margin-top:var(--s-3)}
.mt-4{margin-top:var(--s-4)}.mt-5{margin-top:var(--s-5)}.mt-6{margin-top:var(--s-6)}
.mt-8{margin-top:var(--s-8)}.mt-10{margin-top:var(--s-10)}
.mb-0{margin-bottom:0}.mb-2{margin-bottom:var(--s-2)}.mb-3{margin-bottom:var(--s-3)}
.mb-4{margin-bottom:var(--s-4)}.mb-5{margin-bottom:var(--s-5)}.mb-6{margin-bottom:var(--s-6)}
.mb-8{margin-bottom:var(--s-8)}
.gap-2{gap:var(--s-2)}.gap-3{gap:var(--s-3)}.gap-4{gap:var(--s-4)}.gap-5{gap:var(--s-5)}
.flex-1{flex:1}.w-full{width:100%}
.text-center{text-align:center}.text-right{text-align:right}
.items-start{align-items:flex-start}.items-center{align-items:center}.items-end{align-items:flex-end}
.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}
.flex-col{display:flex;flex-direction:column}
@media (max-width: 640px) { .hide-sm { display: none !important; } }
@media (max-width: 900px) { .hide-md { display: none !important; } }

.mini-webinar-banner { margin: 0 0 22px; padding: 20px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); }
.mini-webinar-kicker { display: block; color: var(--accent-text); font-size: 12px; font-weight: 700; }
.mini-webinar-banner p { margin: 10px 0 16px; line-height: 1.45; }
.mini-webinar-banner .btn { width: 100%; }
.auth-webinar-banner { max-width: 428px; margin: 0 auto 32px; }
html[data-iosapp] .mini-webinar-banner { display: none !important; }

html[data-miniapp] .auth-shell { display: block; padding: 28px 18px; }
html[data-miniapp] .auth-card { margin: auto; }
html[data-miniapp] .auth-card .card { padding: 22px; }
