/* Final dark-mode hardening layer — loaded after dark-mode-system. */
html[data-theme="dark"] body.papillon-account-screen{
  --account-dark-surface-1: var(--dk-surface-1);
  --account-dark-surface-2: var(--dk-surface-2);
  --account-dark-surface-3: var(--dk-surface-3);
}

/* --------------------------------------------------------------------------
   Account / profile hardening
   -------------------------------------------------------------------------- */
html[data-theme="dark"] body.papillon-account-screen :where(
  .papillon-profile-dashboard,
  .profile-mobile-title,
  .profile-welcome,
  .profile-data-card,
  .profile-data-grid>div,
  .profile-quick-links>a,
  .papillon-profile-sidebar,
  .profile-sidebar-user,
  .papillon-address-book-card,
  .papillon-saved-address-card,
  .papillon-order-view,
  .papillon-order-hero,
  .papillon-order-facts,
  .papillon-order-notes,
  .papillon-order-native-details,
  .papillon-order-delivery-address,
  .support-options>a,
  .account-form-heading,
  .papillon-login-form,
  .papillon-password-recovery-shell,
  .papillon-password-recovery-copy,
  .papillon-password-recovery-form,
  .woocommerce-Address,
  .woocommerce-EditAccountForm,
  .edit-account,
  .papillon-edit-address-form,
  .address-not-set
){
  border-color:var(--dk-border)!important;
  background:linear-gradient(180deg,var(--account-dark-surface-1),var(--account-dark-surface-2))!important;
  color:var(--dk-text)!important;
  box-shadow:none!important;
}
html[data-theme="dark"] body.papillon-account-screen :where(.profile-welcome-copy,.profile-card-heading div,.profile-mobile-title span,.profile-sidebar-identity,.profile-quick-link-copy,strong,h2,h3,h4){color:var(--dk-text)!important;}
html[data-theme="dark"] body.papillon-account-screen :where(.profile-welcome p,.profile-card-kicker,.profile-sidebar-user small,.profile-quick-link-copy small,.woocommerce-MyAccount-content p,.woocommerce-MyAccount-content li,.papillon-address-book-card p,.papillon-order-hero p,.papillon-order-facts small,.papillon-order-notes li,.address-not-set p){color:var(--dk-text-2)!important;}
html[data-theme="dark"] body.papillon-account-screen :where(.profile-stat,.profile-avatar,.profile-welcome-mark,.account-nav-icon,.profile-quick-link-icon,.papillon-order-section-icon){border-color:var(--dk-border)!important;background:var(--account-dark-surface-3)!important;color:var(--dk-accent)!important;}
html[data-theme="dark"] body.papillon-account-screen .profile-data-grid>div,
html[data-theme="dark"] body.papillon-account-screen .papillon-order-native-details .woocommerce-table--order-details,
html[data-theme="dark"] body.papillon-account-screen .papillon-order-native-details .woocommerce-table--order-details td,
html[data-theme="dark"] body.papillon-account-screen .papillon-order-native-details .woocommerce-table--order-details th{
  border-color:var(--dk-border)!important;
  background:transparent!important;
  color:var(--dk-text-2)!important;
}
html[data-theme="dark"] body.papillon-account-screen .papillon-account-nav,
html[data-theme="dark"] body.papillon-account-screen .papillon-profile-sidebar[data-account-nav-ready="true"][data-account-nav-state="expanded"] .papillon-account-nav,
html[data-theme="dark"] body.papillon-account-screen .papillon-profile-sidebar.is-expanded .papillon-account-nav{
  border-color:var(--dk-border)!important;
  background:var(--dk-surface-2)!important;
}
html[data-theme="dark"] body.papillon-account-screen .papillon-account-nav a{
  border-color:rgba(255,255,255,.06)!important;
  background:transparent!important;
  color:var(--dk-text-2)!important;
}
html[data-theme="dark"] body.papillon-account-screen .papillon-account-nav a:hover,
html[data-theme="dark"] body.papillon-account-screen .papillon-account-nav a.is-active{
  background:var(--dk-hover)!important;
  color:var(--dk-text)!important;
}
html[data-theme="dark"] body.papillon-account-screen :where(input.input-text,input[type="text"],input[type="email"],input[type="tel"],input[type="password"],select,textarea){
  border-color:var(--dk-border)!important;
  background:var(--dk-field)!important;
  color:var(--dk-text)!important;
}
html[data-theme="dark"] body.papillon-account-screen :where(input::placeholder,textarea::placeholder){color:var(--dk-muted)!important;opacity:1!important;}
html[data-theme="dark"] body.papillon-account-screen .auth-checkmark,
html[data-theme="dark"] body.papillon-account-screen .papillon-address-default-form button,
html[data-theme="dark"] body.papillon-account-screen .papillon-address-cancel,
html[data-theme="dark"] body.papillon-account-screen .profile-edit-link{
  border-color:var(--dk-border)!important;
  background:var(--dk-surface-3)!important;
  color:var(--dk-accent)!important;
}

