.auth-gate {
  --auth-bg: #111416;
  --auth-visual: #171b1e;
  --auth-panel: #121517;
  --auth-card: rgba(28, 32, 35, .94);
  --auth-card-soft: #202529;
  --auth-text: #eceeed;
  --auth-muted: #aeb5b8;
  --auth-line: #343b40;
  --auth-primary: #b79a5d;
  --auth-primary-strong: #c6aa6a;
  --auth-primary-soft: rgba(183, 154, 93, .13);
  --auth-on-primary: #171510;
  --auth-focus: #c6aa6a;
  min-height: 100dvh;
  grid-template-columns: minmax(360px, 1.08fr) minmax(430px, .92fr);
  color: var(--auth-text);
  background: var(--auth-bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] .auth-gate {
  --auth-bg: #eef1f1;
  --auth-visual: #e8edef;
  --auth-panel: #f4f5f3;
  --auth-card: rgba(255, 255, 253, .94);
  --auth-card-soft: #eef1f1;
  --auth-text: #252a2e;
  --auth-muted: #606970;
  --auth-line: #d2d8da;
  --auth-primary: #d4e5ed;
  --auth-primary-strong: #42677a;
  --auth-primary-soft: rgba(154, 190, 207, .22);
  --auth-on-primary: #284654;
  --auth-focus: #526d7c;
}

.auth-gate .auth-theme-toggle {
  position: absolute;
  z-index: 4;
  top: 14px;
  right: 14px;
  order: initial;
  width: 42px;
  min-height: 42px;
  padding: 8px;
  justify-content: center;
  color: var(--auth-text);
  background: color-mix(in srgb, var(--auth-card) 88%, transparent);
  border-color: var(--auth-line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  backdrop-filter: blur(12px);
}

.auth-gate .auth-theme-toggle:hover {
  color: var(--auth-text);
  background: var(--auth-card-soft);
  border-color: var(--auth-primary-strong);
  transform: none;
}

.auth-gate .auth-visual {
  isolation: isolate;
  min-width: 0;
  padding: clamp(36px, 5vw, 76px);
  border-right: 1px solid var(--auth-line);
  background: var(--auth-visual);
}

.auth-gate .auth-visual::before,
.auth-gate .auth-visual::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.auth-gate .auth-visual::before {
  inset: clamp(24px, 4vw, 58px);
  border: 1px solid color-mix(in srgb, var(--auth-line) 72%, transparent);
  border-left-color: transparent;
  opacity: .66;
}

.auth-gate .auth-visual::after {
  right: clamp(34px, 5vw, 80px);
  bottom: clamp(34px, 5vw, 76px);
  width: min(34vw, 430px);
  height: 1px;
  background: var(--auth-primary);
  opacity: .58;
}

.auth-gate .auth-brand-logo,
.auth-gate .auth-visual-copy,
.auth-gate .auth-security-list {
  position: relative;
  z-index: 1;
}

.auth-gate .auth-logo-frame {
  display: inline-flex;
  align-items: center;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--auth-line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--auth-card) 62%, transparent);
  backdrop-filter: blur(12px);
}

.auth-gate .auth-brand-svg { width: clamp(210px, 22vw, 300px); height: auto; }
html[data-theme="light"] .auth-gate .auth-logo-frame {
  border-color: var(--auth-line);
  background: rgba(255, 255, 253, .72);
}
html[data-theme="light"] .auth-gate .auth-brand-svg { content: url("../../../assets/icons/atrium-logo-light.svg"); }
.auth-gate .auth-visual-copy { max-width: 700px; margin: clamp(62px, 11vh, 118px) 0 clamp(36px, 6vh, 68px); }

.auth-gate .auth-visual-copy .eyebrow {
  margin: 0;
  color: var(--auth-primary-strong);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.auth-gate .auth-visual-copy h1 {
  margin: 16px 0 22px;
  color: var(--auth-text);
  font: 600 clamp(46px, 5.2vw, 76px)/1.01 "Playfair Display", Georgia, serif;
  letter-spacing: -.025em;
}

.auth-gate .auth-visual-copy h1 em {
  color: var(--auth-primary-strong);
  font-size: .74em;
  font-style: normal;
  font-weight: 560;
  letter-spacing: -.01em;
}
.auth-gate .auth-visual-copy > p { max-width: 610px; margin: 0; color: var(--auth-muted); font-size: 15px; line-height: 1.68; }

.auth-gate .auth-intro-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.auth-gate .auth-intro-flow li { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 9px; padding-top: 12px; border-top: 1px solid var(--auth-line); }
.auth-gate .auth-intro-flow li > span { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--auth-primary-strong); border-radius: 50%; color: var(--auth-primary-strong); font-size: 11px; font-weight: 800; }
.auth-gate .auth-intro-flow div { display: grid; gap: 4px; }
.auth-gate .auth-intro-flow strong { color: var(--auth-text); font-size: 12px; line-height: 1.35; }
.auth-gate .auth-intro-flow small { color: var(--auth-muted); font-size: 10px; line-height: 1.45; }

