/* Общий стиль auth (Haze) — legacy /app и haze shell */
:root {
  --haze-accent: #ed5b2f;
  --haze-accent-muted: rgba(237, 91, 47, 0.14);
  --haze-surface: #1c252e;
  --haze-border: rgba(145, 158, 171, 0.22);
  --haze-text-muted: #919eab;
}

/* Выше sticky topbar (11050), assistant guide (12050), cookie (13000), drawer (12600).
   Иначе на телефоне окно регистрации оказывается «под» шапкой/баннером. */
.haze-auth-backdrop,
#authModal.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 14500;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.haze-auth-backdrop[hidden],
#authModal.auth-modal-overlay.hidden {
  display: none !important;
}

.haze-auth-card {
  position: relative;
  width: min(440px, 100%);
  max-height: min(92vh, 760px);
  max-height: min(92dvh, 760px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--haze-surface, #1c252e);
  border: 1px solid var(--haze-border);
  border-radius: 14px;
  padding: 22px 22px 20px;
  color: #fff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}
.haze-auth-card--wide { width: min(460px, 100%); }

/* Блокируем скролл страницы и прячем конкурирующие fixed-слои под auth */
body.haze-auth-open {
  overflow: hidden !important;
}
body.haze-auth-open .aspro-cookie-banner,
body.haze-auth-open .aspro-pilot-banner,
body.haze-auth-open .aspro-asst-fab,
body.haze-auth-open .aspro-assistant-fab,
body.haze-auth-open #asproAssistantFab,
body.haze-auth-open #supportFab,
body.haze-auth-open #supportModal {
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 768px) {
  .haze-auth-backdrop,
  #authModal.auth-modal-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top, 0px))
             max(12px, env(safe-area-inset-right, 0px))
             max(16px, env(safe-area-inset-bottom, 0px))
             max(12px, env(safe-area-inset-left, 0px));
  }
  .haze-auth-card,
  .haze-auth-card--wide {
    width: 100%;
    max-width: 100%;
    max-height: none;
    margin: 0 auto;
    border-radius: 12px;
    padding: 18px 16px 20px;
  }
  /* iOS не зумит форму при фокусе, если input ≥ 16px */
  .haze-input,
  .auth-glass-input.haze-input,
  .haze-auth-tab,
  .auth-tab.tab-btn.haze-auth-tab {
    font-size: 16px;
  }
  .haze-auth-tabs {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--haze-surface, #1c252e);
    padding-bottom: 4px;
  }
  body.gov-workspace .haze-auth-tabs {
    background: var(--gov-surface, #fff);
  }
}

.haze-auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--haze-text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.haze-auth-close:hover { color: #fff; background: rgba(255,255,255,0.06); }

.haze-auth-brand {
  text-align: center;
  margin-bottom: 16px;
}
.haze-auth-brand__logo { margin-bottom: 8px; border-radius: 10px; }
.haze-auth-brand__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.haze-auth-brand__tagline {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--haze-text-muted);
}

.haze-auth-vk {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(145, 158, 171, 0.14);
}
.haze-auth-vk__hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--haze-text-muted);
  text-align: center;
}
.haze-auth-vk__error {
  margin-top: 8px;
  font-size: 12px;
  color: #f87171;
  text-align: center;
  min-height: 1em;
}

.haze-auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.haze-auth-tab,
.auth-tab.tab-btn.haze-auth-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--haze-border);
  background: transparent;
  color: var(--haze-text-muted);
  cursor: pointer;
  font-size: 14px;
}
.haze-auth-tab.is-active,
.auth-tab.tab-btn.haze-auth-tab.is-active {
  background: var(--haze-accent-muted);
  border-color: var(--haze-accent);
  color: #fff;
}

.haze-label {
  display: block;
  font-size: 12px;
  color: var(--haze-text-muted);
  margin: 0 0 6px;
}
.haze-input,
.auth-glass-input.haze-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid var(--haze-border);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 15px;
}
.haze-input:focus,
.auth-glass-input.haze-input:focus {
  outline: none;
  border-color: var(--haze-accent);
  box-shadow: 0 0 0 2px var(--haze-accent-muted);
}

.haze-password-field {
  position: relative;
  margin-bottom: 12px;
}
.haze-password-field .haze-input,
.haze-password-field .auth-glass-input {
  margin-bottom: 0;
  padding-right: 44px;
}
.haze-password-field__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--haze-text-muted);
  cursor: pointer;
}
.haze-password-field__toggle:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.haze-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.haze-btn--primary,
.btn-lux.haze-btn--primary {
  width: 100%;
  background: var(--haze-accent);
  border-color: var(--haze-accent);
  color: #fff;
}
.haze-btn--primary:hover { filter: brightness(1.06); }
.haze-btn--ghost {
  background: transparent;
  border-color: var(--haze-border);
  color: var(--haze-text-muted);
}

.haze-auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--haze-text-muted);
  cursor: pointer;
}
.haze-auth-remember input { width: 16px; height: 16px; }

