/** Dark Operations Entry theme shared by login, MFA, enrollment, and dashboard. */

:root {
  color-scheme: dark;
  --page: #020308;
  --panel: #05070d;
  --surface: #080b15;
  --surface-raised: #0a0f1a;
  --line: #1a2331;
  --line-strong: #2c3646;
  --text: #f4f5f8;
  --muted: #99a3b3;
  --text-dim: #c1c7d0;
  --faint: #8490a3;
  --purple: #06b6d4;
  --purple-bright: #22d3ee;
  --purple-light: #67e8f9;
  --green: #2ad28a;
  --danger: #ff7b92;
  --focus: 0 0 0 3px rgba(6, 182, 212, 0.22);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--page);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

a { color: inherit; }

button, input { font: inherit; }

.auth-shell {
  display: grid;
  grid-template-columns: clamp(280px, 21vw, 360px) minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(1000px circle at 100% -10%, #0c1626 0%, transparent 50%),
    radial-gradient(800px circle at 20% 110%, #081222 0%, transparent 48%),
    var(--surface);
}
[data-theme="light"] .auth-shell {
  background:
    radial-gradient(1000px circle at 100% -10%, #ffffff 0%, transparent 55%),
    radial-gradient(800px circle at 20% 110%, #e9f2f6 0%, transparent 50%),
    var(--surface);
}

.trust-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(28px, 4vh, 48px) clamp(24px, 2.6vw, 42px) clamp(24px, 3vh, 36px);
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  width: max-content;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 36px;
  border: 2px solid var(--purple);
  border-radius: 10px 10px 14px 14px;
  color: var(--purple-bright);
  font-size: 15px;
  font-weight: 800;
}
.brand-logo { width: 42px; height: 42px; object-fit: contain; flex: 0 0 auto; }
.brand-logo-light { width: 58px; height: 46px; }

.brand-copy {
  max-width: 210px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.trust-list {
  display: grid;
  gap: 34px;
  margin-top: 64px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.trust-item { display: grid; grid-template-columns: 30px 1fr; gap: 14px; }
.trust-item strong { display: block; font-size: 14px; font-weight: 650; }
.trust-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.trust-icon { color: var(--purple-bright); font-size: 12px; font-weight: 800; letter-spacing: .04em; }

.environment {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 0 10px;
  margin-top: auto;
  padding-top: 25px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.environment > span {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
}

.environment small { grid-column: 2; color: var(--muted); }

.auth-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: clamp(36px, 7vh, 88px) clamp(40px, 8vw, 150px);
  background: transparent;
}

.steps {
  display: grid;
  grid-template-columns: max-content minmax(80px, 170px) max-content;
  align-items: center;
  max-width: 480px;
  margin: 0;
  padding: 0;
  color: var(--faint);
  list-style: none;
}

.steps li:not(.step-line) { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.steps li > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}
.steps .active { color: var(--text); font-weight: 650; }
.steps .active > span { border-color: var(--purple-bright); color: var(--text); }
.steps .complete > span { background: var(--purple); }
.step-line { height: 1px; margin: 0 14px; background: var(--line-strong); }

.form-wrap {
  width: min(100%, 600px);
  margin-top: clamp(44px, 8vh, 96px);
}
.enroll-wrap { width: min(100%, 660px); margin-top: 42px; }
.eyebrow { margin: 0 0 14px; color: var(--purple-bright); font-size: 12px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(34px, 3.2vw, 50px); line-height: 1.1; letter-spacing: -.035em; }
.intro { margin: 16px 0 32px; color: var(--muted); font-size: 16px; }

.field { position: relative; margin-bottom: 24px; }
.field > label:not(.sr-only) { display: block; margin-bottom: 8px; color: var(--text-dim); font-size: 14px; }
.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  height: 58px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  background: var(--surface-raised);
  color: var(--text);
}
.field input:focus { border-color: var(--purple-bright); box-shadow: var(--focus); }

.password-field input { padding-right: 72px; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.primary-button {
  width: 100%;
  min-height: 58px;
  margin-top: 8px;
  border: 1px solid #06b6d4;
  border-radius: 6px;
  background: #0e7490;
  color: white;
  cursor: pointer;
  font-weight: 700;
}
.primary-button:hover { background: #0891b2; }
.primary-button:focus-visible { outline: 0; box-shadow: var(--focus); }

.security-note { margin: 32px 0 0; color: var(--muted); text-align: center; font-size: 13px; }
.security-note > span { margin-right: 5px; color: var(--green); font-weight: 800; }
.back-link { display: inline-block; margin-top: 28px; color: var(--purple-bright); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.temporary-password-wrap { margin-top: clamp(28px, 5vh, 64px); }
.security-badge {
  display: grid;
  place-items: center;
  width: 48px;
  height: 52px;
  margin-bottom: 28px;
  border: 1px solid rgba(103, 232, 249, .55);
  border-radius: 13px 13px 17px 17px;
  background: rgba(6, 182, 212, .08);
}
.security-badge > span {
  width: 15px;
  height: 15px;
  border: 3px solid var(--purple-bright);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(103, 232, 249, .35);
}
.password-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.password-help ul { margin: 8px 0 0; padding-left: 19px; }
.password-help li { margin-top: 3px; }

.token-field input {
  height: 78px !important;
  padding-left: 28px !important;
  border-color: var(--purple-bright) !important;
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: .62em;
  text-align: center;
}
.token-field input::placeholder { color: #3a4352; }
.token-timer { display: flex; align-items: center; gap: 10px; margin: 18px 0 22px; color: var(--muted); font-size: 13px; }
.token-timer > span { display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid var(--purple); border-radius: 50%; color: var(--text); }
.token-timer strong { font-weight: 500; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; color: var(--text-dim); font-size: 14px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--purple); }

.enrollment-grid { display: grid; grid-template-columns: 190px 1fr; gap: 24px; align-items: center; margin: 26px 0; }
.qr-card { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.qr-card img { display: block; width: 100%; height: auto; }
.manual-key { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
.manual-key strong { color: var(--text); font-size: 15px; }
.manual-key code { overflow-wrap: anywhere; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--purple-light); font-size: 12px; }

.errorlist, .form-errors { margin: 8px 0 0; padding: 0; color: var(--danger); font-size: 13px; list-style: none; }
.form-errors { margin-bottom: 20px; padding: 12px 14px; border: 1px solid #713849; border-radius: 6px; background: #1a0b11; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.dashboard-page { min-height: 100vh; background: var(--page); }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; height: 76px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dashboard-account { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 13px; }
.dashboard-account form { margin: 0; }
.dashboard-account button { border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 12px; background: var(--surface); color: var(--text); cursor: pointer; }
.empty-dashboard { min-height: calc(100vh - 76px); }

@media (max-width: 780px) {
  .auth-shell { display: block; width: 100%; min-height: 100vh; min-height: 100dvh; margin: 0; border: 0; }
  .trust-panel { min-height: auto; padding: 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-copy, .trust-list, .environment { display: none; }
  .auth-content { padding: 34px 22px 60px; }
  .steps { grid-template-columns: max-content minmax(30px, 1fr) max-content; }
  .form-wrap, .enroll-wrap { margin-top: 48px; }
  .enrollment-grid { grid-template-columns: 150px 1fr; }
  .dashboard-account > span { display: none; }
}

@media (max-width: 1100px) and (min-width: 781px) {
  .auth-shell { grid-template-columns: 270px minmax(0, 1fr); }
  .auth-content { padding-inline: clamp(38px, 6vw, 72px); }
  .trust-panel { padding-inline: 28px; }
}

@media (max-height: 760px) and (min-width: 781px) {
  .trust-list {
    gap: 22px;
    margin-top: 34px;
    padding-top: 26px;
  }

  .auth-content { padding-block: 28px; }
  .form-wrap { margin-top: 34px; }
  .intro { margin-bottom: 24px; }
  .field { margin-bottom: 18px; }
  .security-note { margin-top: 22px; }
}

@media (max-width: 520px) {
  .steps li:not(.step-line) { gap: 7px; font-size: 12px; }
  .steps li > span { width: 30px; height: 30px; }
  .enrollment-grid { grid-template-columns: 1fr; }
  .qr-card { width: 190px; }
  .token-field input { font-size: 28px; letter-spacing: .45em; }
}

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


/* ---- refinement pass: subtle ambient depth, restrained buttons ---- */
body { position: relative; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px circle at 4% -10%, rgba(6, 182, 212, .09), transparent 60%),
    radial-gradient(680px circle at 55% 118%, rgba(8, 145, 178, .07), transparent 60%);
}

.trust-panel {
  background: rgba(6, 10, 18, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.primary-button,
.dashboard-account button {
  transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.primary-button:active { transform: translateY(0); box-shadow: none; }

/* ============================================================
   Light theme
   Toggled via [data-theme="light"] on <html>. Every color in
   this file is sourced from the variables below (or the shared
   ones in dashboard.css), so this block is the single place a
   light palette needs to be defined.
   ============================================================ */
[data-theme="light"] {
  color-scheme: light;
  --page: #f3f6fa;
  --panel: #ffffff;
  --surface: #ffffff;
  --surface-raised: #f6f9fc;
  --line: #dde3ea;
  --line-strong: #c7d0da;
  --text: #121822;
  --muted: #5b6675;
  --text-dim: #46505f;
  --faint: #5f6a77;
  --purple: #0e7490;
  --purple-bright: #0a6b81;
  --purple-light: #0c7286;
  --green: #0e9166;
  --danger: #c9304c;
  --focus: 0 0 0 3px rgba(12, 127, 150, .22);
}

[data-theme="light"] body::before {
  background:
    radial-gradient(600px circle at 4% -10%, rgba(6, 182, 212, .07), transparent 60%),
    radial-gradient(680px circle at 55% 118%, rgba(8, 145, 178, .05), transparent 60%);
}

[data-theme="light"] .trust-panel {
  background: rgba(255, 255, 255, .72);
  border-right-color: var(--line);
  box-shadow: 1px 0 0 rgba(16, 24, 40, .04);
}
[data-theme="light"] .auth-content { background-color: transparent; }
[data-theme="light"] .primary-button { box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
[data-theme="light"] .security-badge { box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
[data-theme="light"] .qr-card { border: 1px solid var(--line); }
[data-theme="light"] .field input[type="email"],
[data-theme="light"] .field input[type="password"],
[data-theme="light"] .field input[type="text"] {
  background: rgba(9, 22, 33, .03);
}
[data-theme="light"] .field input:focus { background: rgba(9, 22, 33, .045); }
[data-theme="light"] .form-errors { background: #fdecef; border-color: #f0b9c4; }
[data-theme="light"] .token-field input::placeholder { color: #c3ccd6; }
[data-theme="light"] .manual-key code { background: #eef7f9; }
[data-theme="light"] .dashboard-header { background: rgba(255, 255, 255, .78); }
[data-theme="light"] .dashboard-account button { background: rgba(9, 22, 33, .03); }
[data-theme="light"] .dashboard-account button:hover { background: rgba(9, 22, 33, .06); }
[data-theme="light"] * { scrollbar-color: rgba(12, 127, 150, .3) transparent; }
[data-theme="light"] *::-webkit-scrollbar-thumb { background-color: rgba(12, 127, 150, .25); }
[data-theme="light"] *::-webkit-scrollbar-thumb:hover { background-color: rgba(12, 127, 150, .4); }

/* theme toggle control */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(148, 163, 184, .07);
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.theme-toggle:hover { border-color: rgba(6, 182, 212, .4); color: var(--purple-bright); background: rgba(148, 163, 184, .14); }
.theme-toggle svg { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.auth-theme-toggle { position: fixed; z-index: 40; top: 20px; right: 20px; }
@media (max-width: 780px) { .auth-theme-toggle { top: 14px; right: 14px; } }

/* logo swap: dark wordmark for light theme, light wordmark for dark theme */
.brand-logo-light { display: none; }
[data-theme="light"] .brand-logo-dark { display: none; }
[data-theme="light"] .brand-logo-light { display: block; }