.auth-gate .auth-security-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  color: var(--auth-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .055em;
  line-height: 1.45;
  text-transform: uppercase;
}

.auth-gate .auth-security-list span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--auth-line);
}

.auth-gate .auth-security-list span > span {
  display: block;
  padding: 0;
  border: 0;
}

.auth-gate .auth-panel {
  align-items: center;
  padding: 12px clamp(28px, 5vw, 66px);
  background: var(--auth-panel);
}

.auth-gate .auth-card {
  position: relative;
  width: min(100%, 520px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 22px clamp(26px, 3.4vw, 38px) 16px;
  border: 1px solid var(--auth-line);
  border-radius: 18px;
  color: var(--auth-text);
  background: var(--auth-card);
  box-shadow: 0 18px 50px -38px rgba(0, 0, 0, .68);
  backdrop-filter: blur(18px);
}

.auth-gate .auth-card-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  text-align: center;
}

.auth-gate .auth-card-brand.hidden {
  display: none !important;
}

.auth-gate .auth-card-emblem {
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .2));
}

.auth-gate .auth-card-brand-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.auth-gate .auth-card-brand-name {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--auth-text);
  line-height: 1.1;
}

.auth-gate .auth-card-brand-tagline {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--auth-primary-strong);
}

.auth-gate .auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  background: var(--auth-card-soft);
}

.auth-gate .auth-tab {
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--auth-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .045em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
  white-space: nowrap;
}

.auth-gate .auth-tab:hover { color: var(--auth-text); background: color-mix(in srgb, var(--auth-card) 70%, transparent); }
.auth-gate .auth-tab.active { color: var(--auth-on-primary); border-color: color-mix(in srgb, var(--auth-primary-strong) 72%, var(--auth-line)); background: var(--auth-primary); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); font-weight: 700; }

.auth-gate .auth-login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 16px;
  flex-wrap: wrap;
}

.auth-gate .auth-login-options .trust-browser-control {
  margin: 0 !important;
  flex: 1;
  min-width: 190px;
}

.auth-gate .auth-forgot-password-link {
  background: transparent;
  border: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 6px;
  color: var(--auth-primary-strong);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.auth-gate .auth-forgot-password-link:hover {
  opacity: .8;
}

.auth-gate .auth-card-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--auth-line);
  text-align: center;
}

.auth-gate .auth-card-footer.hidden {
  display: none !important;
}

.auth-gate .auth-footer-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--auth-muted);
  flex-wrap: wrap;
}

.auth-gate .auth-link-action {
  background: transparent;
  border: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 6px;
  color: var(--auth-primary-strong);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s ease;
}

.auth-gate .auth-link-action:hover {
  opacity: .85;
}

.auth-gate .auth-footer-legal {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--auth-muted);
  opacity: .75;
}

.auth-gate .auth-register-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--auth-line);
  font-size: 12.5px;
  color: var(--auth-muted);
}

.auth-gate .auth-step.active { animation: authMineralReveal 180ms ease both; }
.auth-gate .auth-step .eyebrow { color: var(--auth-primary-strong); }
.auth-gate .auth-step h2 { margin: 8px 0 12px; color: var(--auth-text); font-size: clamp(27px, 3vw, 37px); }
.auth-gate .auth-step > p:not(.eyebrow) { margin-bottom: 22px; color: var(--auth-muted); }

