/* Compact authentication surface. Login pages intentionally keep their own visual contract. */
.auth-body {
  min-width: 0;
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
}

.auth-shell {
  display: grid;
  min-width: 0;
  min-height: 100dvh;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
}

.auth-rail {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(28px, 4vw, 58px) clamp(24px, 6vw, 88px) 30px;
  background: var(--nav);
  color: #fff;
  isolation: isolate;
}

.auth-rail::before,
.auth-rail::after {
  position: absolute;
  z-index: -1;
  border: 1px solid rgb(174 201 246 / 18%);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
}

.auth-rail::before {
  top: 18%;
  right: 6%;
  width: min(30vw, 330px);
  aspect-ratio: 1;
}

.auth-rail::after {
  right: -120px;
  bottom: -170px;
  width: 380px;
  height: 380px;
  border-color: rgb(174 201 246 / 10%);
}

.auth-brand {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  padding: 0;
}

.auth-rail-copy {
  position: relative;
  z-index: 1;
  max-width: 450px;
  margin: auto 0 50px;
  padding-top: 84px;
}

.auth-rail-copy h1 {
  max-width: 13ch;
  color: #fff;
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 680;
  letter-spacing: -.06em;
  line-height: 1.08;
}

.auth-rail-copy p:not(.eyebrow) {
  max-width: 40ch;
  margin-top: 19px;
  color: #bfcee4;
  font-size: 15px;
  line-height: 1.7;
}

.service-map {
  position: relative;
  display: grid;
  max-width: 500px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 45px;
  padding-top: 18px;
}

.service-map-line {
  position: absolute;
  top: 28px;
  right: 16%;
  left: 16%;
  height: 1px;
  background: #405474;
}

.service-map-node {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 0 10px;
}

.service-map-node::before {
  width: 9px;
  height: 9px;
  margin-bottom: 8px;
  border: 2px solid #61789f;
  border-radius: 50%;
  background: var(--nav);
  content: "";
}

.service-map-node.is-active::before {
  border-color: #b8cbff;
  background: #6f8ff1;
  box-shadow: 0 0 0 5px rgb(111 143 241 / 16%);
}

.service-map-index {
  color: #8195b9;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
}

.service-map-node strong {
  color: #f5f8ff;
  font-size: 13px;
  font-weight: 650;
}

.service-map-node small {
  overflow: hidden;
  color: #9eafca;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-rail-foot {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  color: #9caecc;
  font-size: 11px;
}

.auth-rail-foot .aside-rule {
  width: 1px;
  height: 13px;
  margin: 0 4px;
  background: #405274;
}

.auth-rail-foot .environment-mark {
  width: 7px;
  height: 7px;
  background: #8caeff;
  box-shadow: 0 0 0 3px rgb(140 174 255 / 15%);
}

.auth-card-wrap {
  display: grid;
  min-width: 0;
  align-content: center;
  justify-items: center;
  padding: clamp(28px, 5vw, 72px) clamp(22px, 7vw, 112px);
}

.auth-card {
  width: min(100%, 480px);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(26px, 3.2vw, 39px);
  background: var(--surface);
  box-shadow: 0 24px 70px rgb(17 29 53 / 12%);
}

.auth-card-head h2 {
  color: var(--text);
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 680;
  letter-spacing: -.045em;
  line-height: 1.16;
}

