/* ============================================================
   Gateway Armor — дизайн-система (светлая тема, единственная)
   Токены + компоненты. Один источник правды для всех экранов.
   Перенесено из docs/design/redesign-mockup/app/app.css (2026-07-23),
   ниже — слой совместимости под legacy-разметку одностраничника.
   ============================================================ */

:root {
  color-scheme: light;               /* не подстраиваемся под тёмную систему */

  /* — цвет (тёплая палитра: крем + коралл) — */
  --ink:      #201d19;               /* тёмный тёплый — текст, заголовки */
  --ink-2:    #57534a;               /* вторичный текст */
  --ink-3:    #8a857a;               /* подписи, плейсхолдеры */
  --paper:    #faf9f5;               /* фон страницы — кремовый */
  --panel:    #fffdf7;               /* карточки, поднятые поверхности */
  --white:    #ffffff;               /* поля ввода, QR */
  --subtle:   #eeece2;               /* мягкий тёплый блок */
  --accent:   #d97757;               /* акцент — коралл */
  --accent-2: #c15f3c;               /* ховер акцента (глубже) */
  --accent-ink:#a44b2c;              /* тёмно-коралловый текст на светлом */
  --brand-red:#c1452f;               /* логотип-плашка GA */
  --danger:   #b23b30;               /* удаление/ошибки */
  --line:     rgba(20, 19, 17, 0.14);
  --line-2:   rgba(20, 19, 17, 0.07);
  --focus:    rgba(217, 119, 87, 0.32);

  /* — шрифт — */
  --serif: Georgia, "Iowan Old Style", "Times New Roman", Cambria, serif;
  --sans:  "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* — форма — */
  --radius:   10px;
  --radius-lg:16px;
  --shadow:   0 1px 2px rgba(36,33,28,.05), 0 8px 24px -12px rgba(36,33,28,.12);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* тонкая «зернистость» бумаги — материал, а не плоскость */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: .035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- каркас приложения ---------- */
.app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }
.app-header {
  height: 80px; display: flex; align-items: center; justify-content: space-between;
  padding-inline: clamp(1rem, 4vw, 2rem); border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
/* название — растровая картинка из референса (wordmark_ga.png, «GatewayArmor»),
   встроенным шрифтом не повторяется — см. решение владельца 2026-07-23 */
.brand .wordmark { display: block; height: 18px; width: auto; }
/* логотип: круглый лабиринт (коралловый) */
.ga-logo { display: block; flex: none; width: 48px; height: 48px; color: var(--accent); }
.ga-logo.lg { width: 58px; height: 58px; }
.ga-logo path { stroke-width: 2.5; }   /* тоньше расстояния между кольцами (~6.5) */
.app-header .h-right { font-size: .9rem; }

.app-main {
  flex: 1; display: flex; justify-content: center;
  padding: clamp(1.5rem, 5vh, 3.5rem) clamp(1rem, 4vw, 2rem);
}
.col { width: 100%; }
.col.narrow { max-width: 440px; }
.col.wide   { max-width: 760px; }

/* ---------- панель / карточка ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: clamp(1.5rem, 5vw, 2.4rem);
}
.panel + .panel { margin-top: 1rem; }

/* ---------- типографика ---------- */
.eyebrow { font-size: .8rem; font-weight: 600; color: var(--accent); margin: 0 0 .7rem;
  display: inline-flex; align-items: center; gap: .55rem; }
.eyebrow::before { content: ""; width: 1.2rem; height: 2px; background: var(--accent); border-radius: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; line-height: 1.15; }
h2 { font-size: 1.4rem; line-height: 1.2; }
h3 { font-size: 1.15rem; line-height: 1.25; }
.sub { color: var(--ink-2); margin: .5rem 0 0; }
.sub.center, h1.center, h2.center { text-align: center; }
.voice { font-family: var(--serif); font-style: italic; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.center { text-align: center; }

/* ---------- ссылки ---------- */
.link { color: var(--accent); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
.textlink {
  color: var(--ink); text-decoration: none; font-weight: 500;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size .3s ease, color .2s ease; padding-bottom: 1px;
  cursor: pointer; border: none; background-color: transparent; font-family: var(--sans); font-size: inherit;
}
.textlink:hover { background-size: 100% 2px; color: var(--accent); }

/* ---------- кнопки ---------- */
.btn {
  font-family: var(--sans); font-size: .96rem; font-weight: 500; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.4rem; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .2s, color .2s, border-color .2s;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #f7f4ed; }
.btn-primary:not(:disabled):hover { background: var(--accent-2); }
.btn-subtle  { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-subtle:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost   { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { color: var(--ink); }
.btn-danger  { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger:hover { text-decoration: underline; }
.btn-success { background: #4a7c59; color: #f7f4ed; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-direction: column; gap: .6rem; }

/* ---------- поля ввода ---------- */
.field { display: flex; flex-direction: column; gap: .45rem; }
.field + .field { margin-top: 1rem; }
.lbl { font-size: .88rem; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.inp {
  width: 100%; font-family: var(--sans); font-size: 1rem; color: var(--ink);
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem .9rem; transition: border-color .2s, box-shadow .2s;
}
.inp::placeholder { color: var(--ink-3); }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
textarea.inp { resize: vertical; min-height: 120px; line-height: 1.5; }
.pass-wrap { position: relative; }
.pass-wrap .inp { padding-right: 5.2rem; }
.pass-toggle {
  position: absolute; right: .7rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--ink-3); font-size: .84rem; font-weight: 500;
  cursor: pointer; font-family: var(--sans); padding: .2rem;
}
.pass-toggle:hover { color: var(--accent); }
.hint { font-size: .82rem; color: var(--ink-3); }
.error { font-size: .86rem; color: var(--danger); }

/* ---------- вкладки (вход/регистрация) ---------- */
.tabs { display: flex; background: var(--subtle); border-radius: var(--radius); padding: .28rem; margin-bottom: 1.5rem; }
.tab {
  flex: 1; text-align: center; padding: .6rem; border-radius: 7px; border: none; cursor: pointer;
  background: transparent; color: var(--ink-2); font-family: var(--sans); font-size: .95rem; font-weight: 500;
  transition: background .2s, color .2s, box-shadow .2s;
}
.tab[aria-selected="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(36,33,28,.08); }

/* ---------- разделитель ---------- */
.divider { display: flex; align-items: center; gap: .8rem; color: var(--ink-3); font-size: .82rem; margin: 1.4rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* ---------- карточки тарифов (единый вид с лендингом) ---------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 1.9rem; align-items: stretch; }
.plan {
  position: relative; text-align: left; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; padding: 1.9rem 1.7rem; cursor: pointer;
  display: flex; flex-direction: column; gap: .5rem; transition: border-color .2s, box-shadow .2s;
}
.plan:hover { border-color: var(--accent); }
.plan.feature { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.plan .flag {
  position: absolute; top: -.75rem; left: 1.5rem; background: var(--accent); color: #f7f4ed;
  font-size: .72rem; font-weight: 600; letter-spacing: .01em; padding: .24rem .7rem; border-radius: 20px;
}
.plan .pname { font-family: var(--serif); font-size: 1.35rem; color: var(--ink); }
.plan .devices { font-size: .9rem; font-weight: 600; color: var(--accent-ink); }
.plan .price { font-family: var(--serif); font-size: 2.3rem; line-height: 1; color: var(--ink); margin-top: .2rem; }
.plan .price small { font-family: var(--sans); font-size: .88rem; color: var(--ink-3); font-weight: 400; }
.plan .who { font-size: .95rem; color: var(--ink-2); line-height: 1.5; }
.plan .btn { margin-top: auto; justify-content: center; }
@media (max-width: 760px) { .plans { grid-template-columns: 1fr; } .plan .flag { left: auto; right: 1.5rem; } }

/* согласие */
.consent { display: flex; align-items: flex-start; gap: .6rem; margin-top: 1.4rem; font-size: .84rem; color: var(--ink-2); }
.consent input { margin-top: .2rem; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }

/* ---------- инфо-карточка (профиль) ---------- */
.info { background: var(--subtle); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.info-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .5rem 0; }
.info-row + .info-row { border-top: 1px solid var(--line-2); }
.info-row .k { color: var(--ink-2); font-size: .92rem; }
.info-row .v { font-weight: 600; text-align: right; }
.info-row .v.accent { color: var(--accent-ink); }

/* профиль: заголовок пользователя */
.user-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; }
.user-head .uname { font-family: var(--serif); font-size: 1.35rem; }
.user-head .umail { font-size: .9rem; color: var(--ink-3); }

/* QR */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: .7rem; margin: 1.4rem 0; }
.qr { width: 168px; height: 168px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.qr svg { display: block; width: 100%; height: 100%; }

/* danger zone (компактный футер удаления) */
.danger-zone { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); text-align: center; }
.danger-zone .btn-danger { padding: .3rem .5rem; font-size: .92rem; }
.danger-note { display: block; font-size: .76rem; margin-top: .1rem; }

/* success / notice */
.notice { background: var(--subtle); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1.1rem 1.2rem; display: flex; gap: .8rem; align-items: flex-start; }
.notice .ico { color: var(--accent); flex: none; }
.notice .t { font-size: .92rem; color: var(--ink-2); }
.notice .t b { color: var(--ink); }

/* стек с отступами */
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: 1rem; }
.mt-s { margin-top: .6rem; } .mt-m { margin-top: 1.2rem; } .mt-l { margin-top: 1.8rem; }

.back { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink-3); font-size: .9rem; text-decoration: none; cursor: pointer; background: none; border: none; font-family: var(--sans); font-size: .9rem; }
.back:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.footnote { text-align: center; margin-top: 1.4rem; font-size: .82rem; color: var(--ink-3); }
.support-link { text-align: center; margin-top: 1.4rem; }

/* ============================================================
   СЛОЙ СОВМЕСТИМОСТИ — под legacy-разметку одностраничника
   (JS переключает состояния классом .hidden, силомер seg1/2/3 и т.п.)
   ============================================================ */

/* утилита показа/скрытия — замена Tailwind .hidden */
.hidden { display: none !important; }

/* плавное появление состояния */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* спиннер в кнопке (замена lucide-иконки загрузки) */
.spin {
  display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: -.15em; margin-right: .45em;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* поле в состоянии ошибки */
.inp.error { border-color: var(--danger); box-shadow: none; }

/* силомер пароля (legacy-схема seg1/seg2/seg3 + weak/medium/strong) */
.strength-meter { display: flex; gap: .35rem; margin-top: .5rem; height: 4px; }
.strength-meter .segment { flex: 1; background: var(--line); border-radius: 2px; transition: background-color .3s ease; }
.strength-meter .segment.weak { background: var(--danger); }
.strength-meter .segment.medium { background: #c08a2e; }
.strength-meter .segment.strong { background: var(--accent); }
.strength-label { font-size: .8rem; margin-top: .3rem; color: var(--ink-3); transition: color .3s ease; min-height: 1em; }
.strength-label.weak { color: var(--danger); }
.strength-label.medium { color: #c08a2e; }
.strength-label.strong { color: var(--accent-ink); }

/* подсказка требований к паролю */
.password-tooltip {
  position: absolute; top: 0; left: calc(100% + 12px);
  background: var(--ink); color: #f7f4ed; padding: 8px 12px; border-radius: 8px;
  font-size: .75rem; line-height: 1.4; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s ease;
  z-index: 10; width: 220px;
}
.password-tooltip::before {
  content: ''; position: absolute; top: 12px; left: -6px;
  border: 6px solid transparent; border-right-color: var(--ink);
}
.password-tooltip.visible { opacity: 1; visibility: visible; }
@media (max-width: 640px) { .password-tooltip { display: none; } }

/* «скидочный» бейдж на карточке тарифа */
.badge-sale {
  position: absolute; top: -.75rem; right: 1.5rem; background: var(--accent); color: #f7f4ed;
  font-size: .72rem; font-weight: 600; letter-spacing: .01em; padding: .24rem .7rem; border-radius: 20px;
}

/* QR-контейнер (canvas от qr-code-styling) */
#qrcode-container {
  display: inline-block; background: var(--white); padding: 12px;
  border-radius: var(--radius); border: 1px solid var(--line); line-height: 0;
}
#qrcode-container canvas { display: block !important; margin: 0 auto; width: 200px !important; height: 200px !important; }
#qrcode-container img { display: none !important; }