.auth-gate #authSetupForm > .eyebrow { padding-right: 48px; }
.auth-gate #authSetupForm > p:not(.eyebrow) { margin-bottom: 10px; line-height: 1.45; }
.auth-gate :is(#authIdentityStep, #authMonitoringStep) > .eyebrow { padding-right: 48px; }
.auth-gate :is(#authIdentityStep, #authMonitoringStep) > p:not(.eyebrow) { margin: 0 0 18px; color: var(--auth-muted); line-height: 1.45; }

.auth-gate .auth-step label {
  gap: 7px;
  margin: 14px 0;
  color: var(--auth-muted);
  font-size: 11px;
  letter-spacing: .065em;
}

.auth-gate .auth-setup-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.auth-gate .auth-setup-grid > label,
.auth-gate .auth-field-row label {
  margin: 0 0 8px;
  gap: 5px;
}

.auth-gate .auth-field-row {
  grid-template-columns: minmax(0, 1fr) 136px;
  align-items: end;
  gap: 12px;
}

.auth-gate .auth-uf-label { padding-left: 8px; text-align: left; }

.auth-gate .auth-field-row input,
.auth-gate .auth-field-row select {
  min-height: 42px;
}

.auth-gate #authSetupForm input,
.auth-gate #authSetupForm select { min-height: 42px; padding-top: 9px; padding-bottom: 9px; }
.auth-gate #authSetupForm .password-input-wrap input[type="password"] { height: 42px; padding-top: 10px; padding-bottom: 10px; }
.auth-gate #authSetupForm .password-toggle { min-height: 40px; }
.auth-gate #authSetupForm .auth-submit { min-height: 42px; margin-top: 12px; }
.auth-gate .auth-setup-heading { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: start; gap: 12px; }
.auth-gate .auth-setup-heading > span { min-height: 42px; display: grid; place-items: center; border: 1px solid var(--auth-line); border-radius: 50%; color: var(--auth-primary-strong); background: var(--auth-primary-soft); font-size: 10px; font-weight: 800; }
.auth-gate .auth-setup-heading .eyebrow { margin: 1px 0 3px; }
.auth-gate .auth-setup-heading h2 { margin: 0; }

.auth-gate .auth-step input,
.auth-gate .auth-step select {
  min-height: 46px;
  border: 1px solid var(--auth-line);
  border-radius: 9px;
  color: var(--auth-text);
  background: color-mix(in srgb, var(--auth-bg) 72%, var(--auth-card));
  box-shadow: none;
}

.auth-gate #authSetupForm select[name="oabUf"] {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' stroke='%23aeb5b8' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
}

html[data-theme="light"] .auth-gate #authSetupForm select[name="oabUf"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' stroke='%23606970' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.auth-gate .auth-step input:focus,
.auth-gate .auth-step select:focus,
.auth-gate .auth-tab:focus-visible,
.auth-gate button:focus-visible,
.auth-gate summary:focus-visible {
  outline: 2px solid var(--auth-focus);
  outline-offset: 2px;
  border-color: var(--auth-focus);
  box-shadow: none;
}

.auth-gate .password-input-wrap { position: relative; display: block; }
.auth-gate .password-input-wrap input { width: 100%; box-sizing: border-box; padding-right: 52px; }
.auth-gate .password-input-wrap input[type="password"] {
  height: 46px;
  padding-top: 13px;
  padding-bottom: 13px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 18px;
  letter-spacing: .12em;
}
.auth-gate .password-input-wrap input[type="password"]::placeholder {
  font-family: var(--v2-font-interface);
  font-size: 13px;
  letter-spacing: normal;
}
.auth-gate .password-toggle {
  position: absolute;
  inset: 1px 1px 1px auto;
  width: 44px;
  min-height: 44px;
  border: 0;
  border-left: 1px solid var(--auth-line);
  border-radius: 0 8px 8px 0;
  color: var(--auth-muted);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  transform: none;
}

.auth-gate .auth-submit { min-height: 46px; border-radius: 9px; }
.auth-gate .button.gold { color: var(--auth-on-primary); border-color: color-mix(in srgb, var(--auth-primary-strong) 70%, var(--auth-line)); background: var(--auth-primary); box-shadow: none; }
.auth-gate .button.gold:hover { color: var(--auth-on-primary); background: var(--auth-primary-strong); transform: none; box-shadow: none; }
.auth-gate .button.ghost { color: var(--auth-text); border-color: var(--auth-line); background: transparent; box-shadow: none; }
.auth-gate .button.ghost:hover { border-color: var(--auth-primary-strong); background: var(--auth-primary-soft); transform: none; }

.auth-gate .auth-qr { border: 1px solid var(--auth-line); border-radius: 10px; box-shadow: none; }
.auth-gate .auth-step details { border-color: var(--auth-line); border-radius: 9px; color: var(--auth-muted); background: var(--auth-card-soft); }
.auth-gate .auth-step summary { min-height: 44px; display: flex; align-items: center; color: var(--auth-text); }
.auth-gate .auth-manual-secret { color: var(--auth-primary-strong); background: var(--auth-bg); }
.auth-gate .recovery-codes { border: 1px solid var(--auth-line); background: var(--auth-bg); color: var(--auth-text); }

.auth-gate .trust-browser-control {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--auth-line);
  border-radius: 9px;
  background: var(--auth-card-soft);
}

