/* UA Electronics contrast repair — loaded after every existing theme stylesheet.
   Presentation only: no commerce, authentication, catalogue, or payment logic. */

:root {
  --ua-contrast-ink: #1d1d1f;
  --ua-contrast-muted: #62666f;
  --ua-contrast-paper: #ffffff;
  --ua-contrast-page: #f5f5f7;
  --ua-contrast-surface: rgba(255,255,255,.94);
  --ua-contrast-surface-alt: #f0f1f4;
  --ua-contrast-line: #d2d4da;
  --ua-contrast-accent: #0066cc;
  --ua-contrast-focus: rgba(0,102,204,.22);
}

html:not([data-theme="dark"]) {
  color-scheme: light;
  --ink: #1d1d1f;
  --muted: #62666f;
  --paper: #ffffff;
  --surface: #f5f5f7;
  --surface-raised: rgba(255,255,255,.94);
  --line: #d2d4da;
  --accent: #0066cc;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f7fa;
  --muted: #b1b7c2;
  --paper: #101216;
  --surface: #191c22;
  --surface-raised: #20242b;
  --line: #3b414b;
  --accent: #58a6ff;
}

/* ===== Admin: product review + order management ===== */
html:not([data-theme="dark"]) body:has(.admin-shell) {
  background: #f5f5f7 !important;
  color: #1d1d1f !important;
}
html[data-theme="dark"] body:has(.admin-shell) {
  background: radial-gradient(ellipse at 8% 0%, rgba(41,151,255,.10), transparent 34%), #101216 !important;
  color: #f5f7fa !important;
}
body:has(.admin-shell) .admin-shell,
body:has(.admin-shell) .admin-header,
body:has(.admin-shell) .admin-header > div,
body:has(.admin-shell) .order-header-copy,
body:has(.admin-shell) .order-header-actions {
  color: var(--ink) !important;
}
html:not([data-theme="dark"]) body:has(.admin-shell) .admin-header h1,
html:not([data-theme="dark"]) body:has(.admin-shell) .panel h2,
html:not([data-theme="dark"]) body:has(.admin-shell) .product-heading h3,
html:not([data-theme="dark"]) body:has(.admin-shell) .order-card h3 {
  color: #1d1d1f !important;
}
html[data-theme="dark"] body:has(.admin-shell) .admin-header h1,
html[data-theme="dark"] body:has(.admin-shell) .panel h2,
html[data-theme="dark"] body:has(.admin-shell) .product-heading h3,
html[data-theme="dark"] body:has(.admin-shell) .order-card h3,
html[data-theme="dark"] body:has(.admin-shell) .panel strong,
html[data-theme="dark"] body:has(.admin-shell) .order-card strong {
  color: #f5f7fa !important;
}
body:has(.admin-shell) .muted,
body:has(.admin-shell) .pagination span,
body:has(.admin-shell) .product-visual .sku,
body:has(.admin-shell) .order-meta {
  color: var(--muted) !important;
}
body:has(.admin-shell) .panel,
body:has(.admin-shell) .product-card,
body:has(.admin-shell) .order-card,
body:has(.admin-shell) .empty-state,
body:has(.admin-shell) .order-empty {
  color: var(--ink) !important;
  border-color: var(--line) !important;
  background: var(--surface-raised) !important;
}
body:has(.admin-shell) label,
body:has(.admin-shell) .field label,
body:has(.admin-shell) .login-panel label,
body:has(.admin-shell) .toolbar-controls label,
body:has(.admin-shell) .order-filters label,
body:has(.admin-shell) .order-search label,
body:has(.admin-shell) .order-stat label,
body:has(.admin-shell) .detail-key {
  color: var(--muted) !important;
}
body:has(.admin-shell) input:not([type="checkbox"]),
body:has(.admin-shell) textarea,
body:has(.admin-shell) select {
  color: var(--ink) !important;
  background-color: var(--paper) !important;
  border: 1px solid var(--line) !important;
  caret-color: var(--accent);
  color-scheme: inherit;
}
body:has(.admin-shell) input::placeholder,
body:has(.admin-shell) textarea::placeholder {
  color: var(--muted) !important;
  opacity: 1 !important;
}
body:has(.admin-shell) option {
  color: #1d1d1f;
  background: #ffffff;
}
body:has(.admin-shell) input:focus-visible,
body:has(.admin-shell) textarea:focus-visible,
body:has(.admin-shell) select:focus-visible,
body:has(.admin-shell) button:focus-visible,
body:has(.admin-shell) a:focus-visible {
  outline: 3px solid var(--ua-contrast-focus) !important;
  outline-offset: 2px;
}
html[data-theme="dark"] body:has(.admin-shell) input:focus-visible,
html[data-theme="dark"] body:has(.admin-shell) textarea:focus-visible,
html[data-theme="dark"] body:has(.admin-shell) select:focus-visible,
html[data-theme="dark"] body:has(.admin-shell) button:focus-visible,
html[data-theme="dark"] body:has(.admin-shell) a:focus-visible {
  --ua-contrast-focus: rgba(88,166,255,.42);
}
html[data-theme="dark"] body:has(.admin-shell) input:not([type="checkbox"]),
html[data-theme="dark"] body:has(.admin-shell) textarea,
html[data-theme="dark"] body:has(.admin-shell) select {
  background-color: #171a20 !important;
  color: #f5f7fa !important;
  border-color: #454b56 !important;
  color-scheme: dark;
}
body:has(.admin-shell) .review-warning,
body:has(.admin-shell) .manual-review-note {
  background: #fff7df !important;
  border-color: #d69a18 !important;
  color: #644800 !important;
}
html[data-theme="dark"] body:has(.admin-shell) .review-warning,
html[data-theme="dark"] body:has(.admin-shell) .manual-review-note {
  background: #302713 !important;
  border-color: #9b741b !important;
  color: #f6df9a !important;
}
body:has(.admin-shell) .notice {
  background: #eaf3ff !important;
  color: #164a83 !important;
  border: 1px solid #c7dcfb !important;
}
body:has(.admin-shell) .notice.error {
  background: #fff0f0 !important;
  color: #9e252d !important;
  border-color: #f2c3c6 !important;
}
body:has(.admin-shell) .notice.success {
  background: #eaf8ef !important;
  color: #176438 !important;
  border-color: #bde6ca !important;
}
html[data-theme="dark"] body:has(.admin-shell) .notice {
  background: #142b42 !important;
  color: #c7e2ff !important;
  border-color: #294e70 !important;
}
html[data-theme="dark"] body:has(.admin-shell) .notice.error {
  background: #3a1d23 !important;
  color: #ffc4c8 !important;
  border-color: #71313b !important;
}
html[data-theme="dark"] body:has(.admin-shell) .notice.success {
  background: #163326 !important;
  color: #b9f2cc !important;
  border-color: #285a3d !important;
}
body:has(.admin-shell) .status-pill,
body:has(.admin-shell) .order-badge {
  color: #654600 !important;
  background: #fff0c4 !important;
  border-color: #e0bd67 !important;
}
body:has(.admin-shell) .status-pill.live,
body:has(.admin-shell) .order-badge.paid,
body:has(.admin-shell) .order-badge.delivered {
  color: #145c32 !important;
  background: #e0f6e7 !important;
  border-color: #a9d9b8 !important;
}
html[data-theme="dark"] body:has(.admin-shell) .status-pill,
html[data-theme="dark"] body:has(.admin-shell) .order-badge {
  color: #f6df9a !important;
  background: #302713 !important;
  border-color: #71591e !important;
}
html[data-theme="dark"] body:has(.admin-shell) .status-pill.live,
html[data-theme="dark"] body:has(.admin-shell) .order-badge.paid,
html[data-theme="dark"] body:has(.admin-shell) .order-badge.delivered {
  color: #b9f2cc !important;
  background: #163326 !important;
  border-color: #285a3d !important;
}
body:has(.admin-shell) .button:disabled {
  opacity: 1 !important;
  cursor: not-allowed;
}
body:has(.admin-shell) .admin-theme-toggle,
body:has(.admin-shell) .theme-toggle {
  display: inline-flex !important;
  visibility: visible !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: auto !important;
  min-width: 112px !important;
  min-height: 38px !important;
  padding: 8px 13px !important;
  margin: 0 8px 0 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: var(--surface-raised) !important;
  color: var(--ink) !important;
  font: 650 12px/1.2 Inter, ui-sans-serif, system-ui, sans-serif !important;
  opacity: 1 !important;
}
body:has(.admin-shell) .admin-theme-toggle .theme-toggle-icon,
body:has(.admin-shell) .theme-toggle .theme-toggle-icon {
  display: inline-block !important;
  visibility: visible !important;
  color: var(--ink) !important;
  font-size: 18px !important;
  line-height: 1 !important;
}
body:has(.admin-shell) .admin-theme-toggle .theme-toggle-label,
body:has(.admin-shell) .theme-toggle .theme-toggle-label {
  display: inline !important;
  visibility: visible !important;
  color: var(--ink) !important;
  white-space: nowrap !important;
  opacity: 1 !important;
}

