:root{
  --primary:#2563eb;
  --primary-dark:#1d4ed8;
  --ink:#0f172a;
  --text:#475569;
  --muted:#64748b;
  --surface:#fff;
  --soft:#f8fafc;
  --border:#dbe3ef;
  --success:#15803d;
  --danger:#b91c1c;
  --shadow:0 35px 100px rgba(15,23,42,.14);
}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--text);background:#f8fafc}
a{text-decoration:none;color:inherit}
button,input{font:inherit}
.auth-shell{min-height:100vh;display:grid;grid-template-columns:1.05fr .95fr}
.auth-visual{
  position:relative;
  min-height:100vh;
  padding:42px 55px;
  display:flex;
  flex-direction:column;
  color:#dbeafe;
  background:
    radial-gradient(circle at 70% 15%,rgba(56,189,248,.28),transparent 25%),
    radial-gradient(circle at 12% 88%,rgba(79,70,229,.35),transparent 32%),
    linear-gradient(145deg,#0f172a,#172554 55%,#0c4a6e);
  overflow:hidden;
}
.auth-visual:after{
  content:"";
  position:absolute;
  width:520px;height:520px;
  right:-260px;bottom:-260px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:50%;
  box-shadow:0 0 0 70px rgba(255,255,255,.025),0 0 0 140px rgba(255,255,255,.018);
}
.brand{position:relative;z-index:2;display:inline-flex;align-items:center;gap:12px;font-size:1.2rem;font-weight:800;color:#fff}
.brand>span:last-child>span{color:#60a5fa}
.brand-mark{width:44px;height:44px;position:relative}
.brand-mark i{position:absolute;width:27px;height:27px;left:8px;top:8px;border-radius:50%;background:linear-gradient(135deg,#38bdf8,#2563eb)}
.brand-mark b{position:absolute;width:42px;height:18px;left:0;top:13px;border:2px solid #60a5fa;border-radius:50%;transform:rotate(-20deg)}
.visual-copy{position:relative;z-index:2;max-width:620px;margin:auto 0}
.eyebrow,.kicker{font-size:.74rem;font-weight:800;letter-spacing:.12em;color:#93c5fd}
.visual-copy h1{max-width:660px;margin:16px 0;font-size:clamp(2.8rem,5vw,5rem);line-height:1.02;letter-spacing:-.055em;color:#fff}
.visual-copy>p{max-width:580px;font-size:1.05rem}
.mini-dashboard{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:35px}
.mini-dashboard>div{padding:17px;border:1px solid rgba(255,255,255,.11);border-radius:16px;background:rgba(255,255,255,.06);backdrop-filter:blur(12px)}
.mini-dashboard small,.mini-dashboard strong{display:block}
.mini-dashboard small{font-size:.72rem}.mini-dashboard strong{margin-top:5px;color:#fff;font-size:1.25rem}
.visual-footer{position:relative;z-index:2;font-size:.72rem}
.auth-main{display:grid;place-items:center;padding:36px;background:linear-gradient(145deg,#fff,#eff6ff)}
.auth-card{width:min(100%,470px);padding:38px;background:rgba(255,255,255,.92);border:1px solid rgba(255,255,255,.8);border-radius:28px;box-shadow:var(--shadow);backdrop-filter:blur(18px)}
.mobile-brand{display:none}
.auth-card h2,.simple-card h1,.welcome-card h1{margin:10px 0 8px;color:var(--ink);font-size:2.3rem;letter-spacing:-.04em}
.auth-card>p{margin-top:0}
form{display:grid;gap:17px;margin-top:25px}
label{display:grid;gap:7px;color:#334155;font-size:.78rem;font-weight:800}
input{width:100%;padding:13px 14px;border:1px solid var(--border);border-radius:11px;color:var(--ink);background:#fff;outline:none}
input:focus{border-color:#60a5fa;box-shadow:0 0 0 4px rgba(96,165,250,.18)}
.password-field{position:relative}
.password-field input{padding-right:68px}
.password-field button{position:absolute;right:8px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--primary);font-size:.74rem;font-weight:800;cursor:pointer}
.form-options{display:flex;justify-content:space-between;align-items:center;gap:16px;font-size:.77rem}
.form-options>a,.back-link{color:var(--primary);font-weight:800}
.checkbox{display:flex;grid-template-columns:auto 1fr;align-items:center;gap:8px}
.checkbox input{width:16px;height:16px}
.btn{display:inline-flex;align-items:center;justify-content:center;min-height:47px;padding:11px 20px;border:1px solid transparent;border-radius:999px;font-weight:800;cursor:pointer}
.btn.primary{color:#fff;background:linear-gradient(135deg,#2563eb,#4f46e5);box-shadow:0 14px 30px rgba(37,99,235,.24)}
.btn.secondary{color:var(--ink);background:#fff;border-color:var(--border)}
.block{width:100%}
.alert{margin:18px 0;padding:13px 15px;border-radius:12px;font-size:.82rem}
.alert.error{color:#991b1b;background:#fee2e2;border:1px solid #fecaca}
.alert.success{color:#166534;background:#dcfce7;border:1px solid #bbf7d0}
.auth-note{margin-top:22px;padding-top:18px;border-top:1px solid var(--border);font-size:.7rem;text-align:center}
.auth-divider{display:flex;align-items:center;gap:12px;margin:20px 0;color:var(--muted);font-size:.72rem;font-weight:800}.auth-divider:before,.auth-divider:after{content:"";height:1px;flex:1;background:var(--border)}
.device-login-button,.install-app-button{margin-top:10px}.passkey-status{min-height:0;margin:0;color:var(--muted);font-size:.78rem;line-height:1.45;text-align:center}.passkey-status:not(:empty){min-height:42px;margin:0 0 10px;padding:10px 12px;border-radius:11px;background:#eff6ff;color:#1e40af}.passkey-status.success{background:#dcfce7;color:#166534}.passkey-status.error{background:#fee2e2;color:#991b1b}
[data-pwa-install][hidden],[data-passkey-login][hidden]{display:none!important}
.device-login-card>p{line-height:1.65}.device-actions{display:grid;gap:10px;margin-top:18px}.registered-devices{margin-top:26px}.registered-devices h2{margin:0 0 10px;color:var(--ink);font-size:1rem}.registered-devices article{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:13px 0;border-bottom:1px solid var(--border)}.registered-devices article>div{display:grid;gap:3px}.registered-devices small{color:var(--muted);font-size:.7rem}.registered-devices form{margin:0}.device-remove{padding:7px 10px;border:1px solid #fecaca;border-radius:9px;background:#fff;color:#b91c1c;font-size:.72rem;font-weight:800;cursor:pointer}
.pwa-install-dialog{position:fixed;inset:0;z-index:3000;display:grid;place-items:center;padding:20px}.pwa-install-dialog[hidden]{display:none}.pwa-install-backdrop{position:absolute;inset:0;background:rgba(2,6,23,.68);backdrop-filter:blur(5px)}.pwa-install-dialog section{position:relative;width:min(100%,420px);padding:32px;border:1px solid var(--border);border-radius:24px;background:var(--surface);color:var(--text);box-shadow:0 28px 80px rgba(2,6,23,.32);text-align:center}.pwa-install-dialog h2{margin:16px 0 8px;color:var(--ink)}.pwa-install-dialog p{margin:0 0 20px;line-height:1.65}.pwa-install-close{position:absolute;right:12px;top:10px;width:36px;height:36px;border:0;background:transparent;color:var(--muted);font-size:1.5rem;cursor:pointer}.pwa-install-icon{width:62px;height:62px;margin:auto;display:grid;place-items:center;border-radius:18px;background:linear-gradient(135deg,#0b2a66,#2563eb);color:#fff;font-weight:900}
.simple-auth{min-height:100vh;display:grid;place-items:center;padding:24px;background:linear-gradient(145deg,#eff6ff,#f8fafc,#eef2ff)}
.simple-card{width:min(100%,520px);padding:38px;background:#fff;border:1px solid var(--border);border-radius:26px;box-shadow:var(--shadow)}
.centered-brand{margin-bottom:34px;color:var(--ink)}
.dev-link{padding:14px;border-radius:13px;background:#fff7ed;border:1px solid #fed7aa;font-size:.76rem;word-break:break-all}
.dev-link strong,.dev-link a,.dev-link small{display:block}
.dev-link a{margin:7px 0;color:#c2410c;font-weight:700}
.back-link{display:block;margin-top:24px;text-align:center}
.success-mark{width:70px;height:70px;margin:20px auto;border-radius:50%;display:grid;place-items:center;color:#fff;background:#16a34a;font-size:2rem;font-weight:900}
.dashboard-body{min-height:100vh;background:#f8fafc}
.dashboard-header{height:78px;display:flex;justify-content:space-between;align-items:center;padding:0 max(24px,calc((100% - 1180px)/2));background:#0f172a}
.dashboard-main{width:min(calc(100% - 36px),1180px);margin:55px auto;display:grid;grid-template-columns:1.15fr .85fr;gap:24px}
.welcome-card,.next-module{padding:34px;border:1px solid var(--border);border-radius:24px;background:#fff;box-shadow:0 15px 45px rgba(15,23,42,.07)}
.user-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;margin-top:28px}
.user-grid article{padding:18px;border-radius:14px;background:#f8fafc;border:1px solid var(--border)}
.user-grid small,.user-grid strong{display:block}.user-grid small{font-size:.7rem}.user-grid strong{margin-top:4px;color:var(--ink);font-size:.9rem}
.next-module h2{color:var(--ink)}.next-module li{margin:8px 0}
@media(max-width:900px){
  .auth-shell{grid-template-columns:1fr}
  .auth-visual{display:none}
  .auth-main{min-height:100vh;padding:24px}
  .mobile-brand{display:block;margin-bottom:35px}
  .mobile-brand .brand{color:var(--ink)}
  .dashboard-main{grid-template-columns:1fr}
}
@media(max-width:560px){
  .auth-main,.simple-auth{padding:14px}
  .auth-card,.simple-card{padding:27px 20px;border-radius:20px}
  .form-options{align-items:flex-start;flex-direction:column}
  .mini-dashboard,.user-grid{grid-template-columns:1fr}
  .dashboard-header{padding:0 14px}
  .dashboard-header .brand>span:last-child{display:none}
}

/* Accessible dark mode for all shared authentication screens. */
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="dark"] body{background:#07111f;color:#d7e1ee!important}
html[data-theme="dark"] .auth-main{background:linear-gradient(145deg,#07111f,#0b1b2e)}
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .simple-card,
html[data-theme="dark"] .welcome-card,
html[data-theme="dark"] .next-module{background:#0d1d31;border-color:#29415e;color:#d7e1ee}
html[data-theme="dark"] .auth-card h2,
html[data-theme="dark"] .simple-card h1,
html[data-theme="dark"] .welcome-card h1,
html[data-theme="dark"] .next-module h2{color:#f8fafc!important}
html[data-theme="dark"] .auth-card>p,
html[data-theme="dark"] .auth-card label,
html[data-theme="dark"] .auth-note{color:#c4d0df!important}
html[data-theme="dark"] input{background:#071426;color:#f8fafc;border-color:#38536f}
html[data-theme="dark"] input::placeholder{color:#94a3b8}
html[data-theme="dark"] .btn.secondary{background:#172b45;color:#f8fafc;border-color:#38536f}
html[data-theme="dark"] .simple-auth,
html[data-theme="dark"] .dashboard-body{background:#07111f}
html[data-theme="dark"] .dashboard-header{background:#040b14}
html[data-theme="dark"] .user-grid article{background:#10233d;border-color:#29415e}
html[data-theme="dark"] .user-grid strong{color:#f8fafc}
html[data-theme="dark"] .auth-divider:before,html[data-theme="dark"] .auth-divider:after{background:#29415e}html[data-theme="dark"] .passkey-status:not(:empty){background:#102b4d;color:#bfdbfe}html[data-theme="dark"] .passkey-status.success{background:#123d2c;color:#d1fae5}html[data-theme="dark"] .passkey-status.error{background:#451a1a;color:#fee2e2}html[data-theme="dark"] .registered-devices h2{color:#f8fafc}html[data-theme="dark"] .registered-devices article{border-color:#29415e}html[data-theme="dark"] .device-remove{background:#301919;color:#fecaca;border-color:#7f1d1d}html[data-theme="dark"] .pwa-install-dialog section{background:#0d1d31;color:#d7e1ee;border-color:#29415e}html[data-theme="dark"] .pwa-install-dialog h2{color:#f8fafc}

.auth-theme-toggle{
  position:fixed;top:18px;right:18px;z-index:20;width:42px;height:42px;
  display:grid;place-items:center;border:1px solid var(--border);border-radius:50%;
  background:var(--surface);color:var(--ink);cursor:pointer;box-shadow:0 8px 24px rgba(15,23,42,.12)
}
.auth-theme-toggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
html[data-theme="dark"] .auth-theme-toggle{background:#10233d;color:#f8fafc;border-color:#38536f}
