/* Экраны входа: слева карточка (тема системы), справа тёмная панель (как в LawServices).
   Токены карточки — из app.css (--bg, --surface, --text…); у панели свои, она тёмная всегда. */

.is-auth { --auth-radius: 18px; }
.is-auth main { display: flex; }

.auth { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - 140px); }
@media (min-width: 960px) { .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.auth--wide { grid-template-columns: minmax(0, 1fr) !important; }

.auth__main { display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth__card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.auth--wide .auth__card { max-width: 720px; }

.auth__title { margin: 0; font-size: clamp(26px, 3.4vw, 34px); line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; }
.auth__lead { margin: 0; color: var(--muted); line-height: 1.55; }
.auth__hint { margin: 0; color: var(--text-2); }
.auth__form { display: flex; flex-direction: column; gap: 14px; }
.auth__row { display: flex; justify-content: flex-end; font-size: 14px; }
.auth__switch { margin: 6px 0 0; color: var(--muted); font-size: 15px; text-align: center; }
.auth__switch form, form.auth__switch { display: inline; }

.auth__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px; border-radius: 14px; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 16px; text-decoration: none; text-align: center;
  background: var(--brand-gradient); color: #fff;
  box-shadow: var(--brand-shadow);
}
.auth__btn:hover { color: #fff; filter: brightness(1.06); }
.auth__btn[disabled] { opacity: 0.6; cursor: progress; }
.auth__btn--ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: none; }
.auth__btn--ghost:hover { color: var(--text); background: var(--surface-2); filter: none; }
.auth__btn--small { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.auth__link { font: inherit; background: none; border: 0; padding: 6px 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.auth__link--danger { color: var(--danger-text); }

.auth__error, .auth__notice, .auth__flash li { margin: 0; padding: 12px 14px; border-radius: 12px; font-size: 15px; line-height: 1.45; }
.auth__error { background: var(--danger-bg); color: var(--danger-fg); border: 1px solid var(--danger-border); }
.auth__notice, .auth__flash li.is-success, .auth__flash li.is-info { background: var(--accent-soft); color: var(--accent-strong); border: 1px solid transparent; }
.auth__flash { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.auth__flash li.is-error { background: var(--danger-bg); color: var(--danger-fg); border: 1px solid var(--danger-border); }

.auth__icon { width: 60px; height: 60px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.auth__icon--alert { background: var(--warn-bg); color: var(--warn-fg); }

/* поля */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 16px; min-height: 50px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); width: 100%;
}
.field textarea { min-height: 76px; line-height: 1.45; resize: vertical; }
/* галочка: в одну строку с подписью, обычного размера */
.field--check { flex-direction: column; gap: 2px; }   /* флажок с подписью в строку, пояснение — ниже, а не сжатой колонкой */
.field__check { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; cursor: pointer; min-height: 44px; }
.field .field__check input { width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; accent-color: var(--accent); flex: none; }
/* выбор файла: своя кнопка с переводом вместо «Choose File» браузера, превью фото */
.file-pick { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: 12px; cursor: pointer; background: var(--surface); }
.file-pick:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.file-pick__img { width: 56px; height: 56px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.file-pick__btn { flex: none; padding: 9px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 14px; }
.file-pick__name { min-width: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.field select {
  appearance: none; padding-right: 44px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger-text); }
.field__help { color: var(--muted); font-size: 13px; line-height: 1.45; }
.field__error { color: var(--danger-text); font-size: 13px; }
.field__pw { position: relative; }
.field__pw input { padding-right: 52px; }
.field__eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 10px; }
.field__eye.is-on { color: var(--accent); }
.field__code { font-size: 26px !important; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }

/* шаги регистрации */
.auth__steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; counter-reset: s; }
.auth__steps li { flex: 1; counter-increment: s; font-size: 13px; font-weight: 600; color: var(--muted); padding-top: 10px; border-top: 3px solid var(--border); }
.auth__steps li::before { content: counter(s) ". "; }
.auth__steps li.is-on { color: var(--text); border-top-color: var(--accent); }
.auth__steps li.is-done { color: var(--accent); border-top-color: var(--accent); }

/* второй фактор */
.auth__passkey { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.auth__passkey p { margin: 0; color: var(--text-2); }
.auth__alt { border-top: 1px solid var(--border); padding-top: 14px; }
.auth__alt p { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.auth__alt ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.auth__alt a { display: inline-flex; min-height: 40px; align-items: center; }

.mfa-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mfa-item { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.mfa-item--best { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mfa-item__icon { font-size: 26px; flex: none; }
.mfa-item__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mfa-item__text span { color: var(--muted); font-size: 14px; line-height: 1.4; }
.mfa-item__text em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; margin-left: 4px; vertical-align: middle; }
.mfa-item__go { flex: none; font: inherit; font-weight: 700; font-size: 14px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.mfa-item__go:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 480px) { .mfa-item { flex-wrap: wrap; } .mfa-item__go { width: 100%; justify-content: center; } }

.auth__howto { margin: 0; padding-left: 20px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.totp { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.totp__qr { width: 200px; height: 200px; padding: 10px; background: #fff; border-radius: 14px; border: 1px solid var(--border); }
.totp__manual summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.totp__secret { display: block; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 15px; letter-spacing: 0.08em; word-break: break-all; text-align: center; }

/* страница «Безопасность» */
.sec { border: 1px solid var(--border); border-radius: 16px; padding: 18px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.sec h2 { margin: 0; font-size: 18px; }
.sec__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.sec__list, .sec__events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sec__list li, .sec__events li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 10px 0; border-top: 1px solid var(--border); }
.sec__list li > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.sec__list small, .sec__events small { color: var(--muted); font-size: 13px; }
.sec__actions { display: flex; gap: 14px; }
.sec__note { margin: 0; color: var(--text-2); }

/* тёмная панель справа */
.auth__panel { display: none; position: relative; overflow: hidden; color: #ecfdf7; background: radial-gradient(900px 500px at 80% 0%, #0b2b27, transparent 70%), #041210; }
@media (min-width: 960px) { .auth__panel { display: flex; align-items: center; } }
.auth__glow { position: absolute; width: 520px; height: 520px; right: -140px; bottom: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(20, 184, 166, 0.35), transparent 65%); animation: auth-breathe 6s ease-in-out infinite; }
@keyframes auth-breathe { 50% { transform: scale(1.12); opacity: 0.7; } }
.auth__panel-inner { position: relative; padding: 56px; max-width: 560px; display: flex; flex-direction: column; gap: 22px; }
.auth__eyebrow { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; color: #99f6e4; text-transform: uppercase; }
.auth__panel-title { margin: 0; font-size: clamp(30px, 3vw, 44px); line-height: 1.08; font-weight: 800; letter-spacing: -0.02em; color: #ecfdf7; }
.auth__g { background: linear-gradient(100deg, #5eead4, #a7f3d0 45%, #fcd34d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth__ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth__ticks li { position: relative; padding-left: 32px; color: #c7ddd7; line-height: 1.5; }
.auth__ticks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #041210; background: linear-gradient(135deg, #5eead4, #fcd34d); }
.auth__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.auth__chips span { padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); animation: auth-bob 4.5s ease-in-out infinite; animation-delay: calc(var(--i) * -0.7s); }
@keyframes auth-bob { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .auth__glow, .auth__chips span { animation: none; } }
.field .field__label { font-weight: 600; font-size: 14px; }
.file-pick { position: relative; }
.field .file-pick input[type="file"] { position: absolute; left: 0; top: 0; width: 1px !important; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; }
