/**
 * Тёмная тема — единый слой для публичных страниц витрины.
 * Родитель: body.page-site-content (вход, 404, доставка, блог, счёт, конструктор и т.д.).
 */
[data-theme="dark"] body.page-site-content {
  background: var(--bg) !important;
  color: var(--text);
}

/* Общая типографика: .policy, .page-content, .oferta-wrap */
[data-theme="dark"] body.page-site-content .policy h1,
[data-theme="dark"] body.page-site-content .policy h2,
[data-theme="dark"] body.page-site-content .oferta-wrap h1,
[data-theme="dark"] body.page-site-content .oferta-wrap h2,
[data-theme="dark"] body.page-site-content .page-content h1,
[data-theme="dark"] body.page-site-content .page-content h2 {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .policy h3,
[data-theme="dark"] body.page-site-content .oferta-wrap h3,
[data-theme="dark"] body.page-site-content .page-content h3 {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .policy p,
[data-theme="dark"] body.page-site-content .policy li,
[data-theme="dark"] body.page-site-content .oferta-wrap p,
[data-theme="dark"] body.page-site-content .oferta-wrap li,
[data-theme="dark"] body.page-site-content .page-content p,
[data-theme="dark"] body.page-site-content .page-content li {
  color: var(--text-secondary) !important;
}

/* Инлайн серые из шаблонов/редактора страниц (доставка, тексты из админки) */
[data-theme="dark"] body.page-site-content .policy [style*="color:#333"],
[data-theme="dark"] body.page-site-content .policy [style*="color: #333"],
[data-theme="dark"] body.page-site-content .policy [style*="color:#444"],
[data-theme="dark"] body.page-site-content .policy [style*="color: #444"],
[data-theme="dark"] body.page-site-content .policy [style*="color:#555"],
[data-theme="dark"] body.page-site-content .policy [style*="color: #555"],
[data-theme="dark"] body.page-site-content .policy [style*="color:#666"],
[data-theme="dark"] body.page-site-content .policy [style*="color: #666"],
[data-theme="dark"] body.page-site-content .policy [style*="color:#888"],
[data-theme="dark"] body.page-site-content .policy [style*="color: #888"] {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .policy strong,
[data-theme="dark"] body.page-site-content .del-card strong,
[data-theme="dark"] body.page-site-content .pp-card strong {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .policy a,
[data-theme="dark"] body.page-site-content .oferta-wrap a,
[data-theme="dark"] body.page-site-content .page-content a,
[data-theme="dark"] body.page-site-content .back-link {
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content .policy .info-block,
[data-theme="dark"] body.page-site-content .oferta-wrap .info-block {
  background: rgba(77, 154, 255, 0.1) !important;
  border-left-color: var(--primary) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .policy .warn-block {
  background: rgba(255, 152, 0, 0.12) !important;
  border-left-color: #ff9800 !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .detail-grid dt {
  color: var(--text-muted) !important;
}

[data-theme="dark"] body.page-site-content .detail-grid dd {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .page-content th,
[data-theme="dark"] body.page-site-content .page-content td {
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .page-content th {
  background: var(--bg-secondary) !important;
  color: var(--text) !important;
}

/* Доставка: карточки */
[data-theme="dark"] body.page-site-content .del-card {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
}

[data-theme="dark"] body.page-site-content .del-card h3,
[data-theme="dark"] body.page-site-content .del-card h4 {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .del-card p,
[data-theme="dark"] body.page-site-content .pp-card p {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .pp-card {
  background: var(--card) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] body.page-site-content .pp-card h4 {
  color: var(--text) !important;
}

/* Контакты */
[data-theme="dark"] body.page-site-content .cc {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] body.page-site-content .cc h3 {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .cc p {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .cc-icon {
  color: var(--primary) !important;
}

/* Возврат: таймлайн */
[data-theme="dark"] body.page-site-content .tl-item {
  border-left-color: var(--border) !important;
}

[data-theme="dark"] body.page-site-content .tl-item::before {
  background: var(--primary) !important;
  border-color: var(--card) !important;
  box-shadow: 0 0 0 2px var(--primary) !important;
}

[data-theme="dark"] body.page-site-content .tl-item h4 {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .tl-item p {
  color: var(--text-secondary) !important;
}

/* Оферта: подзаголовок с инлайном color:#666 */
[data-theme="dark"] body.page-site-content .oferta-wrap p[style*="color:#666"] {
  color: var(--text-muted) !important;
}

/* Блог: список */
[data-theme="dark"] body.page-site-content .blog-hero {
  background: linear-gradient(135deg, #1a1d2e 0%, #1e3a5f 45%, var(--primary) 160%) !important;
  color: #fff !important;
}

[data-theme="dark"] body.page-site-content .blog-card {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
}

[data-theme="dark"] body.page-site-content .blog-card:hover {
  box-shadow: var(--shadow-lg) !important;
}

[data-theme="dark"] body.page-site-content .blog-card__cover-wrap,
[data-theme="dark"] body.page-site-content .blog-card__cover {
  background: #fff !important;
}

[data-theme="dark"] body.page-site-content .blog-card__cover-placeholder {
  background: linear-gradient(135deg, var(--bg-secondary), rgba(77, 154, 255, 0.12)) !important;
  color: var(--text-muted) !important;
}

[data-theme="dark"] body.page-site-content .blog-card__date {
  color: var(--text-muted) !important;
}

[data-theme="dark"] body.page-site-content .blog-card__title {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .blog-card__excerpt {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .blog-card__read {
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content .blog-card__cat {
  background: rgba(77, 154, 255, 0.15) !important;
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content .blog-cat-link {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .blog-cat-link:hover {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content .blog-cat-link.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content .empty-blog {
  color: var(--text-muted) !important;
}

[data-theme="dark"] body.page-site-content .empty-blog i {
  color: var(--border) !important;
}

[data-theme="dark"] body.page-site-content .pagination .page-btn:not(.active) {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .pagination .page-btn:hover,
[data-theme="dark"] body.page-site-content .pagination .page-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Блог: статья */
[data-theme="dark"] body.page-site-content .blog-post__back {
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__date {
  color: var(--text-muted) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__title {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__content {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__content h2,
[data-theme="dark"] body.page-site-content .blog-post__content h3 {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__content blockquote {
  background: rgba(77, 154, 255, 0.1) !important;
  border-left-color: var(--primary) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__content th,
[data-theme="dark"] body.page-site-content .blog-post__content td {
  border-color: var(--border) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__content th {
  background: var(--bg-secondary) !important;
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__cover-wrap {
  background: #fff !important;
}

[data-theme="dark"] body.page-site-content .blog-post__car-btn {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content .blog-post__car-btn:hover {
  background: var(--bg-secondary) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content .blog-post-wrap div[style*="border-top:1px solid #eee"] {
  border-top-color: var(--border) !important;
}

[data-theme="dark"] body.page-site-content .blog-post-wrap span[style*="color:#888"] {
  color: var(--text-muted) !important;
}

/* Вход / восстановление пароля — общая вёрстка (светлая и тёмная) */
body.page-site-content.page-auth .auth-lead {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.95rem;
  line-height: 1.5;
}

body.page-site-content.page-auth .auth-oauth {
  border-top: 1px solid var(--border);
  text-align: center;
}

body.page-site-content.page-auth .auth-oauth__lead {
  font-size: 0.88rem;
  margin: 0 0 12px;
  text-align: center;
}

body.page-site-content.page-auth .auth-oauth__buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Одинаковый «размер кнопки» для Telegram и Google (ширина виджета Telegram large ≈ 238px) */
body.page-site-content.page-auth .auth-oauth__telegram-wrap,
body.page-site-content.page-auth .auth-oauth-google {
  width: 240px;
  min-height: 48px;
  box-sizing: border-box;
  flex: 0 0 auto;
}

body.page-site-content.page-auth .auth-oauth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 0.9rem;
  border-radius: 10px;
  border-color: var(--border);
  background: var(--card);
  color: var(--text);
}

body.page-site-content.page-auth .auth-oauth-google:hover {
  border-color: var(--primary);
  color: var(--primary);
}

body.page-site-content.page-auth .auth-oauth-google img {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  body.page-site-content.page-auth .auth-oauth__telegram-wrap,
  body.page-site-content.page-auth .auth-oauth-google {
    width: 100%;
    max-width: 240px;
  }
}

@media (min-width: 769px) {
  body.page-site-content.page-auth .auth-oauth__buttons {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    gap: 12px 16px;
  }
}

/* Обводка вокруг Telegram iframe — та же геометрия, что у .auth-oauth-google */
body.page-site-content.page-auth .auth-oauth__telegram-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  line-height: 0;
}

body.page-site-content.page-auth .auth-oauth__telegram-wrap iframe {
  width: 238px !important;
  height: 40px !important;
  max-width: 100%;
  border: 0;
}

/* Согласие на ПДн — регистрация */
body.page-site-content.page-auth .auth-privacy-consent__label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 400;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-secondary);
  margin: 0;
}

body.page-site-content.page-auth .auth-privacy-consent__label input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

body.page-site-content.page-auth .auth-privacy-consent__policy {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.page-site-content.page-auth .auth-privacy-consent__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

/* Вход / восстановление пароля — тёмная тема */
[data-theme="dark"] body.page-site-content.page-auth main.container h1 {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content.page-auth a[href]:not(.btn):not(.auth-oauth-google) {
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content.page-auth p[style*="color:#888"],
[data-theme="dark"] body.page-site-content.page-auth p[style*="color: #888"] {
  color: var(--text-muted) !important;
}

/* Убрать «плашку» var(--card) у форм входа: фон страницы + поля с собственным bg */
[data-theme="dark"] body.page-site-content.page-auth form.auth-form.checkout-form {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
}

[data-theme="dark"] body.page-site-content.page-auth .auth-oauth-google {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content.page-auth .auth-oauth-google:hover {
  background: var(--card) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content.page-auth .auth-oauth__telegram-wrap {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
}

/* Виджет Telegram / страница ошибки (Bot domain invalid) в iframe — светлая внутри; инверсия для тёмной темы */
[data-theme="dark"] body.page-site-content.page-auth .auth-oauth__telegram-wrap iframe {
  filter: invert(1) hue-rotate(180deg);
  border-radius: 8px;
}

[data-theme="dark"] body.page-site-content.page-auth .auth-privacy-consent__label {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content.page-auth .auth-privacy-consent__policy {
  color: var(--primary) !important;
}

[data-theme="dark"] body.page-site-content.page-auth div[style*="background:#fff3e0"],
[data-theme="dark"] body.page-site-content.page-auth div[style*="background: #fff3e0"] {
  background: rgba(255, 152, 0, 0.18) !important;
  border-color: rgba(255, 183, 77, 0.45) !important;
}

[data-theme="dark"] body.page-site-content.page-auth div[style*="background:#fff3e0"] h2,
[data-theme="dark"] body.page-site-content.page-auth div[style*="background: #fff3e0"] h2 {
  color: #ffcc80 !important;
}

[data-theme="dark"] body.page-site-content.page-auth div[style*="background:#fff3e0"] p,
[data-theme="dark"] body.page-site-content.page-auth div[style*="background: #fff3e0"] p {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content.page-auth #fpReqs,
[data-theme="dark"] body.page-site-content.page-auth #passwordRequirements {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content.page-auth #fpReqs div[style*="border-top:1px solid #eee"],
[data-theme="dark"] body.page-site-content.page-auth #passwordRequirements div[style*="border-top:1px solid #e0e0e0"] {
  border-top-color: var(--border) !important;
}

[data-theme="dark"] body.page-site-content.page-auth #passwordRequirements div[style*="color:#333"],
[data-theme="dark"] body.page-site-content.page-auth #passwordRequirements div[style*="color: #333"] {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content.page-auth a.btn-outline[style*="background:#fff"],
[data-theme="dark"] body.page-site-content.page-auth a.btn-outline[style*="background: #fff"] {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* 404 */
[data-theme="dark"] body.page-site-content.page-error .error-page__code {
  color: var(--border) !important;
}

[data-theme="dark"] body.page-site-content.page-error .error-page__title {
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content.page-error .error-page__text {
  color: var(--text-secondary) !important;
}

/* Загрузка файлов к заказу */
[data-theme="dark"] body.page-site-content.order-upload-body .order-upload-page label {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] body.page-site-content.order-upload-body .order-upload-page input[type="file"][style*="border:1px solid #ddd"] {
  border-color: var(--border) !important;
}

/* Счёт на оплату — экран; печать остаётся светлой */
@media screen {
  [data-theme="dark"] body.page-site-content.page-invoice {
    background: var(--bg) !important;
    color: var(--text) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .invoice {
    background: var(--card) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-md) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .inv-logo {
    color: var(--primary) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .inv-num h1 {
    color: var(--text) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .inv-num p,
  [data-theme="dark"] body.page-site-content.page-invoice .inv-section h3,
  [data-theme="dark"] body.page-site-content.page-invoice .inv-footer {
    color: var(--text-muted) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .inv-party-box {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .inv-party-box h4,
  [data-theme="dark"] body.page-site-content.page-invoice .qr-info strong {
    color: var(--text) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .inv-party-box p,
  [data-theme="dark"] body.page-site-content.page-invoice .qr-info {
    color: var(--text-secondary) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice th {
    background: var(--bg-secondary) !important;
    color: var(--text-muted) !important;
    border-bottom-color: var(--border) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice td {
    color: var(--text-secondary) !important;
    border-bottom-color: var(--border) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .total-row td {
    color: var(--text) !important;
    border-top-color: var(--border) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .qr-section {
    background: var(--bg-secondary) !important;
    border-color: var(--border) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .act-btn-back {
    background: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
  }

  [data-theme="dark"] body.page-site-content.page-invoice .act-btn-back:hover {
    background: var(--card) !important;
    color: var(--text) !important;
  }
}

@media print {
  body.page-invoice,
  body.page-invoice .invoice,
  body.page-invoice table,
  body.page-invoice .inv-party-box,
  body.page-invoice th,
  body.page-invoice td {
    background: #fff !important;
    color: #222 !important;
    box-shadow: none !important;
  }

  body.page-invoice .inv-logo {
    color: #005bff !important;
  }

  body.page-invoice .inv-num h1,
  body.page-invoice .inv-party-box h4,
  body.page-invoice .qr-info strong {
    color: #1a1a2e !important;
  }

  body.page-invoice .inv-num p,
  body.page-invoice .inv-section h3,
  body.page-invoice .inv-party-box p,
  body.page-invoice .qr-info,
  body.page-invoice .inv-footer {
    color: #555 !important;
  }
}

/* Popup привязки Telegram */
[data-theme="dark"] body.page-site-content.page-telegram-popup {
  background: var(--bg) !important;
  color: var(--text) !important;
}

[data-theme="dark"] body.page-site-content.page-telegram-popup p[style*="color:#888"],
[data-theme="dark"] body.page-site-content.page-telegram-popup p[style*="color: #888"] {
  color: var(--text-muted) !important;
}

/* Конструктор: общий фон страницы с шапкой */
[data-theme="dark"] body.constructor-page.page-site-content {
  background: var(--bg) !important;
  color: var(--text);
}