/* ===== Storefront, cart, delivery form and payment hand-off ===== */
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) {
  color: #1d1d1f;
  background-color: #f5f5f7;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) {
  color: #f5f7fa !important;
  background-color: #101216 !important;
}
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .site-header {
  color: #1d1d1f;
  background: rgba(255,255,255,.92);
  border-color: #e0e2e7;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .site-header {
  color: #f5f7fa !important;
  background: rgba(18,21,27,.96) !important;
  border-color: #343943 !important;
}
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .cart-page-heading h1,
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .checkout-heading h2,
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .checkout-result h2 {
  color: #1d1d1f !important;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-page-heading h1,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-heading h2,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-result h2,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-items-heading,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-summary-panel h2,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-heading p,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-result p {
  color: #f5f7fa !important;
}
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .checkout-form-section,
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .cart-items-panel,
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .cart-summary-panel,
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .checkout-result {
  background: rgba(255,255,255,.94) !important;
  color: #1d1d1f !important;
  border-color: #e0e2e7 !important;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-form-section,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-items-panel,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-summary-panel,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-result,
html[data-theme="dark"] body:not(:has(.admin-shell)) .catalogue-empty {
  background: #1b1f26 !important;
  color: #f5f7fa !important;
  border-color: #3a414c !important;
}
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .checkout-fields-grid label,
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .checkout-consent {
  color: #4a4f59 !important;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-fields-grid label,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-consent,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-summary-panel,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-summary-panel p,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-summary-panel span,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-summary-panel strong,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-item,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-item * {
  color: #d8dee8 !important;
}
body:not(:has(.admin-shell)) .checkout-fields-grid input,
body:not(:has(.admin-shell)) .checkout-fields-grid select,
body:not(:has(.admin-shell)) .checkout-fields-grid textarea {
  width: 100%;
  background: #ffffff !important;
  color: #1d1d1f !important;
  border: 1px solid #cfd3db !important;
  -webkit-text-fill-color: #1d1d1f;
  caret-color: #0066cc;
}
body:not(:has(.admin-shell)) .checkout-fields-grid input::placeholder,
body:not(:has(.admin-shell)) .checkout-fields-grid textarea::placeholder {
  color: #656b75 !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #656b75;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-fields-grid input,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-fields-grid select,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-fields-grid textarea {
  background: #252a32 !important;
  color: #f5f7fa !important;
  border-color: #4b5563 !important;
  -webkit-text-fill-color: #f5f7fa;
  caret-color: #58a6ff;
  color-scheme: dark;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-fields-grid input::placeholder,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-fields-grid textarea::placeholder {
  color: #aeb7c5 !important;
  -webkit-text-fill-color: #aeb7c5;
}
body:not(:has(.admin-shell)) .checkout-warning {
  background: #fff5d8 !important;
  color: #624800 !important;
  border: 1px solid #e3c36f !important;
  border-radius: 13px;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-warning {
  background: #302713 !important;
  color: #f6df9a !important;
  border-color: #8b6b20 !important;
}
body:not(:has(.admin-shell)) .checkout-message:not(:empty),
body:not(:has(.admin-shell)) .catalogue-feedback {
  background: #eaf3ff !important;
  color: #194b80 !important;
  border-color: #c5dcfa !important;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-message:not(:empty),
html[data-theme="dark"] body:not(:has(.admin-shell)) .catalogue-feedback {
  background: #142b42 !important;
  color: #c7e2ff !important;
  border-color: #2b5579 !important;
}
body:not(:has(.admin-shell)) .shipping-rule-note,
body:not(:has(.admin-shell)) .cart-summary-footnote,
body:not(:has(.admin-shell)) .checkout-heading > p:not(.eyebrow),
body:not(:has(.admin-shell)) .site-footer {
  color: #62666f !important;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .shipping-rule-note,
html[data-theme="dark"] body:not(:has(.admin-shell)) .cart-summary-footnote,
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-heading > p:not(.eyebrow),
html[data-theme="dark"] body:not(:has(.admin-shell)) .site-footer {
  color: #b1b7c2 !important;
}
body:not(:has(.admin-shell)) .checkout-submit:disabled,
body:not(:has(.admin-shell)) button:disabled,
body:not(:has(.admin-shell)) .button:disabled {
  opacity: 1 !important;
  cursor: not-allowed;
}
html:not([data-theme="dark"]) body:not(:has(.admin-shell)) .checkout-submit:disabled {
  background: #d8e8f9 !important;
  color: #2b5278 !important;
  border: 1px solid #b8d2ef !important;
  box-shadow: none !important;
}
html[data-theme="dark"] body:not(:has(.admin-shell)) .checkout-submit:disabled {
  background: #244a70 !important;
  color: #f5f7fa !important;
  border: 1px solid #3e668e !important;
  box-shadow: none !important;
}
body:not(:has(.admin-shell)) .theme-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 11px;
  background: var(--surface-raised) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  opacity: 1 !important;
}
body:not(:has(.admin-shell)) .theme-toggle-icon,
body:not(:has(.admin-shell)) .theme-toggle-label {
  color: var(--ink) !important;
  opacity: 1 !important;
}

@media (prefers-reduced-motion: reduce) {
  body *, body *::before, body *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