.haze-auth-link {
  font-size: 12px;
  color: var(--haze-accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  margin-bottom: 12px;
}

.haze-auth-card__error,
.haze-auth-card__success {
  font-size: 13px;
  margin-top: 10px;
  min-height: 1.2em;
}
.haze-auth-card__error { color: #f87171; }
.haze-auth-card__success {
  color: #6ee7b7;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(6, 78, 59, 0.35);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.haze-auth-divider {
  text-align: center;
  font-size: 12px;
  color: var(--haze-text-muted);
  margin: 0 0 12px;
}

.haze-auth-legal {
  border: 1px solid var(--haze-border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0 16px;
}
.haze-auth-legal__legend {
  font-size: 13px;
  font-weight: 600;
  padding: 0 6px;
}
.haze-auth-legal__intro {
  font-size: 12px;
  line-height: 1.45;
  color: var(--haze-text-muted);
  margin: 0 0 10px;
}
.haze-auth-legal__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 8px;
  cursor: pointer;
}
.haze-auth-legal__row a { color: var(--haze-accent); }
.haze-auth-legal__optional {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(145, 158, 171, 0.14);
}

.haze-drawer-hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--haze-text-muted);
  text-align: center;
}
.haze-drawer-hint a { color: var(--haze-accent); }

.auth-legal-group {
  border: 1px solid var(--haze-border);
  border-radius: 10px;
  padding: 12px 14px;
}
.auth-legal-group__legend {
  font-size: 13px;
  font-weight: 600;
  padding: 0 6px;
  color: #e2e8f0;
}

.haze-auth-vk-complete {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--haze-border);
  background: rgba(0,0,0,0.2);
}
.haze-auth-vk-complete.hidden { display: none !important; }

.haze-auth-reaccept {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(239, 246, 255, 0.95);
  color: #1e293b;
}
.haze-auth-reaccept[hidden] { display: none !important; }
.haze-auth-reaccept.hidden { display: none !important; }
.haze-auth-reaccept__msg {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.4;
  color: #b45309;
  font-weight: 600;
}
.haze-auth-reaccept__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  color: #334155;
}
.haze-auth-reaccept__row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}
.haze-auth-reaccept__row a {
  color: #2563eb;
  text-decoration: underline;
}
body[data-theme="dark"] .haze-auth-reaccept,
.haze-auth-card:not(.haze-auth-card--official) .haze-auth-reaccept {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(69, 26, 3, 0.35);
  color: #fde68a;
}
body[data-theme="dark"] .haze-auth-reaccept__msg,
.haze-auth-card:not(.haze-auth-card--official) .haze-auth-reaccept__msg {
  color: #fbbf24;
}
body[data-theme="dark"] .haze-auth-reaccept__row,
.haze-auth-card:not(.haze-auth-card--official) .haze-auth-reaccept__row {
  color: #e2e8f0;
}
body[data-theme="dark"] .haze-auth-reaccept__row a,
.haze-auth-card:not(.haze-auth-card--official) .haze-auth-reaccept__row a {
  color: #93c5fd;
}

.haze-auth-forgot.hidden { display: none !important; }

/* OFFICIAL-REGISTER: строгий мастер типа аккаунта */
.haze-auth-card__title--official {
  font-size: 20px;
  font-weight: 700;
  color: #f4f6f8;
  margin-bottom: 6px;
}
.haze-auth-card__lead--official {
  font-size: 14px;
  color: var(--haze-text-muted);
  margin-bottom: 16px;
}
.haze-reg-type-list {
  border: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.haze-reg-type {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 2px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.35;
  color: #dfe3e8;
  border-bottom: 1px solid rgba(145, 158, 171, 0.12);
}
.haze-reg-type:last-child { border-bottom: none; }
.haze-reg-type input[type="radio"] {
  margin-top: 3px;
  accent-color: #005fb8;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.haze-btn--official {
  background: #005fb8;
  border: 1px solid #005fb8;
  color: #fff;
  font-weight: 600;
  border-radius: 4px;
}
.haze-btn--official:hover { background: #004a94; border-color: #004a94; }
.haze-input--official {
  border-radius: 4px;
  border-color: rgba(145, 158, 171, 0.35);
}
.haze-label__req { color: #ef5350; font-size: 12px; }
.haze-auth-card__footer-link {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--haze-text-muted);
}
.haze-auth-link-btn {
  background: none;
  border: none;
  color: #64b5f6;
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  padding: 0;
}
.haze-auth-back-link {
  background: none;
  border: none;
  color: var(--haze-text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0 0 10px;
  margin-bottom: 4px;
}
.haze-auth-back-link:hover { color: #fff; }
.haze-reg-inn-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.haze-reg-inn-row .haze-input { flex: 1; min-width: 0; }
.haze-btn--sm { font-size: 12px; padding: 8px 10px; white-space: nowrap; }
.haze-reg-address { resize: vertical; min-height: 56px; }
.haze-reg-lookup-msg { font-size: 12px; margin: 6px 0 10px; }
.haze-reg-lookup-msg--ok { color: #66bb6a; }
.haze-reg-lookup-msg--warn { color: #ffb74d; }
.haze-reg-lookup-msg--err { color: #ef5350; }
