:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1b1f24; --muted: #66707c; --line: #e2e6ea;
  --accent: #2a62c4; --accent-text: #ffffff; --bad: #c0332b; --bad-bg: #fbe5e3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a; --card: #1b2027; --text: #e7eaee; --muted: #93a0ae; --line: #2b323b;
    --accent: #7aa8f5; --accent-text: #0e1218; --bad: #ff7b72; --bad-bg: #3d1f1d;
  }
}
* { 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", sans-serif;
}
main { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: .9rem; }
header.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 28px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  display: block; padding: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; color: inherit; text-decoration: none;
}
a.card:hover, a.card:focus-visible { border-color: var(--accent); outline: none; }
.card .icon { font-size: 1.8rem; line-height: 1; margin-bottom: 8px; }
.card .name { font-weight: 600; }
form.login { max-width: 360px; margin: 12vh auto 0; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
label { display: block; margin: 14px 0 4px; font-size: .85rem; color: var(--muted); }
input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-text);
}
form.login button { width: 100%; margin-top: 20px; }
button.link { background: none; color: var(--muted); padding: 6px 10px; border: 1px solid var(--line); font-weight: 500; }
.error { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-size: .9rem; }

/* second factor pages */
form.login.wide { max-width: 420px; }
main.narrow { max-width: 460px; }
.qr { display: flex; justify-content: center; margin: 12px 0; }
.qr svg { width: 200px; height: 200px; border-radius: 8px; }
code.key { display: inline-block; margin-top: 4px; padding: 4px 8px; border-radius: 6px; background: var(--bg);
  border: 1px solid var(--line); letter-spacing: .08em; word-break: break-all; }
ul.codes { list-style: none; margin: 16px 0; padding: 14px; display: grid; gap: 8px; grid-template-columns: 1fr 1fr;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
ul.codes code { font-size: 1.05rem; letter-spacing: .06em; }
a.button { display: inline-block; padding: 10px 16px; border-radius: 8px; background: var(--accent);
  color: var(--accent-text); font-weight: 600; text-decoration: none; }
a { color: var(--accent); }
