.auth-layer {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  pointer-events: none;
}

.auth-layer.is-open {
  pointer-events: auto;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: #f8fafc;
}

.auth-panel {
  position: relative;
  z-index: 1;
  width: min(calc(100vw - 40px), 860px);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
}

.auth-intro {
  position: relative;
  padding: 38px;
  background: linear-gradient(145deg, #123a8c 0%, #1858c5 56%, #1676d2 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-mark {
  display: block;
  width: 82px;
  height: 82px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 16px;
  background: transparent !important;
  box-shadow: none !important;
}

.auth-brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.auth-brand div {
  display: grid;
  gap: 3px;
}

.auth-brand strong {
  color: #fff;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.auth-brand span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
}

.auth-intro-copy {
  position: relative;
  z-index: 1;
  max-width: 320px;
}

.auth-eyebrow {
  display: block;
  margin-bottom: 10px;
  color: #2563eb;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-intro .auth-eyebrow {
  color: #bfdbfe;
}

.auth-intro-copy h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.auth-intro-copy p {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.92rem;
  line-height: 1.65;
}

.auth-intro-status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
}

.auth-intro-status span {
  width: 8px;
  height: 8px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.13);
}

.auth-entry {
  padding: 52px 48px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-mobile-logo {
  display: none;
}

.auth-panel-head h1 {
  margin: 0;
  color: #0f172a;
  font-size: 1.85rem;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.auth-panel-head p {
  margin: 9px 0 0;
  color: #64748b;
  font-size: 0.9rem;
}

.auth-form {
  display: grid;
  gap: 18px;
  margin-top: 30px;
}

.auth-field {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 0.77rem;
  font-weight: 700;
}

.auth-input-wrap {
  position: relative;
  display: block;
}

.auth-input-wrap > .auth-input-icon {
  position: absolute;
  z-index: 1;
  left: 15px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px 0 44px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  background: #f8fafc;
  color: #0f172a;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 500;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.auth-input-wrap:has(.auth-password-toggle) input {
  padding-right: 48px;
}

.auth-password-toggle {
  position: absolute;
  z-index: 2;
  right: 7px;
  top: 50%;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.auth-password-toggle:hover {
  background: #e8f0fb;
  color: #2563eb;
}

.auth-password-toggle:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}

.auth-password-toggle > .auth-password-toggle-icon {
  position: static;
  z-index: auto;
  left: auto;
  top: auto;
  transform: none;
  pointer-events: auto;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-form input:focus {
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11);
}

.auth-form input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 4px;
}

.auth-actions .button {
  min-height: 48px;
  padding-inline: 18px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  justify-content: space-between;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

.auth-error {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.82rem;
}

.auth-error > span {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.auth-help {
  margin: 24px 0 0;
  color: #94a3b8;
  font-size: 0.76rem;
  text-align: center;
}

.auth-android-download {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 22px;
  padding: 10px;
  border: 1px solid #dbe7f5;
  border-radius: 12px;
  background: #f8fbff;
}

.auth-android-qr {
  display: grid;
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d6e2f1;
  border-radius: 8px;
  background: #fff;
}

.auth-android-qr:focus-visible,
.auth-android-copy a:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.auth-android-qr img {
  display: block;
  width: 92px;
  height: 92px;
}

.auth-android-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.auth-android-copy strong {
  color: #1e3a5f;
  font-size: .81rem;
}

.auth-android-copy span {
  color: #64748b;
  font-size: .72rem;
  line-height: 1.35;
}

.auth-android-copy a {
  width: fit-content;
  margin-top: 3px;
  color: #2563eb;
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
}

.auth-android-copy a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .auth-layer {
    padding: 12px;
  }

  .auth-panel {
    width: min(calc(100vw - 24px), 430px);
    min-height: 0;
    max-height: calc(100dvh - 24px);
    overflow-x: hidden;
    overflow-y: auto;
    grid-template-columns: 1fr;
    border-radius: 20px;
  }

  .auth-intro {
    display: none;
  }

  .auth-entry {
    padding: 30px 24px 24px;
  }

  .auth-panel-head {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .auth-mobile-logo {
    flex: 0 0 66px;
    width: 66px;
    height: 66px;
    display: block;
  }

  .auth-mobile-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .auth-panel-head .auth-eyebrow {
    margin-bottom: 5px;
  }

  .auth-panel-head h1 {
    font-size: 1.45rem;
  }

  .auth-panel-head p {
    margin-top: 5px;
    font-size: 0.8rem;
  }

  .auth-form {
    margin-top: 26px;
    gap: 15px;
  }

  .auth-help {
    margin-top: 18px;
  }

  .auth-android-download {
    display: none;
  }
}

@media (max-width: 380px) {
  .auth-entry {
    padding: 24px 20px 20px;
  }

  .auth-mobile-logo {
    flex-basis: 58px;
    width: 58px;
    height: 58px;
  }

  .auth-form input,
  .auth-actions .button {
    min-height: 46px;
  }
}

.auth-actions .button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.auth-actions .button:hover,
.auth-actions .button:focus-visible {
  transform: translateY(-1px);
}

.auth-actions .button:active {
  transform: translateY(0);
}

.auth-code-panel {
  display: block;
  width: min(calc(100vw - 40px), 390px);
  min-height: 0;
  border-radius: 22px;
}

.auth-code-panel .auth-entry {
  align-items: center;
  padding: 32px 34px 28px;
  text-align: center;
}

.auth-code-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}

.auth-code-panel .auth-panel-head p { margin-top: 7px; }
.auth-code-form { width: 100%; margin-top: 24px; gap: 7px; }
.auth-code-form .auth-field { align-items: center; }
.auth-code-input.auth-code-input {
  min-height: 58px;
  padding: 0 14px;
  border-color: #bcd7e9;
  border-radius: 14px;
  background: #f8fcff;
  color: #183a53;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-align: center;
}
.auth-code-input.auth-code-input::placeholder { color: #9bb4c5; letter-spacing: .14em; }
.auth-code-input.auth-code-input:focus { border-color: #2999d4; box-shadow: 0 0 0 4px rgba(41, 153, 212, .14); }
.auth-code-hint { color: #718399; font-size: .76rem; }
.auth-code-panel .auth-help { margin: 20px 0 0; font-size: .76rem; }

@media (max-width: 480px) {
  .auth-code-panel { width: min(calc(100vw - 24px), 390px); }
  .auth-code-panel .auth-entry { padding: 27px 22px 23px; }
}
