/* ===========================================================================
   HxH Store · MASTER UI FIX (vFinal)
   Fixes: black boxes on light themes, signup/showcase layout,
          desktop auth view, coupon-box dark background, smooth animations,
          theme card backgrounds, typography/spacing polish.
   Loads LAST so it wins over all prior layers.
   =========================================================================== */

/* --------------------------------------------------------------------------
 * -1. THEME TOKEN FALLBACKS (so every light theme has all rx-* vars even if
 *     ux-next.css hasn't executed when a component renders).
 * ----------------------------------------------------------------------- */
:root {
  --rx-bg: #f6f4fc; --rx-bg-2: #f0edfa; --rx-ink: #191327; --rx-ink-2: #5f5873;
  --rx-ink-3: #928ba6; --rx-card: #ffffff;
  --rx-accent: #6d3bf5; --rx-accent-2: #9b6bff; --rx-accent-3: #c5aaff;
  --rx-soft: #f1edfc; --rx-ring: #c5aaff; --rx-line: #e6e0f6;
  --rx-glow: rgba(109,59,245,.7); --rx-glow-soft: rgba(109,59,245,.4);
  --rx-blob-a: rgba(197,170,255,.7); --rx-blob-b: rgba(155,107,255,.45);
  --rx-grad: linear-gradient(135deg,#6d3bf5,#5b2be0,#4a1fc7);
  --purple: #6d3bf5;
  --panel: #ffffff; --panel2: #f0edfa; --line: #e6e0f6; --text: #191327; --muted: #5f5873;
}
html[data-theme="ivory"] {
  --rx-bg:#f7f4ec;--rx-bg-2:#f2efe5;--rx-ink:#15211b;--rx-ink-2:#4d5b53;--rx-ink-3:#8d978f;
  --rx-card:#fff;--rx-accent:#0e7c5a;--rx-accent-2:#17a67a;--rx-accent-3:#3ecf9e;
  --rx-soft:#edf7f1;--rx-ring:#9fe8cd;--rx-line:#e7e2d5;
  --rx-glow:rgba(14,124,90,.75);--rx-glow-soft:rgba(14,124,90,.45);
  --rx-blob-a:rgba(159,232,205,.85);--rx-blob-b:rgba(62,207,158,.5);
  --rx-grad:linear-gradient(135deg,#0e7c5a,#0b6a4e,#095a42);
  --purple:#0e7c5a;--panel:#fff;--panel2:#f2efe5;--line:#e7e2d5;--text:#15211b;--muted:#4d5b53;
}
html[data-theme="sand"] {
  --rx-bg:#f4efe6;--rx-bg-2:#eee7da;--rx-ink:#2b2019;--rx-ink-2:#6b5a4c;--rx-ink-3:#9a8879;
  --rx-card:#fffdf9;--rx-accent:#a65b32;--rx-accent-2:#d08a57;--rx-accent-3:#eabf9b;
  --rx-soft:#f9f1e6;--rx-ring:#e5c3a4;--rx-line:#e9ddca;
  --rx-glow:rgba(166,91,50,.7);--rx-glow-soft:rgba(166,91,50,.4);
  --rx-grad:linear-gradient(135deg,#a65b32,#93502b,#7d4323);
  --purple:#a65b32;--panel:#fffdf9;--panel2:#eee7da;--line:#e9ddca;--text:#2b2019;--muted:#6b5a4c;
}
html[data-theme="ocean"] {
  --rx-bg:#eff6f7;--rx-bg-2:#e7f1f3;--rx-ink:#0b2430;--rx-ink-2:#4d6570;--rx-ink-3:#8398a1;
  --rx-card:#fff;--rx-accent:#0e7490;--rx-accent-2:#22a3b8;--rx-accent-3:#7fd6e0;
  --rx-soft:#e6f4f6;--rx-ring:#9adde8;--rx-line:#dcebee;
  --rx-glow:rgba(14,116,144,.7);--rx-glow-soft:rgba(14,116,144,.4);
  --rx-grad:linear-gradient(135deg,#0e7490,#0c667f,#0a586e);
  --purple:#0e7490;--panel:#fff;--panel2:#e7f1f3;--line:#dcebee;--text:#0b2430;--muted:#4d6570;
}
html[data-theme="rose"] {
  --rx-bg:#fcf3f2;--rx-bg-2:#f8eae9;--rx-ink:#2a151b;--rx-ink-2:#6d5259;--rx-ink-3:#a08a90;
  --rx-card:#fffdfd;--rx-accent:#d6436b;--rx-accent-2:#f08ca4;--rx-accent-3:#ffc2d0;
  --rx-soft:#fdeef1;--rx-ring:#ffc2d0;--rx-line:#f2dfde;
  --rx-glow:rgba(214,67,107,.65);--rx-glow-soft:rgba(214,67,107,.4);
  --rx-grad:linear-gradient(135deg,#d6436b,#c5365d,#ad2b50);
  --purple:#d6436b;--panel:#fffdfd;--panel2:#f8eae9;--line:#f2dfde;--text:#2a151b;--muted:#6d5259;
}
html[data-theme="midnight"],html[data-theme="black"] {
  --rx-bg:#080c11;--rx-bg-2:#0d131a;--rx-ink:#e9f4ef;--rx-ink-2:#a4b6ae;--rx-ink-3:#74857e;
  --rx-card:#111820;--rx-accent:#37dda3;--rx-accent-2:#6df2c6;--rx-accent-3:#b4ffe4;
  --rx-soft:rgba(55,221,163,.09);--rx-ring:rgba(55,221,163,.4);--rx-line:rgba(255,255,255,.09);
  --rx-glow:rgba(55,221,163,.4);--rx-glow-soft:rgba(55,221,163,.25);
  --rx-grad:linear-gradient(135deg,#37dda3,#23c48d,#16a878);
  --purple:#37dda3;--panel:#111820;--panel2:#0d131a;--line:rgba(255,255,255,.09);--text:#e9f4ef;--muted:#a4b6ae;
}

/* --------------------------------------------------------------------------
 * 0. GLOBAL SMOOTHNESS & PERFORMANCE
 * ----------------------------------------------------------------------- */
html { scroll-behavior: smooth; }
html, body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
* {
  -webkit-tap-highlight-color: transparent;
}
button, a, .btn, .icon-btn, input, select, textarea, .product, .card,
.panel, .stat, .theme-option-card, .category-card, .coupon-box, .line-item {
  transition: background-color 0.22s ease, border-color 0.22s ease,
              color 0.22s ease, box-shadow 0.22s ease,
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease;
}
.btn {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s ease, background 0.22s ease,
              color 0.22s ease, border-color 0.22s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }

/* --------------------------------------------------------------------------
 * 1. DARK-BOX-ON-LIGHT-THEME FIX
 *    Ensure ALL panels/cards/boxes use theme-aware light surfaces on light
 *    themes (ivory, violet, sand, ocean, rose, white, default).
 * ----------------------------------------------------------------------- */
html[data-theme="ivory"],
html[data-theme="violet"],
html[data-theme="sand"],
html[data-theme="ocean"],
html[data-theme="rose"],
html[data-theme="white"],
html[data-theme="default"] {
  color-scheme: light;
}
html[data-theme="midnight"],
html[data-theme="black"] {
  color-scheme: dark;
}

/* Panels, cards, modals — use the rx-card token when it exists, else a safe
   light/dark fallback. */
html body .panel,
html body .stat,
html body .modal,
html body .product,
html body .category-card,
html body .featured-showcase,
html body .theme-option-card,
html body .coupon-box,
html body .coupon-card,
html body .profile-hero-card,
html body .notif-drawer-content,
html body .reorder-product-card,
html body .admin-ai-copilot-panel,
html body .api-tester-card,
html body .captcha-panel,
html body .verification-status-card,
html body .preferences-panel,
html body .wallet-deposit-panel,
html body .wallet-summary-col .stat,
html body .wallet-requests-panel,
html body .wallet-history-panel,
html body .hxh-app-hero,
html body .hxh-install-modal {
  background: var(--rx-card, #ffffff) !important;
  color: var(--rx-ink, #15211b) !important;
  border-color: var(--rx-line, #e7e2d5) !important;
}

/* Secondary panels (panel2) */
html body .coupon-box,
html body .theme-option-card,
html body .auth-remember-field .remember-me-label,
html body .search-footer-wrap,
html body .table-wrap,
html body .preference-block,
html body .currency-chips-wrap {
  background: var(--rx-bg-2, #f2efe5) !important;
}

/* Text color fixes in light themes */
html[data-theme="ivory"] h1, html[data-theme="ivory"] h2, html[data-theme="ivory"] h3,
html[data-theme="ivory"] h4, html[data-theme="ivory"] strong,
html[data-theme="violet"] h1, html[data-theme="violet"] h2, html[data-theme="violet"] h3,
html[data-theme="violet"] h4, html[data-theme="violet"] strong,
html[data-theme="sand"] h1, html[data-theme="sand"] h2, html[data-theme="sand"] h3,
html[data-theme="sand"] h4, html[data-theme="sand"] strong,
html[data-theme="ocean"] h1, html[data-theme="ocean"] h2, html[data-theme="ocean"] h3,
html[data-theme="ocean"] h4, html[data-theme="ocean"] strong,
html[data-theme="rose"] h1, html[data-theme="rose"] h2, html[data-theme="rose"] h3,
html[data-theme="rose"] h4, html[data-theme="rose"] strong,
html[data-theme="white"] h1, html[data-theme="white"] h2, html[data-theme="white"] h3,
html[data-theme="white"] h4, html[data-theme="white"] strong,
html[data-theme="default"] h1, html[data-theme="default"] h2, html[data-theme="default"] h3,
html[data-theme="default"] h4, html[data-theme="default"] strong {
  color: var(--rx-ink, #15211b) !important;
}

html body p,
html body .muted,
html body small:not(.status):not(.live-pill):not(.range-pill):not(.ref-bonus-pill):not(.profile-role-badge):not(.verification-status-pill),
html body .form-note,
html body .field-hint {
  color: var(--rx-ink-2, #4d5b53) !important;
}

/* Inputs in light themes */
html[data-theme="ivory"] input, html[data-theme="ivory"] select, html[data-theme="ivory"] textarea,
html[data-theme="violet"] input, html[data-theme="violet"] select, html[data-theme="violet"] textarea,
html[data-theme="sand"] input, html[data-theme="sand"] select, html[data-theme="sand"] textarea,
html[data-theme="ocean"] input, html[data-theme="ocean"] select, html[data-theme="ocean"] textarea,
html[data-theme="rose"] input, html[data-theme="rose"] select, html[data-theme="rose"] textarea,
html[data-theme="white"] input, html[data-theme="white"] select, html[data-theme="white"] textarea,
html[data-theme="default"] input, html[data-theme="default"] select, html[data-theme="default"] textarea {
  background: #ffffff !important;
  color: var(--rx-ink, #15211b) !important;
  border-color: var(--rx-line, #e7e2d5) !important;
}
html body input::placeholder,
html body textarea::placeholder {
  color: var(--rx-ink-3, #8d978f) !important;
  opacity: 1;
}

/* Coupon box specific — was showing black */
html body .coupon-box {
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink, #15211b) !important;
  border-radius: 16px !important;
}
html body .coupon-input-row input {
  background: var(--rx-card, #ffffff) !important;
  color: var(--rx-ink, #15211b) !important;
  border: 1.5px solid var(--rx-line, #e7e2d5) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  font-family: inherit !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase;
}
html body .coupon-input-row input:focus {
  border-color: var(--rx-accent, #0e7c5a) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--rx-accent, #0e7c5a) 14%, transparent) !important;
  outline: none;
}
html body .applied-coupon-tag {
  background: color-mix(in srgb, var(--rx-accent-2, #17a67a) 13%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--rx-accent-2, #17a67a) 35%, transparent) !important;
  color: var(--rx-accent, #0e7c5a) !important;
  border-radius: 12px;
}
html body .applied-coupon-tag strong { color: var(--rx-accent, #0e7c5a) !important; }
html body .cart-discount-row { color: var(--rx-accent, #0e7c5a) !important; }

/* Theme cards */
html body .theme-option-card {
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 2px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink, #15211b) !important;
  border-radius: 20px !important;
}
html body .theme-option-card h3 { color: var(--rx-ink, #15211b) !important; }
html body .theme-option-card p { color: var(--rx-ink-2, #4d5b53) !important; }
html body .theme-option-card.active {
  background: var(--rx-card, #ffffff) !important;
  border-color: var(--rx-accent, #0e7c5a) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent, #0e7c5a) 16%, transparent),
              0 14px 30px -14px var(--rx-glow, rgba(14,124,90,0.45)) !important;
}
html body .theme-active-pill {
  background: var(--rx-card, #ffffff) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink-2, #4d5b53) !important;
}
html body .theme-active-pill.active {
  background: color-mix(in srgb, var(--rx-accent, #0e7c5a) 12%, transparent) !important;
  border-color: var(--rx-accent, #0e7c5a) !important;
  color: var(--rx-accent, #0e7c5a) !important;
}

/* Midnight theme (dark) — keep surfaces dark and ink light */
html[data-theme="midnight"] body .panel,
html[data-theme="midnight"] body .stat,
html[data-theme="midnight"] body .modal,
html[data-theme="midnight"] body .product,
html[data-theme="midnight"] body .category-card,
html[data-theme="midnight"] body .theme-option-card,
html[data-theme="midnight"] body .coupon-box,
html[data-theme="midnight"] body .coupon-card,
html[data-theme="midnight"] body .profile-hero-card,
html[data-theme="midnight"] body .notif-drawer-content,
html[data-theme="midnight"] body .reorder-product-card,
html[data-theme="black"] body .panel,
html[data-theme="black"] body .stat,
html[data-theme="black"] body .modal,
html[data-theme="black"] body .product,
html[data-theme="black"] body .category-card,
html[data-theme="black"] body .theme-option-card,
html[data-theme="black"] body .coupon-box,
html[data-theme="black"] body .coupon-card,
html[data-theme="black"] body .profile-hero-card,
html[data-theme="black"] body .notif-drawer-content {
  background: #111820 !important;
  border-color: rgba(255,255,255,0.08) !important;
  color: #e9f4ef !important;
}
html[data-theme="midnight"] body .coupon-box,
html[data-theme="midnight"] body .theme-option-card,
html[data-theme="black"] body .coupon-box,
html[data-theme="black"] body .theme-option-card {
  background: #0d131a !important;
}
html[data-theme="midnight"] body input,
html[data-theme="midnight"] body select,
html[data-theme="midnight"] body textarea,
html[data-theme="black"] body input,
html[data-theme="black"] body select,
html[data-theme="black"] body textarea {
  background: #0d131a !important;
  color: #e9f4ef !important;
  border-color: rgba(255,255,255,0.1) !important;
}

/* --------------------------------------------------------------------------
 * 2. SIGNUP / SIGNIN (AUTH) PAGE POLISH
 *    - Larger desktop layout, no background on art image,
 *      proper spacing, text alignment, premium feel.
 * ----------------------------------------------------------------------- */
html body .auth-panel {
  max-width: 560px !important;
  margin: 0 auto !important;
  padding: 36px 40px 32px !important;
  border-radius: 32px !important;
  box-shadow: 0 36px 80px -44px rgba(6, 30, 22, 0.28),
              0 2px 8px rgba(6, 30, 22, 0.05) !important;
}
.auth-header-block {
  text-align: center !important;
  padding: 0 0 6px !important;
}
.auth-brand-emblem {
  width: 76px !important;
  height: 76px !important;
  margin: 0 auto 16px !important;
  border-radius: 22px !important;
  display: grid !important;
  place-items: center !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--rx-accent, #0e7c5a) 14%, transparent), color-mix(in srgb, var(--rx-accent-2, #17a67a) 8%, transparent)) !important;
  border: 1px solid color-mix(in srgb, var(--rx-accent, #0e7c5a) 28%, transparent) !important;
  box-shadow: 0 10px 28px -10px var(--rx-glow-soft, rgba(14,124,90,0.4)) !important;
}
.auth-brand-emblem img {
  width: 52px !important;
  height: 52px !important;
  border-radius: 14px !important;
}
.auth-art {
  display: block !important;
  width: min(320px, 100%) !important;
  max-width: 320px !important;
  height: auto !important;
  max-height: 200px !important;
  object-fit: contain !important;
  margin: 4px auto 8px !important;
  border-radius: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: drop-shadow(0 18px 30px color-mix(in srgb, var(--rx-accent, #0e7c5a) 20%, transparent)) !important;
}
.auth-pill-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 6px auto 14px !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  background: color-mix(in srgb, var(--rx-accent, #0e7c5a) 12%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--rx-accent, #0e7c5a) 32%, transparent) !important;
  color: var(--rx-accent, #0e7c5a) !important;
}
html body .auth-panel h2 {
  font-size: clamp(26px, 3.4vw, 34px) !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
  line-height: 1.15 !important;
  margin: 4px 0 10px !important;
  background: linear-gradient(135deg, var(--rx-accent, #6d3bf5), var(--rx-accent-2, #9b6bff)) !important;
  background-clip: text !important;
  -webkit-background-clip: text !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
}
html body .auth-header-block p {
  font-size: 15px !important;
  line-height: 1.6 !important;
  max-width: 440px !important;
  margin: 0 auto 18px !important;
  color: var(--rx-ink-2, #4d5b53) !important;
}
html body .auth-panel .field { margin-bottom: 14px; }
html body .auth-panel .field label {
  font-size: 13px !important;
  font-weight: 650 !important;
  margin-bottom: 6px !important;
  color: var(--rx-ink, #15211b) !important;
}
html body .auth-panel input,
html body .auth-panel select,
html body .auth-panel textarea {
  min-height: 48px !important;
  padding: 0 14px !important;
  font-size: 15px !important;
  border-radius: 14px !important;
  border: 1.5px solid var(--rx-line, #e7e2d5) !important;
  background: var(--rx-card, #ffffff) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}
html body .auth-panel input:focus,
html body .auth-panel select:focus,
html body .auth-panel textarea:focus {
  border-color: var(--rx-accent, #0e7c5a) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--rx-accent, #0e7c5a) 14%, transparent) !important;
  outline: none;
}
html body .auth-panel .btn[type="submit"],
html body .auth-submit-btn {
  width: 100% !important;
  min-height: 54px !important;
  font-size: 15.5px !important;
  font-weight: 780 !important;
  letter-spacing: 0.01em !important;
  border-radius: 16px !important;
  margin-top: 6px !important;
  background: var(--rx-grad, linear-gradient(135deg, #0e7c5a, #0b6a4e)) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 18px 34px -14px var(--rx-glow, rgba(14,124,90,0.6)),
              inset 0 1px 0 rgba(255,255,255,0.25) !important;
}
html body .auth-panel .btn[type="submit"]:hover,
html body .auth-submit-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 24px 42px -16px var(--rx-glow, rgba(14,124,90,0.7)),
              inset 0 1px 0 rgba(255,255,255,0.35) !important;
}
.auth-footer-card {
  margin-top: 20px !important;
  padding: 14px 16px !important;
  border-radius: 16px !important;
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}
.auth-footer-prompt { margin: 0 !important; font-weight: 700 !important; color: var(--rx-ink, #15211b) !important; font-size: 14px; }
.auth-footer-sub { display: block; font-size: 12px !important; color: var(--rx-ink-2, #4d5b53) !important; margin-top: 2px; }
.auth-switch-btn { white-space: nowrap; border-radius: 12px !important; }
.registration-policy-note {
  text-align: center !important;
  font-size: 12px !important;
  color: var(--rx-ink-3, #8d978f) !important;
  margin: 12px 0 0 !important;
  line-height: 1.5 !important;
}
.registration-policy-note a { color: var(--rx-accent, #0e7c5a) !important; font-weight: 600; }
.verification-required-note {
  display: flex !important;
  gap: 10px !important;
  align-items: flex-start !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  background: color-mix(in srgb, var(--rx-accent, #0e7c5a) 8%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--rx-accent, #0e7c5a) 22%, transparent) !important;
  margin-bottom: 12px !important;
}
.verification-required-note svg { color: var(--rx-accent, #0e7c5a) !important; flex-shrink: 0; margin-top: 2px; }
.verification-required-note strong { display: block; font-size: 13px; color: var(--rx-ink, #15211b) !important; }
.verification-required-note small { font-size: 12px; color: var(--rx-ink-2, #4d5b53) !important; line-height: 1.5; }
.referral-input-field {
  padding: 12px 14px !important;
  border-radius: 14px !important;
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
}
.referral-input-field label { display: flex; align-items: center; justify-content: space-between; }
.ref-bonus-pill {
  font-size: 10px !important;
  padding: 3px 8px !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--rx-accent, #0e7c5a) 12%, transparent) !important;
  color: var(--rx-accent, #0e7c5a) !important;
  font-weight: 700 !important;
}
.auth-method-tabs {
  display: flex !important;
  gap: 6px !important;
  padding: 4px !important;
  background: var(--rx-bg-2, #f2efe5) !important;
  border-radius: 14px !important;
  margin-bottom: 16px !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
}
.auth-method-tabs button {
  flex: 1 !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  background: transparent !important;
  border: none !important;
  color: var(--rx-ink-2, #4d5b53) !important;
  cursor: pointer !important;
}
.auth-method-tabs button.active {
  background: var(--rx-card, #ffffff) !important;
  color: var(--rx-accent, #0e7c5a) !important;
  box-shadow: 0 4px 10px -4px rgba(0,0,0,0.08) !important;
}

/* Desktop view enhancements — wider on big screens */
@media (min-width: 900px) {
  html body .auth-panel {
    max-width: 620px !important;
    padding: 44px 56px 40px !important;
  }
  .auth-art { max-width: 360px !important; }
}
@media (max-width: 640px) {
  html body .auth-panel {
    padding: 28px 22px 24px !important;
    border-radius: 26px !important;
  }
  .auth-art { max-width: 240px !important; }
}

/* --------------------------------------------------------------------------
 * 3. CART / CHECKOUT SUMMARY POLISH
 * ----------------------------------------------------------------------- */
html body #app .split > section.panel:last-child .total {
  border-top: 1px solid var(--rx-line, #e7e2d5) !important;
  padding-top: 12px !important;
  margin-top: 8px !important;
}
html body #app .split > section.panel:last-child .total strong {
  font-size: 22px !important;
  font-weight: 800 !important;
  color: var(--rx-accent, #0e7c5a) !important;
  letter-spacing: -0.02em;
}
html body .btn[data-action="checkout"] {
  width: 100% !important;
  min-height: 52px !important;
  border-radius: 16px !important;
  font-weight: 750 !important;
  font-size: 15px !important;
}

/* --------------------------------------------------------------------------
 * 4. HERO / HOME PAGE text polish — avoid overlapping text
 * ----------------------------------------------------------------------- */
html body .hero h2 {
  line-height: 1.1 !important;
  letter-spacing: -0.03em !important;
}
html body .hero p {
  line-height: 1.65 !important;
  max-width: 60ch !important;
}

/* --------------------------------------------------------------------------
 * 5. GENERAL FIXES — selected states, ripple, smooth scroll, no flicker
 * ----------------------------------------------------------------------- */
html body .btn.secondary {
  background: var(--rx-card, #ffffff) !important;
  border: 1.5px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink, #15211b) !important;
}
html body .btn.secondary:hover {
  border-color: var(--rx-accent, #0e7c5a) !important;
  color: var(--rx-accent, #0e7c5a) !important;
  background: color-mix(in srgb, var(--rx-accent, #0e7c5a) 6%, transparent) !important;
}
/* Fix black icon-btn on light */
html body .icon-btn {
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink-2, #4d5b53) !important;
}
html body .icon-btn:hover {
  background: var(--rx-soft, #edf7f1) !important;
  color: var(--rx-accent, #0e7c5a) !important;
}
html[data-theme="midnight"] body .icon-btn,
html[data-theme="black"] body .icon-btn {
  background: #0d131a !important;
  border-color: rgba(255,255,255,0.1) !important;
  color: #a4b6ae !important;
}
html[data-theme="midnight"] body .btn.secondary,
html[data-theme="black"] body .btn.secondary {
  background: #0d131a !important;
  border-color: rgba(255,255,255,0.12) !important;
  color: #e9f4ef !important;
}

/* Header/Search bar */
html body .header-search,
html body .search-wrap {
  background: var(--rx-bg-2, #f2efe5) !important;
  border-color: var(--rx-line, #e7e2d5) !important;
  border-radius: 16px !important;
}
html body .header-search input {
  background: transparent !important;
  border: none !important;
  color: var(--rx-ink, #15211b) !important;
}
html body .header-search input::placeholder { color: var(--rx-ink-3, #8d978f) !important; }

/* Floating bottom nav */
html body .mobile-nav {
  background: color-mix(in srgb, var(--rx-card, #ffffff) 92%, transparent) !important;
  border-color: var(--rx-line, #e7e2d5) !important;
  backdrop-filter: blur(22px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.4) !important;
  border-radius: 22px !important;
  box-shadow: 0 18px 40px -20px rgba(0,0,0,0.18) !important;
}
html body .mobile-nav a {
  color: var(--rx-ink-3, #8d978f) !important;
}
html body .mobile-nav a.active {
  color: var(--rx-accent, #0e7c5a) !important;
}

/* Prevent horizontal scroll glitches */
html, body { overflow-x: hidden; }

/* Tables & table wraps */
html body .table-wrap {
  border-radius: 16px !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  overflow: hidden;
}
html body th {
  font-size: 11px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  font-weight: 750 !important;
}
html body td { font-size: 14px !important; }

/* Remove residual purple blob decor that can flicker dark */
html body .auth-panel::before,
html body .auth-panel::after {
  display: none !important;
}

/* Misc dark leftover element fixes */
html body .notice {
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink-2, #4d5b53) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
}
html body .line-item {
  border-radius: 16px !important;
  padding: 14px !important;
}

/* Desktop layout container */
@media (min-width: 1100px) {
  html body #app {
    max-width: 1240px !important;
    margin: 0 auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
}

/* Password toggle button no dark */
html body .password-toggle {
  color: var(--rx-ink-2, #4d5b53) !important;
  background: transparent !important;
  border: none !important;
}
html body .password-wrap { background: transparent !important; }

/* Remove any :before that forces dark color behind panels on light themes */
html[data-theme="ivory"] body::before,
html[data-theme="violet"] body::before,
html[data-theme="sand"] body::before,
html[data-theme="ocean"] body::before,
html[data-theme="rose"] body::before {
  opacity: 0.55 !important;
}

/* --------------------------------------------------------------------------
 * 6. TRUST-HERO (About page) — theme-aware (no dark-on-light)
 * ----------------------------------------------------------------------- */
html body .trust-hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--rx-accent, #6d3bf5) 12%, var(--rx-card, #fff)), color-mix(in srgb, var(--rx-accent-2, #9b6bff) 6%, var(--rx-card, #fff))) !important;
  border: 1px solid color-mix(in srgb, var(--rx-accent, #6d3bf5) 22%, var(--rx-line, #e6e0f6)) !important;
  color: var(--rx-ink, #191327) !important;
}
html body .trust-hero .eyebrow { color: var(--rx-accent, #6d3bf5) !important; font-size: 11px !important; letter-spacing: 0.16em !important; font-weight: 700; }
html body .trust-hero h2 { color: var(--rx-ink, #191327) !important; font-size: clamp(28px, 4vw, 40px) !important; line-height: 1.1 !important; letter-spacing: -0.03em !important; }
html body .trust-hero h2 em { color: var(--rx-accent, #6d3bf5) !important; font-style: normal; background: linear-gradient(135deg, var(--rx-accent, #6d3bf5), var(--rx-accent-2, #9b6bff)); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
html body .trust-hero p { color: var(--rx-ink-2, #5f5873) !important; font-size: 15px !important; line-height: 1.65 !important; max-width: 60ch; }
html body .trust-emblem {
  background: color-mix(in srgb, var(--rx-accent, #6d3bf5) 14%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--rx-accent, #6d3bf5) 28%, transparent) !important;
  color: var(--rx-accent, #6d3bf5) !important;
}
html body .contact-main {
  background: linear-gradient(135deg, color-mix(in srgb, var(--rx-accent, #6d3bf5) 12%, var(--rx-card, #fff)), color-mix(in srgb, var(--rx-accent-2, #9b6bff) 6%, var(--rx-card, #fff))) !important;
  color: var(--rx-ink, #191327) !important;
}
html body .contact-main h2 { color: var(--rx-ink, #191327) !important; }
html body .contact-main p { color: var(--rx-ink-2, #5f5873) !important; }
html body .contact-email a { color: var(--rx-accent, #6d3bf5) !important; }
html body .trust-hero .btn {
  background: var(--rx-grad, linear-gradient(135deg, #6d3bf5, #4a1fc7)) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 14px !important;
  padding: 12px 22px !important;
  font-weight: 700 !important;
}

/* Midnight (dark) trust-hero stays dark */
html[data-theme="midnight"] body .trust-hero,
html[data-theme="black"] body .trust-hero {
  background: radial-gradient(ellipse at 85% 0, rgba(55,221,163,0.12), transparent 65%), linear-gradient(120deg, #0d131a, #111820) !important;
  border-color: rgba(55,221,163,0.18) !important;
  color: #e9f4ef !important;
}
html[data-theme="midnight"] body .trust-hero h2,
html[data-theme="black"] body .trust-hero h2 { color: #e9f4ef !important; }
html[data-theme="midnight"] body .trust-hero h2 em,
html[data-theme="black"] body .trust-hero h2 em {
  background: linear-gradient(135deg, #37dda3, #b4ffe4);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
html[data-theme="midnight"] body .trust-hero p,
html[data-theme="black"] body .trust-hero p { color: #a4b6ae !important; }
html[data-theme="midnight"] body .trust-emblem,
html[data-theme="black"] body .trust-emblem {
  background: rgba(55,221,163,0.08) !important;
  border-color: rgba(55,221,163,0.2) !important;
  color: #37dda3 !important;
}
html[data-theme="midnight"] body .contact-main,
html[data-theme="black"] body .contact-main {
  background: radial-gradient(ellipse at 95% 5%, rgba(55,221,163,0.1), transparent 65%), #0d131a !important;
  color: #e9f4ef !important;
}
html[data-theme="midnight"] body .contact-main h2,
html[data-theme="black"] body .contact-main h2 { color: #e9f4ef !important; }
html[data-theme="midnight"] body .contact-main p,
html[data-theme="black"] body .contact-main p { color: #a4b6ae !important; }

/* --------------------------------------------------------------------------
 * 7. Ensure hero text never overlaps the laptop image
 * ----------------------------------------------------------------------- */
html body .hero.hx-hero {
  gap: 32px !important;
  align-items: center !important;
}
html body .hero-copy h2 {
  font-size: clamp(32px, 4.8vw, 56px) !important;
  line-height: 1.05 !important;
  letter-spacing: -0.04em !important;
  margin-bottom: 14px !important;
}
html body .hero-copy p {
  font-size: 16px !important;
  line-height: 1.65 !important;
  max-width: 52ch !important;
  margin-bottom: 22px !important;
}
@media (min-width: 900px) {
  html body .hero.hx-hero {
    grid-template-columns: 1.05fr 0.95fr !important;
    gap: 40px !important;
  }
}

html body .cart-total-row {
  border-top: 1px solid var(--rx-line, #e7e2d5) !important;
  padding-top: 14px !important;
  margin-top: 8px !important;
}
html body .cart-total-row strong {
  font-size: 24px !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em;
}
html body .available-balance-note { color: var(--rx-ink-3, #928ba6) !important; font-size: 13px; }

/* Mini-banner (referral / API) theme-aware */
html body .mini-banner {
  background: var(--rx-card, #ffffff) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink, #15211b) !important;
  border-radius: 22px !important;
}
html body .mini-banner h3 { color: var(--rx-ink, #15211b) !important; }
html body .mini-banner p { color: var(--rx-ink-2, #4d5b53) !important; }
html body .mini-banner.green { background: color-mix(in srgb, var(--rx-accent-2, #17a67a) 8%, var(--rx-card, #fff)) !important; }
html body .mini-banner .banner-icon { color: var(--rx-accent, #0e7c5a) !important; }

/* Category cards */
html body .category-card {
  background: var(--rx-card, #ffffff) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink, #15211b) !important;
  border-radius: 20px !important;
}
html body .category-card strong { color: var(--rx-ink, #15211b) !important; }
html body .category-card small { color: var(--rx-ink-2, #4d5b53) !important; }

/* Fix kbd (Ctrl+K) in search bar so it's visible */
html body kbd {
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink-2, #4d5b53) !important;
  border-radius: 8px;
  font-size: 11px;
  padding: 3px 7px;
  font-family: inherit;
}

/* Footer theme-aware */
html body .pro-footer,
html body .footer {
  background: var(--rx-card, #ffffff) !important;
  border-top: 1px solid var(--rx-line, #e7e2d5) !important;
  color: var(--rx-ink-2, #4d5b53) !important;
}
html body .footer h4,
html body .footer-brand strong { color: var(--rx-ink, #15211b) !important; }
html body .footer a { color: var(--rx-ink-2, #4d5b53) !important; }
html body .footer a:hover { color: var(--rx-accent, #0e7c5a) !important; }

/* Policy/legal pages in light theme */
html body .policy-contents {
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  border-radius: 18px !important;
}
html body .policy-section {
  background: var(--rx-card, #ffffff) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  border-radius: 18px !important;
}
html body .policy-section h2 { color: var(--rx-ink, #15211b) !important; }
html body .policy-section p { color: var(--rx-ink-2, #4d5b53) !important; }
html body .policy-number { color: var(--rx-ink-3, #928ba6) !important; }
html body .policy-help {
  background: var(--rx-bg-2, #f2efe5) !important;
  border: 1px solid var(--rx-line, #e7e2d5) !important;
  border-radius: 16px !important;
}

/* Make scroll smoother and reduce motion sensitivity */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
