:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0a0a0b;
  --ink: #f3f3f5;
  --muted: #a2a2ab;
  --line: #323238;
  --control: #17171b;
  --accent: #7c3aed;
  --error: #f1b9ad;
  background: var(--bg);
  color: var(--ink);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --ink: #202023;
  --muted: #66666f;
  --line: #d9d9df;
  --control: #fff;
  --error: #982b23;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background-image: linear-gradient(145deg, color-mix(in srgb, var(--accent) 9%, var(--bg)), var(--bg) 40%, color-mix(in srgb, var(--accent) 4%, var(--bg))); background-attachment: fixed; }
body { margin: 0; min-height: 100svh; display: grid; place-items: center; padding: max(32px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); font-size: 15px; line-height: 1.5; letter-spacing: 0; }
.login-page { width: 100%; max-width: 400px; min-width: 0; }
.brand { margin-bottom: 32px; }
.brand img { display: block; object-fit: contain; margin-bottom: 16px; }
.brand-icon { display: block; width: 72px; height: 72px; border-radius: 18px; overflow: hidden; background: #111; margin-bottom: 18px; }
.brand .brand-icon img { width: 136px; height: 136px; max-width: none; margin: -32px; object-fit: cover; }
h1 { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 0 0 10px; }
h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 500; margin: 0 0 12px; }
p { margin: 0; overflow-wrap: anywhere; }
.subtitle, .instructions, .field-hint, .access, .help-content { color: var(--muted); }
.step-number { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border: 1px solid var(--line); border-radius: 50%; font-size: 12px; font-variant-numeric: tabular-nums; }
.instructions { font-size: 14px; margin-bottom: 16px; }
.bot-link, button { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 50px; padding: 12px 16px; color: var(--ink); background: var(--control); font: inherit; font-weight: 500; text-align: center; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: background-color 160ms ease, border-color 160ms ease, opacity 160ms ease; }
.bot-link:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--control)); }
form { margin-top: 26px; }
input { width: 100%; min-height: 60px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--control); color: var(--ink); font: inherit; font-size: 26px; letter-spacing: 0; font-variant-numeric: tabular-nums; text-align: center; caret-color: var(--ink); }
input::placeholder { color: var(--muted); opacity: .65; }
input[aria-invalid="true"] { border-color: var(--error); }
.field-hint { margin-top: 8px; font-size: 12px; }
button { width: 100%; margin-top: 16px; background: var(--accent); border-color: transparent; color: var(--on-accent, #fff); }
button:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
button:disabled { cursor: wait; opacity: .75; }
button[aria-busy="true"]::before { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: login-spin .8s linear infinite; }
:is(.bot-link, button, input, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#message { color: var(--error); background: color-mix(in srgb, var(--error) 7%, var(--bg)); border: 1px solid color-mix(in srgb, var(--error) 30%, var(--line)); border-radius: 8px; font-size: 13px; padding: 12px; margin-top: 14px; }
.account-link { display: flex; align-items: center; min-height: 44px; margin-top: 6px; color: var(--ink); font-size: 14px; text-underline-offset: 4px; }
.first-login { margin-top: 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 0; list-style: none; cursor: pointer; font-size: 14px; }
summary::-webkit-details-marker { display: none; }
summary span { font-size: 20px; font-weight: 400; line-height: 1; transition: transform 160ms ease; }
details[open] summary span { transform: rotate(45deg); }
.help-content { font-size: 13px; padding-bottom: 18px; }
.help-content p + p { margin-top: 12px; }
.access { margin-top: 22px; font-size: 12px; line-height: 1.7; text-align: center; }
.auto-login-status { display: flex; align-items: center; gap: 12px; padding: 18px 0; }
.login-spinner { width: 20px; height: 20px; flex: 0 0 20px; border: 2px solid var(--line); border-right-color: var(--ink); border-radius: 50%; animation: login-spin .8s linear infinite; }
.auto-login :is(.login-step, form, .first-login, .access) { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes login-spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) { body { padding-top: max(28px, env(safe-area-inset-top)); } .brand { margin-bottom: 26px; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
