/* Страницы входа и регистрации — тёмная тема (community dark) */
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: radial-gradient(circle at 50% 0%, #1a1f2e 0%, #0e1118 70%, #000 100%) !important;
  color: #f5f5f5 !important;
  min-height: 100vh;
  min-height: 100dvh;
}

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: 32px 28px !important;
  background: rgba(22, 22, 22, 0.85) !important;
  border: 1px solid #2a2a2a !important;
  border-radius: 20px !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  box-sizing: border-box;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
  width: 100%;
}

.auth-logo-slot {
  flex: 0 0 auto;
  width: 100%;
  height: 120px;
  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: 120px;
  object-fit: contain;
  margin: 0;
  filter: brightness(1.1) saturate(1.1);
}

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: #ffffff !important;
  text-align: center;
}

body.auth-page--v2 .auth-subtitle {
  margin: 0 !important;
  font-size: 14px !important;
  line-height: 1.45;
  color: #a3a3a3 !important;
  text-align: center;
}

body.auth-page--v2 .field-group {
  margin-top: 12px;
  width: 100%;
  box-sizing: border-box;
}

body.auth-page--v2 .field-icon {
  background: #3b82f6 !important;
  color: #fff !important;
  width: 32px !important;
  height: 32px !important;
  left: 10px !important;
  font-size: 16px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

/* Поля ввода без подложки: прозрачный фон, без бордера, чистая типографика */
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: transparent !important;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 0 !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-style: normal !important;
  transition: border-color 0.15s ease;
}

body.auth-page--v2 .auth-form input[type="text"]:focus,
body.auth-page--v2 .auth-form input[type="password"]:focus,
body.auth-page--v2 .auth-card input[type="text"]:focus,
body.auth-page--v2 .auth-card input[type="password"]:focus {
  outline: none !important;
  border-color: transparent !important;
  border-bottom-color: #3b82f6 !important;
  background: transparent !important;
}

body.auth-page--v2 .auth-form input::placeholder,
body.auth-page--v2 .auth-card input::placeholder {
  color: #737373 !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: #d4d4d4;
}

.auth-terms-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  padding: 0;
  accent-color: #3b82f6;
  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: #60a5fa !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: #3b82f6 !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

body.auth-page--v2 .auth-form button#authSubmitBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #2a2a2a !important;
  color: #737373 !important;
}

body.auth-page--v2 .auth-form button#authSubmitBtn:not(:disabled):hover {
  background: #2f6df0 !important;
}

body.auth-page--v2 .auth-form button#authSubmitBtn:not(:disabled):active {
  transform: scale(0.99);
}

body.auth-page--v2 .auth-form > p {
  margin-top: 16px !important;
  font-size: 14px !important;
  text-align: center !important;
  width: 100%;
  color: #a3a3a3 !important;
}

body.auth-page--v2 .auth-form > p a {
  color: #60a5fa !important;
  font-weight: 700 !important;
  text-decoration: none;
}

body.auth-page--v2 .auth-form > p a:hover {
  text-decoration: underline;
}

body.auth-page--v2 .error {
  color: #ef4444 !important;
  text-align: center;
  width: 100%;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
}

/* Модальное окно — тоже тёмное */
.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(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.auth-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  background: #161616 !important;
  color: #f5f5f5 !important;
  border-radius: 18px;
  border: 1px solid #2a2a2a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #2a2a2a;
  color: #f5f5f5 !important;
}

.auth-modal-header h3,
.auth-modal-panel h3,
#agreementModalTitle {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #ffffff !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #ffffff !important;
}

.auth-modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #262626;
  color: #f5f5f5;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.auth-modal-close:hover {
  background: #333;
}

.auth-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c4c4c4;
}

.auth-modal-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid #2a2a2a;
}

.auth-modal-footer button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: #3b82f6 !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.auth-modal-footer button:hover {
  background: #2f6df0 !important;
}

@media (max-width: 420px) {
  .auth-logo-slot {
    height: 100px;
  }

  .auth-logo {
    max-height: 100px;
    max-width: min(220px, 88vw);
  }

  body.auth-page--v2 .auth-form {
    padding: 24px 20px !important;
  }
}

/* Перебить global_redesign / style для auth — тёмная тема */
body.auth-page--v2,
body.auth-page {
  background: radial-gradient(circle at 50% 0%, #1a1f2e 0%, #0e1118 70%, #000 100%) !important;
  color: #f5f5f5 !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;
}