.auth-gate .trust-browser-control input { width: 20px; min-height: 20px; margin: 1px 0 0; }
.auth-gate .trust-browser-control span { display: grid; gap: 3px; }
.auth-gate .trust-browser-control strong { color: var(--auth-text); font-size: 12px; letter-spacing: 0; text-transform: none; }
.auth-gate .trust-browser-control small { color: var(--auth-muted); font-size: 11px; font-weight: 500; letter-spacing: 0; line-height: 1.45; text-transform: none; }

.auth-gate .auth-feedback { border: 1px solid var(--auth-line); border-radius: 9px; color: var(--auth-text); background: var(--auth-card-soft); }
.auth-gate .auth-feedback.error { border-color: #8e514c; color: #efbbb5; background: rgba(112, 49, 43, .18); }
.auth-gate .auth-feedback.success { border-color: #587460; color: #b8d5bf; background: rgba(64, 101, 74, .17); }
html[data-theme="light"] .auth-gate .auth-feedback.error { color: #873f38; background: #f4e4e2; }
html[data-theme="light"] .auth-gate .auth-feedback.success { color: #47644e; background: #e4ede6; }
.auth-gate .auth-local-note { margin-top: 12px !important; padding-top: 10px; border-color: var(--auth-line); color: var(--auth-muted) !important; }
.auth-gate .auth-spinner { border-color: var(--auth-line); border-top-color: var(--auth-primary-strong); }

@keyframes authMineralReveal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .auth-gate { grid-template-columns: 1fr; }
  .auth-gate .auth-visual { min-height: auto; padding: 24px; border-right: 0; border-bottom: 1px solid var(--auth-line); }
  .auth-gate .auth-visual::before { inset: 14px; }
  .auth-gate .auth-visual::after { display: none; }
  .auth-gate .auth-visual-copy { margin: 28px 0 8px; }
  .auth-gate .auth-visual-copy h1 { margin: 10px 0 12px; font-size: 40px; }
  .auth-gate .auth-visual-copy > p:last-child { max-width: 680px; }
  .auth-gate .auth-intro-flow { grid-template-columns: 1fr; margin-top: 18px; }
  .auth-gate .auth-security-list { display: none; }
  .auth-gate .auth-panel { padding: 22px; }
  .auth-gate .auth-card { max-height: none; }
}

html[data-theme="light"] .auth-gate .button.gold {
  color: #ffffff;
  background: #1e4a62;
  border-color: #16384a;
  box-shadow: 0 4px 14px rgba(30, 74, 98, .24);
}

html[data-theme="light"] .auth-gate .button.gold:hover {
  color: #ffffff;
  background: #153648;
  border-color: #0e2430;
  box-shadow: 0 6px 18px rgba(30, 74, 98, .32);
}

html[data-theme="light"] .auth-gate .auth-tab.active {
  color: #ffffff;
  background: #1e4a62;
  border-color: #16384a;
  box-shadow: 0 2px 8px rgba(30, 74, 98, .2);
}

@media (max-width: 520px) {
  .auth-gate .auth-theme-toggle { top: 10px; right: 10px; min-width: 44px; padding: 8px; }
  .auth-gate .auth-visual { padding: 18px; }
  .auth-gate .auth-logo-frame { min-height: 48px; padding: 7px 10px; }
  .auth-gate .auth-brand-svg { width: 158px; }
  .auth-gate .auth-visual-copy { margin: 20px 0 4px; }
  .auth-gate .auth-visual-copy .eyebrow { font-size: 9px; }
  .auth-gate .auth-visual-copy h1 { font-size: 31px; }
  .auth-gate .auth-visual-copy > p:last-child { display: block; font-size: 12px; line-height: 1.5; }
  .auth-gate .auth-intro-flow { display: none; }
  .auth-gate .auth-panel { padding: 12px; }
  .auth-gate .auth-card { padding: 22px 18px; border-radius: 14px; }
  .auth-gate .auth-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .auth-gate .auth-step h2 { font-size: 28px; }
  .auth-gate .auth-qr { width: min(190px, 74vw); height: auto; aspect-ratio: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-gate .auth-step.active { animation: none; }
  .auth-gate *, .auth-gate *::before, .auth-gate *::after { transition-duration: 1ms !important; }
}

/* Separate account creation from optional judicial monitoring. */
.auth-gate [hidden] { display: none !important; }
#authIdentityStep, #authMonitoringStep { animation: authSetupSlide .25s ease-out; }
#authMonitoringStep > .auth-field-row { margin: 20px 0; }
#authMonitoringChoice { margin: 16px 0; }
#authSetupForm #authMonitoringChoice input { min-height: 20px; }
@keyframes authSetupSlide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { #authIdentityStep, #authMonitoringStep { animation: none; } }
