/* Страницы входа и регистрации — всегда светлая тема */
html:has(body.auth-page--v2),
body.auth-page--v2,
body.auth-page--v2[data-theme="dark"],
body.auth-page--v2[data-theme="midnight"],
body.auth-page--v2[data-theme="graphite"],
body.auth-page--v2[data-theme="light"] {
  background: linear-gradient(165deg, #f4f6fb 0%, #e8ecf4 45%, #dfe6f2 100%) !important;
  color: #1a1d26 !important;
}

body.auth-modal-open {
  overflow: hidden;
}

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 16px 28px;
  box-sizing: border-box;
}

body.auth-page--v2 .auth-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(400px, 100%);
  margin: 0;
  padding: 0;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  box-sizing: border-box;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 16px;
  width: 100%;
}

.auth-logo-slot {
  flex: 0 0 auto;
  width: 100%;
  height: 140px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: min(260px, 88vw);
  max-height: 140px;
  object-fit: contain;
  margin: 0;
}

body.auth-page--v2 .auth-form h2 {
  margin: 0 0 6px !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em;
  color: #1a1d26 !important;
  text-align: center;
}

body.auth-page--v2 .auth-subtitle {
  margin: 0 !important;
  font-size: 14px !important;
  line-height: 1.45;
  color: #5c6370 !important;
  text-align: center;
}

body.auth-page--v2 .field-group {
  margin-top: 10px;
  width: 100%;
  box-sizing: border-box;
}

body.auth-page--v2 .field-icon {
  background: #2563eb !important;
  color: #fff !important;
  width: 32px !important;
  height: 32px !important;
  left: 10px !important;
  font-size: 16px !important;
}

body.auth-page--v2 .auth-form input[type="text"],
body.auth-page--v2 .auth-form input[type="password"],
body.auth-page--v2 .auth-card input[type="text"],
body.auth-page--v2 .auth-card input[type="password"] {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 50px !important;
  margin: 0 !important;
  padding: 0 14px 0 52px !important;
  box-sizing: border-box !important;
  background: #f0f2f7 !important;
  border: 1px solid #d8dde8 !important;
  border-radius: 999px !important;
  color: #1a1d26 !important;
  font-size: 15px !important;
  font-style: normal !important;
}

body.auth-page--v2 .auth-form input::placeholder,
body.auth-page--v2 .auth-card input::placeholder {
  color: #8b93a3 !important;
  font-style: normal !important;
}

.auth-terms-row {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
}

.auth-terms-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
  user-select: none;
  text-align: center;
  color: #1a1d26;
}

.auth-terms-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  padding: 0;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

.auth-agreement-link {
  display: inline;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  background: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: #2563eb !important;
  font: inherit;
  font-weight: 600;
  font-size: inherit;
  line-height: inherit;
  vertical-align: baseline;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.auth-agreement-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.auth-page--v2 .auth-form button#authSubmitBtn {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 16px 0 0 !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
  min-height: 50px !important;
  border: none !important;
  border-radius: 999px !important;
  background: #1a1d26 !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

body.auth-page--v2 .auth-form button#authSubmitBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

body.auth-page--v2 .auth-form button#authSubmitBtn:not(:disabled):hover {
  opacity: 0.92;
}

body.auth-page--v2 .auth-form > p {
  margin-top: 16px !important;
  font-size: 14px !important;
  text-align: center !important;
  width: 100%;
  color: #5c6370 !important;
}

body.auth-page--v2 .auth-form > p a {
  color: #2563eb !important;
  font-weight: 700 !important;
}

body.auth-page--v2 .error {
  color: #d63a5c !important;
  text-align: center;
  width: 100%;
  margin-top: 8px;
}

/* Модальное окно — тоже светлое */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.auth-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.45);
  backdrop-filter: blur(4px);
}

.auth-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  background: #fff !important;
  color: #1a1d26 !important;
  border-radius: 18px;
  border: 1px solid rgba(26, 29, 38, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e8ecf4;
  color: #1a1d26 !important;
}

.auth-modal-header h3,
.auth-modal-panel h3,
#agreementModalTitle {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #1a1d26 !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #1a1d26 !important;
}

.auth-modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #f0f2f7;
  color: #1a1d26;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.auth-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #4a5160;
}

.auth-modal-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid #e8ecf4;
}

.auth-modal-footer button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: #1a1d26 !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

@media (max-width: 420px) {
  .auth-logo-slot {
    height: 120px;
  }

  .auth-logo {
    max-height: 120px;
    max-width: min(220px, 88vw);
  }
}

/* Перебить global_redesign / style для auth */
body.auth-page--v2,
body.auth-page {
  background: linear-gradient(165deg, #f4f6fb 0%, #e8ecf4 45%, #dfe6f2 100%) !important;
  color: #1a1d26 !important;
}

body.auth-page--v2 .auth-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

body.auth-page--v2 .auth-form button:not(#authSubmitBtn),
body.auth-page--v2 .auth-card button:not(#authSubmitBtn) {
  width: auto !important;
  min-height: 0 !important;
}
