:root {
  --brand-primary: #2563eb;
  --brand-background: #f8fafc;
  --ink: #0f172a;
  --muted: #475569;
  --surface: #ffffff;
  --border: #cbd5e1;
  --danger: #b91c1c;
  --success: #047857;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
/* Layout classes (grid, flex) must not override the hidden attribute of inactive steps. */
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--brand-background); }
a { color: var(--brand-primary); }
button, input, select, textarea { font: inherit; }
button, .button {
  border: 0; border-radius: .55rem; padding: .7rem 1rem; font-weight: 650; cursor: pointer;
  background: var(--brand-primary); color: white;
}
button.secondary { color: var(--ink); background: #e2e8f0; }
button.danger { background: var(--danger); }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #f59e0b; outline-offset: 2px;
}
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: .5rem; padding: .7rem; background: white; color: var(--ink); }
label { display: grid; gap: .35rem; font-weight: 600; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: .75rem; top: -5rem; z-index: 100; background: white; padding: .75rem; }
.skip-link:focus { top: .75rem; }
.status { min-height: 1.5rem; padding: .5rem 0; color: var(--muted); }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }

.auth-shell { display: grid; grid-template-columns: minmax(18rem, 32rem) minmax(20rem, 1fr); min-height: 100vh; }
.auth-panel { display: grid; align-content: center; gap: 1.25rem; padding: clamp(1.5rem, 5vw, 4.5rem); background: var(--surface); }
.auth-hero { display: grid; align-content: end; padding: clamp(2rem, 7vw, 7rem); color: white; background: linear-gradient(140deg, var(--brand-primary), #0f172a 75%); }
.brand { display: flex; align-items: center; gap: .75rem; }
.brand img { width: 2.75rem; height: 2.75rem; object-fit: contain; }
.stack { display: grid; gap: 1rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; color: var(--muted); }
.divider::before, .divider::after { content: ""; border-top: 1px solid var(--border); }

.app-shell { display: grid; grid-template-columns: 16rem 1fr; min-height: 100vh; }
.sidebar { background: #0f172a; color: white; padding: 1.25rem; }
.sidebar a { display: block; color: #e2e8f0; text-decoration: none; padding: .7rem; border-radius: .45rem; }
.sidebar a:hover, .sidebar a[aria-current="page"] { background: #334155; color: white; }
.main { padding: clamp(1rem, 4vw, 3rem); min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 2rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; padding: 1.1rem; box-shadow: 0 1px 2px rgb(15 23 42 / .06); }
.card h2, .card h3 { margin-top: 0; }
.metric { font-size: 2rem; font-weight: 750; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--border); border-radius: .75rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem; text-align: left; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
th { background: #f1f5f9; }
.badge { display: inline-block; border-radius: 999px; padding: .2rem .55rem; background: #e2e8f0; margin: .12rem; font-size: .85rem; }
/* The hero's white text would sit on the badge's light background. */
.auth-hero .badge { color: #0f172a; }
.badge.good { color: #065f46; background: #d1fae5; }
.badge.warn { color: #92400e; background: #fef3c7; }
.panel { display: none; }
.panel.active { display: block; }
dialog { border: 0; border-radius: .8rem; padding: 1.5rem; width: min(32rem, calc(100% - 2rem)); box-shadow: 0 1rem 3rem rgb(15 23 42 / .3); }
dialog::backdrop { background: rgb(15 23 42 / .65); }

button.link { padding: 0; background: none; color: var(--brand-primary); font-weight: 600; text-decoration: underline; text-underline-offset: .2em; }
.button { display: inline-block; text-decoration: none; }
.button.secondary { color: var(--ink); background: #e2e8f0; }
.link-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; }
.checkbox { display: flex; align-items: center; gap: .6rem; font-weight: 500; }
.checkbox input { width: auto; }
.qr { width: min(14rem, 100%); justify-self: center; }
.qr svg { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: .5rem; }
.secret summary { cursor: pointer; font-weight: 600; }
.secret-value, .codes { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.secret-value { display: block; padding: .6rem; border-radius: .45rem; background: #f1f5f9; word-break: break-all; letter-spacing: .08em; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem 1.5rem; padding: .9rem 1.2rem .9rem 2.2rem; margin: 0; border-radius: .6rem; background: #f1f5f9; }
.item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; }
.item p { margin: 0; }
.item .detail { color: var(--muted); font-size: .9rem; }
.list { display: grid; gap: .75rem; }
.section { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.section-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; }
.section-header h3 { margin: 0; }
.danger-zone { border-color: #fecaca; }
.app-logo { width: 2rem; height: 2rem; object-fit: contain; }

@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar a { white-space: nowrap; }
  .topbar { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
