/* ============================================================
   FDV Holding ERP - Light Theme Layer
   White operational theme inspired by the Dashboard CRM report.
   Loaded after the existing visual layers and activated with
   html[data-theme="light"].
   ============================================================ */

/* Theme switch shared by both themes */
.theme-toggle {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid rgba(141, 174, 187, 0.20);
  border-radius: var(--radius-sm);
  color: var(--ambient-text-2, var(--gray));
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    color 160ms var(--ease-out),
    transform 140ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
}

.theme-toggle:hover {
  border-color: rgba(23, 212, 207, 0.34);
  color: var(--ambient-text, var(--white));
  background: rgba(23, 212, 207, 0.08);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--ambient-focus, 0 0 0 3px var(--focus-ring));
}

.theme-toggle:active { transform: scale(0.98); }

.theme-toggle-icon {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--mint);
  background: var(--mint-dim);
}

.theme-icon {
  position: absolute;
  width: 16px;
  height: 16px;
  transition: opacity 160ms var(--ease-out), transform 180ms var(--ease-out);
}

.theme-icon-sun { opacity: 0; transform: rotate(-22deg) scale(0.82); }
.theme-icon-moon { opacity: 1; transform: rotate(0) scale(1); }

.theme-toggle-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.theme-toggle-copy span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.theme-toggle-copy strong {
  overflow: hidden;
  color: currentColor;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle-track {
  position: relative;
  width: 32px;
  height: 18px;
  border: 1px solid rgba(141, 174, 187, 0.28);
  border-radius: 999px;
  background: rgba(3, 21, 25, 0.62);
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.theme-toggle-track > span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ambient-muted, var(--muted));
  transition: transform 180ms var(--ease-out), background-color 160ms var(--ease-out);
}

/* Light design tokens */
html[data-theme="light"] {
  color-scheme: light;

  --theme-name: "FDV Claro";
  --ambient-bg-0: #edf2f3;
  --ambient-bg-1: #f4f7f8;
  --ambient-bg-2: #eaf2f0;
  --ambient-panel: #ffffff;
  --ambient-panel-strong: #ffffff;
  --ambient-panel-soft: #f4f8f8;
  --ambient-border: #d5e0e3;
  --ambient-border-strong: #9fcdbd;
  --ambient-cyan: #08725e;
  --ambient-green: #0f805f;
  --ambient-warning: #9a680d;
  --ambient-danger: #b84646;
  --ambient-info: #276fa5;
  --ambient-text: #17323a;
  --ambient-text-2: #36515a;
  --ambient-muted: #657980;
  --ambient-shadow-sm: 0 1px 2px rgba(28, 70, 76, 0.07);
  --ambient-shadow-md: 0 10px 26px rgba(28, 70, 76, 0.09);
  --ambient-shadow-float: 0 20px 54px rgba(28, 70, 76, 0.16);
  --ambient-focus: 0 0 0 3px rgba(8, 114, 94, 0.18);

  --navy: #f4f7f8;
  --navy-deep: #edf2f3;
  --navy-light: #eaf2f0;
  --navy-card: #ffffff;
  --navy-hover: rgba(8, 114, 94, 0.07);
  --navy-dark: #eef4f3;
  --mint: #08725e;
  --mint-dim: rgba(8, 114, 94, 0.10);
  --mint-glow: rgba(8, 114, 94, 0.055);
  --teal: #0f805f;
  --teal-dim: rgba(15, 128, 95, 0.12);
  --blue-fdv: #164f91;
  --white: #17323a;
  --gray: #36515a;
  --gray-dim: rgba(23, 50, 58, 0.06);
  --black: #102c33;
  --muted: #657980;
  --border: #d5e0e3;
  --border-sub: #e1e9eb;
  --border-color: #d5e0e3;
  --text: #17323a;
  --text-secondary: #526b73;
  --text-muted: #657980;
  --surface-1: #ffffff;
  --surface-2: #f4f8f8;
  --surface-3: rgba(8, 114, 94, 0.055);
  --focus-ring: rgba(8, 114, 94, 0.20);
  --panel: #ffffff;
  --card-bg: #ffffff;
  --card-border: #d5e0e3;
  --green: #08725e;
  --primary: #08725e;
  --accent: #08725e;
  --radius: 8px;
  --font-head: var(--font-title);

  --color-ingreso: #087a58;
  --color-egreso: #b84646;
  --color-neutral: #526b73;
  --color-warning: #8a610f;
  --color-info: #276fa5;

  --shadow-card: var(--ambient-shadow-md);
  --shadow-glow: 0 0 0 1px rgba(8, 114, 94, 0.025);
  --shadow-modal: var(--ambient-shadow-float);
}

