/* ============================================================
   TS Chat — портал регистрации.
   Дизайн-система: Apple Human Interface Guidelines, СВЕТЛАЯ тема.
   ВАРИАНТ A «Apple Clean» — эталон apple.com: нейтральный белый,
   много воздуха, один синий акцент. color-scheme: light.
   Применение: cp /root/portal/variant-a.css /root/portal/styles.css
   ------------------------------------------------------------
   Что взято из HIG:
   • Типографика (typography.md): системный шрифт SF Pro, масштаб
     Dynamic Type «Large» — Large Title 34, Title 2 22, Body 17,
     Callout 16, Footnote 13, Caption 12; трекинг по таблице Apple;
     всё в rem, поэтому подчиняется системному размеру текста.
   • Цвет (color.md): только семантические цвета —
     systemBackground #FBFBFD, secondary #FFFFFF, tertiary #F5F5F7,
     label #1D1D1F, secondaryLabel, separator, systemFill.
     Акцент — systemBlue (light) #0071E3; systemGreen строго для
     состояний «готово / подтверждено / надёжно»; systemRed для ошибок.
     Один цвет = одно значение.
   • Материалы (materials.md): в слое контента — стандартный плотный
     материал; размытие (glass) только в функциональном слое —
     липкая шапка и тост.
   • Пространство и иерархия (layout.md): одна колонка, много воздуха,
     сетка 8 pt, крупные заголовки, никакой плотности.
   • Движение (motion.md): пружинные кривые, 0.22–0.45 s, короткое
     и по делу; при reduce motion — только затухания.
   • Доступность (accessibility.md): контраст ≥ 4.5:1, цели нажатия
     ≥ 50 px, safe-area, видимый фокус, поддержка reduce motion,
     reduce transparency и increase contrast.
   ============================================================ */

/* ------------------------------------------------------------
   1. ТОКЕНЫ
   ------------------------------------------------------------ */
:root {
  color-scheme: light;

  /* Поверхности (светлая тема) */
  --bg: #FBFBFD;
  --surface-1: #FFFFFF;
  --surface-2: #F5F5F7;
  --glass: rgba(255, 255, 255, 0.72);

  /* Текст */
  --label: #1D1D1F;
  --label-2: rgba(0, 0, 0, 0.56);
  --label-3: rgba(0, 0, 0, 0.36);
  --placeholder: rgba(0, 0, 0, 0.36);

  /* Разделители */
  --separator: rgba(0, 0, 0, 0.12);
  --hairline: rgba(0, 0, 0, 0.06);
  --hairline-strong: rgba(0, 0, 0, 0.16);

  /* Заливки контролов (systemFill, light) */
  --fill-2: rgba(120, 120, 128, 0.16);
  --fill-3: rgba(120, 120, 128, 0.12);
  --fill-4: rgba(120, 120, 128, 0.08);

  /* Сигнальные цвета (system colors, light) */
  --blue: #0071E3;
  --blue-press: #0058B0;
  --green: #34C759;
  --red: #FF3B30;
  --orange: #FF9500;
  --yellow: #E5A200;
  --indigo: #5856D6;

  /* Текст-версии сигнальных цветов: контраст >= 4.5:1 на светлом фоне.
     Яркие --green/--red остаются только для графики (точки, шкала, заливки). */
  --green-ink: #22813A;
  --red-ink: #E10C00;

  --accent: var(--blue);
  /* --accent-tint — чистый оттенок акцента: только заливки без текста
     (шкала прогресса). Текст и кнопки используют контрастный --accent. */
  --accent-tint: #0071E3;
  --accent-soft: rgba(0, 113, 227, 0.14);
  --green-soft: rgba(52, 199, 89, 0.14);
  --red-soft: rgba(255, 59, 48, 0.12);
  --indigo-soft: rgba(88, 86, 214, 0.14);

  /* Типографика — Dynamic Type, размер Large */
  --f-large-title: 2.125rem;   /* 34 / 41 */
  --f-title-2: 1.375rem;       /* 22 / 28 */
  --f-title-3: 1.25rem;        /* 20 / 25 */
  --f-body: 1.0625rem;         /* 17 / 22 */
  --f-callout: 1rem;           /* 16 / 21 */
  --f-subhead: .9375rem;       /* 15 / 20 */
  --f-footnote: .8125rem;      /* 13 / 18 */
  --f-caption: .75rem;         /* 12 / 16 */

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
          system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* Движение */
  --spring: cubic-bezier(.34, 1.28, .44, 1);
  --spring-tight: cubic-bezier(.28, 1.12, .42, 1);
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-in-out: cubic-bezier(.42, 0, .58, 1);
  --t-fast: .2s;
  --t: .32s;
  --t-slow: .45s;

  /* Геометрия */
  --r-card: 28px;
  --r-row: 18px;
  --r-field: 14px;
  --r-pill: 999px;
  --w: 560px;
  --hit: 54px;
  --hit-min: 44px;

  /* Безопасные зоны */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --pad-x: clamp(20px, 6vw, 32px);
  --gut-l: calc(var(--pad-x) + var(--safe-l));
  --gut-r: calc(var(--pad-x) + var(--safe-r));
  --inset-l: max(var(--gut-l), calc((100% - var(--w)) / 2 + var(--gut-l)));
  --inset-r: max(var(--gut-r), calc((100% - var(--w)) / 2 + var(--gut-r)));
}

