:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #dbe1ea;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --good: #166534;
  --bad: #991b1b;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin:0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
header { background:#0f172a; color:#fff; position:sticky; top:0; z-index:20; box-shadow:0 4px 18px rgba(15,23,42,.18); }
.header-inner { max-width:1380px; margin:0 auto; padding:14px 20px; display:grid; grid-template-columns:auto 1fr; gap:14px 20px; align-items:center; }
.brand-block { min-width:240px; }
.brand { font-size:1.15rem; font-weight:700; }
.subbrand { font-size:.88rem; color:#cbd5e1; margin-top:4px; }
.nav { display:flex; flex-wrap:wrap; gap:8px; }
.nav button { background:transparent; border:1px solid rgba(255,255,255,.18); color:#fff; border-radius:999px; padding:8px 12px; cursor:pointer; }
.nav button.active { background:#fff; color:#0f172a; }
.header-controls { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:12px; align-items:center; }
.scenario-controls, .session-controls { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.scenario-controls select { min-width:220px; }
.subtle-label { color:#cbd5e1; }
.user-email { color:#e5e7eb; }
.status-pill { padding:6px 10px; border-radius:999px; background:rgba(255,255,255,.12); color:#e5e7eb; font-size:.85rem; min-width:92px; text-align:center; }
.status-pill.error { background:#7f1d1d; color:#fff; }
#anon-status { justify-self:end; }
.hidden { display:none !important; }
main { max-width:1380px; margin:0 auto; padding:20px; display:grid; gap:18px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:18px; padding:18px; box-shadow:0 8px 20px rgba(15,23,42,.04); }
.cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap:16px; }
.metric-label { color:var(--muted); font-size:.9rem; }
.metric-value { font-size:1.65rem; font-weight:700; margin-top:6px; }
.muted { color:var(--muted); }
.pill { display:inline-block; padding:4px 10px; border-radius:999px; background:var(--accent-soft); color:#1e40af; font-size:.82rem; margin-bottom:10px; }
.callout { border-left:4px solid var(--accent); background:#eff6ff; padding:12px 14px; border-radius:0 12px 12px 0; }
.section-title { margin:0 0 14px 0; }
.card h1, .card h2, .card h3 { margin:0 0 14px 0; line-height:1.3; }
p, ol { margin-top:0; }
.toolbar { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.toolbar button, .toolbar label.buttonish, .action-btn, button, label.buttonish {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration:none;
  display:inline-block;
}
.secondary { background:#fff !important; color:var(--text) !important; border:1px solid var(--line) !important; }
.small-btn { padding:7px 11px; font-size:.9rem; }
.table-wrap { overflow:auto; max-width:100%; max-height:62vh; margin-top:12px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.table-wrap table { min-width:760px; }
table { width:100%; border-collapse:collapse; background:#fff; }
th, td { padding:10px 12px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
th { background:#f8fafc; font-size:.92rem; position:sticky; top:0; z-index:2; box-shadow:inset 0 -1px 0 var(--line); }
input, select, textarea, button { font:inherit; }
input[type='text'], input[type='number'], input[type='date'], input[type='email'], input[type='password'], select, textarea {
  width:100%; padding:8px 10px; border-radius:10px; border:1px solid #cbd5e1; background:#fff;
}
textarea { min-height:80px; }
.grid-2 { display:grid; gap:16px; grid-template-columns: 1.1fr .9fr; }
.auth-grid { display:grid; gap:16px; grid-template-columns: 1.2fr .9fr .9fr; }
.auth-card { min-height: 100%; }
.stack-form { display:grid; gap:12px; }
.stack-form label { display:grid; gap:6px; font-weight:600; }
.section { display:none; gap:18px; }
.section.active { display:grid; }
.small { font-size:.9rem; }
.footer-note { margin-top:12px; color:var(--muted); font-size:.9rem; line-height:1.45; }
.right { text-align:right; }
.positive { color:var(--good); }
.negative { color:var(--bad); }
.spacer { height:6px; }
@media (max-width: 1180px) {
  .header-inner { grid-template-columns: 1fr; }
  #anon-status { justify-self:start; }
  .header-controls { justify-content:flex-start; }
  .auth-grid { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .grid-2 { grid-template-columns: 1fr; }
  .table-wrap { max-height:50vh; }
}

.auth-grid-phase4 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.footer-note a { color: var(--accent); }

.auth-grid-reset { grid-template-columns: minmax(320px, 640px); justify-content: center; }
.reset-page-card { max-width: 640px; width: 100%; justify-self: center; }

.table-toolbar { justify-content: space-between; }
.table-toolbar h2 { margin-bottom: 0; }

.choice-row { display:flex !important; align-items:center; gap:10px; font-weight:600; }
.choice-row input[type="radio"], .choice-row input[type="checkbox"] { width:auto; margin:0; }
.two-col-grid { display:grid; gap:12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
#twofactor-card .toolbar { margin-top: 4px; }
