:root[data-theme="dark"]{
  --bg:#0A0A0A; --bg-elevated:#111110; --surface:#151513; --surface-hover:#1D1D1A;
  --border:#2A2A26; --border-soft:#1E1E1B;
  --text:#F3F2ED; --text-dim:#948F84; --text-faint:#5C584F;
  --accent:#D83831; --accent-text:#FF6156; --accent-soft:rgba(216,56,49,.16);
  --success:#3FAE6B; --success-soft:rgba(63,174,107,.14);
  --warn:#D89A38; --warn-soft:rgba(216,154,56,.14);
}
:root[data-theme="light"]{
  --bg:#FBFAF8; --bg-elevated:#FFFFFF; --surface:#FFFFFF; --surface-hover:#F3F2ED;
  --border:#E4E2DB; --border-soft:#ECEAE3;
  --text:#14130F; --text-dim:#716C61; --text-faint:#A8A297;
  --accent:#D83831; --accent-text:#B72B25; --accent-soft:rgba(216,56,49,.08);
  --success:#2F8F55; --success-soft:rgba(47,143,85,.10);
  --warn:#B57A1F; --warn-soft:rgba(181,122,31,.10);
}
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{ background:var(--bg); color:var(--text); font-family:'Inter',system-ui,sans-serif; -webkit-font-smoothing:antialiased; min-height:100vh; }

.auth-wrap{ min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px; gap:16px; }
.auth-card{ width:100%; max-width:400px; background:var(--surface); border:1px solid var(--border); border-radius:18px; padding:28px 26px; }
.auth-brand{ display:flex; align-items:center; gap:12px; margin-bottom:22px; }
.auth-mark{ width:38px; height:38px; border-radius:10px; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.auth-mark svg{ width:19px; height:19px; }
.auth-brand b{ display:block; font-size:14px; font-weight:700; }
.auth-brand span{ font-size:11px; color:var(--text-dim); }

.tabs{ display:flex; gap:4px; background:var(--bg-elevated); border:1px solid var(--border); border-radius:10px; padding:4px; margin-bottom:18px; }
.tab{ flex:1; padding:8px; border:none; background:none; color:var(--text-dim); font-size:12.5px; font-weight:600; border-radius:7px; cursor:pointer; font-family:inherit; }
.tab.active{ background:var(--surface); color:var(--text); }

.auth-form{ display:flex; flex-direction:column; gap:12px; }
[hidden]{ display:none !important; }
.auth-form label{ display:flex; flex-direction:column; gap:5px; font-size:12px; font-weight:600; color:var(--text-dim); min-width:0; }
.auth-form input{ width:100%; min-width:0; background:var(--bg-elevated); border:1px solid var(--border); color:var(--text); font-size:13px; padding:10px 12px; border-radius:9px; font-family:inherit; }
.auth-form input:focus{ outline:2px solid var(--accent); outline-offset:-1px; }
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; min-width:0; }
.form-hint{ font-size:11px; color:var(--text-faint); font-weight:400; line-height:1.5; margin:2px 0 0; }

.btn-primary{ background:var(--accent); color:#fff; border:none; padding:11px; font-size:13.5px; font-weight:600; border-radius:9px; cursor:pointer; font-family:inherit; margin-top:4px; }
.btn-primary:hover{ background:var(--accent-text); }
.btn-primary:disabled{ opacity:.6; cursor:not-allowed; }
.link-btn{ background:none; border:none; color:var(--text-dim); font-size:12px; cursor:pointer; text-decoration:underline; font-family:inherit; padding:2px; }
.link-btn:hover{ color:var(--accent-text); }

.or{ display:flex; align-items:center; gap:10px; margin:16px 0 12px; color:var(--text-faint); font-size:11px; }
.or::before,.or::after{ content:""; flex:1; height:1px; background:var(--border-soft); }
.btn-google{ display:flex; align-items:center; justify-content:center; gap:10px; width:100%; background:var(--bg-elevated); border:1px solid var(--border); color:var(--text); font-size:13px; font-weight:600; padding:10px; border-radius:9px; text-decoration:none; }
.btn-google:hover{ border-color:var(--text-faint); }

.msg{ display:none; font-size:12.5px; padding:10px 12px; border-radius:9px; margin-bottom:14px; line-height:1.5; }
.msg.show{ display:block; }
.msg.err{ background:var(--warn-soft); border:1px solid var(--warn); color:var(--warn); }
.msg.ok{ background:var(--success-soft); border:1px solid var(--success); color:var(--success); }

.auth-foot{ font-size:11px; color:var(--text-faint); text-align:center; max-width:400px; }

/* 2FA */
.panel-title{ margin:0 0 2px; font-size:15px; font-weight:700; }
.qr-box{ display:flex; align-items:center; justify-content:center; min-height:150px; padding:14px; background:#fff; border-radius:12px; }
.qr-box svg{ width:190px; height:190px; display:block; }
.qr-manual{ font-size:12px; color:var(--text-dim); }
.qr-manual summary{ cursor:pointer; padding:4px 0; }
.qr-secret{ display:block; margin-top:6px; font-family:'IBM Plex Mono',monospace; font-size:12px; background:var(--bg-elevated); border:1px solid var(--border); border-radius:8px; padding:8px 10px; word-break:break-all; color:var(--text); }
.backup-grid{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.backup-grid code{ font-family:'IBM Plex Mono',monospace; font-size:13px; background:var(--bg-elevated); border:1px solid var(--border); border-radius:8px; padding:9px 6px; text-align:center; letter-spacing:.06em; color:var(--text); }
.chk{ flex-direction:row !important; align-items:center; gap:8px; font-size:12px; color:var(--text-dim); cursor:pointer; }
.chk input{ width:15px !important; height:15px; flex-shrink:0; }
#setup2faCode, #challenge2faCode{ letter-spacing:.35em; text-align:center; font-family:'IBM Plex Mono',monospace; font-size:17px; }
