.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: min(400px, calc(100vw - 32px));
  width: 100%;
  min-width: 0;
  max-height: min(calc(100vh - 32px), calc(100dvh - 32px));
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  margin: auto;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: opacity 0.2s, visibility 0.2s;
}

.auth-modal--hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.auth-modal-overlay--loading {
  background: rgba(0,0,0,0.7);
}

.auth-modal__loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.auth-modal__loader--active {
  display: flex;
}

.auth-modal__loader-gif {
  max-width: 60px;
  max-height: 60px;
}

.auth-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

.auth-modal__close:hover {
  color: #333;
}

.auth-modal__tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.auth-modal__tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  border-bottom: 2px solid transparent;
}

.auth-modal__tab:hover {
  color: #333;
}

.auth-modal__tab--active {
  color: #333;
  background: #fff5eb;
  border-bottom-color: #e87d2c;
}

.auth-modal__panel {
  display: none;
}

.auth-modal__panel--active {
  display: block;
}

.auth-modal__label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #333;
}

.auth-modal__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.auth-modal__input:focus {
  outline: none;
  border-color: #e87d2c;
}

.auth-modal__btn {
  width: 100%;
  padding: 12px 20px;
  background: #e87d2c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

.auth-modal__btn:hover {
  background: #d66b1f;
}

.auth-modal__msg {
  margin-bottom: 12px;
  font-size: 13px;
  color: #c00;
  min-height: 18px;
}

.auth-modal__msg.success {
  color: #090;
}

.auth-modal__link {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--main-color, #4854a2);
}

.auth-modal__step--hidden,
.auth-modal__forgot-view--hidden {
  display: none !important;
}

.auth-modal__input-wrap {
  position: relative;
  margin-bottom: 16px;
}

.auth-modal__input-wrap .auth-modal__input {
  margin-bottom: 0;
  padding-right: 36px;
}

.auth-modal__hint {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ddd;
  text-align: center;
  line-height: 20px;
  font-size: 12px;
  color: #666;
  cursor: help;
  pointer-events: auto;
}

.auth-modal__hint:hover {
  background: #ccc;
}

/* Тултип при наведении на ? */
.auth-modal__hint[title] {
  position: absolute;
}

@media (max-width: 480px) {
  .auth-modal-overlay {
    padding: 8px;
    align-items: flex-start;
    left: 0;
    right: 0;
    width: 100%;
  }
  .auth-modal {
    max-width: calc(100vw - 16px);
    max-height: min(calc(100vh - 16px), calc(100dvh - 16px));
    padding: 20px 16px;
    width: 100%;
  }
}