/* ------------------------------------------------------------
   2. СБРОС И БАЗА
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;             /* горизонтального скролла нет */
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: clip;                 /* не создаёт скролл-контейнер → sticky работает */
  padding: calc(var(--safe-t) + 8px) var(--gut-r) calc(var(--safe-b) + 44px) var(--gut-l);
  font-family: var(--font);
  font-size: var(--f-body);
  line-height: 1.29;              /* 22 / 17 */
  font-optical-sizing: auto;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ul, dl, dd, dt { margin: 0; }
ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: .94em; }
button, input { font: inherit; color: inherit; }
svg { display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
[tabindex='-1']:focus,
[tabindex='-1']:focus-visible { outline: none; }

/* Ссылка «Перейти к форме» — видна только с клавиатуры */
.skip-link {
  position: absolute;
  top: calc(-1 * (var(--safe-t) + 96px));
  left: var(--gut-l);
  z-index: 60;
  display: inline-flex; align-items: center;
  min-height: var(--hit-min);
  padding: 10px 20px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: var(--f-subhead);
  font-weight: 600;
  transition: top var(--t) var(--spring);
}
.skip-link:hover { text-decoration: none; }
.skip-link:focus { top: calc(var(--safe-t) + 12px); }

/* Амбиентная подсветка фона — единственный декоративный элемент */
.glow {
  position: fixed;
  inset: -32% -24% auto -24%;
  height: 58vh;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(44% 56% at 26% 18%, rgba(0, 113, 227, 0.12), transparent 72%),
    radial-gradient(38% 50% at 78% 6%, rgba(88, 86, 214, 0.09), transparent 74%);
  filter: blur(24px);
  animation: drift 28s var(--ease-in-out) infinite alternate;
}

/* ------------------------------------------------------------
   3. ШАПКА — функциональный слой: стекло, safe-area, sticky
   ------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-left: calc(-1 * var(--gut-l));
  margin-right: calc(-1 * var(--gut-r));
  padding:
    calc(var(--safe-t) * .3 + 10px)
    var(--inset-r)
    10px
    var(--inset-l);
  background: rgba(251, 251, 253, 0.92);
  border-bottom: 1px solid var(--hairline);
  animation: fade-down var(--t-slow) var(--ease-out) both;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topbar {
    background: var(--glass);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
  }
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(160deg, var(--blue), var(--blue-press));
  box-shadow: 0 3px 10px rgba(0, 113, 227, 0.24), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.brand-name {
  font-size: var(--f-callout);
  font-weight: 600;
  letter-spacing: -.0194em;
  white-space: nowrap;
}

.status {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--fill-4);
  color: var(--label-2);
  font-size: var(--f-footnote);
  letter-spacing: -.0062em;
  white-space: nowrap;
  transition: color var(--t) var(--ease-out), background var(--t) var(--ease-out);
}
.status-dot {
  width: 8px; height: 8px; flex: none;
  border-radius: 50%;
  background: var(--label-3);
  transition: background var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out);
}
.status[data-state='online'] { color: var(--green); background: var(--green-soft); }
.status[data-state='online'] .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.16);
  animation: pulse 2.6s var(--ease-in-out) infinite;
}
.status[data-state='offline'] { color: var(--red); background: var(--red-soft); }
.status[data-state='offline'] .status-dot { background: var(--red); }

/* ------------------------------------------------------------
   4. СТРАНИЦА И КАРТОЧКА
   ------------------------------------------------------------ */
.page {
  width: 100%;
  max-width: var(--w);
  margin: 0 auto;
  padding-top: 32px;
}

.card {
  padding: 0;
  border: 0;
  background: transparent;
}
/* На широком экране контент собирается в стандартный материал */
@media (min-width: 620px) {
  .card {
    padding: 40px 36px 44px;
    border-radius: var(--r-card);
    border: 1px solid var(--hairline);
    background: var(--surface-1);
    animation: rise-in var(--t-slow) var(--ease-out) both;
  }
}

.title {
  font-size: clamp(1.875rem, 8.4vw, var(--f-large-title));
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .0118em;
  animation: rise-in var(--t-slow) var(--ease-out) both;
}
.subtitle {
  margin-top: 8px;
  color: var(--label-2);
  font-size: var(--f-callout);
  line-height: 1.31;
  letter-spacing: -.0194em;
  animation: rise-in var(--t-slow) .04s var(--ease-out) both;
}

/* ------------------------------------------------------------
   5. ПРОГРЕСС
   ------------------------------------------------------------ */
.track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 28px;
}
.track span {
  height: 4px;
  border-radius: 2px;
  background: var(--fill-3);
  transition: background var(--t-slow) var(--ease-out);
}
.track[data-step='1'] span:nth-child(-n+1),
.track[data-step='2'] span:nth-child(-n+2),
.track[data-step='3'] span:nth-child(-n+3),
.track[data-step='4'] span:nth-child(-n+4) { background: var(--accent); }

