/* GazTormoz · вход и второй фактор — светлое оформление нового дизайна.
   Единый слой для templates/login.html и templates/twofa.html.
   Токены повторяют static/css/gt-new.css (body.gt), чтобы вход выглядел
   частью портала, а не отдельным сайтом. */

@font-face {
  font-family: 'Inter Tight';
  font-weight: 400; font-display: swap;
  src: url('/static/fonts/auto/inter-tight-400-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-04B1, U+2116;
}
@font-face {
  font-family: 'Inter Tight';
  font-weight: 400; font-display: swap;
  src: url('/static/fonts/auto/inter-tight-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter Tight';
  font-weight: 600; font-display: swap;
  src: url('/static/fonts/auto/inter-tight-700-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-04B1, U+2116;
}
@font-face {
  font-family: 'Inter Tight';
  font-weight: 600; font-display: swap;
  src: url('/static/fonts/auto/inter-tight-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 500; font-display: swap;
  src: url('/static/fonts/auto/jetbrains-mono-400-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 500; font-display: swap;
  src: url('/static/fonts/auto/jetbrains-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f4f4f6;
  --card: #ffffff;
  --ink: #111114;
  --ink2: #4b4b55;
  --ink3: #74747e;
  --line: #e9e9ee;
  --line-soft: #f1f1f4;
  --red: #d5001c;
  --red-h: #b60018;
  --red-soft: rgba(213, 0, 28, .08);
  --green: #0f8f66;
  --r: 22px;
  --r-sm: 14px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --shadow: 0 1px 2px rgba(17, 17, 20, .04), 0 24px 60px -32px rgba(17, 17, 20, .30);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { min-height: 100%; }

body.auth {
  font-family: 'Inter Tight', 'Product Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: -.005em;
  color: var(--ink);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

/* Мягкое свечение за карточкой: тёплый блик сверху, как в шапке портала,
   и едва заметный красный ореол слева. Без картинок и без «стекла». */
body.auth::before,
body.auth::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(70px);
}
body.auth::before {
  width: 620px; height: 620px; top: -320px; left: -180px;
  background: radial-gradient(circle, rgba(213, 0, 28, .11), transparent 68%);
}
body.auth::after {
  width: 520px; height: 520px; bottom: -300px; right: -140px;
  background: radial-gradient(circle, rgba(214, 178, 120, .20), transparent 70%);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(468px, 100%);
  animation: shell-in .62s var(--ease) both;
}
@keyframes shell-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 34px 34px 30px;
  box-shadow: var(--shadow);
}

/* Крестик у окна подтверждения: закрыть и уйти в портал. На iPhone
   свайп вниз закрывает приложение, но окно при этом остаётся — крестик
   надёжнее (просьба владельца 09.11.2026). */
.card-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--ink3);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.card-close:hover { background: var(--line-soft); color: var(--ink); }
.card-close:active { background: var(--line); }
.card-close svg { width: 18px; height: 18px; display: block; }

/* Авто-уход в портал: полоска показывает, что сейчас откроется. */
.auto-go {
  margin: 18px auto 0;
  width: 148px; height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.auto-go i {
  display: block; height: 100%; width: 100%;
  background: var(--red);
  transform-origin: left center;
  animation: auto-go 1.4s linear forwards;
}
@keyframes auto-go { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ── Знак ───────────────────────────────────────────────────────────── */
.brandline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.brandmark {
  height: 46px;
  width: auto;
  display: block;
  overflow: visible;
}

/* Геометрия лежит в <defs> без заливки: цвет задаём на самом <use>, иначе
   пути наследуют fill="none" от корня SVG и знак не рисуется вовсе. */
.bm-mark use { fill: url(#paint0_linear_248_50); }
.bm-glow use { fill: var(--red); }
.bm-gaz use, .bm-ormoz use { fill: #050505; }

/* Появление: плашка «доезжает» с лёгким разворотом, надпись — со сдвигом. */
.bm-mark {
  transform-box: view-box;
  transform-origin: 30.8px 22.4px;
  animation: bm-mark-in 1.05s var(--ease) both;
}
@keyframes bm-mark-in {
  0%   { opacity: 0; transform: translate3d(-16px, 6px, 0) scale(.62) rotate(-9deg); filter: blur(3px); }
  55%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}

.bm-gaz  { animation: bm-gaz-in .78s var(--ease) .30s both; }
.bm-ormoz { animation: bm-ormoz-in .78s var(--ease) .42s both; }
@keyframes bm-gaz-in {
  from { opacity: 0; transform: translateX(-11px); }
  to   { opacity: 1; transform: none; }
}
@keyframes bm-ormoz-in {
  from { opacity: 0; transform: translateX(11px); }
  to   { opacity: 1; transform: none; }
}

/* Блик по плашке: один проход при появлении, дальше редко и мягко. */
.bm-shine { animation: bm-shine-run 1.15s ease-in-out .55s 1 both, bm-shine-loop 7.5s ease-in-out 2.6s infinite; }
@keyframes bm-shine-run {
  from { transform: translateX(0); opacity: .0; }
  12%  { opacity: .95; }
  to   { transform: translateX(142px); opacity: 0; }
}
@keyframes bm-shine-loop {
  0%, 62%  { transform: translateX(0);     opacity: 0; }
  66%      { opacity: .85; }
  82%, 100% { transform: translateX(142px); opacity: 0; }
}

/* Дыхание ореола: почти незаметно, но оживляет знак. */
.bm-glow {
  fill: var(--red);
  transform-box: view-box;
  transform-origin: 30.8px 22.4px;
  filter: blur(7px);
  opacity: 0;
  animation: bm-breathe 6.5s ease-in-out 1.2s infinite;
}
@keyframes bm-breathe {
  0%, 100% { opacity: 0;    transform: scale(.94); }
  46%      { opacity: .26;  transform: scale(1.05); }
  70%      { opacity: .10;  transform: scale(1.0); }
}

/* Кольцо-«пинг» один раз после сборки знака. */
.bm-ring {
  transform-box: view-box;
  transform-origin: 30.8px 22.4px;
  opacity: 0;
  animation: bm-ring 1.25s var(--ease) .62s 1 both;
}
@keyframes bm-ring {
  0%   { opacity: .55; transform: scale(.55); }
  70%  { opacity: .12; transform: scale(1.35); }
  100% { opacity: 0;   transform: scale(1.5); }
}

.brand-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink3);
}

/* ── Тексты ─────────────────────────────────────────────────────────── */
h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.025em;
  margin: 0 0 6px;
}
.sub {
  color: var(--ink2);
  font-size: 14px;
  margin: 0 0 24px;
}
.sub.tight { margin-bottom: 18px; }
.center { text-align: center; }

/* ── Кнопки ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: #fff;
  background: linear-gradient(180deg, #e21b2f, var(--red) 56%, var(--red-h));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 8px 20px -12px rgba(213, 0, 28, .7);
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), filter .16s;
}
.btn:hover { filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 12px 26px -12px rgba(213,0,28,.75); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn[disabled] { opacity: .55; cursor: default; filter: none; transform: none; }

.btn-ghost {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(17, 17, 20, .04);
}
.btn-ghost:hover { background: #fcfcfd; border-color: #dcdce2; box-shadow: 0 6px 16px -12px rgba(17, 17, 20, .5); }

.btn-quiet {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--ink3);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.btn-quiet:hover { color: var(--ink); filter: none; box-shadow: none; }

.btn-icon { width: 20px; height: 20px; flex: 0 0 auto; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; }

/* ── Поля ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 15px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #a9a9b3; }
.input:focus {
  outline: none;
  border-color: #c9c9d2;
  box-shadow: 0 0 0 4px rgba(17, 17, 20, .05);
}

/* ── Код из шести цифр ──────────────────────────────────────────────── */
.otp { position: relative; }
/* Поле ввода лежит поверх ячеек и остаётся настоящим полем: текст в нём
   прозрачный, а рисуют цифры ячейки. Раньше оно было opacity:0 — и на iPhone
   по нему не срабатывало долгое нажатие с «Вставить» (жалоба владельца
   09.11.2026). 16px обязательны, иначе iOS зумит страницу при фокусе. */
.otp input.real {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  border: 0;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: 2px;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}
.otp input.real::selection { background: rgba(17, 17, 20, .12); }
.otp .cells {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  pointer-events: none;
}
.otp .cell {
  height: 58px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  transition: border-color .14s, box-shadow .14s, background .14s, transform .14s var(--ease);
}
.otp .cell.filled { border-color: #cfcfd8; background: #fcfcfd; }
.otp .cell.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 20, .07);
  transform: translateY(-1px);
}
.otp.invalid .cell { border-color: #e6a2a8; background: #fff6f6; }
.otp.shake { animation: otp-shake .34s ease-in-out; }
@keyframes otp-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  50%      { transform: translateX(5px); }
  75%      { transform: translateX(-3px); }
}

/* ── Сообщения ──────────────────────────────────────────────────────── */
.err {
  margin-top: 16px;
  padding: 11px 14px;
  font-size: 13px;
  color: #a4121f;
  background: #fff5f6;
  border: 1px solid #f6d9dc;
  border-radius: 11px;
  word-break: break-word;
}
.ok {
  margin-top: 16px;
  padding: 11px 14px;
  font-size: 13px;
  color: #0a6b4b;
  background: #f2fbf7;
  border: 1px solid #cfeee1;
  border-radius: 11px;
}
.hint {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink3);
}

/* ── Разделитель ────────────────────────────────────────────────────── */
.sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 18px;
  font-size: 12px;
  color: var(--ink3);
}
.sep::before, .sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ── Служебные блоки ────────────────────────────────────────────────── */
.row { display: flex; gap: 10px; align-items: center; }
.row .input { flex: 1 1 auto; }
.row .btn { width: auto; flex: 0 0 auto; min-height: 48px; padding-inline: 18px; }

.step { display: flex; gap: 13px; margin-bottom: 18px; }
.step .num {
  flex: 0 0 25px;
  height: 25px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 50%;
}
.step h3 { font-size: 14.5px; font-weight: 600; margin: 1px 0 5px; }
.step p { font-size: 13px; color: var(--ink2); line-height: 1.55; }

.qr {
  display: inline-block;
  padding: 11px;
  margin: 10px 0 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.qr img { display: block; width: 196px; height: 196px; }

.secret {
  display: inline-block;
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--ink);
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  word-break: break-all;
}

.dl { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 11px; }
.dl .btn { width: auto; min-height: 42px; font-size: 13px; padding-inline: 15px; }

.footnote {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink3);
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Ожидание подтверждения на телефоне ─────────────────────────────── */
.approve { text-align: center; }
.approve-code {
  display: inline-flex;
  gap: 10px;
  margin: 16px 0 4px;
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink);
}
.approve-code span {
  width: 58px; height: 68px;
  display: grid; place-items: center;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink3);
}
.pulse i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(15, 143, 102, .5);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(15, 143, 102, .5); }
  70%  { box-shadow: 0 0 0 9px rgba(15, 143, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 143, 102, 0); }
}

/* ── Телефон ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  body.auth { padding: 18px 12px; align-items: flex-start; }
  .card { padding: 26px 20px 22px; border-radius: 18px; }
  .brandmark { height: 40px; }
  .otp .cells { gap: 6px; }
  .otp .cell { height: 52px; font-size: 20px; border-radius: 11px; }
  .row { flex-direction: column; }
  .row .btn { width: 100%; }
  .qr img { width: 168px; height: 168px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .bm-shine, .bm-glow, .bm-ring { display: none; }
}