/* --------------------------------------------------------------------------
   Checkout hardening
   -------------------------------------------------------------------------- */
html[data-theme="dark"] body.papillon-checkout-screen :where(
  .checkout-page-shell>.woocommerce,
  form.checkout,
  #customer_details>.col-1,
  #customer_details>.col-2,
  .woocommerce-billing-fields,
  .woocommerce-shipping-fields,
  .woocommerce-additional-fields,
  .checkout_coupon,
  .woocommerce-form-login,
  #order_review,
  #payment,
  .papillon-checkout-address-option,
  .select2-container .select2-selection--single,
  .select2-dropdown,
  .woocommerce-checkout-review-order-table,
  .woocommerce-checkout-review-order-table thead th,
  .woocommerce-checkout-review-order-table tbody td,
  .woocommerce-checkout-review-order-table tfoot th,
  .woocommerce-checkout-review-order-table tfoot td,
  .wc-block-components-sidebar,
  .wc-block-components-order-summary,
  .wc-block-components-checkout-step,
  .woocommerce-info,
  .woocommerce-error,
  .woocommerce-message
){
  border-color:var(--dk-border)!important;
  background:linear-gradient(180deg,var(--dk-surface-1),var(--dk-surface-2))!important;
  color:var(--dk-text)!important;
  box-shadow:none!important;
}
html[data-theme="dark"] body.papillon-checkout-screen .woocommerce-checkout-review-order-table :is(tr,th,td){border-color:var(--dk-border)!important;color:var(--dk-text-2)!important;}
html[data-theme="dark"] body.papillon-checkout-screen .woocommerce-checkout-review-order-table thead th,
html[data-theme="dark"] body.papillon-checkout-screen .woocommerce-checkout-review-order-table .order-total :is(th,td,.amount){background:var(--dk-surface-3)!important;color:var(--dk-text)!important;}
html[data-theme="dark"] body.papillon-checkout-screen .papillon-checkout-address-option.is-selected{background:linear-gradient(180deg,#112229,#163039)!important;box-shadow:0 0 0 2px rgba(105,200,192,.12)!important;border-color:rgba(105,200,192,.45)!important;}
html[data-theme="dark"] body.papillon-checkout-screen :where(.papillon-checkout-address-count,.papillon-checkout-address-edit,.papillon-checkout-address-radio,.papillon-checkout-address-badge){border-color:var(--dk-border)!important;background:var(--dk-surface-3)!important;color:var(--dk-accent)!important;}
html[data-theme="dark"] body.papillon-checkout-screen :is(.woocommerce-billing-fields,.woocommerce-additional-fields)>h3::before,
html[data-theme="dark"] body.papillon-checkout-screen #order_review_heading::before{background:var(--dk-surface-3)!important;color:var(--dk-accent)!important;}
html[data-theme="dark"] body.papillon-checkout-screen .papillon-checkout-address-option.is-selected .papillon-checkout-address-radio::after{background:var(--dk-accent)!important;}
html[data-theme="dark"] body.papillon-checkout-screen :where(.form-row .input-text,.form-row textarea,.form-row select,.select2-container .select2-selection--single){border-color:var(--dk-border)!important;background:var(--dk-field)!important;color:var(--dk-text)!important;}
html[data-theme="dark"] body.papillon-checkout-screen :where(.form-row label,.woocommerce-billing-fields>h3,.woocommerce-additional-fields>h3,.woocommerce-shipping-fields>h3,#ship-to-different-address,.transaction-page-heading>p,.transaction-page-heading .eyebrow){color:var(--dk-text-2)!important;}
html[data-theme="dark"] body.papillon-checkout-screen :where(#payment ul.payment_methods li,.place-order,div.payment_box){border-color:var(--dk-border)!important;background:var(--dk-surface-3)!important;color:var(--dk-text-2)!important;}
html[data-theme="dark"] body.papillon-checkout-screen #payment div.payment_box::before{border-bottom-color:var(--dk-surface-3)!important;}

/* --------------------------------------------------------------------------
   Cart hardening
   -------------------------------------------------------------------------- */
html[data-theme="dark"] body.papillon-cart-screen :where(
  .woocommerce-cart-form,
  .shop_table.cart,
  .shop_table.cart tbody tr.cart_item,
  .shop_table.cart td.actions,
  .shop_table.cart .coupon,
  .cart_totals,
  .cross-sells,
  .pap-empty-cart,
  .wc-block-cart__main,
  .wc-block-cart__sidebar,
  .wc-block-components-order-summary,
  .wc-block-components-totals-wrapper,
  .woocommerce-message,
  .woocommerce-info,
  .woocommerce-error
){
  border-color:var(--dk-border)!important;
  background:linear-gradient(180deg,var(--dk-surface-1),var(--dk-surface-2))!important;
  color:var(--dk-text)!important;
  box-shadow:none!important;
}
html[data-theme="dark"] body.papillon-cart-screen .shop_table.cart :is(th,td),
html[data-theme="dark"] body.papillon-cart-screen .cart_totals table :is(th,td),
html[data-theme="dark"] body.papillon-cart-screen .wc-block-cart-items td{
  border-color:var(--dk-border)!important;
  color:var(--dk-text-2)!important;
}
html[data-theme="dark"] body.papillon-cart-screen .shop_table.cart .coupon .input-text,
html[data-theme="dark"] body.papillon-cart-screen .cart_totals .shipping-calculator-form :is(input,select),
html[data-theme="dark"] body.papillon-cart-screen .quantity.pap-cart-quantity,
html[data-theme="dark"] body.papillon-cart-screen .quantity.pap-cart-quantity .qty,
html[data-theme="dark"] body.papillon-cart-screen .pap-cart-quantity-button,
html[data-theme="dark"] body.papillon-cart-screen .wc-block-components-quantity-selector{
  border-color:var(--dk-border)!important;
  background:var(--dk-field)!important;
  color:var(--dk-text)!important;
}
html[data-theme="dark"] body.papillon-cart-screen .shop_table.cart button[name="update_cart"]{background:var(--dk-surface-3)!important;color:var(--dk-accent)!important;border-color:var(--dk-border)!important;}
html[data-theme="dark"] body.papillon-cart-screen .pap-empty-cart-secondary{background:var(--dk-surface-3)!important;color:var(--dk-text)!important;border-color:var(--dk-border)!important;}

/* --------------------------------------------------------------------------
   Single product hardening
   -------------------------------------------------------------------------- */
html[data-theme="dark"] body.papillon-product-screen :where(
  .pap-single-product-main,
  .pap-product-gallery-column,
  .pap-product-summary-column,
  .pap-product-purchase-card,
  .pap-product-meta,
  .pap-product-tabs,
  .pap-product-tabs [role="tabpanel"],
  .pap-product-related,
  .related.products,
  .upsells.products,
  .woocommerce-product-details__short-description,
  .woocommerce-tabs,
  .commentlist .review,
  .comment-respond,
  form.variations_form,
  .variations,
  .quantity,
  .pap-product-sale-banner
){
  border-color:var(--dk-border)!important;
  background:linear-gradient(180deg,var(--dk-surface-1),var(--dk-surface-2))!important;
  color:var(--dk-text)!important;
  box-shadow:none!important;
}
/* جعبهٔ انتخاب متغیر و محصول گروهی: لایهٔ روشن (product-detail.css) با چهار کلاس
   و !important برنده می‌شد و در دارک‌مود یک کادر سفید می‌ماند؛ اینجا با
   گزینندهٔ قوی‌تر همان سطح دارک اعمال می‌شود. */
html[data-theme="dark"] body.papillon-product-screen div.product form.variations_form.cart,
html[data-theme="dark"] body.papillon-product-screen div.product form.grouped_form.cart{
  border-color:var(--dk-border)!important;
  background:linear-gradient(180deg,var(--dk-surface-1),var(--dk-surface-2))!important;
  color:var(--dk-text)!important;
  box-shadow:none!important;
}
html[data-theme="dark"] body.papillon-product-screen div.product form.variations_form.cart .variations tr,
html[data-theme="dark"] body.papillon-product-screen div.product form.variations_form.cart .single_variation_wrap{
  border-color:var(--dk-border-soft)!important;
}
html[data-theme="dark"] body.papillon-product-screen :where(.variations select,.quantity .qty,input.input-text,textarea,select){border-color:var(--dk-border)!important;background:var(--dk-field)!important;color:var(--dk-text)!important;}
html[data-theme="dark"] body.papillon-product-screen :where(.pap-product-meta,.woocommerce-tabs .panel,.woocommerce-tabs ul.tabs li a,.commentlist .description,.related.products .price,.upsells.products .price){color:var(--dk-text-2)!important;}

/* --------------------------------------------------------------------------
   پولیش کنتراست دارک‌مود — هر مورد با اسکنر کنتراست پیدا و با اندازه‌گیری
   دوباره تأیید شده است (نسبت‌ها در گزارش QA).
   -------------------------------------------------------------------------- */
/* متن توضیحات در تب‌های محصول: #5f7377 روی سطح تیره ۳٫۵:۱ می‌داد. */
html[data-theme="dark"] body.papillon-product-screen .pap-product-after-summary .woocommerce-Tabs-panel :where(p,li){
  color:var(--dk-text-2)!important;
}
/* نوار افزودن به سبد در موبایل پس‌زمینهٔ روشن #eef5f5 می‌گرفت. */
html[data-theme="dark"] body.papillon-product-screen div.product .woocommerce-variation-add-to-cart,
html[data-theme="dark"] body.papillon-product-screen div.product.product-type-simple form.cart{
  background:var(--dk-surface-2)!important;
  border-color:var(--dk-border)!important;
}

/* نشان‌های وضعیت تیکت: رنگ‌های روشن (#7a5200 …) روی سطح تیره ۲٫۵:۱ می‌دادند. */
html[data-theme="dark"] body.papillon-account-screen .pap-tickets__status{background:var(--dk-surface-3)!important;color:var(--dk-text-2)!important;}
html[data-theme="dark"] body.papillon-account-screen .pap-tickets__status.is-open{background:rgba(214,166,62,.20)!important;color:#f2d79a!important;}
html[data-theme="dark"] body.papillon-account-screen .pap-tickets__status.is-answered{background:rgba(45,168,124,.20)!important;color:#a5e9c8!important;}
html[data-theme="dark"] body.papillon-account-screen .pap-tickets__status.is-pending{background:rgba(105,200,192,.18)!important;color:var(--dk-accent)!important;}
html[data-theme="dark"] body.papillon-account-screen .pap-tickets__status.is-closed{background:var(--dk-surface-2)!important;color:var(--dk-muted)!important;}
html[data-theme="dark"] body.papillon-account-screen .pap-tickets__unread{background:rgba(214,166,62,.20)!important;color:#f2d79a!important;}
/* همان مشکل در نشان‌های درخواست شارژ کیف پول. */
html[data-theme="dark"] body.papillon-account-screen .pap-wallet__requests li.is-approved .pap-wallet__request-status{background:rgba(45,168,124,.20)!important;color:#a5e9c8!important;}
html[data-theme="dark"] body.papillon-account-screen .pap-wallet__requests li.is-rejected .pap-wallet__request-status{background:rgba(181,60,60,.22)!important;color:#ffb3b3!important;}
html[data-theme="dark"] body.papillon-account-screen .pap-wallet__requests li.is-pending .pap-wallet__request-status{background:rgba(214,166,62,.20)!important;color:#f2d79a!important;}
html[data-theme="dark"] body.papillon-account-screen .pap-wallet__request-note{color:#ffb3b3!important;}

/* حالت hover که لایهٔ روشن با رنگ‌های #fbfdfd/#f4fafa تقریباً سفید می‌کرد. */
html[data-theme="dark"] body.papillon-account-screen .support-options a:hover,
html[data-theme="dark"] body.papillon-account-screen .papillon-address-edit-action:hover,
html[data-theme="dark"] body.papillon-account-screen .papillon-address-default-form button:hover{
  border-color:var(--dk-border-strong)!important;
  background:var(--dk-hover)!important;
  color:var(--dk-text)!important;
}
html[data-theme="dark"] body.papillon-account-screen .support-options a:hover :where(b,small,span){color:var(--dk-text-2)!important;}

/* --------------------------------------------------------------------------
   Filled account controls
   `--account-accent` maps to the LIGHT teal (#69c8c0) in dark mode so accent
   text, links and indicators stay readable on dark surfaces — but the same
   token also paints every filled button, and a white label on that teal is
   1.98:1 («ذخیره تغییرات», «ارسال کد تأیید», address save, order actions).
   Fills therefore take the deep teal the rest of the dark theme uses
   (`--dk-accent-fill` + white = 7.0:1, hover 6.1:1); the light teal stays for
   text and indicators. Quiet controls (cancel, the re-send button) are
   excluded so they keep their soft surface.
   -------------------------------------------------------------------------- */
html[data-theme="dark"] body.papillon-account-screen :is(
  .woocommerce-MyAccount-content form .button:not(.papillon-address-cancel),
  .woocommerce-MyAccount-content .button:not(.papillon-address-cancel),
  .pap-orders__action.is-primary,
  .pap-orders-empty__button,
  .papillon-address-form-actions button.button,
  .papillon-login-form .auth-otp-send:not(.is-secondary)
){
  border-color:var(--dk-accent-fill)!important;
  background:var(--dk-accent-fill)!important;
  background-image:none!important;
  color:#fff!important;
  box-shadow:0 9px 22px rgba(0,0,0,.24)!important;
}
@media(hover:hover){
  html[data-theme="dark"] body.papillon-account-screen :is(
    .woocommerce-MyAccount-content form .button:not(.papillon-address-cancel),
    .woocommerce-MyAccount-content .button:not(.papillon-address-cancel),
    .pap-orders__action.is-primary,
    .pap-orders-empty__button,
    .papillon-address-form-actions button.button,
    .papillon-login-form .auth-otp-send:not(.is-secondary)
  ):hover:not(:disabled){
    border-color:var(--dk-accent-hover)!important;
    background:var(--dk-accent-hover)!important;
    color:#fff!important;
  }
}
/* Checked boxes and initials tiles are accent fills carrying a white glyph:
   same problem, same fill, and the glyph stays white. */
html[data-theme="dark"] body.papillon-account-screen :is(
  .auth-remember input:checked+.auth-checkmark,
  .papillon-address-default-choice>input[type="checkbox"]:checked+.papillon-address-checkbox-ui,
  .profile-avatar,
  .profile-welcome-mark
){
  border-color:var(--dk-accent-fill)!important;
  background-color:var(--dk-accent-fill)!important;
  background-image:linear-gradient(145deg,var(--dk-accent-hover),var(--dk-accent-fill))!important;
  color:#fff!important;
  box-shadow:none!important;
}

/* --------------------------------------------------------------------------
   Checkout text inks
   checkout-experience.css is written in light-mode inks. The surfaces under it
   are already normalized above; these are the labels on top that measured
   1.3–2.8:1 in dark (Section headings, the address kicker and summary, the
   coupon/loyalty links, the order table, the privacy note).
   -------------------------------------------------------------------------- */
html[data-theme="dark"] body.papillon-checkout-screen :is(
  .papillon-checkout-address-topline strong,
  .papillon-checkout-address-picker__heading h3,
  .woocommerce-checkout-review-order-table .product-name
){color:var(--dk-text)!important;}
/* Section headings are addressed by id in the light stylesheet, so they need an
   id here too — a `:where()` override loses to `#order_review_heading` whatever
   the load order. */
html[data-theme="dark"] body.papillon-checkout-screen #order_review_heading,
html[data-theme="dark"] body.papillon-checkout-screen :is(.woocommerce-billing-fields,.woocommerce-additional-fields)>h3{
  color:var(--dk-text)!important;
}
html[data-theme="dark"] body.papillon-checkout-screen :is(
  .papillon-checkout-address-text,
  .woocommerce-checkout-review-order-table .product-quantity
){color:var(--dk-text-2)!important;}
html[data-theme="dark"] body.papillon-checkout-screen :is(
  .papillon-checkout-address-kicker,
  .papillon-checkout-address-content small,
  .woocommerce-checkout-review-order-table thead th,
  .transaction-page-heading>p:last-child,
  #payment .woocommerce-privacy-policy-text
){color:var(--dk-muted)!important;}
html[data-theme="dark"] body.papillon-checkout-screen :is(
  .transaction-page-heading .eyebrow,
  .woocommerce-checkout-review-order-table .order-total th,
  .woocommerce-checkout-review-order-table .order-total td,
  .woocommerce-checkout-review-order-table .order-total .amount,
  .woocommerce-form-login-toggle .woocommerce-info a,
  .woocommerce-form-coupon-toggle .woocommerce-info a,
  #payment .woocommerce-privacy-policy-text a
){color:var(--dk-accent)!important;}
/* The little “i” chip and the selected radio dot are light-mode fills with no
   text role: they take the dark chip surface and the bright accent. */
html[data-theme="dark"] body.papillon-checkout-screen :is(.woocommerce-form-login-toggle,.woocommerce-form-coupon-toggle) .woocommerce-info::before{
  background:var(--dk-surface-3)!important;color:var(--dk-accent)!important;
}
html[data-theme="dark"] body.papillon-checkout-screen .papillon-checkout-address-option.is-selected .papillon-checkout-address-radio{
  border-color:var(--dk-accent)!important;background:var(--dk-field)!important;
}
html[data-theme="dark"] body.papillon-checkout-screen .papillon-checkout-address-option.is-selected .papillon-checkout-address-radio::after{
  background:var(--dk-accent)!important;
}

/* Strong contrast for dark-mode footer logo panel if any inherited light card leaks back in. */
html[data-theme="dark"] body .site-footer .brand-light,
html[data-theme="dark"] body .site-footer .footer-brand,
html[data-theme="dark"] body .site-footer .footer-brand-mark{
  background:transparent!important;
  box-shadow:none!important;
}