.step-line {
  margin-top: 12px;
  color: var(--label-3);
  font-size: var(--f-caption);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------
   6. ПАНЕЛИ
   ------------------------------------------------------------ */
.panel { animation: rise-in var(--t) var(--ease-out) both; }
.panel > * { animation: rise-in var(--t) var(--ease-out) both; }
.panel > *:nth-child(1) { animation-delay: .03s; }
.panel > *:nth-child(2) { animation-delay: .07s; }
.panel > *:nth-child(3) { animation-delay: .11s; }
.panel > *:nth-child(4) { animation-delay: .15s; }
.panel > *:nth-child(5) { animation-delay: .19s; }

.panel-title {
  margin-top: 26px;
  font-size: var(--f-title-2);
  line-height: 1.27;
  font-weight: 600;
  letter-spacing: -.0118em;
}
.panel-lead {
  margin-top: 8px;
  color: var(--label-2);
  font-size: var(--f-subhead);
  line-height: 1.38;
  letter-spacing: -.0153em;
}
.panel-lead strong { color: var(--label); font-weight: 600; }
.panel-lead code { color: var(--label); }

/* Сообщение об ошибке */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 24px;
  padding: 14px 12px 14px 16px;
  border-radius: var(--r-row);
  background: var(--red-soft);
  color: var(--label);
  font-size: var(--f-subhead);
  line-height: 1.38;
  letter-spacing: -.0153em;
}
.alert-icon { flex: none; margin-top: 1px; color: var(--red); }
.alert > span { flex: 1; min-width: 0; }
.alert-close {
  flex: none;
  display: grid; place-items: center;
  width: 32px; height: 32px; margin: -6px -2px -6px 0;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--label-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.alert-close:hover { background: var(--fill-3); color: var(--label); }
.alert-close:active { transform: scale(.92); }

/* ------------------------------------------------------------
   7. ПОЛЯ
   ------------------------------------------------------------ */
.field { margin-top: 26px; }
.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: var(--f-subhead);
  font-weight: 600;
  letter-spacing: -.0153em;
}
.muted { color: var(--label-2); font-weight: 400; }

.input-wrap { position: relative; display: flex; align-items: center; }

.input {
  width: 100%;
  min-width: 0;
  min-height: var(--hit);
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-field);
  background: var(--fill-3);
  color: var(--label);
  font-size: var(--f-body);
  line-height: 1.29;
  letter-spacing: -.0253em;
  appearance: none;
  transition: background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}
.input::placeholder { color: var(--placeholder); }
.input:hover { background: var(--fill-2); }
.input:focus {
  outline: none;
  background: var(--fill-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input.has-prefix { padding-left: 38px; }
.input.has-toggle { padding-right: 58px; }

.input-prefix {
  position: absolute; left: 16px;
  color: var(--label-2);
  font-size: var(--f-body);
  pointer-events: none;
}

.field.is-invalid .input {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.14);
}
.field.is-invalid .input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.18);
}

