:root {
  --bg: #f5f6f8; --surface: #ffffff; --text: #16191d; --muted: #5a6470; --border: #d5dae0;
  --danger: #b3261e; --danger-bg: #fdecea; --ok: #1b6e3c; --ok-bg: #e7f5ec;
  --primary: #1f5fbf; --on-primary: #ffffff; --field-border: #7f8994;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --bg: #101317; --surface: #1a1e24; --text: #eef1f4; --muted: #a4aeb9; --border: #333a43;
    --danger: #ffb4ab; --danger-bg: #3a1613; --ok: #8fd9ac; --ok-bg: #12301f;
    --primary: #7fb0ff; --on-primary: #000000; --field-border: #7a8591;
  }
}
:root[data-mode="dark"] {
  --bg: #101317; --surface: #1a1e24; --text: #eef1f4; --muted: #a4aeb9; --border: #333a43;
  --danger: #ffb4ab; --danger-bg: #3a1613; --ok: #8fd9ac; --ok-bg: #12301f;
    --primary: #7fb0ff; --on-primary: #000000; --field-border: #7a8591;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; align-items: center; justify-content: center; padding: 16px; }
main { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px 28px; }
main.wide { max-width: 640px; }
.logo { display: block; max-height: 44px; max-width: 200px; margin: 0 0 20px; }
.brand { font-size: 13px; letter-spacing: .02em; color: var(--muted); margin: 0 0 4px; }
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 20px; font-weight: 650; }
h2 { font-size: 16px; margin: 28px 0 10px; font-weight: 650; }
p { margin: 0 0 14px; }
.muted { color: var(--muted); font-size: 14px; }
label { display: block; font-size: 14px; font-weight: 550; margin: 0 0 4px; }
input[type=text], input[type=password] { display: block; width: 100%; height: 44px; padding: 8px 12px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--field-border); border-radius: 8px; margin: 0 0 14px; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0 0 18px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
button { display: block; width: 100%; height: 44px; font: inherit; font-weight: 600; color: var(--on-primary); background: var(--primary); border: 0; border-radius: 8px; cursor: pointer; }
button:hover { filter: brightness(.94); }
button.secondary { color: var(--text); background: transparent; border: 1px solid var(--border); }
button.small { display: inline-block; width: auto; height: 34px; padding: 0 12px; font-size: 14px; }
a { color: var(--primary); }
.error, .notice { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 0 0 16px; }
.error { color: var(--danger); background: var(--danger-bg); }
.notice { color: var(--ok); background: var(--ok-bg); }
.qr { display: block; width: 200px; height: 200px; margin: 0 auto 14px; background: #fff; padding: 8px; border-radius: 8px; }
code.secret { display: block; word-break: break-all; font-size: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin: 0 0 14px; }
.codes { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 12px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
form.inline { display: inline; margin: 0; }
button.small { white-space: nowrap; }
@media (max-width: 480px) { main { padding: 24px 18px; } .hide-narrow { display: none; } }
