/* Critical UI guardrails loaded after admin-selected theme overrides. */
:root {
  --mabapu-safe-dark: var(--royal-dark, #1a1a2e);
  --mabapu-safe-deep: var(--royal-deep, #0c0a09);
  --mabapu-safe-cream: var(--royal-cream, #fff8f0);
  --mabapu-safe-muted-on-dark: var(--royal-text-muted-on-dark, rgba(255, 248, 240, 0.78));
  --mabapu-safe-surface: var(--royal-surface, #ffffff);
  --mabapu-safe-surface-muted: var(--royal-surface-muted, #f3f4f6);
  --mabapu-safe-text: var(--royal-text, #1f2937);
  --mabapu-safe-text-muted: var(--royal-text-muted, #4b5563);
}

/* Semantic theme layer: foreground and background always travel as a tested pair. */
body.mabapu-app-runtime-body,
.admin-layout,
.chef-layout {
  background: var(--theme-page-bg) !important;
  color: var(--theme-text);
}

:where(.card, .card-glass, .mabapu-card, .recipe-card, .product-card, .nature-card,
  .admin-chart-card, .stat-card, .table-card, .form-card, .modal-content, .dropdown-menu) {
  background-color: var(--theme-surface);
  color: var(--theme-text);
  border-color: var(--theme-border);
}

:where(.card, .card-glass, .mabapu-card, .recipe-card, .product-card, .nature-card,
  .admin-content, .chef-content, main) :where(h1, h2, h3, h4, h5, h6) {
  color: var(--theme-heading);
}

:where(.text-muted, .form-hint, .help-text, .section-subtitle, small, .muted) {
  color: var(--theme-text-muted) !important;
}

:where(input:not([type="checkbox"]):not([type="radio"]), textarea, select, .form-control, .form-input) {
  background-color: var(--theme-input-bg) !important;
  color: var(--theme-input-text) !important;
  border-color: var(--theme-input-border) !important;
}

:where(input, textarea)::placeholder { color: var(--theme-text-muted) !important; opacity: 1; }

:where(a:not(.btn):not(.admin-sidebar__link):not(.navbar-royal__link)) { color: var(--theme-link); }
:where(a:not(.btn):not(.admin-sidebar__link):not(.navbar-royal__link)):hover { color: var(--theme-link-hover); }

:where(.btn-primary, .royal-btn, button[type="submit"]:not(.btn-danger):not(.btn-secondary)) {
  background: var(--theme-primary-bg) !important;
  color: var(--theme-primary-text) !important;
  border-color: var(--theme-primary-bg) !important;
}

:where(.btn-primary, .royal-btn, button[type="submit"]:not(.btn-danger):not(.btn-secondary)):hover {
  background: var(--theme-primary-hover-bg) !important;
  color: var(--theme-primary-hover-text) !important;
  border-color: var(--theme-primary-hover-bg) !important;
  transform: none !important;
}

:where(button, .btn, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--theme-focus) !important;
  outline-offset: 3px !important;
  box-shadow: none !important;
}

:where(button, .btn, input, textarea, select):disabled,
:where(.btn-disabled, [aria-disabled="true"]) {
  background: var(--theme-disabled-bg) !important;
  color: var(--theme-disabled-text) !important;
  border-color: var(--theme-border) !important;
  opacity: 1 !important;
}

.alert-success { background: var(--theme-success-bg) !important; color: var(--theme-success-text) !important; }
.alert-warning { background: var(--theme-warning-bg) !important; color: var(--theme-warning-text) !important; }
.alert-error, .alert-danger { background: var(--theme-error-bg) !important; color: var(--theme-error-text) !important; }

:where(svg:not([fill="none"]), .link-icon, .nav-icon) { color: currentColor; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── GLOBAL ANTI-COPY SELECTION LAYER ─────────────────────────── */
body, html {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

/* Allow selection in form controls, code blocks, and explicitly marked copyable areas */
input, textarea, select, [contenteditable="true"], .selectable, .copyable, #chef-upi-id, .chef-upi-id, code, pre {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

/* ── GLOBAL PRINT PROTECTION SYSTEM ──────────────────────────── */
@media print {
  html, body, body *, * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

html[data-theme]:not([data-theme="royal"]) body {
  background: linear-gradient(180deg, var(--royal-ivory, #fefcf3) 0%, var(--royal-cream, #fff8f0) 100%);
}

html[data-theme]:not([data-theme="royal"]) .navbar-royal,
html[data-theme]:not([data-theme="royal"]) .footer-royal,
html[data-theme]:not([data-theme="royal"]) .chef-sidebar,
html[data-theme]:not([data-theme="royal"]) .admin-sidebar {
  background: linear-gradient(135deg, var(--royal-dark, #1a1a2e), var(--royal-deep, #16213e)) !important;
  border-color: rgba(var(--royal-gold-rgb, 212, 168, 83), 0.18) !important;
}

html[data-theme]:not([data-theme="royal"]) .hero-royal,
html[data-theme]:not([data-theme="royal"]) .section-dark,
html[data-theme]:not([data-theme="royal"]) .marketplace-showcase,
html[data-theme]:not([data-theme="royal"]) .auth-page {
  background: var(--theme-hero-bg) !important;
}

.navbar-royal__link,
.navbar-royal__mobile-menu .navbar-royal__link,
.footer-royal a,
.chef-sidebar__link,
.admin-sidebar__link {
  color: rgba(255, 248, 240, 0.82);
}

.navbar-royal__link:hover,
.navbar-royal__link--active,
.navbar-royal__mobile-menu .navbar-royal__link:hover,
.footer-royal a:hover,
.chef-sidebar__link:hover,
.chef-sidebar__link.active,
.admin-sidebar__link:hover,
.admin-sidebar__link.active {
  color: var(--royal-gold, #d4a853);
}

.navbar-royal__link svg,
.navbar-royal__mobile-menu svg,
.footer-royal__social svg,
.alert svg,
.nav-svg {
  display: block;
  max-width: none;
  flex-shrink: 0;
}

.navbar-royal__link svg,
.navbar-royal__mobile-menu .navbar-royal__link svg {
  width: 18px;
  height: 18px;
}

.nav-svg {
  width: 18px;
  height: 18px;
}

.recipe-card__badge svg,
.recipe-card__time svg,
.recipe-card__rating svg,
.recipe-card__meta-item svg {
  display: block;
  flex: 0 0 auto;
  fill: currentColor;
  stroke: none;
}

.recipe-card__badge svg,
.recipe-card__time svg,
.recipe-card__rating svg {
  width: 14px;
  height: 14px;
}

.recipe-card__meta-item svg {
  width: 13px;
  height: 13px;
}

.recipe-card__chef svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: none;
}

.chef-bento-icon svg,
.chef-bento-card svg {
  display: block;
  flex: 0 0 auto;
  max-width: 100%;
  max-height: 100%;
}

.btn svg,
a svg,
button svg,
.form-label svg,
.section-header__label svg,
.product-badge svg {
  flex-shrink: 0;
  vertical-align: -0.125em;
}

:where(a, button, .btn, .form-label, .section-header__label, .product-badge, .alert, h1, h2, h3, h4) > svg:not([width]):not([height]):not([style*="width"]) {
  width: 1em;
  height: 1em;
}

.card,
.card-glass,
.mabapu-card,
.recipe-card,
.product-card,
.orders-mobile-detail-card {
  color: var(--royal-dark, #1a1a2e);
}

.section-dark,
.marketplace-showcase,
.auth-page,
.dash-hero,
.dash-hero-sm,
.coins-hero,
.coins-hero-mob,
.subs-active-card,
.subs-active-card-mob,
.card-royal {
  color: var(--theme-hero-text) !important;
}

.section-dark :where(h1, h2, h3, h4, .section-title, .section-header__title),
.marketplace-showcase :where(h1, h2, h3, h4, .section-title, .section-header__title),
.dash-hero :where(h1, h2, h3, h4),
.dash-hero-sm :where(h1, h2, h3, h4),
.coins-hero :where(h1, h2, h3, h4),
.coins-hero-mob :where(h1, h2, h3, h4),
.subs-active-card :where(h1, h2, h3, h4),
.subs-active-card-mob :where(h1, h2, h3, h4),
.card-royal :where(h1, h2, h3, h4) {
  color: var(--theme-hero-text) !important;
}

.section-dark p,
.marketplace-showcase p,
.dash-hero-sub,
.dash-hero-sub-sm,
.coins-hero-value,
.coins-hero-value-mob,
.coins-hero-rate {
  color: var(--theme-hero-muted) !important;
}

.product-card,
.marketplace-showcase .product-card {
  background: var(--theme-surface);
  color: var(--theme-text);
}

.product-card :where(a:not(.btn), h1, h2, h3, h4, .product-card__name, strong) {
  color: var(--theme-heading);
}

.product-card :where(p, .product-card__description, .product-card__weight, small, .text-muted) {
  color: var(--theme-text-muted);
}

.product-card .product-card__description,
.marketplace-showcase .product-card .product-card__description,
.marketplace-showcase .product-card p {
  color: var(--theme-text-muted);
}

.product-card .product-card__price {
  color: var(--theme-heading) !important;
}

.product-card .product-card__body {
  border-color: var(--color-border, #e5e7eb) !important;
}

.auth-page {
  background: linear-gradient(135deg, var(--royal-dark, #1a1a2e), var(--royal-deep, #0f172a), var(--royal-navy, #111827));
}

.auth-card {
  color: var(--mabapu-safe-cream) !important;
}

.auth-card :where(h1, h2, h3, .auth-card__logo) {
  color: var(--royal-gold, #d4a853) !important;
}

.auth-card :where(p, .auth-description, .form-hint, .auth-footer-text),
.auth-card__logo p {
  color: var(--mabapu-safe-muted-on-dark) !important;
}

.auth-card .form-label {
  color: rgba(255, 248, 240, 0.86) !important;
}

.auth-card .form-control,
.auth-card input,
.auth-card select,
.auth-card textarea {
  color: var(--mabapu-safe-cream) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(var(--royal-gold-rgb, 212, 168, 83), 0.28) !important;
}

.auth-card .form-control::placeholder,
.auth-card input::placeholder,
.auth-card textarea::placeholder {
  color: rgba(255, 248, 240, 0.52) !important;
}

.auth-card .google-btn {
  color: var(--mabapu-safe-dark) !important;
  background: var(--mabapu-safe-surface) !important;
  border-color: #d1d5db !important;
}

.checkout-page-main,
.checkout-page-main .card,
.checkout-page-main .card-glass,
.checkout-summary,
.cart-item {
  color: var(--mabapu-safe-text);
}

.checkout-page-main :where(h1, h2, h3, h4, label, strong),
.checkout-summary :where(span, strong),
.cart-item :where(a, span, strong) {
  color: inherit;
}

.checkout-page-main .card,
.checkout-page-main .card-glass,
.checkout-summary {
  background-color: var(--mabapu-safe-surface);
}

.text-dark,
.checkout-page-main .text-dark,
.marketplace-grid .text-dark {
  color: var(--mabapu-safe-dark);
}

.form-control,
.royal-input,
input,
select,
textarea {
  color: var(--royal-dark, #1a1a2e);
  background-color: #ffffff;
}

.form-control::placeholder,
.royal-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: #6b7280;
  opacity: 1;
}

.navbar-royal__mobile-menu .form-control,
.navbar-royal__mobile-menu input,
.admin-sidebar,
.chef-sidebar,
.navbar-royal,
.footer-royal {
  color: var(--royal-cream, #fff8f0);
}

.mobile-menu-header span {
  color: var(--royal-gold, #d4a853) !important;
}

.navbar-royal__hamburger {
  background: rgba(255, 248, 240, 0.1) !important;
  border-color: rgba(var(--royal-gold-rgb, 212, 168, 83), 0.45) !important;
  color: var(--mabapu-safe-cream) !important;
  flex-direction: column !important;
  gap: 5px !important;
}

.navbar-royal__hamburger span {
  display: block !important;
  width: 22px !important;
  min-width: 22px !important;
  height: 2px !important;
  min-height: 2px !important;
  border-radius: 999px !important;
  background: var(--mabapu-safe-cream) !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  margin: 0 !important;
}

.navbar-royal__hamburger:hover,
.navbar-royal__hamburger:focus-visible {
  background: rgba(var(--royal-gold-rgb, 212, 168, 83), 0.18) !important;
  border-color: var(--royal-gold, #d4a853) !important;
  outline: 2px solid rgba(var(--royal-gold-rgb, 212, 168, 83), 0.45);
  outline-offset: 2px;
}

.navbar-royal__mobile-menu {
  background: var(--royal-dark, #1a1a2e) !important;
  color: var(--mabapu-safe-cream) !important;
}

.navbar-royal__mobile-menu .navbar-royal__link {
  color: rgba(255, 248, 240, 0.9) !important;
  border-bottom-color: rgba(255, 248, 240, 0.1) !important;
}

.navbar-royal__mobile-menu .navbar-royal__link svg {
  color: currentColor !important;
}

.navbar-royal__mobile-menu .navbar-royal__link:hover,
.navbar-royal__mobile-menu .navbar-royal__link[aria-current="page"] {
  color: var(--royal-gold, #d4a853) !important;
  background: rgba(var(--royal-gold-rgb, 212, 168, 83), 0.12) !important;
}

.mobile-menu-close {
  color: var(--mabapu-safe-cream) !important;
  background: rgba(255, 248, 240, 0.08) !important;
  border: 1px solid rgba(var(--royal-gold-rgb, 212, 168, 83), 0.28) !important;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-close:hover,
.mobile-menu-close:focus-visible {
  color: var(--royal-gold, #d4a853) !important;
  border-color: var(--royal-gold, #d4a853) !important;
}

.btn-primary,
a.btn-primary,
button.btn-primary {
  background: linear-gradient(135deg, var(--royal-saffron, #ff6b35), var(--royal-saffron-dark, var(--royal-saffron, #ff6b35))) !important;
  border-color: var(--royal-saffron, #ff6b35) !important;
  color: #ffffff !important;
}

.btn-primary:hover,
a.btn-primary:hover,
button.btn-primary:hover {
  color: #ffffff !important;
}

.btn-gold,
a.btn-gold,
button.btn-gold {
  color: var(--mabapu-safe-dark) !important;
}

.footer-royal {
  background: var(--royal-midnight, #0d1117) !important;
  color: rgba(255, 248, 240, 0.72) !important;
}

.footer-royal__brand span,
.footer-royal h3,
.footer-royal h4 {
  color: var(--royal-gold, #d4a853) !important;
}

.footer-royal__brand p,
.footer-royal .newsletter-desc,
.footer-royal__bottom,
.footer-royal__bottom p {
  color: rgba(255, 248, 240, 0.68) !important;
}

.footer-royal a {
  color: rgba(255, 248, 240, 0.84) !important;
}

.footer-royal a:hover {
  color: var(--royal-gold, #d4a853) !important;
}

.footer-royal__newsletter input {
  color: var(--mabapu-safe-cream) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

/* ── SKIP-TO-MAIN LINK (Accessibility) ──────────────────────── */
.skip-link {
  position: absolute !important;
  top: -999px !important;
  left: -999px !important;
  z-index: 99999 !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  padding: 12px 24px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  border-radius: 0 0 8px 0 !important;
  background: #166534 !important;
  color: #ffffff !important;
  border: 2px solid #14532d !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35) !important;
  transition: none !important;
}

.skip-link:focus,
.skip-link:focus-visible {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: auto !important;
  height: auto !important;
  clip: auto !important;
  overflow: visible !important;
  white-space: normal !important;
  outline: 3px solid #fbbf24 !important;
  outline-offset: 2px !important;
}

/* ── PAGINATION SYSTEM UNIFICATION ───────────────────────────── */
/* Style the outer paginator nav wrapper correctly across all platforms */
nav[role="navigation"],
.royal-pagination nav,
.royal-pagination-wrap nav {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  margin: 24px 0 !important;
  flex-wrap: wrap !important;
}

/* Force pagination text/stats to render clean or hide if desired, but don't break flex spacing */
nav[role="navigation"] p,
.royal-pagination nav p,
.royal-pagination-wrap nav p {
  font-size: 13px !important;
  color: var(--royal-cream, #F0E8D8) !important;
  opacity: 0.7 !important;
  margin: 0 12px !important;
  text-align: center !important;
}

/* Force all SVG chevrons to be small and inline, preventing giant rendering */
nav[role="navigation"] svg,
.pagination svg,
.royal-pagination svg,
.royal-pagination-wrap svg,
.pagination-container svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

/* Ensure container divs inside Tailwind paginator render beautifully and responsively */
nav[role="navigation"] > div,
.royal-pagination nav > div,
.royal-pagination-wrap nav > div {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

/* On mobile, allow full flexibility so buttons don't clip */
@media (max-width: 640px) {
  nav[role="navigation"] > div,
  .royal-pagination nav > div,
  .royal-pagination-wrap nav > div {
    justify-content: center !important;
  }
}

/* Base button styling for all pagination links and active/disabled states */
.pagination,
.royal-pagination .pagination,
nav[role="navigation"] span.relative,
nav[role="navigation"] div.hidden > div > span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  flex-wrap: wrap !important;
}

/* Style each pagination node (links and active/disabled states) */
nav[role="navigation"] a,
nav[role="navigation"] span.relative > span,
nav[role="navigation"] span.relative > a,
.pagination a,
.pagination span,
.royal-pagination a,
.royal-pagination span,
.royal-pagination-wrap a,
.royal-pagination-wrap span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 36px !important;
  height: 36px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(var(--royal-gold-rgb, 184, 146, 13), 0.25) !important;
  background: rgba(var(--royal-dark-rgb, 15, 8, 5), 0.85) !important;
  color: var(--royal-cream, #F0E8D8) !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
}

/* Hover effect */
nav[role="navigation"] a:hover,
.pagination a:hover,
.royal-pagination a:hover,
.royal-pagination-wrap a:hover {
  background: var(--royal-gold, #B8920D) !important;
  color: var(--royal-dark, #0F0805) !important;
  border-color: var(--royal-gold, #B8920D) !important;
}

/* Active page styling */
nav[role="navigation"] [aria-current="page"] span,
nav[role="navigation"] span.active,
.pagination .active,
.pagination span.active,
.royal-pagination .active,
.royal-pagination-wrap .active,
.royal-pagination-wrap .active span {
  background: var(--royal-gold, #B8920D) !important;
  color: var(--royal-dark, #0F0805) !important;
  border-color: var(--royal-gold, #B8920D) !important;
  cursor: default !important;
  pointer-events: none !important;
}

/* Disabled/Unavailable state */
nav[role="navigation"] [aria-disabled="true"] span,
nav[role="navigation"] .disabled span,
.pagination .disabled,
.royal-pagination .disabled,
.royal-pagination-wrap .disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  background: rgba(var(--royal-dark-rgb, 15, 8, 5), 0.5) !important;
}

/* Flatten any double nested spans from default Laravel styles */
.pagination span span,
.royal-pagination span span,
.royal-pagination-wrap span span,
nav[role="navigation"] span span {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
  height: auto !important;
  color: inherit !important;
  display: inline !important;
}

/* ── PRICING / PREMIUM PAGE CONTRAST GUARDS ─────────────────── */
/* The premium page owns its semantic pairings; this only protects its root surface. */
.harvest-premium-scaffold {
  background-color: var(--theme-page-bg) !important;
  color: var(--theme-text) !important;
}

.harvest-premium-scaffold .harvest-display-title {
  color: var(--theme-hero-text) !important;
}

.harvest-premium-scaffold .harvest-display-subtitle {
  color: var(--theme-hero-muted) !important;
}

.harvest-premium-scaffold .pricing-card {
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

.harvest-premium-scaffold .pricing-features li {
  color: var(--theme-text) !important;
}

.harvest-premium-scaffold .popular-card {
  border-color: var(--theme-primary-bg) !important;
}

.harvest-premium-scaffold .plan-name { color: var(--theme-heading) !important; }
.harvest-premium-scaffold .price-amount { color: var(--theme-link) !important; }
.harvest-premium-scaffold .price-duration { color: var(--theme-text-muted) !important; }

.harvest-premium-scaffold .active-sub-banner {
  background: var(--theme-success-bg) !important;
  color: var(--theme-success-text) !important;
  border-color: var(--theme-success-text) !important;
}

.harvest-premium-scaffold .active-title { color: var(--theme-success-text) !important; }
.harvest-premium-scaffold .active-detail,
.harvest-premium-scaffold .active-meta { color: var(--theme-success-text) !important; }

.harvest-premium-scaffold .per-recipe-card {
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
}

.harvest-premium-scaffold .pr-info h4 { color: var(--theme-heading) !important; }
.harvest-premium-scaffold .pr-info span { color: var(--theme-text-muted) !important; }
.harvest-premium-scaffold .pr-price { color: var(--theme-link) !important; }

.harvest-premium-scaffold .magazine-feature-badge {
  background: var(--theme-accent-bg) !important;
  color: var(--theme-accent-text) !important;
  border-color: var(--theme-icon-border) !important;
}

.harvest-premium-scaffold .trust-item,
.harvest-premium-scaffold .trust-item span {
  color: var(--theme-icon) !important;
}

/* Theme ordinary interface icons while preserving official brand/payment artwork. */
.theme-icon-skin,
.sidebar .nav-icon,
.menu-icon,
.stat-icon,
.feature-icon,
.card-icon,
.action-icon,
.dashboard-icon,
.vp-icon,
.mag-icon-ring {
  background: var(--theme-icon-bg);
  color: var(--theme-icon-text);
  border: 1px solid var(--theme-icon-border);
  border-color: var(--theme-icon-border);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

:is(a, button, .value-prop-card):hover .theme-icon-skin,
.sidebar .nav-link:hover .nav-icon,
.sidebar .nav-link.active .nav-icon,
.menu-item:hover .menu-icon,
.card:hover .card-icon,
.feature-card:hover .feature-icon,
.value-prop-card:hover .vp-icon {
  background: var(--theme-icon-hover-bg);
  color: var(--theme-icon-hover-text);
  border-color: var(--theme-icon-hover-bg);
}

/* ── THEME SAFETY CARD & WORKSPACE OVERRIDES ─────────────────── */

/* Legacy admin workspaces use the validated dark hero pair. This keeps their
   existing light content readable while still allowing every festival theme
   to skin the admin panel. */
.admin-runtime-body .admin-content {
  background: var(--theme-page-bg);
  color: var(--theme-text);
}

.admin-runtime-body .admin-content [style*="color:rgba(255,248,240"],
.admin-runtime-body .admin-content [style*="color: rgba(255,248,240"],
.admin-runtime-body .admin-content [style*="color:rgba(255, 248, 240"],
.admin-runtime-body .admin-content [style*="color: rgba(255, 248, 240"],
.admin-runtime-body .admin-content [style*="color:#A0AEC0"],
.admin-runtime-body .admin-content [style*="color:#CBD5E0"],
.admin-runtime-body .admin-content [style*="color:#9CA3AF"],
.admin-runtime-body .admin-content [style*="color:#A1A1AA"] {
  color: var(--theme-text-muted) !important;
}

.admin-runtime-body .admin-sidebar {
  background: var(--theme-hero-bg) !important;
  border-color: var(--theme-icon-border) !important;
  color: var(--theme-hero-text);
}

.admin-runtime-body .admin-sidebar__logo a {
  color: var(--theme-hero-text) !important;
}

.admin-runtime-body .admin-sidebar__subtitle,
.admin-runtime-body .admin-sidebar__user,
.admin-runtime-body .admin-sidebar__link {
  color: var(--theme-hero-muted) !important;
}

.admin-runtime-body .admin-sidebar__link:hover,
.admin-runtime-body .admin-sidebar__link.active {
  background: transparent !important;
  color: var(--theme-hero-text) !important;
  text-decoration: none;
}

.admin-runtime-body .admin-sidebar__link .link-icon {
  min-width: 28px;
  min-height: 28px;
  border: 1px solid var(--theme-icon-border);
  border-radius: 8px;
  background: var(--theme-icon-bg);
  color: var(--theme-icon-text);
}

.admin-runtime-body .admin-sidebar__link:hover .link-icon,
.admin-runtime-body .admin-sidebar__link.active .link-icon {
  border-color: var(--theme-icon-hover-bg);
  background: var(--theme-icon-hover-bg);
  color: var(--theme-icon-hover-text);
}

.admin-runtime-body .royal-card,
.admin-runtime-body .royal-workspace {
  background: var(--theme-hero-bg) !important;
  border: 1px solid var(--theme-border) !important;
  color: var(--theme-hero-text) !important;
}

.admin-runtime-body .royal-card [style*="color:rgba(255,248,240"],
.admin-runtime-body .royal-card [style*="color: rgba(255,248,240"],
.admin-runtime-body .royal-card [style*="color:rgba(255, 248, 240"],
.admin-runtime-body .royal-card [style*="color: rgba(255, 248, 240"],
.admin-runtime-body .royal-workspace [style*="color:rgba(255,248,240"],
.admin-runtime-body .royal-workspace [style*="color: rgba(255,248,240"],
.admin-runtime-body .royal-workspace [style*="color:rgba(255, 248, 240"],
.admin-runtime-body .royal-workspace [style*="color: rgba(255, 248, 240"],
.admin-runtime-body .royal-card [style*="color:#A0AEC0"],
.admin-runtime-body .royal-card [style*="color:#CBD5E0"],
.admin-runtime-body .royal-card [style*="color:#9CA3AF"],
.admin-runtime-body .royal-card [style*="color:#A1A1AA"],
.admin-runtime-body .royal-workspace [style*="color:#A0AEC0"],
.admin-runtime-body .royal-workspace [style*="color:#CBD5E0"],
.admin-runtime-body .royal-workspace [style*="color:#9CA3AF"],
.admin-runtime-body .royal-workspace [style*="color:#A1A1AA"] {
  color: var(--theme-hero-muted) !important;
}

.admin-runtime-body .royal-card [style*="color:#1f1f33"],
.admin-runtime-body .royal-card [style*="color:#1A1A2E"],
.admin-runtime-body .royal-card [style*="color:#08080C"],
.admin-runtime-body .royal-card [style*="color:#2a2a3f"],
.admin-runtime-body .royal-workspace [style*="color:#1f1f33"],
.admin-runtime-body .royal-workspace [style*="color:#1A1A2E"],
.admin-runtime-body .royal-workspace [style*="color:#08080C"],
.admin-runtime-body .royal-workspace [style*="color:#2a2a3f"] {
  color: var(--theme-hero-text) !important;
}

.admin-runtime-body .royal-card :is(svg, .link-icon, .action-icon),
.admin-runtime-body .royal-workspace :is(svg, .link-icon, .action-icon) {
  color: currentColor;
}

.admin-runtime-body .royal-card h1, .admin-runtime-body .royal-card h2,
.admin-runtime-body .royal-card h3, .admin-runtime-body .royal-card h4,
.admin-runtime-body .royal-card h5, .admin-runtime-body .royal-card h6,
.admin-runtime-body .royal-workspace h1, .admin-runtime-body .royal-workspace h2,
.admin-runtime-body .royal-workspace h3, .admin-runtime-body .royal-workspace h4,
.admin-runtime-body .royal-workspace h5, .admin-runtime-body .royal-workspace h6,
.admin-runtime-body .royal-card strong, .admin-runtime-body .royal-workspace strong {
  color: var(--theme-hero-text) !important;
}

.admin-runtime-body .royal-card label,
.admin-runtime-body .royal-workspace label {
  color: var(--theme-hero-muted) !important;
}

.admin-runtime-body .royal-card input, .admin-runtime-body .royal-card select,
.admin-runtime-body .royal-card textarea, .admin-runtime-body .royal-workspace input,
.admin-runtime-body .royal-workspace select, .admin-runtime-body .royal-workspace textarea {
  background-color: var(--theme-input-bg) !important;
  color: var(--theme-input-text) !important;
  border: 1px solid var(--theme-input-border) !important;
}

.admin-runtime-body .royal-card input::placeholder,
.admin-runtime-body .royal-card textarea::placeholder,
.admin-runtime-body .royal-workspace input::placeholder,
.admin-runtime-body .royal-workspace textarea::placeholder {
  color: var(--theme-text-muted) !important;
}

.admin-runtime-body .royal-card a,
.admin-runtime-body .royal-workspace a {
  color: var(--theme-hero-text) !important;
  text-decoration: underline;
}

.admin-runtime-body .royal-card a:hover,
.admin-runtime-body .royal-workspace a:hover {
  color: var(--theme-hero-muted) !important;
}

.admin-runtime-body .royal-badge-replied {
  background: var(--theme-success-bg) !important;
  color: var(--theme-success-text) !important;
  border-color: var(--theme-success-text) !important;
}

.admin-runtime-body .royal-badge-pending {
  background: var(--theme-warning-bg) !important;
  color: var(--theme-warning-text) !important;
  border-color: var(--theme-warning-text) !important;
}

/* Modern admin pages can opt into the light semantic workspace explicitly. */
.admin-runtime-body .semantic-admin-workspace .royal-card,
.admin-runtime-body .semantic-admin-workspace.royal-workspace {
  background: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

.admin-runtime-body .semantic-admin-workspace .royal-card :is(h1, h2, h3, h4, h5, h6, strong) {
  color: var(--theme-heading) !important;
}

.admin-runtime-body .semantic-admin-workspace .royal-card .royal-header .royal-title {
  color: var(--theme-accent-text) !important;
}

.admin-runtime-body .semantic-admin-workspace .royal-card label {
  color: var(--theme-text) !important;
}

.admin-runtime-body .semantic-admin-workspace .royal-card a:not(.royal-btn-reply):not(.btn) {
  color: var(--theme-link) !important;
}

.admin-runtime-body .semantic-admin-workspace .royal-card a:not(.royal-btn-reply):not(.btn):hover {
  color: var(--theme-link-hover) !important;
}

/* Standard content and commerce cards use semantic theme surfaces. */
.card, 
.recipe-card, 
.product-card, 
.cart-item, 
.harvest-card, 
.checkout-summary, 
.checkout-card, 
.checkout-box,
.recipe-detail-card,
.ingredients-card {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

.card h1, .card h2, .card h3, .card h4, .card h5, .card h6,
.recipe-card h1, .recipe-card h2, .recipe-card h3, .recipe-card h4, .recipe-card h5, .recipe-card h6,
.product-card h1, .product-card h2, .product-card h3, .product-card h4, .product-card h5, .product-card h6,
.checkout-summary h1, .checkout-summary h2, .checkout-summary h3, .checkout-summary h4, .checkout-summary h5, .checkout-summary h6,
.checkout-card h1, .checkout-card h2, .checkout-card h3, .checkout-card h4, .checkout-card h5, .checkout-card h6,
.checkout-box h1, .checkout-box h2, .checkout-box h3, .checkout-box h4, .checkout-box h5, .checkout-box h6 {
  color: var(--theme-heading) !important;
}

.card label, .recipe-card label, .product-card label, .checkout-summary label, .checkout-card label, .checkout-box label {
  color: var(--theme-text) !important;
}

.card input, .recipe-card input, .product-card input, .checkout-summary input, .checkout-card input, .checkout-box input,
.card select, .recipe-card select, .product-card select, .checkout-summary select, .checkout-card select, .checkout-box select,
.card textarea, .recipe-card textarea, .product-card textarea, .checkout-summary textarea, .checkout-card textarea, .checkout-box textarea {
  background-color: var(--theme-input-bg) !important;
  color: var(--theme-input-text) !important;
  border: 1px solid var(--theme-input-border) !important;
}

/* Restore correct colors for recipe and product card badges/meta labels that get overridden by generic card overrides */
.recipe-card .recipe-card__badge,
.recipe-card .recipe-card__badge * {
  color: var(--royal-gold, #F59E0B) !important;
}
.recipe-card .recipe-card__badge[aria-label="Featured recipe"],
.recipe-card .recipe-card__badge[aria-label="Featured recipe"] * {
  color: var(--royal-cream, #ffffff) !important;
}
.recipe-card .recipe-card__time,
.recipe-card .recipe-card__time * {
  color: var(--royal-cream, #FFFFFF) !important;
}
.recipe-card .recipe-card__rating,
.recipe-card .recipe-card__rating * {
  color: var(--royal-gold-dark, #D97706) !important;
}
.recipe-card .recipe-card__meta-item,
.recipe-card .recipe-card__meta-item * {
  color: var(--royal-text-muted, #64748B) !important;
}
.recipe-card .recipe-card__chef span {
  color: var(--royal-text-muted, #475569) !important;
}

.product-card .product-card__description {
  color: var(--theme-text-muted) !important;
}
.product-card .product-card__weight {
  color: var(--theme-text-muted) !important;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

.product-card:hover .product-card__img {
  transform: scale(1.03);
}

.product-card__channel--affiliate {
  background: var(--theme-warning-bg) !important;
  color: var(--theme-warning-text) !important;
}

.product-card__channel--native {
  background: var(--theme-success-bg) !important;
  color: var(--theme-success-text) !important;
}

@media (prefers-reduced-motion: reduce) {
  .product-card,
  .product-card__img {
    transition: none !important;
  }
  .product-card:hover {
    transform: none;
  }
  .product-card:hover .product-card__img {
    transform: none;
  }
}
