.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-modal[hidden] { display: none; }

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
  padding: 28px 24px 24px;
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}

.auth-head { margin-bottom: 18px; padding-right: 28px; }
.auth-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  margin: 0 0 12px;
}
html[data-theme="dark"] .auth-logo { filter: invert(1); }
.auth-head h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.auth-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form[hidden],
.auth-form .auth-field[hidden],
.auth-form label[hidden],
.auth-note[hidden],
.field-error[hidden] {
  display: none !important;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.auth-field .req {
  color: #dc2626;
  font-style: normal;
  font-weight: 800;
}

.auth-field .field-error {
  margin: 0;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.mobile-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page);
  padding: 0 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.mobile-code {
  font-weight: 800;
  color: var(--ink);
  flex-shrink: 0;
}

.mobile-field input {
  height: 100%;
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  flex: 1;
  color: var(--ink);
  font: inherit;
}

.mobile-field:focus-within {
  border-color: var(--ink);
}

.auth-field.is-invalid .mobile-field,
.auth-field.is-invalid > input {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px #dc2626;
}

.auth-field.is-invalid .otp-box {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px #dc2626;
}

.auth-form input[type="text"],
.auth-form input[type="tel"] {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
}

.auth-form input:focus {
  outline: 0;
  border-color: var(--ink);
}

.otp-boxes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.otp-box {
  width: 100%;
  height: 54px !important;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 22px !important;
  font-weight: 800;
  text-align: center;
  padding: 0 !important;
  caret-color: var(--ink);
}

.otp-box:focus {
  outline: 0;
  border-color: var(--ink);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .06);
}

.auth-captcha-wrap {
  min-height: 0;
}

.auth-captcha-wrap:empty {
  display: none;
}

#authMsg91Captcha {
  display: flex;
  justify-content: center;
  min-height: 0;
}

#authMsg91Captcha:empty {
  display: none;
}

.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  cursor: pointer;
}

.auth-submit:hover { opacity: .9; }
.auth-submit:disabled { opacity: .6; cursor: wait; }

.auth-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-align: center;
}

.auth-link:hover { color: var(--ink); }

.auth-link:disabled {
  cursor: not-allowed;
  opacity: .7;
  color: var(--muted);
}

.auth-note {
  margin: 12px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.auth-note.is-error {
  color: #dc2626;
}

body.auth-open { overflow: hidden; }

@media (max-width: 420px) {
  .otp-box {
    height: 48px !important;
    font-size: 20px !important;
    border-radius: 12px;
  }
}
