:root{--text-scale:1;font-size:calc(100% * var(--text-scale))}
:root {
  --bg: #f8fafc;
  --surface: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --soft: #f1f5f9;
  --hover: #e2e8f0;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --action: #4f46e5;
  --action-hover: #6366f1;
  --success: #10b981;
}
.dark {
  --bg: #020617;
  --surface: #0f172a;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --soft: #1e293b;
  --hover: #334155;
  --line: #334155;
  --accent: #818cf8;
}

*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:var(--bg);color:var(--text);font:0.875rem/1.5 system-ui,-apple-system,sans-serif}
main{min-height:100dvh;padding:24px 20px 150px}
header{max-width:1080px;margin:auto;font-size:1.125rem;font-weight:750;letter-spacing:-.4px}
.brand-accent{color:var(--accent)}
.stage{width:100%;max-width:390px;margin:56px auto 0}
.card{background:var(--surface);border-radius:16px;padding:24px;box-shadow:0 2px 6px #0f172a06}
h1{font-size:1.5rem;line-height:1.3;margin:0 0 8px}
p{margin:0;color:var(--muted)}
label{display:block;font-weight:550;margin:22px 0 7px}
input,button{font:inherit;color:inherit}
input{width:100%;min-width:0;border:1px solid var(--line);background:var(--surface);padding:12px;border-radius:8px}
input:focus{outline:2px solid #6366f1;outline-offset:2px}
button{cursor:pointer;min-height:44px;border:0;border-radius:12px;padding:12px 16px;background:var(--soft);font-weight:550;line-height:1.4}
button.primary{color:white;background:var(--action)}
.wide{width:100%;margin-top:24px}
.separator{display:flex;align-items:center;gap:14px;color:var(--muted);margin:20px 0}
.separator:before,.separator:after{content:'';height:1px;flex:1;background:var(--line)}
.hint{font-size:0.75rem;line-height:1.55;margin-top:15px}
.outside{font-size:0.75rem;text-align:center;margin-top:20px}
.error{background:#f43f5e12;color:#be123c;border-radius:12px;padding:12px;margin-top:18px;overflow-wrap:anywhere}
body.dark .error{color:#fda4af}
.password{position:relative}
.password input{padding-right:82px}
.password button{position:absolute;right:3px;top:3px;min-height:40px;padding:8px 10px;border-radius:8px;font-size:0.75rem;background:transparent;color:var(--accent)}
dialog{background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:16px;padding:22px;width:350px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 32px);overflow:auto}
dialog::backdrop{background:#0f172a88}
dialog h2{font-size:1.125rem;margin:0 0 12px}
dialog .wide{margin-top:12px}
@media(max-width:440px){main{padding:20px 16px 150px}
.stage{margin-top:32px}
.card{padding:20px}
h1{font-size:1.375rem}
}


.password input{padding-right:58px;min-height:48px}
.password button.password-eye{right:2px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:44px;height:44px;min-height:44px;padding:10px;color:var(--muted)}
.password-eye svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.password-eye .eye-closed{display:none}.password-eye[aria-pressed=true] .eye-open{display:none}.password-eye[aria-pressed=true] .eye-closed{display:block}
button:focus-visible{outline:2px solid var(--action-hover);outline-offset:3px}
.password-eye:focus-visible{outline-offset:-3px}
input[aria-invalid=true]{border-color:#e11d48}
.field-error{color:#be123c;font-size:0.75rem;margin-top:7px;overflow-wrap:anywhere}.dark .field-error{color:#fda4af}
#telegram .wide{margin-top:24px}#telegram:last-child .wide{margin-top:0}
.separator{font-size:0.75rem}.card .hint{min-height:0}
.secondary.wide{background:var(--soft);color:var(--text)}
#setupStage{max-width:420px}.badge{display:inline-flex;gap:6px;align-items:center;border-radius:4px;padding:4px 8px;font-size:0.6875rem;font-weight:600;background:#10b98112;color:#059669;margin-bottom:12px}.dark .badge{color:#34d399}
.badge svg{width:14px;height:14px;flex-shrink:0;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.value{background:var(--soft);padding:12px;border-radius:8px;margin-top:16px;font:600 1.0rem/1.5 ui-monospace,monospace;overflow-wrap:anywhere}
h1:focus{outline:none}

/* Compact composition requested by Pavel; same DS v2 palette/native buttons. */
main{padding-bottom:24px}
.stage{margin-top:16px}
label{margin-top:16px}
.wide{margin-top:16px}
.separator{margin:16px 0}
.alternatives{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.alternatives button{width:100%;margin:0;white-space:normal;overflow-wrap:anywhere}
@media(max-width:440px){.stage{margin-top:16px}}
.login-method-icon{width:20px;height:20px;flex-shrink:0;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.icon-button{display:flex;align-items:center;justify-content:center;gap:8px}
.icon-button span{min-width:0}
.alternatives>div{display:flex}.alternatives button.icon-button{display:flex;align-items:center;justify-content:center;gap:8px}
.login-method-icon.passkey-mark{width:24px;height:24px;flex-basis:24px;fill:currentColor;stroke:none}
.alternatives button{min-height:48px}
