.auth-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 72;
  --auth-input-border: #d2d2d7;
  --auth-input-focus-border: #d2d2d7;
  --auth-input-focus-ring: rgba(210, 210, 215, 0.45);
  display: grid;
  width: min(520px, calc(100vw - 36px));
  max-height: min(720px, calc(100vh - 34px));
  gap: 20px;
  padding: 30px;
  border: 0;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.14), 0 4px 18px rgba(0, 0, 0, 0.06);
  transform: translate(-50%, -50%);
}

.auth-panel.hidden {
  display: none;
}

.auth-toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 86;
  width: fit-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(31, 36, 42, 0.94);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.auth-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.auth-toast.warn {
  background: var(--accent-toast, rgba(180, 35, 24, 0.94));
}

.auth-head {
  display: grid;
  gap: 7px;
  padding-right: 34px;
}

.auth-head h2 {
  margin: 0;
  color: var(--text, #1d1d1f);
  font-size: 1.74rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.auth-head p {
  margin: 0;
  color: var(--sub, var(--muted, #6e6e73));
  font-size: 0.88rem;
  line-height: 1.55;
}

.auth-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f1f1f3;
  color: #515154;
  cursor: pointer;
}

.auth-close-btn svg {
  width: 20px;
  height: 20px;
}

.auth-close-btn path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.auth-panel form {
  display: grid;
  gap: 12px;
}

.auth-panel form.hidden {
  display: none;
}

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

.auth-field label {
  color: var(--sub, var(--muted, #6e6e73));
  font-size: 0.78rem;
  font-weight: 760;
}

.auth-panel input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--auth-input-border);
  border-radius: 14px;
  background: rgba(247, 247, 248, 0.92);
  color: var(--text, #1d1d1f);
  font-size: 0.92rem;
}

.auth-panel input:focus {
  border-color: var(--auth-input-focus-border);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px var(--auth-input-focus-ring);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 2px;
}

.auth-actions .primary-btn {
  min-width: 116px;
}

.auth-panel .primary-btn,
.auth-panel .secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line, var(--border, #d2d2d7));
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 760;
  line-height: 1;
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
}

.auth-panel .primary-btn {
  border-color: var(--accent, #0066cc);
  background: var(--accent, #0066cc);
  color: #fff;
  box-shadow: none;
}

.auth-panel .secondary-btn {
  background: transparent;
  color: var(--text, #1d1d1f);
}

.auth-panel .primary-btn:disabled,
.auth-panel .secondary-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.auth-text-btn {
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--sub, var(--muted, #6e6e73));
  font-family: inherit;
  font-size: 14px;
  font-weight: 760;
  line-height: 1;
  cursor: pointer;
}

.auth-text-btn:hover,
.auth-text-btn:focus-visible {
  color: var(--accent, #0066cc);
  outline: none;
}

.auth-reset-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

#btnRequestResetCode,
#btnRequestRegisterCode {
  align-self: end;
  min-width: 116px;
  white-space: nowrap;
}

.auth-message {
  color: var(--sub, var(--muted, #6e6e73));
  font-size: 0.78rem;
  line-height: 1.45;
}

.auth-message.warn {
  color: var(--accent, var(--danger, #b42318));
}

@media (max-width: 720px) {
  .auth-panel {
    width: calc(100vw - 24px);
    gap: 16px;
    padding: 22px;
    border-radius: 22px;
  }

  .auth-toast {
    max-width: calc(100vw - 24px);
    border-radius: 18px;
    white-space: normal;
  }

  .auth-head h2 {
    font-size: 1.46rem;
  }

  .auth-reset-code-row {
    grid-template-columns: 1fr;
  }
}
