html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6f8;
  --card: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f1f4;
  --line: rgba(24, 24, 27, 0.12);
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #52525b;
  --faint: #71717a;
  --green: #6830ea;
  --red: #b91c1c;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #be123c;
  --rail-text: #18181b;
  --rail-muted: #52525b;
  --rail-border: #e4e4e7;
}

html[data-theme="light"] body {
  background: var(--bg) !important;
  color: var(--muted) !important;
}

.theme-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.9);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  font: 600 0.75rem/1 "Geist", "Geist Fallback", system-ui, sans-serif;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.theme-toggle:hover { border-color: rgba(255, 255, 255, 0.35); }
.theme-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.theme-toggle-icon { display: inline-flex; width: 15px; height: 15px; }
.theme-toggle-icon svg { width: 15px; height: 15px; }

html[data-theme="light"] .theme-toggle {
  border-color: #d4d4d8;
  background: rgba(255, 255, 255, 0.94);
  color: #18181b;
  box-shadow: 0 8px 24px rgba(24, 24, 27, 0.12);
}

/* Portal de clientes */
html[data-theme="light"] .portal-header {
  background: rgba(246, 246, 248, 0.9) !important;
  border-color: var(--border) !important;
}
html[data-theme="light"] .site-rail {
  background: #fff !important;
  border-color: var(--rail-border) !important;
  color: var(--rail-text) !important;
}
html[data-theme="light"] .site-rail-brand { color: var(--rail-text) !important; }
html[data-theme="light"] .site-rail-toggle,
html[data-theme="light"] .site-rail-hide,
html[data-theme="light"] .site-rail-mobile-toggle,
html[data-theme="light"] .site-rail-mobile-close,
html[data-theme="light"] .site-rail-reopen { color: var(--rail-muted) !important; }
html[data-theme="light"] .site-rail-toggle:hover,
html[data-theme="light"] .site-rail-hide:hover,
html[data-theme="light"] .site-rail-mobile-toggle:hover,
html[data-theme="light"] .site-rail-mobile-close:hover,
html[data-theme="light"] .site-rail-reopen:hover {
  color: var(--rail-text) !important;
  background: rgba(24, 24, 27, 0.05) !important;
}
html[data-theme="light"] .site-rail-reopen { background: #fff !important; }
html[data-theme="light"] .site-rail-nav a,
html[data-theme="light"] .site-rail-bottom a { color: var(--rail-muted) !important; }
html[data-theme="light"] .site-rail-nav a:hover,
html[data-theme="light"] .site-rail-bottom a:hover {
  color: var(--rail-text) !important;
  background: rgba(24, 24, 27, 0.05) !important;
}
html[data-theme="light"] .site-rail-nav a.is-active {
  color: var(--rail-text) !important;
  border-color: rgba(85, 106, 243, 0.45) !important;
  background: rgba(85, 106, 243, 0.1) !important;
}
html[data-theme="light"] .site-rail:not(.is-expanded) .site-rail-brand::after,
html[data-theme="light"] .site-rail:not(.is-expanded) .site-rail-nav a::after,
html[data-theme="light"] .site-rail:not(.is-expanded) .site-rail-bottom a::after {
  background: #fff !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
html[data-theme="light"] .site-rail-backdrop { background: rgba(24, 24, 27, 0.35); }
html[data-theme="light"] .portal-footer { border-color: var(--border); }

html[data-theme="light"] .card,
html[data-theme="light"] .dashboard-card {
  background: #fff !important;
  border-color: var(--border) !important;
}
html[data-theme="light"] .dashboard-card strong,
html[data-theme="light"] .hero-balance strong { color: #18181b !important; }
html[data-theme="light"] .dashboard-card:hover { background: #fafafa !important; }
html[data-theme="light"] tbody tr:hover { background: rgba(24, 24, 27, 0.035) !important; }
html[data-theme="light"] th { color: var(--muted); }
html[data-theme="light"] .customer-group-row td {
  background: rgba(85, 106, 243, 0.08) !important;
  border-color: rgba(85, 106, 243, 0.2) !important;
  color: var(--text) !important;
}
html[data-theme="light"] .filter-select,
html[data-theme="light"] .portal-page input,
html[data-theme="light"] .portal-page select,
html[data-theme="light"] .portal-page textarea {
  background: #fff !important;
  color: var(--text) !important;
  border-color: #d4d4d8 !important;
}
html[data-theme="light"] .pill { border-color: var(--border); }

/* Checkout y páginas de contrato */
html[data-theme="light"] nav {
  background: var(--bg) !important;
  border-color: var(--line) !important;
}
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  background: #fff !important;
  color: #18181b !important;
  -webkit-text-fill-color: #18181b !important;
  border-color: #d4d4d8 !important;
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #71717a !important;
  -webkit-text-fill-color: #71717a !important;
}
html[data-theme="light"] .btn-primary {
  background: #18181b !important;
  color: #fff !important;
}
html[data-theme="light"] .btn-primary:hover { background: #3f3f46 !important; }
html[data-theme="light"] .btn-secondary {
  border-color: #d4d4d8 !important;
  color: #18181b !important;
}
html[data-theme="light"] .form-card,
html[data-theme="light"] .plan-info,
html[data-theme="light"] .resumen-pago,
html[data-theme="light"] .pending-orders,
html[data-theme="light"] .spidi-card,
html[data-theme="light"] .pasarela-box {
  background: #fff !important;
  border-color: #e4e4e7 !important;
}
html[data-theme="light"] .pm-card {
  background: #fff !important;
  border-color: #d4d4d8 !important;
  color: #18181b !important;
}
html[data-theme="light"] .pm-card:hover { background: #fafafa !important; }
html[data-theme="light"] .pm-card.selected {
  background: rgba(104, 48, 234, 0.08) !important;
  border-color: rgba(104, 48, 234, 0.55) !important;
}
html[data-theme="light"] .pm-radio { border-color: #a1a1aa; }
html[data-theme="light"] .pm-card.selected .pm-radio { border-color: #6830ea; }
html[data-theme="light"] .pm-card.selected .pm-radio::after { background: #6830ea; }
html[data-theme="light"] .checkout-pending-card {
  background: #fff !important;
  border-color: #d4d4d8 !important;
  color: #18181b !important;
}
html[data-theme="light"] .checkout-pending-section h2,
html[data-theme="light"] .checkout-customer-group h3 { color: #18181b !important; }
html[data-theme="light"] .checkout-pending-card.selected {
  background: rgba(104, 48, 234, 0.1) !important;
  border-color: #6830ea !important;
}
html[data-theme="light"] .checkout-pending-content strong,
html[data-theme="light"] .checkout-pending-content b { color: #18181b !important; }
html[data-theme="light"] .checkout-pending-content span { color: #52525b !important; }
html[data-theme="light"] .checkout-selection-summary {
  background: #fff !important;
  border-color: #e4e4e7 !important;
}
html[data-theme="light"] .checkout-selection-count { color: #52525b !important; }
html[data-theme="light"] .checkout-selection-count strong { color: #18181b !important; }
html[data-theme="light"] .checkout-selection-table td { color: #18181b !important; }
html[data-theme="light"] .checkout-selection-table thead th,
html[data-theme="light"] .checkout-selection-table th:first-child { color: #71717a !important; }
html[data-theme="light"] .checkout-selection-table tr.is-total th,
html[data-theme="light"] .checkout-selection-table tr.is-total td { color: #18181b !important; }
html[data-theme="light"] .checkout-selection-tools button {
  border-color: #d4d4d8 !important;
  color: #18181b !important;
}
html[data-theme="light"] .checkout-selection-tools button:hover { background: #f4f4f5 !important; }
html[data-theme="light"] .checkout-back-to-perfil { color: #52525b !important; }

/* Páginas generadas por Builder */
html[data-theme="light"] body[class^="fb-"] {
  background: #f6f6f8 !important;
  color: #18181b !important;
}
html[data-theme="light"] body[class^="fb-"] [class*="fb-"] {
  background-color: transparent !important;
  color: #18181b !important;
}
html[data-theme="light"] body[class^="fb-"] a[class*="fb-"] { color: #18181b !important; }
html[data-theme="light"] body[class^="fb-"] span[style*="color:#6830EA"] { color: #6830ea !important; }
html[data-theme="light"] body[class^="fb-"] span[style*="color:#666666"] { color: #71717a !important; }

html[data-theme="light"] body[class^="fb-"] .theme-surface {
  background: #fff !important;
  border-color: #e4e4e7 !important;
  color: #18181b !important;
}
html[data-theme="light"] body[class^="fb-"] a.theme-light-control,
html[data-theme="light"] body[class^="fb-"] button.theme-light-control {
  background: #18181b !important;
  border-color: #18181b !important;
  color: #fff !important;
}
html[data-theme="light"] body[class^="fb-"] a.theme-light-control *,
html[data-theme="light"] body[class^="fb-"] button.theme-light-control * { color: #fff !important; }

@media (max-width: 640px) {
  .theme-toggle { right: 0.75rem; bottom: 0.75rem; }
}

@media print {
  .theme-toggle { display: none !important; }
}