/* Индикатор проверки логина */
.input-state { position: absolute; right: 18px; display: none; }
.input-state .is-ok,
.input-state .is-bad,
.input-state .spinner { display: none; }
.input-wrap[data-state='ok'] .input-state { display: block; color: var(--green); }
.input-wrap[data-state='bad'] .input-state { display: block; color: var(--red); }
.input-wrap[data-state='check'] .input-state { display: block; }
.input-wrap[data-state='ok'] .is-ok,
.input-wrap[data-state='bad'] .is-bad { display: block; animation: pop-in var(--t-fast) var(--spring) both; }
.input-wrap[data-state='check'] .spinner {
  display: block;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--fill-2);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

/* Показать / скрыть пароль */
.input-toggle {
  position: absolute; right: 5px;
  display: grid; place-items: center;
  width: var(--hit-min); height: var(--hit-min);
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--label-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.input-toggle:hover { color: var(--label); background: var(--fill-4); }
.input-toggle:active { transform: scale(.9); }
.input-toggle .ic-hide { display: none; }
.input-toggle[aria-pressed='true'] .ic-show { display: none; }
.input-toggle[aria-pressed='true'] .ic-hide { display: block; }

/* Подпись под полем: подсказка, предпросмотр адреса или ошибка */
.field-note {
  margin-top: 10px;
  color: var(--label-2);
  font-size: var(--f-footnote);
  line-height: 1.38;
  letter-spacing: -.0062em;
  overflow-wrap: anywhere;
}
.field-note[data-tone='ok'] { color: var(--green); }
.field-note[data-tone='error'] {
  color: var(--red);
  animation: pop-in var(--t-fast) var(--spring) both;
}

/* ------------------------------------------------------------
   8. НАДЁЖНОСТЬ ПАРОЛЯ
   ------------------------------------------------------------ */
.strength {
  display: flex; align-items: center; gap: 6px;
  margin-top: 14px;
}
.strength i {
  flex: 1 1 0; min-width: 0;
  height: 5px;
  border-radius: 3px;
  background: var(--fill-3);
  transition: background var(--t) var(--ease-out);
}
.strength-label {
  flex: none;
  min-width: 104px;
  text-align: right;
  color: var(--label-2);
  font-size: var(--f-caption);
}
.strength[data-score='1'] i:nth-child(-n+1) { background: var(--red); }
.strength[data-score='2'] i:nth-child(-n+2) { background: var(--orange); }
.strength[data-score='3'] i:nth-child(-n+3) { background: var(--yellow); }
.strength[data-score='4'] i { background: var(--green); }

.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 14px;
}
.chips li {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--fill-4);
  color: var(--label-2);
  font-size: var(--f-caption);
  letter-spacing: 0;
  transition: color var(--t) var(--ease-out), background var(--t) var(--ease-out);
}
/* Состояние передаётся не только цветом: точка меняет плотность */
.chips li::before {
  content: '';
  width: 6px; height: 6px; flex: none;
  border-radius: 50%;
  background: currentColor;
  opacity: .3;
  transition: opacity var(--t) var(--ease-out);
}
.chips li.is-met { color: var(--green); background: var(--green-soft); }
.chips li.is-met::before { opacity: 1; }

