/* Страницы входа «Лимеса». Токены — DESIGN.md, раздел 4. */
/* Шрифты те же, что в консоли (DESIGN.md, раздел 3); лицензия OFL — static/fonts. */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/onest-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/onest-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/onest-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/onest-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/onest-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/onest-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/onest-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/onest-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,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-style: normal; font-weight: 400; font-display: swap; src: url(fonts/jetbrains-mono-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  /* Тема одна — тёмная, те же токены, что в консоли (DESIGN.md, раздел 4). */
  --bg: #0E0F11; --surface: #16171A; --subtle: #222428; --ink: #EDEDEA; --on-ink: #111214;
  --ink-muted: #8F929A; --line: #24262B; --focus: #C5F06A; --bad: #FF8A70; --bad-tint: #2C1A19; --ok: #5DB98A;
  --accent: #C5F06A; --accent-hover: #D3F58A; --on-accent: #10140A;
  --font: "Onest", "Golos UI", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* Атрибут hidden сильнее любых display у компонентов. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Карточка по центру экрана, чуть выше середины — оптически ровнее. */
.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 16px calc(40px + 8vh); }
.card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px 36px 36px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; margin: 0 0 32px; }
.mark { width: 22px; height: 22px; fill: var(--ink); }
.brand-logo { display: block; height: 36px; width: auto; max-width: 220px; object-fit: contain; }
.support { margin: 28px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 14px; line-height: 1.5; }
h1 { font-size: 32px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 10px; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 6px; font-weight: 600; }
.lead { color: var(--ink-muted); margin: 0 0 24px; }
.muted { color: var(--ink-muted); }
.mono, code { font-family: var(--mono); font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 14px; font-weight: 500; }
.control { position: relative; }
.control input { width: 100%; }
.control:has(.reveal:not([hidden])) input { padding-right: 52px; }
/* 16px в полях: Safari не увеличивает страницу при фокусе (DESIGN.md, раздел 6). */
.field input { font: inherit; font-size: 16px; font-weight: 400; height: 48px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--ink); transition: border-color .15s ease-out; }
.field input:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.field input:focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.field input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--surface) inset; -webkit-text-fill-color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 11px 22px; border-radius: 999px; text-align: center; line-height: 1.3;
  font: inherit; font-size: 16px; font-weight: 500; border: 0; cursor: pointer; text-decoration: none; width: 100%;
  transition: background-color .15s ease-out, border-color .15s ease-out; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.btn[disabled] { opacity: .5; cursor: default; }
.alert { background: var(--bad-tint); color: var(--bad); border-radius: 12px; padding: 12px 14px; margin: 0 0 20px; font-size: 15px; }
.hint { margin: 0; font-size: 14px; color: var(--ink-muted); }
.hint:empty { display: none; }
.hint.error { color: var(--bad); }
.hint.ok { color: var(--ok); }
.block > .hint { margin-top: 10px; }

/* Показ пароля. */
.reveal { position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-muted); cursor: pointer;
  transition: color .15s ease-out, background-color .15s ease-out; }
.reveal:hover { color: var(--ink); background: var(--subtle); }
.reveal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.reveal .i-eye-off, .reveal[aria-pressed="true"] .i-eye { display: none; }
.reveal[aria-pressed="true"] .i-eye-off { display: block; }

/* Требования к паролю: отмечаются по ходу ввода. */
.rules { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-muted); }
.rules li { display: flex; align-items: center; gap: 8px; transition: color .15s ease-out; }
.rules li::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line);
  transition: background-color .15s ease-out, border-color .15s ease-out; }
.rules li.ok { color: var(--ink); }
.rules li.ok::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4.6 8.3l2.2 2.2 4.6-4.8' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 100% no-repeat; }
.rules li.bad { color: var(--bad); }
.rules li.bad::before { border-color: var(--bad); }

/* Учётная запись, для которой выполняется шаг. */
.who { display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%; margin: 6px 0 28px;
  padding: 6px 16px 6px 6px; border: 1px solid var(--line); border-radius: 999px; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--subtle); display: grid; place-items: center;
  font-size: 14px; font-weight: 600; }
