:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101418;
  color: #eef2f3;
  --surface: #171d20;
  --border: #2a3437;
  --muted: #9aa7aa;
  --accent: #8be0a0;
  --accent-surface: #173d26;
  --danger: #ffb4a9;
  --danger-surface: #3a2020;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(16px + env(safe-area-inset-top)) 24px 16px;
  border-bottom: 1px solid var(--border);
}
.brand { margin: 0; font-size: 18px; font-weight: 700; }
.mode {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent-surface);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
main {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 70px);
  padding: 28px 16px calc(36px + env(safe-area-inset-bottom));
}
.auth-panel {
  width: min(100%, 460px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: 28px; }
.lead { margin: 10px 0 22px; color: var(--muted); line-height: 1.5; }
form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #dce3e4; font-size: 13px; font-weight: 600; }
input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #3a464a;
  border-radius: 6px;
  outline: none;
  background: #0f1417;
  color: #f4f7f7;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 224, 160, 0.12); }
button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}
.primary { background: var(--accent); color: #102017; }
.secondary { border: 1px solid #465458; background: transparent; color: #e8eeee; }
.button-link {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}
button:disabled { cursor: wait; opacity: 0.65; }
.error, .status {
  margin: 16px 0 0;
  padding: 11px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
}
.error { background: var(--danger-surface); color: var(--danger); }
.status { background: var(--accent-surface); color: #cdebd4; }
[hidden] { display: none !important; }
.qr-wrap {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 4px 0 2px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7faf8;
}
.qr-wrap img { display: block; width: min(220px, 100%); aspect-ratio: 1; }
.secret-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.secret {
  min-width: 0;
  padding: 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0f1417;
  color: #d8e2e4;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}
.secret-row button { min-height: 100%; padding: 0 12px; }
.setup-step { margin-top: 20px; }
.setup-step h2 { margin: 0 0 8px; font-size: 18px; }
.setup-step > p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.recovery-codes {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0f1417;
  color: #f4f7f7;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 15px;
  line-height: 1.65;
  text-align: center;
}
.setup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.footnote { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.auth-link { margin: 14px 0 0; text-align: center; }
.auth-link a { color: var(--accent); font-size: 13px; font-weight: 700; }
.security-note {
  margin: 0 0 18px;
  padding: 11px 12px;
  border: 1px solid #465458;
  border-radius: 6px;
  color: #cbd5d7;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 520px) {
  header { padding-left: 16px; padding-right: 16px; }
  .brand { font-size: 16px; }
  .auth-panel { padding: 20px 16px; }
  h1 { font-size: 24px; }
  .secret-row { grid-template-columns: 1fr; }
  .secret-row button { min-height: 42px; }
  .setup-actions { grid-template-columns: 1fr; }
}