.auth-card-head > p:not(.eyebrow) {
  max-width: 44ch;
  margin-top: 11px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.auth-card .eyebrow {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
}

.auth-server-notice,
.auth-client-error {
  display: grid;
  gap: 2px;
  border: 1px solid #dbe4f2;
  border-radius: 9px;
  margin-top: 22px;
  padding: 11px 13px;
  color: #41526d;
  background: #f7faff;
  font-size: 13px;
  line-height: 1.55;
}

.auth-server-notice span {
  display: block;
  color: inherit;
}

.auth-server-notice-danger,
.auth-client-error {
  border-color: #ebc8ce;
  color: #963b4a;
  background: #fff4f5;
}

.auth-server-notice-info {
  border-color: #cad9f6;
  color: #345a9c;
  background: #f2f6ff;
}

.auth-form {
  display: grid;
  min-width: 0;
  gap: 17px;
  margin-top: 26px;
}

.auth-card .field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.auth-card .field > label,
.auth-card .field > .auth-field-label {
  color: #273958;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.auth-card .field > small {
  color: #70809a;
  font-size: 12px;
  line-height: 1.55;
}

.auth-card input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 11px 13px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.auth-card input:hover {
  border-color: var(--brand);
}

.auth-card input:focus {
  border-color: #4770d7;
  outline: 0;
  background: var(--surface);
  box-shadow: 0 0 0 4px rgb(55 98 214 / 13%);
}

.auth-card input[aria-invalid="true"] {
  border-color: #c56876;
}

.auth-card input[name="code"],
.auth-card input[name="totp_code"] {
  font-family: var(--mono);
  font-size: 19px;
  letter-spacing: .22em;
}

.auth-card input[name="phone"] {
  letter-spacing: .04em;
}

.auth-card .field-error {
  margin: 0;
  color: #a53140;
  font-size: 12px;
  line-height: 1.45;
}

.auth-input-affix {
  position: relative;
  min-width: 0;
}

.auth-input-affix input {
  padding-right: 68px;
}

.auth-input-action {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  min-width: 58px;
  border-radius: 7px;
  padding: 8px 9px;
  background: transparent;
  color: #4162a1;
  font-size: 13px;
  font-weight: 650;
}

.auth-input-action:hover {
  background: #edf2ff;
  color: #244dba;
}

.auth-submit {
  min-height: 48px;
  margin-top: 3px;
  border-radius: 9px;
  font-size: 14px;
}

.auth-submit .icon {
  width: 17px;
  height: 17px;
}

.auth-form[aria-busy="true"] input {
  background: #f4f7fb;
}

.auth-form[aria-busy="true"] .auth-submit {
  position: relative;
}

.auth-methods {
  display: flex;
  min-width: 0;
  gap: 5px;
  border-bottom: 1px solid #dbe3ef;
  margin-top: 28px;
  padding: 0 1px;
}

.auth-method {
  position: relative;
  min-width: 0;
  min-height: 45px;
  flex: 1 1 0;
  border-radius: 8px 8px 0 0;
  padding: 10px 12px;
  background: transparent;
  color: #75839a;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
}

.auth-method:hover {
  color: #3c5d9f;
  background: #f5f8ff;
}

.auth-method.is-active {
  color: var(--brand);
  background: var(--brand-soft);
}

.auth-method.is-active::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
  content: "";
}

.auth-method-panel {
  min-width: 0;
}

.auth-method-panel > .auth-form,
.auth-method-panel > div > .auth-form {
  margin-top: 25px;
}

.auth-verify-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-top: 16px;
}

.auth-resend,
.text-button {
  min-height: 44px;
  border-radius: 7px;
  padding: 9px 5px;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
}