.who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-login { font-size: 13px; color: var(--ink-muted); }
.who + .lead { margin-top: -12px; }

/* Поля кодов. */
.otp { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.mono-input { font-family: var(--mono) !important; letter-spacing: .04em; }

/* Кнопка в ожидании ответа. */
.btn[aria-busy] { position: relative; color: transparent !important; pointer-events: none; opacity: 1; }
.btn[aria-busy]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--ink); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.primary[aria-busy]::after { border-color: var(--on-ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Смена шага без перезагрузки. */
.card.enter > * { animation: enter .18s ease-out both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

.row { display: flex; gap: 8px; margin: -8px 0 16px; }
.row .btn { min-height: 44px; }
.link { border: 0; background: none; padding: 0; font: inherit; font-size: 14px; color: var(--ink); text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; }
.alert:focus { outline: none; }
.note { margin: 24px 0 0; font-size: 14px; color: var(--ink-muted); }
.block { margin-top: 20px; }
.block:first-of-type { margin-top: 0; }
details summary { cursor: pointer; color: var(--ink-muted); font-size: 15px; margin-bottom: 14px; }
.choices { display: flex; flex-direction: column; gap: 14px; }
.choice { border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 20px; }
.choice p { margin: 0 0 14px; color: var(--ink-muted); font-size: 15px; }
.cert-list { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cert-list .btn.cert { width: 100%; height: auto; min-height: 56px; padding: 10px 16px; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 2px; text-align: left; }
.cert-list .btn.cert span { font-size: 14px; font-weight: 400; color: var(--ink-muted); }
.steps { padding-left: 20px; margin: 0 0 20px; color: var(--ink-muted); }
.steps li { margin-bottom: 8px; }
.secret { display: inline-block; background: var(--subtle); color: var(--ink); padding: 4px 8px; border-radius: 8px; letter-spacing: .04em; word-break: break-all; }
.codes { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; counter-reset: code; }
.codes li { counter-increment: code; display: flex; align-items: center; gap: 8px; background: var(--subtle); border-radius: 10px; padding: 9px 12px; }
.codes li::before { content: counter(code); color: var(--ink-muted); font-size: 12px; min-width: 14px; text-align: right; }
.codes li code { font-size: 13px; white-space: nowrap; }
.card:has(.codes-block:not([hidden])), .card:has(.codes) { max-width: 540px; } /* две колонки кодов */
.codes-actions { margin-bottom: 20px; }
.codes-actions .btn { flex: 1; }
.codes-block .check { margin-bottom: 4px; }

/* Шаги привязки: список способов, назад, QR. */
.step { margin: 0 0 6px; font-size: 13px; color: var(--ink-muted); letter-spacing: .01em; }
.methods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.methods form { margin: 0; }
.method { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 40px 1fr 20px; gap: 14px; align-items: center;
  padding: 14px 14px 14px 16px; border: 1px solid var(--line); border-radius: 16px; cursor: pointer; transition: border-color .15s, background .15s; }
.method:hover { border-color: var(--ink-muted); background: var(--subtle); }
.method:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.method[aria-busy="true"], .method:disabled { opacity: .6; cursor: progress; }
.m-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--subtle); display: grid; place-items: center; }
.m-icon svg, .m-chev { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.m-chev { width: 18px; height: 18px; color: var(--ink-muted); }
.m-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-text b { font-weight: 600; font-size: 16px; }
.m-text > span { color: var(--ink-muted); font-size: 14px; line-height: 1.35; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--subtle); font-size: 12px; font-weight: 500; color: var(--ink-muted); vertical-align: 2px; }
.methods .hint, .methods .cert-list { margin: 8px 0 0; }
.back-form { margin: 0 0 14px; }
.back { all: unset; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-muted); font-size: 15px; cursor: pointer; }
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.back:hover { color: var(--ink); }
.back:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.qr-block { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 4px 0 20px; }
.qr { width: 188px; height: 188px; padding: 6px; background: #fff; border-radius: 14px; border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: 100%; }
.manual { width: 100%; }
.manual summary { cursor: pointer; color: var(--ink-muted); font-size: 15px; text-align: center; list-style: none; }
.manual summary::-webkit-details-marker { display: none; }
.manual[open] summary { margin-bottom: 8px; }
.manual p { text-align: center; margin: 6px 0; }
.cancel { text-align: center; margin-top: 20px; }
.facts { margin: 0 0 24px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--ink-muted); flex: none; white-space: nowrap; }
.facts dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
a { color: var(--ink); }
/* Телефон: без карточки, форма на весь экран, как экран входа приложения. */
@media (max-width: 560px) {
  .page { justify-content: flex-start; align-items: stretch;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
  .card { max-width: none; background: transparent; border: 0; border-radius: 0; padding: 0; }
  .brand { margin-bottom: 18vh; }
  h1 { font-size: 30px; }
  .codes { grid-template-columns: 1fr; }
  .card:has(.step) .brand { margin-bottom: 28px; } /* шаги привязки — длинные: без отступа экрана входа */
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .card.enter > * { animation: none; } }

/* Личный кабинет: та же карточка, шире, разделы — вкладками. */
.card.wide { max-width: 720px; }
.brand-out { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.brand-out form { margin: 0; }
.brand-out .console { color: var(--ink); font-weight: 500; }
@media (max-width: 560px) { .wide-only { display: none; } }
.brand-out .link { font-size: 15px; color: var(--ink-muted); text-decoration: none; }
.brand-out .link:hover { color: var(--ink); }
.acc-nav { display: flex; gap: 6px; margin: -12px 0 28px; overflow-x: auto; scrollbar-width: none; }
.acc-nav::-webkit-scrollbar { display: none; }
.acc-nav a { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--subtle); color: var(--ink); text-decoration: none; font-size: 15px;
  transition: background-color .15s ease-out; }
.acc-nav a:hover { background: color-mix(in srgb, var(--ink) 10%, var(--subtle)); }
.acc-nav a[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.notice { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ink); border-radius: 12px; padding: 12px 14px; margin: 0 0 20px; font-size: 15px; }
.acc-sec + .acc-sec { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.acc-sec h2 { margin-bottom: 8px; }
.acc-sec > p { margin: 0 0 12px; }
.acc-act { margin-top: 14px; }
.acc-act .btn, .acc-sec .btn.secondary { width: auto; }
.acc-more summary { margin: 4px 0 16px; color: var(--ink); font-weight: 500; }
.acc-more .form { margin-bottom: 4px; }
.acc-links { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.row-link { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink);
  text-decoration: none; transition: border-color .15s ease-out; }
.row-link:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.row-link span { color: var(--ink-muted); font-size: 14px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-main b { font-weight: 500; }
.row-main .muted { font-size: 14px; }
.rows .bad { color: var(--bad); }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: 14px; width: auto; flex: none; }
.btn[data-armed] { background: var(--bad); color: #1A0B0A; border-color: transparent; }
.tag { font-weight: 400; color: var(--ok); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { appearance: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--line); border-radius: 6px; background: var(--surface);
  display: grid; place-items: center; cursor: pointer; transition: background-color .15s ease-out, border-color .15s ease-out; }
.check input:checked { background: var(--ink); border-color: var(--ink); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--on-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
@media (max-width: 560px) {
  .card.wide .brand { margin-bottom: 20px; } /* в кабинете — без большого отступа экрана входа */
  .acc-nav { margin: 0 -20px 24px; padding: 0 20px; }
  .rows li { align-items: flex-start; flex-direction: column; gap: 10px; }
}

/* Одноразовые коды по почте и SMS */
.otp-send { display: flex; flex-direction: column; gap: 10px; }
.otp-send form { margin: 0; }
.otp-send .btn { width: 100%; }
.otp-resend { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; }
.otp-resend .link { background: none; border: 0; padding: 0; color: var(--ink-muted); font: inherit; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.otp-resend .link:hover:not(:disabled) { color: var(--ink); }
.otp-resend .link:disabled { text-decoration: none; cursor: default; opacity: .7; }
