/* Amarix ID — общий стиль формы входа, экранов OAuth, кнопки SDK и документации. */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@500&display=swap');

:root {
  --brand: #0e5c56;
  --brand-hover: #0b4c47;
  --brand-soft: rgba(14, 92, 86, 0.1);
  --bg: #eceef0;
  --card: #ffffff;
  --ink: #0a0a0b;
  --muted: #52525b;
  --faint: #71717a;
  --line: #e4e4e7;
  --field: #ffffff;
  --field-line: #e4e4e7;
  --field-hover: #d4d4d8;
  --chip: #f4f4f5;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok: #067647;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 18px 48px rgba(14, 92, 86, 0.09);
  --glow-1: rgba(20, 150, 138, 0.14);
  --glow-2: rgba(99, 102, 241, 0.1);
  --dot: rgba(10, 10, 11, 0.06);
  --focus: 0 0 0 4px rgba(14, 92, 86, 0.16);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #14968a;
    --brand-hover: #18ad9f;
    --brand-soft: rgba(20, 150, 138, 0.16);
    --bg: #0b0b0c;
    --card: #141416;
    --ink: #f4f4f5;
    --muted: #a1a1aa;
    --faint: #8b8b94;
    --line: #27272a;
    --field: #0f0f11;
    --field-line: #2a2a2e;
    --field-hover: #3f3f46;
    --chip: #1c1c1f;
    --danger: #fda29b;
    --danger-bg: rgba(180, 35, 24, 0.14);
    --ok: #6ce9a6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.45);
    --glow-1: rgba(20, 150, 138, 0.16);
    --glow-2: rgba(99, 102, 241, 0.12);
    --dot: rgba(255, 255, 255, 0.05);
    --focus: 0 0 0 4px rgba(20, 150, 138, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 Geist, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(60vw 50vh at 0% 0%, var(--glow-1), transparent 70%),
    radial-gradient(60vw 50vh at 100% 100%, var(--glow-2), transparent 70%),
    radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: auto, auto, 16px 16px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

.stage { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.popup .stage { padding: 20px 12px; justify-content: flex-start; }
.card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 22px;
  padding: 30px 28px 26px;
  box-shadow: var(--shadow);
  position: relative;
}
@media (max-width: 440px) {
  .card { padding: 26px 20px 22px; border-radius: 20px; }
}
.foot { margin-top: 18px; font-size: 12.5px; color: var(--faint); text-align: center; }
.foot a { color: var(--faint); }

/* ——— «Рукопожатие»: приложение ··· Amarix ——— */
.handshake { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; }
.handshake .tile, .mark { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.handshake .tile {
  background: var(--chip);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 18px; color: var(--muted);
  overflow: hidden;
}
.handshake .tile img { width: 100%; height: 100%; object-fit: cover; }
.dots { display: flex; gap: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 3px; background: var(--brand); opacity: 0.25; animation: dot 1.6s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%, 100% { opacity: 0.2; transform: translateY(0); } 40% { opacity: 0.95; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.6; } }
.solo { display: flex; justify-content: center; margin-bottom: 20px; }

h1 { font-size: 22px; line-height: 1.25; letter-spacing: -0.4px; font-weight: 600; margin: 0 0 8px; text-align: center; }
.lead { text-align: center; color: var(--faint); font-size: 14px; margin: 0 0 22px; }
p { margin: 0 0 14px; color: var(--muted); }

/* ——— Поля и кнопки ——— */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 2px; }
.input {
  width: 100%;
  height: 50px;
  border-radius: 13px;
  border: 1px solid var(--field-line);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 0 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover { border-color: var(--field-hover); }
.input:focus { border-color: var(--brand); box-shadow: var(--focus); }
.input.bad { border-color: var(--danger); }
.input.code { text-align: center; letter-spacing: 6px; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 22px; }
.pw { position: relative; }
.pw .input { padding-right: 96px; }
.pw button { position: absolute; right: 6px; top: 7px; height: 36px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; border-radius: 9px; }
.pw button:hover { background: var(--chip); }
.error { color: var(--danger); font-size: 13px; margin: 6px 2px 0; }
.alert { background: var(--danger-bg); color: var(--danger); border-radius: 12px; padding: 10px 13px; font-size: 13.5px; margin-bottom: 14px; }
.info { background: var(--brand-soft); color: var(--ink); border-radius: 12px; padding: 10px 13px; font-size: 13.5px; margin-bottom: 14px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 50px; border-radius: 13px; border: 0;
  font: inherit; font-size: 15.5px; font-weight: 600; cursor: pointer;
  text-decoration: none !important;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); margin-top: 10px; }
.btn-quiet:hover:not(:disabled) { background: var(--chip); }
.btn-link { background: transparent; color: var(--brand); height: 40px; margin-top: 6px; font-weight: 500; }
.btn-link.muted { color: var(--faint); }
.btn-danger { color: var(--danger); }
.row-links { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 16px; font-size: 13.5px; }
.row-links button { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12.5px; margin: 16px 0 6px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.qr-link { display: flex; align-items: center; justify-content: center; gap: 8px; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.8s linear infinite; }
.spinner.dark { border-color: var(--line); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ——— Чипы: почта, аккаунт ——— */
.who {
  display: flex; align-items: center; gap: 12px;
  background: var(--chip); border-radius: 14px; padding: 10px 12px; margin-bottom: 18px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who .text { min-width: 0; flex: 1; }
.who .text > b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .text > span { display: block; font-size: 13px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who button { background: none; border: 0; color: var(--brand); font: inherit; font-size: 13px; cursor: pointer; padding: 4px; }

/* ——— Списки: данные для согласия, бизнесы ——— */
.list { list-style: none; margin: 0 0 18px; padding: 0; border-top: 1px solid var(--line); }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.list li svg { flex: none; margin-top: 2px; color: var(--brand); }
.biz { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; color: var(--ink); text-decoration: none !important; border: 1px solid var(--line); margin-bottom: 8px; transition: background 0.15s, border-color 0.15s; }
.biz:hover { background: var(--chip); border-color: var(--field-hover); }
.biz .tile { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.biz .text { flex: 1; min-width: 0; }
.biz b { display: block; }
.biz span { display: block; font-size: 12.5px; color: var(--faint); }
.biz .chev { color: var(--faint); font-size: 20px; }

/* ——— Код устройства и QR ——— */
.devcode { font: 600 28px/1.2 'Geist Mono', ui-monospace, monospace; letter-spacing: 4px; text-align: center; background: var(--chip); border-radius: 14px; padding: 14px; margin: 0 0 16px; }
.meta { background: var(--chip); border-radius: 14px; padding: 4px 14px; margin-bottom: 16px; }
.meta div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.meta div:last-child { border-bottom: 0; }
.meta span { color: var(--faint); }
.qr { display: flex; justify-content: center; margin: 4px 0 14px; }
.qr .frame { background: #fff; padding: 14px; border-radius: 18px; box-shadow: 0 0 0 1px var(--line); position: relative; }
.qr svg { display: block; width: 188px; height: 188px; }
.qr .frame .mark { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; transform: translate(-50%, -50%); border: 4px solid #fff; border-radius: 12px; box-sizing: content-box; }
.qr-code-line { text-align: center; font-size: 13px; color: var(--faint); margin-bottom: 6px; }
.qr-code-line b { font-family: 'Geist Mono', ui-monospace, monospace; color: var(--ink); letter-spacing: 1.5px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 12px; }
.steps li { counter-increment: s; display: flex; gap: 10px; font-size: 13.5px; color: var(--muted); padding: 4px 0; }
.steps li::before { content: counter(s); flex: none; width: 20px; height: 20px; border-radius: 10px; background: var(--chip); color: var(--ink); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.note { font-size: 12.5px; color: var(--faint); margin-top: 14px; text-align: center; }
.warn { font-size: 13px; color: var(--muted); background: var(--chip); border-radius: 12px; padding: 10px 12px; margin-top: 14px; }

.center { text-align: center; }
.big-ok { width: 56px; height: 56px; border-radius: 28px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
[hidden] { display: none !important; }

/* ——— Документация ——— */
.doc { max-width: 760px; width: 100%; background: var(--card); border-radius: 22px; padding: 36px 32px; box-shadow: var(--shadow); }
.doc h1 { text-align: left; font-size: 28px; }
.doc h2 { font-size: 18px; margin: 28px 0 10px; }
.doc p, .doc li { color: var(--muted); }
.doc pre { background: var(--chip); border-radius: 12px; padding: 14px 16px; overflow: auto; font: 13px/1.6 'Geist Mono', ui-monospace, monospace; color: var(--ink); }
.doc code { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 13px; background: var(--chip); padding: 1px 6px; border-radius: 6px; color: var(--ink); }
.doc pre code { background: none; padding: 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc td, .doc th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--faint); font-weight: 500; }

/* Фрейм капчи браузер заливает непрозрачным фоном, когда тема страницы и фрейма
   расходятся (тёмная страница, светлая капча) — отсюда белые углы. Обрезаем по скруглению. */
#captcha { border-radius: 12px; overflow: hidden; line-height: 0; }
#captcha iframe { border-radius: 12px; }