html[data-theme="light"] .theme-icon-moon { opacity: 0; transform: rotate(22deg) scale(0.82); }
html[data-theme="light"] .theme-icon-sun { opacity: 1; transform: rotate(0) scale(1); }
html[data-theme="light"] .theme-toggle-track {
  border-color: rgba(8, 114, 94, 0.28);
  background: rgba(8, 114, 94, 0.12);
}
html[data-theme="light"] .theme-toggle-track > span {
  background: #08725e;
  transform: translateX(14px);
}

/* Canvas and application shell */
html[data-theme="light"],
html[data-theme="light"] body {
  color: var(--text);
  background: #edf2f3;
}

html[data-theme="light"] body {
  background: linear-gradient(180deg, #f7f9f9 0%, #edf2f3 100%);
}

html[data-theme="light"] .app-shell {
  background: #f4f7f8;
}

html[data-theme="light"] .app-shell::before,
html[data-theme="light"] .dashboard-modern::before,
html[data-theme="light"] .dashboard-hero::before {
  display: none;
}

html[data-theme="light"] .main-content,
html[data-theme="light"] .view-container,
html[data-theme="light"] .view {
  color: var(--text-secondary);
  background: transparent;
}

/* Login */
html[data-theme="light"] .login-screen {
  background:
    linear-gradient(135deg, rgba(8, 114, 94, 0.075), transparent 34%),
    linear-gradient(225deg, rgba(39, 111, 165, 0.055), transparent 38%),
    #edf2f3;
}

html[data-theme="light"] .login-card {
  color: var(--text);
  border-color: #c7d8dc;
  background: #ffffff;
  box-shadow: 0 22px 56px rgba(28, 70, 76, 0.14), inset 0 1px 0 rgba(255,255,255,0.9);
}

html[data-theme="light"] .brand-dot-grid span {
  background: #08725e;
  box-shadow: none;
}

html[data-theme="light"] .brand-fdv,
html[data-theme="light"] .login-title,
html[data-theme="light"] .page-title,
html[data-theme="light"] .section-title,
html[data-theme="light"] .table-card-title,
html[data-theme="light"] .chart-title,
html[data-theme="light"] .modal-title {
  color: #17323a;
}

html[data-theme="light"] .brand-bi,
html[data-theme="light"] .brand-tagline,
html[data-theme="light"] .brand-sub,
html[data-theme="light"] .text-mint {
  color: #08725e;
}

/* Sidebar and top bar */
html[data-theme="light"] .sidebar {
  border-right-color: #cbdadd;
  background: #f9fbfb;
  box-shadow: 8px 0 28px rgba(28, 70, 76, 0.07);
}

html[data-theme="light"] .sidebar-brand {
  border-bottom-color: #d5e0e3;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 0 rgba(28, 70, 76, 0.03);
}

html[data-theme="light"] .module-toggle {
  color: #08725e;
}

html[data-theme="light"] .module-toggle:hover,
html[data-theme="light"] .module-group.open > .module-toggle {
  color: #17323a;
  background: linear-gradient(90deg, rgba(8, 114, 94, 0.08), transparent 78%);
}

html[data-theme="light"] .module-chevron,
html[data-theme="light"] .nav-item,
html[data-theme="light"] .user-badge {
  color: #657980;
}

html[data-theme="light"] .nav-item:hover {
  color: #17323a;
  border-color: rgba(8, 114, 94, 0.10);
  background: rgba(8, 114, 94, 0.055);
}

html[data-theme="light"] .nav-item.active {
  color: #075f4f;
  border-color: rgba(8, 114, 94, 0.20);
  background: linear-gradient(90deg, rgba(8, 114, 94, 0.14), rgba(8, 114, 94, 0.045));
  box-shadow: inset 3px 0 0 #08725e;
}

html[data-theme="light"] .sidebar-footer {
  border-top-color: #d5e0e3;
  background: rgba(249, 251, 251, 0.96);
}

html[data-theme="light"] .user-badge strong { color: #17323a; }

html[data-theme="light"] .theme-toggle {
  color: #36515a;
  border-color: #d5e0e3;
  background: #ffffff;
}

html[data-theme="light"] .theme-toggle:hover {
  color: #17323a;
  border-color: #9fcdbd;
  background: #f1f8f5;
}

html[data-theme="light"] .top-bar {
  border-bottom-color: #d5e0e3;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 18px rgba(28, 70, 76, 0.055);
}

html[data-theme="light"] .page-title::before {
  background: #08725e;
  box-shadow: none;
}

/* Shared surfaces */
html[data-theme="light"] :is(
  .kpi-card,
  .table-card,
  .chart-card,
  .diag-lane,
  .diag-card,
  .diag-report-head,
  .prompts-panel,
  .crm-leads-card,
  .crm-campaign-card,
  .crm-quality-card,
  .pago-item,
  .notifications-panel,
  .wa-sidebar,
  .wa-main,
  .wa-header,
  .wa-side-panel,
  .agenda-calendar,
  .md-shell,
  .md-panel,
  .md-table-card,
  .md-records-wrap,
  .nb-layout,
  .nb-months,
  .nb-pages,
  .nb-content,
  .mc-form-panel,
  .mc-metric-card,
  .mc-ficha,
  .mc-flow-node,
  .mc-ia-section,
  .leadq-current,
  .leadq-question,
  .leadq-panel
) {
  color: var(--text-secondary);
  border-color: #d5e0e3;
  background: #ffffff;
  box-shadow: var(--ambient-shadow-sm);
}

html[data-theme="light"] :is(.kpi-card, .chart-card, .diag-card, .pago-item):hover {
  border-color: #9fcdbd;
  box-shadow: var(--ambient-shadow-md);
}

html[data-theme="light"] :is(.kpi-card, .table-card, .chart-card)::after {
  background: linear-gradient(135deg, rgba(8, 114, 94, 0.035), transparent 28%);
}

html[data-theme="light"] :is(.table-card-header, .modal-header, .notifications-head, .wa-header) {
  color: #17323a;
  border-color: #dbe5e7;
  background: #f7f9f9;
}

/* Dashboards */
html[data-theme="light"] .dashboard-hero,
html[data-theme="light"] .dashboard-crm .dashboard-hero,
html[data-theme="light"] .dashboard-operaciones .dashboard-hero {
  color: #17323a;
  border-color: #bfd6ce;
  background: linear-gradient(135deg, #ffffff 0%, #f1f8f5 64%, #eaf3f1 100%);
  box-shadow: 0 14px 34px rgba(28, 70, 76, 0.09), inset 0 1px 0 #ffffff;
}

html[data-theme="light"] .dashboard-hero::after {
  background: linear-gradient(90deg, transparent, rgba(8, 114, 94, 0.42), transparent);
}

html[data-theme="light"] .dashboard-eyebrow {
  color: #075f4f;
  border-color: rgba(8, 114, 94, 0.22);
  background: rgba(8, 114, 94, 0.075);
}

html[data-theme="light"] .dashboard-hero h2,
html[data-theme="light"] .dashboard-hero-metrics strong,
html[data-theme="light"] .kpi-value,
html[data-theme="light"] .crm-leads-stat strong,
html[data-theme="light"] .crm-leads-chart-copy strong,
html[data-theme="light"] .crm-campaign-detail-head strong,
html[data-theme="light"] .crm-campaign-insights strong {
  color: #17323a;
}

html[data-theme="light"] :is(
  .dashboard-hero p,
  .dashboard-hero-metrics span,
  .dashboard-hero-metrics small,
  .kpi-label,
  .kpi-sub,
  .crm-leads-header p,
  .crm-campaign-header p,
  .crm-campaign-detail-head span,
  .crm-leads-stat span,
  .crm-leads-stat small,
  .crm-leads-chart-copy span,
  .crm-leads-legend span,
  .crm-campaign-insights small,
  .crm-campaign-name span
) {
  color: #657980;
}

html[data-theme="light"] .dashboard-hero-metrics,
html[data-theme="light"] .crm-leads-stat,
html[data-theme="light"] .crm-campaign-insights > span,
html[data-theme="light"] .diag-chip,
html[data-theme="light"] .progress-wrap,
html[data-theme="light"] .saldo-track {
  color: #17323a;
  border-color: #d5e0e3;
  background: #f4f8f8;
  box-shadow: none;
}

html[data-theme="light"] .dashboard-modern :is(.kpi-card, .chart-card, .table-card),
html[data-theme="light"] .crm-leads-card,
html[data-theme="light"] .crm-campaign-card {
  border-color: #d5e0e3;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(28, 70, 76, 0.07), inset 0 1px 0 #ffffff;
}

html[data-theme="light"] .crm-leads-card { border-color: #c9dbe2; }
html[data-theme="light"] .crm-spend-card { border-color: #e2c88f; }

html[data-theme="light"] .crm-leads-grid span { border-color: #dbe5e7; }
html[data-theme="light"] .crm-leads-axis,
html[data-theme="light"] .crm-leads-value,
html[data-theme="light"] .crm-leads-label,
html[data-theme="light"] .crm-leads-label small { color: #526b73; }
html[data-theme="light"] .crm-leads-average span { color: #08725e; background: #ffffff; }

/* Tables */
html[data-theme="light"] table { color: #36515a; }

html[data-theme="light"] th,
html[data-theme="light"] .dashboard-modern th,
html[data-theme="light"] .crm-campaign-matrix thead th {
  color: #526b73;
  border-bottom-color: #d5e0e3;
  background: #eaf2f0;
  box-shadow: inset 0 -1px 0 rgba(28, 70, 76, 0.04);
}

html[data-theme="light"] td,
html[data-theme="light"] .crm-campaign-matrix tbody td {
  color: #36515a;
  border-bottom-color: #e1e9eb;
  background: #ffffff;
}

html[data-theme="light"] tbody tr:hover td,
html[data-theme="light"] .dashboard-modern tbody tr:hover td,
html[data-theme="light"] .crm-campaign-matrix tbody tr:hover th,
html[data-theme="light"] .crm-campaign-matrix tbody tr:hover td {
  background: #f1f8f5;
}

html[data-theme="light"] .table-empty,
html[data-theme="light"] .loading-placeholder,
html[data-theme="light"] .notif-empty {
  color: #657980;
  background: #f8fafa;
}

html[data-theme="light"] .crm-campaign-matrix-wrap,
html[data-theme="light"] .crm-campaign-table-wrap,
html[data-theme="light"] .md-sql-table-scroll {
  border-color: #d5e0e3;
  background: #ffffff;
}

html[data-theme="light"] .crm-campaign-matrix tbody tr.primary td {
  color: #0e5045;
  background: #eef8f4;
}

html[data-theme="light"] .crm-campaign-matrix thead th.current {
  color: #145c91;
  background: #e8f3fb;
}

html[data-theme="light"] .crm-substate-state-matrix td.has-value { color: #17323a; }
html[data-theme="light"] .crm-substate-state-matrix td.is-zero { color: #93a2a7; }
html[data-theme="light"] .crm-substate-state-matrix td.is-mismatch,
html[data-theme="light"] .crm-campaign-name span.is-mismatch,
html[data-theme="light"] .crm-campaign-attribution {
  color: #7b5711 !important;
  background: #fff6df;
}

html[data-theme="light"] .crm-active-ads-summary {
  color: #08725e !important;
  background: #eef8f4;
}

/* Forms */
html[data-theme="light"] label { color: #60757d; }

html[data-theme="light"] :is(input, select, textarea, .form-control, .filter-input, .empresa-selector) {
  color: #17323a;
  border-color: #cbdadd;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

html[data-theme="light"] :is(input, select, textarea)::placeholder,
html[data-theme="light"] :is(.form-control, .filter-input)::placeholder {
  color: #87979c;
}

html[data-theme="light"] :is(input, select, textarea, .form-control, .filter-input):hover {
  border-color: #9fcdbd;
  background: #ffffff;
}

html[data-theme="light"] :is(input, select, textarea, .form-control, .filter-input):focus {
  color: #17323a;
  border-color: #08725e;
  background: #ffffff;
  box-shadow: var(--ambient-focus);
}

html[data-theme="light"] select option,
html[data-theme="light"] select optgroup {
  color: #17323a;
  background: #ffffff;
}

/* Buttons */
html[data-theme="light"] .btn-primary {
  color: #ffffff;
  border-color: #08725e;
  background: #08725e;
  box-shadow: 0 7px 16px rgba(8, 114, 94, 0.16), inset 0 1px 0 rgba(255,255,255,0.18);
}

html[data-theme="light"] .btn-primary:hover {
  color: #ffffff;
  background: #075f4f;
  box-shadow: 0 9px 20px rgba(8, 114, 94, 0.20);
}

html[data-theme="light"] :is(.btn-secondary, .btn-ghost-sm, .btn-icon-close) {
  color: #36515a;
  border-color: #cbdadd;
  background: #ffffff;
}

html[data-theme="light"] :is(.btn-secondary, .btn-ghost-sm, .btn-icon-close):hover {
  color: #075f4f;
  border-color: #9fcdbd;
  background: #f1f8f5;
}

html[data-theme="light"] .btn-danger {
  color: #a43f3f;
  border-color: #e2b4b4;
  background: #fff5f5;
}

html[data-theme="light"] .btn-danger:hover { background: #fce9e9; }

html[data-theme="light"] .crm-dashboard-hero-side .crm-dashboard-export-btn {
  color: #ffffff;
  border-color: #08725e;
  background: #08725e;
}

html[data-theme="light"] .crm-dashboard-hero-side .crm-dashboard-export-btn:hover:not(:disabled) {
  color: #ffffff;
  border-color: #075f4f;
  background: #075f4f;
}

/* Statuses and badges */
html[data-theme="light"] .badge { border-color: rgba(23, 50, 58, 0.07); }
html[data-theme="light"] :is(.badge-ingreso, .badge-activo, .badge-pagado, .badge-ganada, .badge-cobrada, .badge-enviada, .badge-aceptada, .badge-baja, .badge-listo, .badge-lead_to_cash, .badge-holding) {
  color: #08725e;
  background: #e8f6f0;
}
html[data-theme="light"] :is(.badge-egreso, .badge-vencido, .badge-perdida, .badge-anulada, .badge-rechazada, .badge-alta) {
  color: #a43f3f;
  background: #fff0f0;
}
html[data-theme="light"] :is(.badge-pendiente, .badge-pausado, .badge-parcial, .badge-simple, .badge-recurrente, .badge-contrato, .badge-producto_fisico, .badge-variable) {
  color: #7b5711;
  background: #fff6df;
}
html[data-theme="light"] :is(.badge-abierta, .badge-borrador, .badge-facturada, .badge-servicio, .badge-producto_digital, .badge-admin, .badge-manager, .badge-usuario, .badge-media, .badge-en-progreso, .badge-venta_facturada, .badge-oportunidad_vendida, .badge-lead_oportunidad, .badge-terminado) {
  color: #145c91;
  background: #e8f3fb;
}
html[data-theme="light"] :is(.badge-inactivo, .badge-cancelado, .badge-stand-by, .badge-cerrada) {
  color: #657980;
  background: #edf2f3;
}

/* Notifications and modal */
html[data-theme="light"] .notifications-btn {
  color: #08725e !important;
  border-color: #9fcdbd !important;
  background: #eef8f4 !important;
  box-shadow: none !important;
}

html[data-theme="light"] .notifications-btn:hover,
html[data-theme="light"] .notifications-btn[aria-expanded="true"] {
  color: #ffffff !important;
  border-color: #08725e !important;
  background: #08725e !important;
}

html[data-theme="light"] .notifications-count { color: #ffffff; background: #9a680d; }

html[data-theme="light"] .notifications-panel {
  color: #36515a;
  border-color: #cbdadd;
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(28, 70, 76, 0.16);
}

html[data-theme="light"] .notifications-list { background: #ffffff; }
html[data-theme="light"] .notif-item { color: #36515a; border-color: #e1e9eb; }
html[data-theme="light"] .notif-item:hover,
html[data-theme="light"] .notif-item:focus-visible { background: #f1f8f5 !important; }
html[data-theme="light"] .notif-title { color: #17323a !important; }
html[data-theme="light"] .notif-detail { color: #526b73 !important; }

html[data-theme="light"] dialog {
  color: #17323a;
  border-color: #b9ced2;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(20, 55, 62, 0.22);
}

html[data-theme="light"] dialog::backdrop {
  background: rgba(18, 45, 52, 0.44);
}

html[data-theme="light"] .modal-body { color: #36515a; }

/* CRM AI and campaign analysis */
html[data-theme="light"] .crm-ai-insight {
  border-color: #9fd8c3;
  background: #eef9f5;
  box-shadow: none;
}

html[data-theme="light"] .crm-ai-insight-head span { color: #08725e; }
html[data-theme="light"] .crm-ai-insight-head strong { color: #12343c; }
html[data-theme="light"] .crm-ai-insight-head small { color: #60757d; }

html[data-theme="light"] .crm-ai-insight-body {
  color: #17323a;
  border-color: #c8ddd5;
  background: #ffffff;
}

html[data-theme="light"] .crm-ai-insight-body.is-loading,
html[data-theme="light"] .crm-ai-insight-body.is-not-generated { color: #71848a; }

html[data-theme="light"] .crm-ai-insight-body.is-error {
  color: #a43f3f;
  border-color: #e2b4b4;
  background: #fff5f5;
}

/* Finance and flow tables */
html[data-theme="light"] .flujo-table { background: #ffffff; }
html[data-theme="light"] .flujo-table th,
html[data-theme="light"] .flujo-head-empresa,
html[data-theme="light"] .flujo-row-saldo-mes td { background: #eaf2f0; }
html[data-theme="light"] .flujo-row-cat td { background: #ffffff; }
html[data-theme="light"] .flujo-row-cat:hover td { background: #f4f8f8; }
html[data-theme="light"] .flujo-row-subtotal td,
html[data-theme="light"] .flujo-row-saldo td,
html[data-theme="light"] .flujo-row-fondos td,
html[data-theme="light"] .flujo-head-sub th { background: #f4f8f8; }

/* WhatsApp and Agenda */
html[data-theme="light"] .wa-sidebar,
html[data-theme="light"] .wa-main,
html[data-theme="light"] .wa-side-panel,
html[data-theme="light"] .wa-header,
html[data-theme="light"] .wa-composer {
  border-color: #d5e0e3;
  background: #ffffff;
}

html[data-theme="light"] :is(.wa-line-pill, .wa-search, .wa-action-select, .wa-msg-input, .wa-panel-input) {
  color: #17323a;
  border-color: #cbdadd;
  background: #ffffff;
}

html[data-theme="light"] .wa-conv-item:hover { background: #f1f8f5; }
html[data-theme="light"] .wa-conv-item.active { color: #17323a; background: #e8f6f0; }
html[data-theme="light"] .wa-bubble { color: #17323a; }
html[data-theme="light"] .wa-bubble-ia .wa-bubble { color: #17323a; border-color: #bed7ea; background: #edf5fb; }
html[data-theme="light"] .wa-bubble-humano .wa-bubble { color: #17323a; border-color: #ead7ae; background: #fff7e9; }
html[data-theme="light"] .wa-empty-state { color: #657980; background: #f8fafa; }

html[data-theme="light"] .agenda-grid-wrap,
html[data-theme="light"] .agenda-requests { border-color: #d5e0e3; background: #ffffff; }
html[data-theme="light"] :is(.agenda-corner, .agenda-day-head, .agenda-hour) { background: #eef4f3; }
html[data-theme="light"] .agenda-slot { background: #fbfcfc; }
html[data-theme="light"] .agenda-item { color: #17323a; background: #e8f6f0; }

/* Campaign notebook */
html[data-theme="light"] .nb-months,
html[data-theme="light"] .nb-pages { border-color: #d5e0e3; background: #f4f8f8; }
html[data-theme="light"] .nb-content { color: #36515a; background: #ffffff; }
html[data-theme="light"] :is(.nb-month-item, .nb-page-item) { color: #657980; }
html[data-theme="light"] :is(.nb-month-item, .nb-page-item):hover { color: #17323a; background: #eaf2f0; }
html[data-theme="light"] .nb-month-item.active { color: #08725e; background: #e8f6f0; }
html[data-theme="light"] .nb-page-item.active { color: #17323a; background: #ffffff; }

/* Metrics, prompts and lead qualification */
html[data-theme="light"] .prompts-output,
html[data-theme="light"] .mc-field :is(input, select),
html[data-theme="light"] .mc-metric-formula code,
html[data-theme="light"] .mc-range-track,
html[data-theme="light"] .mc-save-row input,
html[data-theme="light"] .mc-qc-inputs input,
html[data-theme="light"] .mc-formula-block,
html[data-theme="light"] .mc-ia-result,
html[data-theme="light"] .leadq-current-grid div,
html[data-theme="light"] .leadq-option {
  color: #17323a;
  border-color: #d5e0e3;
  background: #f4f8f8;
}

html[data-theme="light"] .prompts-preset-item:hover,
html[data-theme="light"] .leadq-option:hover { background: #f1f8f5; }
html[data-theme="light"] .prompts-state.inactive { color: #657980; background: #edf2f3; }
html[data-theme="light"] .leadq-score strong { color: #17323a; }
html[data-theme="light"] .leadq-preview-row { border-bottom-color: #dbe5e7; }

/* Data model */
html[data-theme="light"] .md-tabs,
html[data-theme="light"] .md-datos-panel,
html[data-theme="light"] .md-erd-scroll,
html[data-theme="light"] .md-sql-top {
  border-color: #d5e0e3;
  background: #f4f8f8;
}

html[data-theme="light"] .md-tab.active { color: #075f4f; background: #e8f6f0; }
html[data-theme="light"] .md-schema-th-rowlabel,
html[data-theme="light"] .md-schema-row-label { background: #eaf2f0 !important; }
html[data-theme="light"] .md-schema-th,
html[data-theme="light"] .md-records-table thead th { background: #eef4f3; }
html[data-theme="light"] .md-schema-row td { background: #ffffff; }
html[data-theme="light"] .md-schema-row:nth-child(even) td { background: #f7f9f9; }
html[data-theme="light"] .md-erd-box { border-color: #cbdadd; background: #ffffff; }
html[data-theme="light"] .md-erd-box-header { color: #17323a; background: #eaf2f0; }
html[data-theme="light"] .md-erd-col-row { border-bottom-color: #e8edef; }
html[data-theme="light"] .md-sql-textarea { color: #17323a; border-color: #cbdadd; background: #ffffff; }
html[data-theme="light"] .md-kbd,
html[data-theme="light"] .md-group-count { color: #526b73; border-color: #d5e0e3; background: #eaf2f0; }

/* Legacy inline color corrections inside operational views */
html[data-theme="light"] .app-shell [style*="color:#e2e8f0"],
html[data-theme="light"] .app-shell [style*="color:#f1f5f9"],
html[data-theme="light"] .app-shell [style*="color:#ffffff"],
html[data-theme="light"] .app-shell [style*="color:#e8f0fb"] {
  color: #17323a !important;
}

html[data-theme="light"] .app-shell [style*="color:#a0b4cc"],
html[data-theme="light"] .app-shell [style*="color:#8fa0be"],
html[data-theme="light"] .app-shell [style*="color:#5a7a99"],
html[data-theme="light"] .app-shell [style*="color:rgba(255,255,255,0.2"],
html[data-theme="light"] .app-shell [style*="color:rgba(255,255,255,0.3"],
html[data-theme="light"] .app-shell [style*="color:rgba(255,255,255,0.4"],
html[data-theme="light"] .app-shell [style*="color:rgba(255,255,255,0.5"] {
  color: #657980 !important;
}

html[data-theme="light"] .app-shell [style*="background:rgba(255,255,255,0.0"],
html[data-theme="light"] .app-shell [style*="background:rgba(0,0,0,0.1"] {
  background: #f4f8f8 !important;
}

html[data-theme="light"] .app-shell [style*="border:1px solid rgba(255,255,255,0.0"] {
  border-color: #d5e0e3 !important;
}

/* Scrollbars */
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(8, 114, 94, 0.22); }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(8, 114, 94, 0.38); }

@media (max-width: 640px) {
  .theme-toggle { min-height: 44px; }
}

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

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-icon,
  .theme-toggle-track,
  .theme-toggle-track > span {
    transition-duration: 0.001ms !important;
  }
}