.auth-resend:hover,
.text-button:hover {
  color: var(--brand-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-resend:disabled {
  color: #7e8da4;
  text-decoration: none;
}

.auth-resend-status {
  min-width: 0;
  color: #7a889e;
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.form-switch-copy {
  min-width: 0;
  margin-top: 4px;
  color: #74839a;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.form-switch-copy > span {
  color: #415577;
  font-weight: 600;
}

.phone-login {
  min-width: 0;
  padding-top: 25px;
}

.phone-login-head h3 {
  color: var(--text);
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -.02em;
  line-height: 1.35;
}

.phone-login-head > p:not(.eyebrow) {
  max-width: 44ch;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.phone-auth-error {
  margin-top: 16px;
}

.phone-auth-progress {
  margin: 15px 0 0;
  color: #61728d;
  font-size: 13px;
  line-height: 1.5;
}

.local-demo-code {
  border: 1px solid #bfe3d4;
  border-radius: 8px;
  margin: 0;
  padding: 10px 12px;
  color: var(--success);
  background: var(--success-soft);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}

.auth-boundary {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 9px;
  border-top: 1px solid var(--line);
  margin-top: 29px;
  padding-top: 17px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.auth-boundary > span {
  display: grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 6px;
  background: var(--subtle);
  color: var(--brand);
}

.auth-boundary .icon {
  width: 14px;
  height: 14px;
}

.auth-boundary p {
  min-width: 0;
}

.auth-footer {
  width: min(100%, 480px);
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.auth-footer-links { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 18px; margin-top: 13px; line-height: 1.5; }
.auth-footer-links a { color: var(--muted); text-decoration: none; }
.auth-footer-links a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

.auth-unavailable {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid #dce4ef;
  border-radius: 10px;
  margin-top: 27px;
  padding: 15px;
  background: #f8faff;
}

.auth-unavailable-mark {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: #fff2d7;
  color: #86520b;
  font-weight: 700;
}

.auth-unavailable strong {
  display: block;
  color: #314665;
  font-size: 14px;
}

.auth-unavailable p {
  margin-top: 4px;
  color: #73829a;
  font-size: 13px;
}

@media (max-width: 980px) {
  .auth-rail {
    padding-inline: clamp(24px, 4vw, 44px);
  }

  .auth-card-wrap {
    padding-inline: clamp(22px, 4vw, 48px);
  }

  .auth-rail-copy h1 {
    font-size: clamp(32px, 4vw, 45px);
  }
}

@media (max-width: 740px) {
  .auth-shell {
    display: block;
  }

  .auth-rail {
    min-height: 285px;
    padding: 25px 24px 23px;
  }

  .auth-rail-copy {
    max-width: 620px;
    margin: 53px 0 26px;
    padding: 0;
  }

  .auth-rail-copy h1 {
    max-width: 15ch;
    font-size: clamp(30px, 8vw, 41px);
  }

  .auth-rail-copy p:not(.eyebrow) {
    max-width: 52ch;
    margin-top: 11px;
    font-size: 13px;
  }

  .service-map {
    display: none;
  }

  .auth-rail-foot {
    margin-top: auto;
  }

  .auth-card-wrap {
    display: block;
    padding: 25px 16px 34px;
  }

  .auth-card {
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 25px 20px;
  }

  .auth-footer {
    width: min(100%, 520px);
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 600px) {
  .auth-rail {
    min-height: 220px;
    padding: 21px 22px 18px;
  }

  .auth-rail-copy {
    margin: 34px 0 17px;
  }

  .auth-rail-copy h1 {
    font-size: clamp(28px, 7.8vw, 36px);
  }

  .auth-rail-copy p:not(.eyebrow) {
    max-width: 48ch;
    margin-top: 8px;
    font-size: 12px;
  }

  .auth-rail-foot {
    font-size: 10px;
  }
}

@media (max-width: 360px) {
  .auth-rail {
    min-height: 215px;
    padding-inline: 20px;
  }

  .auth-rail-copy {
    margin-top: 30px;
  }

  .auth-rail-copy h1 {
    font-size: 29px;
  }

  .auth-rail-copy p:not(.eyebrow) {
    font-size: 12px;
  }

  .auth-card-wrap {
    padding-inline: 12px;
  }

  .auth-card {
    padding: 23px 17px;
  }

  .auth-card-head h2 {
    font-size: 24px;
  }

  .auth-verify-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }

  .auth-resend-status {
    order: -1;
    text-align: left;
  }

  .auth-boundary {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card input,
  .auth-method,
  .auth-input-action {
    transition: none;
  }
}

html[data-theme="dark"] .auth-body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .auth-card-wrap { background: var(--bg); }
html[data-theme="dark"] .auth-card { border-color: var(--line); background: var(--surface); box-shadow: 0 24px 70px rgb(0 0 0 / 28%); }
html[data-theme="dark"] .auth-card-head h2,
html[data-theme="dark"] .auth-card .field > label,
html[data-theme="dark"] .auth-card .field > .auth-field-label,
html[data-theme="dark"] .phone-login-head h3 { color: var(--text); }
html[data-theme="dark"] .auth-card-head > p:not(.eyebrow),
html[data-theme="dark"] .auth-card .field > small,
html[data-theme="dark"] .form-switch-copy,
html[data-theme="dark"] .auth-resend-status,
html[data-theme="dark"] .phone-login-head > p:not(.eyebrow),
html[data-theme="dark"] .phone-auth-progress,
html[data-theme="dark"] .auth-footer { color: var(--muted); }
html[data-theme="dark"] .auth-card .eyebrow { color: var(--faint); }
html[data-theme="dark"] .auth-server-notice,
html[data-theme="dark"] .auth-client-error,
html[data-theme="dark"] .auth-unavailable { border-color: var(--line); background: var(--surface-soft); color: var(--muted); }
html[data-theme="dark"] .auth-server-notice-info { border-color: #50628f; background: #26304b; color: #c1ccff; }
html[data-theme="dark"] .auth-server-notice-danger,
html[data-theme="dark"] .auth-client-error { border-color: #75414d; background: var(--danger-soft); color: var(--danger); }
html[data-theme="dark"] .auth-card input { border-color: var(--line-strong); background: var(--surface-soft); color: var(--text); }
html[data-theme="dark"] .auth-card input:hover,
html[data-theme="dark"] .auth-card input:focus { border-color: var(--brand); background: var(--surface-soft); }
html[data-theme="dark"] .auth-card input:focus { box-shadow: 0 0 0 4px rgb(164 181 255 / 19%); }
html[data-theme="dark"] .auth-input-action { color: var(--brand); }
html[data-theme="dark"] .auth-input-action:hover { background: var(--brand-soft); color: var(--brand-hover); }
html[data-theme="dark"] .auth-methods { border-color: var(--line); }
html[data-theme="dark"] .auth-method { color: var(--muted); }
html[data-theme="dark"] .auth-method:hover { color: var(--brand-hover); background: var(--brand-soft); }
html[data-theme="dark"] .auth-method.is-active { color: var(--brand); background: var(--brand-soft); }
html[data-theme="dark"] .local-demo-code { border-color: #3d715f; background: var(--success-soft); color: var(--success); }
html[data-theme="dark"] .auth-boundary { border-color: var(--line); color: var(--muted); }
html[data-theme="dark"] .auth-boundary > span { background: var(--subtle); color: var(--brand); }
html[data-theme="dark"] .auth-unavailable-mark { background: var(--warning-soft); color: var(--warning); }
html[data-theme="dark"] .auth-unavailable strong { color: var(--text); }
html[data-theme="dark"] .auth-unavailable p { color: var(--muted); }
html[data-theme="dark"] .auth-footer-links a { color: var(--muted); }