/* ------------------------------------------------------------
   9. ДЕЙСТВИЯ И КНОПКИ
   ------------------------------------------------------------ */
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 32px; }
.actions-plain { flex-direction: row; flex-wrap: wrap; gap: 4px 8px; margin-top: 20px; }

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--hit);
  padding: 14px 24px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--fill-3);
  color: var(--label);
  font-size: var(--f-body);
  font-weight: 600;
  letter-spacing: -.0253em;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform var(--t-fast) var(--spring-tight),
              background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              opacity var(--t-fast) var(--ease-out);
}
.btn:hover { background: var(--fill-2); text-decoration: none; }
.btn:active { transform: scale(.975); }
.btn[disabled],
.btn[aria-busy='true'] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { flex: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 113, 227, 0.2);
}
.btn-primary:hover { background: #0067CF; }
.btn-primary:active { background: var(--blue-press); }

.btn-plain {
  min-height: var(--hit-min);
  padding: 10px 16px;
  background: transparent;
  color: var(--accent);
  font-weight: 500;
}
.btn-plain:hover { background: var(--fill-4); }

.btn-block { width: 100%; margin-top: 26px; }

.btn-spinner {
  display: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .40);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
.btn[aria-busy='true'] .btn-spinner { display: block; }
.btn[aria-busy='true'] .btn-label { opacity: .7; }

.alt-action {
  margin-top: 18px;
  text-align: center;
  color: var(--label-2);
  font-size: var(--f-footnote);
  letter-spacing: -.0062em;
}

/* ------------------------------------------------------------
   10. СТАТУС ПОДТВЕРЖДЕНИЯ (шаг 3)
   ------------------------------------------------------------ */
.status-line {
  display: flex; align-items: center; gap: 11px;
  margin-top: 18px;
  padding: 15px 18px;
  border-radius: var(--r-row);
  background: var(--surface-1);
  color: var(--label-2);
  font-size: var(--f-footnote);
  line-height: 1.38;
  transition: background var(--t) var(--ease-out), color var(--t) var(--ease-out);
}
.status-line > span:not(.spinner):not(.timer) { flex: 1; min-width: 0; }
.status-line[data-state='ok'] { background: var(--green-soft); color: var(--green); }
.status-line[data-state='error'] { background: var(--red-soft); color: var(--red); }
.status-line .spinner {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--fill-2);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.status-line[data-state='ok'] .spinner,
.status-line[data-state='error'] .spinner {
  animation: none;
  border-color: transparent;
}
.status-line[data-state='ok'] .spinner { background: var(--green); }
.status-line[data-state='error'] .spinner { background: var(--red); }
.timer {
  flex: none;
  font-family: var(--mono);
  font-size: var(--f-caption);
  color: var(--label-3);
}

/* ------------------------------------------------------------
   11. ИТОГ (шаг 4)
   ------------------------------------------------------------ */
.success {
  display: grid; place-items: center;
  margin-top: 28px;
  color: var(--green);
}
.success svg { filter: drop-shadow(0 8px 22px rgba(52, 199, 89, 0.2)); }
.success-circle {
  stroke-dasharray: 142;
  stroke-dashoffset: 142;
  animation: draw .6s var(--ease-out) forwards;
}
.success-tick {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw .4s var(--spring-tight) .5s forwards;
}

.creds {
  margin-top: 24px;
  border-radius: var(--r-row);
  background: var(--surface-1);
  overflow: hidden;
}
@media (min-width: 620px) { .creds { background: var(--surface-2); } }
.creds .row {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 14px 12px 14px 16px;
}
.creds .row + .row::before {
  content: '';
  position: absolute; top: 0; left: 16px; right: 0;
  height: 1px;
  background: var(--separator);
}
.creds dt {
  flex: none;
  color: var(--label-2);
  font-size: var(--f-footnote);
  letter-spacing: -.0062em;
}
@media (max-width: 480px) { .creds dt { flex-basis: 100%; } }
.creds dd {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: 2px;
  min-width: 0;
}
.creds code {
  flex: 1;
  min-width: 0;
  color: var(--label);
  font-size: var(--f-subhead);
  overflow-wrap: anywhere;
}
.creds-note {
  flex: 1;
  min-width: 0;
  color: var(--label-2);
  font-size: var(--f-subhead);
}
.copy {
  flex: none;
  display: grid; place-items: center;
  width: var(--hit-min); height: var(--hit-min);
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--label-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--spring-tight);
}
.copy:hover { color: var(--accent); background: var(--accent-soft); }
.copy:active { transform: scale(.9); }

.section-title {
  margin-top: 34px;
  font-size: var(--f-title-3);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.0225em;
}
.section-title + .panel-lead { margin-top: 10px; }

.apps { display: grid; gap: 8px; margin-top: 14px; }
.app-card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  min-width: 0;
  padding: 12px 44px 12px 14px;
  border-radius: var(--r-row);
  background: var(--surface-1);
  color: var(--label);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--spring-tight);
}
@media (min-width: 620px) { .app-card { background: var(--surface-2); } }
.app-card::after {
  content: '';
  position: absolute; right: 20px; top: 50%;
  width: 8px; height: 8px; margin-top: -5px;
  border-top: 2px solid var(--label-3);
  border-right: 2px solid var(--label-3);
  transform: rotate(45deg);
}
.app-card:hover { background: var(--fill-2); text-decoration: none; }
.app-card:active { transform: scale(.99); }
.app-icon {
  flex: none;
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: 13px;
  color: var(--accent);
  background: var(--accent-soft);
}
.app-card:nth-child(2) .app-icon { color: var(--green); background: var(--green-soft); }
.app-card:nth-child(3) .app-icon { color: var(--indigo); background: var(--indigo-soft); }
.app-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.app-text strong { font-size: var(--f-subhead); font-weight: 600; letter-spacing: -.0153em; }
.app-text small { color: var(--label-2); font-size: var(--f-caption); }

