:root {
  color-scheme: light;
  --pmv-page-bg: #f5f5f7;
  --pmv-surface: #ffffff;
  --pmv-surface-soft: #f1f1f4;
  --pmv-text-theme: #211932;
  --pmv-muted-theme: #6d6878;
  --pmv-border-theme: #dedce4;
  --pmv-shadow-theme: 0 18px 48px rgba(33, 20, 62, .12);
}

html[data-theme="dark"] .checkout-legal-note{border-color:#4d4058;background:#211b29;color:#c9bdcf}
html[data-theme="dark"] .checkout-legal-note strong{color:#fff}
html[data-theme="dark"] .checkout-legal-note--custom{border-color:#745629;background:#2a2117;color:#e4d3b7}
html[data-theme="dark"] .checkout-checkbox label{color:#eee7f2}

html[data-theme="dark"] {
  color-scheme: dark;
  --shadow-soft: none;
  --pmv-page-bg: #0d0d12;
  --pmv-surface: #17171f;
  --pmv-surface-soft: #20202a;
  --pmv-surface-strong: #282833;
  --pmv-text-theme: #f5f2fb;
  --pmv-muted-theme: #b4afbe;
  --pmv-border-theme: #363541;
  --pmv-shadow-theme: none;
}

html[data-theme="dark"] body {
  background: var(--pmv-page-bg);
  color: var(--pmv-text-theme);
}

html[data-theme="dark"] :is(.site-header, .header-main, .category-menu, .product-card, .product-box, .cart-box,
  .cart-body, .checkout-card, .checkout-summary-card, .thankyou-box, .thankyou-body, .pmv-configurator__card,
  .pmv-editor-card, .pmv-editor-panel, .pmv-toolbar, .pmv-sidebar, .modal-content, .summary-box, .price-table,
  .form-card, .account-card, .admin-card, .admin-table-wrap) {
  background-color: var(--pmv-surface) !important;
  color: var(--pmv-text-theme);
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] :is(.products-section, .categories-section, .product-page, .cart-page, .checkout-page,
  .thankyou-page, .pmv-configurator, .pmv-editor-page, .pmv-canvas-editor, .project-page) {
  background-color: var(--pmv-page-bg) !important;
}

html[data-theme="dark"] :is(h1, h2, h3, h4, h5, h6, p, label, .product-title, .section-title, .nav-link,
  .category-link, .cart-cell, .summary-row, .pmv-configurator__nav-label, .pmv-configurator__pages-top a,
  .pmv-configurator__pages-bottom a) {
  color: inherit;
}

html[data-theme="dark"] :is(input, select, textarea) {
  background: #111118 !important;
  color: var(--pmv-text-theme) !important;
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] :is(.search-box, .search-box input, .price-table-head, .cart-row, .checkout-row,
  .pmv-configurator__filter select) {
  background-color: var(--pmv-surface-soft) !important;
  color: var(--pmv-text-theme) !important;
  border-color: var(--pmv-border-theme) !important;
}

/* Widoki produktu i podsumowania. */
html[data-theme="dark"] :is(.summary-card, .summary-body, .coupon-row, .summary-price, .project-selected-box,
  .downloads-box, .thankyou-info, .thankyou-btn--secondary, .empty-cart) {
  background: var(--pmv-surface) !important;
  color: var(--pmv-text-theme) !important;
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] :is(.summary-card, .summary-body, .coupon-row, .summary-price, .project-selected-box,
  .thankyou-info, .thankyou-total, .thankyou-btn--secondary) :is(strong, span, p) {
  color: inherit !important;
}

html[data-theme="dark"] :is(.coupon-row, .summary-price) {
  background: var(--pmv-surface-soft) !important;
  border-top-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] :is(.product-form .product-field label, .product-form .checkbox-field) {
  color: var(--pmv-text-theme) !important;
}

html[data-theme="dark"] .product-form .checkbox-field {
  background: var(--pmv-surface-soft) !important;
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] .price-row {
  color: var(--pmv-text-theme) !important;
  border-color: #777381 !important;
}

html[data-theme="dark"] .price-row .qty {
  background: var(--pmv-surface-soft) !important;
  border-right-color: #777381 !important;
}

html[data-theme="dark"] .price-row.active,
html[data-theme="dark"] .price-row:hover {
  border-color: #9b42ff !important;
}

html[data-theme="dark"] .price-row.active .qty {
  border-right-color: #9b42ff !important;
}

/* Koszyk. */
html[data-theme="dark"] :is(.cart-box, .cart-body, .cart-summary, .cart-coupon-panel, .empty-cart) {
  background: var(--pmv-surface) !important;
  color: var(--pmv-text-theme) !important;
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] .cart-row {
  background: var(--pmv-surface-soft) !important;
}

html[data-theme="dark"] .cart-cell {
  color: var(--pmv-text-theme) !important;
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] :is(.cart-product-title, .cart-size-cell, .cart-jm-cell, .cart-price-cell, .cart-total-row,
  .empty-cart p) {
  color: var(--pmv-text-theme) !important;
}

html[data-theme="dark"] .cart-meta-line {
  color: var(--pmv-muted-theme) !important;
}

html[data-theme="dark"] .cart-total-row:first-child {
  background: #302a40 !important;
}

html[data-theme="dark"] .cart-total-row:last-child {
  background: #35253f !important;
}

html[data-theme="dark"] .cart-total-row--discount {
  color: #d9b5ff !important;
}

html[data-theme="dark"] .cart-remove-btn {
  background: transparent !important;
  color: #ff8797 !important;
  border-color: #e25669 !important;
}

/* Realizacja zamówienia i ekran potwierdzenia. */
html[data-theme="dark"] :is(.checkout-card, .checkout-card-body, .checkout-summary-card, .checkout-summary-body,
  .checkout-summary-list, .checkout-summary-totals, .checkout-radio-option, .checkout-conditional,
  .checkout-sender-box, .inpost-modal-dialog, .inpost-modal-footer, .thankyou-box, .thankyou-body) {
  background: var(--pmv-surface) !important;
  color: var(--pmv-text-theme) !important;
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] :is(.checkout-card-body, .checkout-summary-list, .thankyou-body, .inpost-modal-body) {
  background: var(--pmv-surface-soft) !important;
}

html[data-theme="dark"] :is(.checkout-field label, .checkout-radio-option strong, .checkout-conditional-title,
  .checkout-sender-box, .checkout-checkbox label, .checkout-summary-item strong, .checkout-summary-item .price,
  .checkout-total-row, .inpost-picked-point, .inpost-picked-point strong) {
  color: var(--pmv-text-theme) !important;
}

html[data-theme="dark"] :is(.checkout-radio-option span, .checkout-summary-item .meta) {
  color: var(--pmv-muted-theme) !important;
}

html[data-theme="dark"] :is(.checkout-summary-item, .checkout-total-row, .checkout-summary-list,
  .checkout-total-row--grand, .inpost-modal-footer) {
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] .checkout-radio-option.is-active {
  background: #2b2040 !important;
  border-color: #9b42ff !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .locker-selected-badge {
  background: #2b2040 !important;
  color: #dcbfff !important;
}

html[data-theme="dark"] .inpost-modal-ghost {
  background: var(--pmv-surface-soft) !important;
  color: var(--pmv-text-theme) !important;
  border-color: var(--pmv-border-theme) !important;
}

html[data-theme="dark"] .thankyou-total {
  background: #302a40 !important;
  color: var(--pmv-text-theme) !important;
}

/* Udostępniony projekt i karty konfiguratora. */
html[data-theme="dark"] :is(.wrap .card, .wrap .preview, .pmv-configurator__card-frame) {
  background: var(--pmv-surface) !important;
  color: var(--pmv-text-theme) !important;
  border-color: var(--pmv-border-theme) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .wrap .preview {
  background: var(--pmv-surface-soft) !important;
}

html[data-theme="dark"] .wrap .meta {
  color: var(--pmv-muted-theme) !important;
}

html[data-theme="dark"] .faq-answer p {
  color: var(--pmv-muted-theme) !important;
}

/* Cienie ciemnych kart powodowały nachodzące na siebie pasy. */
html[data-theme="dark"] :is(.form-card, .account-card, .admin-card, .admin-stat, .admin-section,
  .admin-quick-link, .product-admin-card, .admin-table-wrap, .pmv-theme-switcher,
  .pmv-mobile-creator-guard__card, .inpost-modal-dialog) {
  box-shadow: none !important;
}

html[data-theme="dark"] img:not(.logo img) {
  filter: brightness(.94);
}

.pmv-theme-switcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10020;
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--pmv-border-theme);
  border-radius: 999px;
  background: color-mix(in srgb, var(--pmv-surface) 92%, transparent);
  box-shadow: var(--pmv-shadow-theme);
  backdrop-filter: blur(14px);
}

.pmv-theme-switcher button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pmv-muted-theme);
  cursor: pointer;
}

.pmv-theme-switcher button[aria-pressed="true"] {
  background: linear-gradient(135deg, #d10cff, #4d16ff);
  color: #fff;
}

.pmv-theme-switcher span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.pmv-mobile-creator-guard {
  display: none;
}

.pmv-flashes {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 10040;
  width: min(92vw, 620px);
  transform: translateX(-50%);
}

.pmv-flash {
  margin-bottom: 8px;
  padding: 13px 16px;
  border-radius: 12px;
  box-shadow: var(--pmv-shadow-theme);
  font-weight: 600;
}

.pmv-flash--success { background: #e7f8ee; color: #126633; }
.pmv-flash--error { background: #ffe8ec; color: #9b1833; }

@media (max-width: 767px) {
  .pmv-theme-switcher {
    right: 10px;
    bottom: 10px;
  }

  body.pmv-editor-page > :not(.pmv-mobile-creator-guard):not(.pmv-theme-switcher) {
    display: none !important;
  }

  body.pmv-editor-page .pmv-mobile-creator-guard {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 22px;
    background: var(--pmv-page-bg);
  }

  .pmv-mobile-creator-guard__card {
    width: min(100%, 470px);
    padding: 32px 24px;
    border: 1px solid var(--pmv-border-theme);
    border-radius: 24px;
    background: var(--pmv-surface);
    color: var(--pmv-text-theme);
    text-align: center;
    box-shadow: var(--pmv-shadow-theme);
  }

  .pmv-mobile-creator-guard__icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin: 0 auto 18px;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #d10cff, #2d00ff);
    color: #fff;
    font-size: 28px;
  }

  .pmv-mobile-creator-guard h1 { margin: 0 0 12px; font-size: 27px; }
  .pmv-mobile-creator-guard p { margin: 0 0 24px; color: var(--pmv-muted-theme); line-height: 1.6; }
  .pmv-mobile-creator-guard a {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-radius: 12px;
    background: linear-gradient(90deg, #d10cff, #2d00ff);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
  }
}