/* ------------------------------------------------------------
   12. ПОДВАЛ И ТОСТ
   ------------------------------------------------------------ */
.footer {
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--separator);
  text-align: center;
  color: var(--label-3);
  font-size: var(--f-footnote);
  line-height: 1.38;
  letter-spacing: -.0062em;
}
.footer code { color: var(--label-2); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 26px);
  z-index: 40;
  max-width: min(520px, calc(100vw - 2 * var(--pad-x)));
  padding: 13px 22px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.96);
  color: var(--label);
  font-size: var(--f-footnote);
  letter-spacing: -.0062em;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .10);
  transform: translateX(-50%);
  animation: toast-in var(--t) var(--spring) both;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .toast {
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
  }
}

/* ------------------------------------------------------------
   13. АНИМАЦИИ
   ------------------------------------------------------------ */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 14px) scale(.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(0, 24px, 0) scale(1.06); }
}

/* ------------------------------------------------------------
   14. НАСТРОЙКИ СИСТЕМЫ
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .strength { flex-wrap: wrap; }
  .strength-label { flex-basis: 100%; min-width: 0; text-align: left; margin-top: 4px; }
  .panel-title { margin-top: 22px; }
  .field { margin-top: 22px; }
  .actions { margin-top: 28px; }
}

@media (hover: none) {
  .app-card:hover { background: var(--surface-1); }
}

/* Reduce Motion: остаются только короткие затухания */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .success-circle, .success-tick { stroke-dashoffset: 0; }
  .glow { animation: none; }
  .btn:active, .copy:active, .input-toggle:active, .app-card:active { transform: none; }
}

/* Reduce Transparency: непрозрачные поверхности вместо стекла */
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: #FBFBFD; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .toast { background: #FFFFFF; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .glow { display: none; }
}

/* Increase Contrast: сильнее текст, разделители и границы */
@media (prefers-contrast: more) {
  :root {
    --label-2: rgba(0, 0, 0, 0.82);
    --label-3: rgba(0, 0, 0, 0.64);
    --separator: rgba(0, 0, 0, 0.3);
    --hairline: rgba(0, 0, 0, 0.22);
    --hairline-strong: rgba(0, 0, 0, 0.38);
    --fill-2: rgba(120, 120, 128, 0.42);
    --fill-3: rgba(120, 120, 128, 0.34);
    --fill-4: rgba(120, 120, 128, 0.26);
    --placeholder: rgba(0, 0, 0, 0.5);
  }
  .input { border-color: var(--hairline-strong); }
  .btn-primary { box-shadow: none; }
}

/* ------------------------------------------------------------
   15. СВЕТЛАЯ ТЕМА: КОНТРАСТ ТЕКСТА (WCAG AA >= 4.5:1)
   Яркие --green / --red оставлены для графики (точки статуса,
   шкала надёжности, заливки, иконки). Для текста — затемнённые
   --green-ink / --red-ink. Третичный --label-3 не используется
   для текста: только для декоративных элементов (точка статуса,
   шеврон карточки).
   ------------------------------------------------------------ */
.status[data-state='online'] { color: var(--green-ink); }
.status[data-state='offline'] { color: var(--red-ink); }
.field-note[data-tone='ok'] { color: var(--green-ink); }
.field-note[data-tone='error'] { color: var(--red-ink); }
.chips li.is-met { color: var(--green-ink); }
.status-line[data-state='ok'] { color: var(--green-ink); }
.status-line[data-state='error'] { color: var(--red-ink); }
.alert-icon { color: var(--red-ink); }
.step-line,
.timer,
.footer { color: var(--label-2); }

/* Нетекстовые элементы навигации читаются заметнее (>= 3:1) */
.status-dot { background: var(--label-2); }
.app-card::after { border-top-color: var(--label-2); border-right-color: var(--label-2); }

/* Светлый тост получает тонкую обводку — иначе растворяется на фоне */
.toast { border: 1px solid var(--hairline); }

/* Шкала прогресса — заливка без текста, поэтому берёт чистый оттенок
   акцента (контраст к тексту здесь не требуется) */
.track[data-step='1'] span:nth-child(-n+1),
.track[data-step='2'] span:nth-child(-n+2),
.track[data-step='3'] span:nth-child(-n+3),
.track[data-step='4'] span:nth-child(-n+4) { background: var(--accent-tint); }

/* Светлая тема: мягкая граница у полей, чтобы они читались
   на белом без заливки */
.input { border-color: var(--hairline); }
.input:hover { border-color: var(--hairline-strong); }
