/* Arc negro: el modo oscuro a elegir (15-oct-2026: «pon opción también en negro, que
   puedas elegir entre blanco y negro el programa con la estética negra de Arc»).
   Los colores salen del kit (arc/css: html[data-ui][data-theme="dark"]); aquí van el botón de
   sol y luna del menú, las muestras de Ajustes, el fundido al cambiar y lo que en negro se
   quedaba claro o ilegible. theme.js pone data-theme en el html. */

/* ── Botón sol / luna junto al usuario, como Ajustes y Salir ── */
html[data-ui="festival"] .nav-footer #btn-tema { order:3; }
html[data-ui="festival"] .nav-sidebar #btn-tema {
  width:32px; height:32px; min-height:0; flex:none; margin:0; padding:0; display:inline-grid; place-items:center;
  border:0; border-radius:10px; background:transparent; color:var(--fc-muted); cursor:pointer;
  transition:background-color 150ms ease, color 150ms ease, transform 100ms var(--arc-ease, ease);
}
html[data-ui] #btn-tema svg { grid-area:1/1; width:18px; height:18px; transition:opacity 200ms var(--arc-ease, ease), transform 300ms var(--arc-ease, ease); }
html[data-ui] #btn-tema .nav-tema-sol { opacity:0; transform:rotate(-90deg) scale(.6); }
html[data-ui][data-theme="dark"] #btn-tema .nav-tema-sol { opacity:1; transform:none; }
html[data-ui][data-theme="dark"] #btn-tema .nav-tema-luna { opacity:0; transform:rotate(90deg) scale(.6); }
@media (hover:hover) and (pointer:fine) {
  html[data-ui="festival"] .nav-sidebar #btn-tema:hover { background:var(--fc-secondary); color:var(--fc-ink); }
}
html[data-ui="festival"] .nav-sidebar #btn-tema:active { background:var(--fc-selected); transform:scale(.94); }
html[data-ui] #btn-tema:focus-visible { outline:2px solid var(--fc-ink); outline-offset:2px; }
@media (max-width:800px) { html[data-ui="festival"] .nav-sidebar #btn-tema { width:44px; height:44px; } }
/* Con cuatro piezas en la fila el nombre se recorta antes que los botones */
html[data-ui="festival"] .nav-footer :is(#btn-tema,#btn-ajustes,.btn-logout) { flex-shrink:0; }

/* ── Fundido corto al cambiar (theme.js usa View Transitions si el navegador las tiene) ── */
::view-transition-old(root), ::view-transition-new(root) { animation-duration:220ms; animation-timing-function:cubic-bezier(.22,1,.36,1); }
@media (prefers-reduced-motion:reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation:none; } }

/* ── Ajustes → Apariencia: Blanco, Negro y Como el sistema ── */
html[data-ui][data-design] #modal-ajustes .appearance-options { grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
@media (max-width:560px) { html[data-ui][data-design] #modal-ajustes .appearance-options { grid-template-columns:1fr; } }
html[data-ui][data-design] .appearance-preview.appearance-preview-dark {
  background:linear-gradient(90deg,oklch(21.5% 0 0) 0 22%,oklch(29% 0 0) 22% calc(22% + 1px),transparent 0),oklch(19% 0 0)!important; border-color:oklch(29% 0 0)!important; }
html[data-ui][data-design] .appearance-preview.appearance-preview-dark::after { background:oklch(23% 0 0)!important; border-color:oklch(31% 0 0)!important; }
html[data-ui][data-design] .appearance-preview.appearance-preview-system {
  background:linear-gradient(115deg,oklch(97.8% 0 0) 0 50%,oklch(19% 0 0) 50%)!important; border-color:oklch(50% 0 0 / .35)!important; }
html[data-ui][data-design] .appearance-preview.appearance-preview-system::after {
  background:linear-gradient(115deg,oklch(100% 0 0) 0 46%,oklch(23% 0 0) 46%)!important; }
html[data-ui][data-theme="dark"][data-design] .appearance-preview:not(.appearance-preview-dark):not(.appearance-preview-system) {
  background:linear-gradient(90deg,oklch(100% 0 0) 0 22%,oklch(93.5% 0 0) 22% calc(22% + 1px),transparent 0),oklch(97.8% 0 0)!important; }
html[data-ui][data-theme="dark"][data-design] .appearance-preview:not(.appearance-preview-dark):not(.appearance-preview-system)::after { background:oklch(100% 0 0)!important; border-color:oklch(93.5% 0 0)!important; }

/* ── Lo que en negro se quedaba claro o ilegible ── */
html[data-ui][data-theme="dark"] {
  --rojo-negativo:oklch(74% .17 25);
}
/* Importes negativos y márgenes en rojo puestos en línea desde app.js (#b91c1c) */
html[data-ui][data-theme="dark"] :is([style*="#b91c1c"],[style*="185, 28, 28"]) { color:var(--rojo-negativo)!important; }
html[data-ui][data-theme="dark"] :is([style*="#ef4444"],[style*="239, 68, 68"]) { color:var(--fc-error)!important; }
html[data-ui][data-theme="dark"] :is([style*="#fef2f2"],[style*="254, 242, 242"]) { background:oklch(28% .06 25)!important; }
html[data-ui][data-theme="dark"] :is(.ana-reparto-error,.rh-tipo-salida,.tar-tarde,.ctz-cuenta-nombre.ctz-cuenta-mal,.gm-adj-ico .gm-adj-ico-pdf) { color:var(--rojo-negativo); }
html[data-ui][data-theme="dark"] .rh-tipo-entrada { color:var(--fc-success); }
html[data-ui][data-theme="dark"] :is(.rh-tipo-pausa,.rh-tipo-reanudar) { color:var(--fc-warning); }
html[data-ui][data-theme="dark"] .cierre-error .cierre-ico { color:var(--rojo-negativo); }

/* Avatares de color por nombre (correo, chat, entrada): el pastel claro pasa a su tono oscuro */
html[data-ui][data-theme="dark"] :is(.gm-avatar,.chatint-avatar,.login-user-avatar)[style*="background:#"] { filter:invert(1) hue-rotate(180deg) saturate(1.3); }
/* «Por cobrar» del Inicio: los degradados alternos eran claros y la inicial, clara */
html[data-ui][data-theme="dark"] .arc-cobros-lista li:nth-child(2n) .arc-cobros-avatar { background:linear-gradient(135deg,oklch(36% .05 235),oklch(38% .045 180)); }
html[data-ui][data-theme="dark"] .arc-cobros-lista li:nth-child(3n) .arc-cobros-avatar { background:linear-gradient(135deg,oklch(38% .05 65),oklch(36% .05 25)); }

/* Planificación: iconos de zona con fondo pastel fijo */
html[data-ui][data-theme="dark"] .plan-zone-icon { filter:invert(1) hue-rotate(180deg) saturate(1.2)!important; }

/* Contabilizador y SII: iconos de las cifras con tinta oscura sobre gris oscuro */
html[data-ui][data-theme="dark"] .ctz-ico-verde { color:var(--fc-success)!important; }
html[data-ui][data-theme="dark"] .ctz-ico-azul { color:oklch(80% .1 250)!important; }
html[data-ui][data-theme="dark"] .ctz-kpi-ico[style*="warning"], html[data-ui][data-theme="dark"] .ctz-kpi-ico:not(.ctz-ico-verde):not(.ctz-ico-azul) { color:var(--fc-warning)!important; }

/* Escáner de Compras: el icono era una pastilla blanca; va como los demás iconos de cabecera */
html[data-ui][data-theme="dark"] :is(.esc-cab-ico,.conc-imp-ico) { background:var(--fc-secondary)!important; color:var(--fc-ink)!important; box-shadow:inset 0 0 0 1px var(--fc-border); }
html[data-ui][data-theme="dark"] :is(.esc-cab-ico,.conc-imp-ico) svg { stroke:currentColor; color:var(--fc-ink)!important; }

/* Documentación: «Firmado» salía blanco sobre blanco */
html[data-ui][data-theme="dark"] .badge-firmado { background:color-mix(in oklab, var(--fc-success) 16%, transparent)!important; color:var(--fc-success)!important; }
/* Chat interno: avatar y etiqueta sobre el color de acción */
html[data-ui][data-theme="dark"] :is(.chatint-avatar:not([style]),.chatint-conv-tag) { color:var(--fc-on-primary); }
/* RRHH: «Urgente» en marrón oscuro */
html[data-ui][data-theme="dark"] #view-rrhh .rh-task-due b { color:var(--fc-warning); }

/* Correo: el mensaje HTML trae sus propios colores; se lee sobre papel blanco */
html[data-ui][data-theme="dark"] .email-html-frame { background:oklch(99% 0 0); border-radius:12px; padding:12px 14px; color-scheme:light; }

/* Revisión contable (Auditoría IA): la hoja tenía tinta y bordes fijos para el blanco */
html[data-ui="festival"][data-theme="dark"] #accounting-review { color:var(--fc-ink); }
html[data-ui][data-theme="dark"] #accounting-review :is(.ar-heading p,small,.ar-caption,dt,label,.ar-extra p,.ar-results-bar span,.ar-detail-footer p) { color:var(--fc-muted); }
html[data-ui][data-theme="dark"] #accounting-review :is(.ar-link,summary) { color:oklch(80% .08 260); }
html[data-ui][data-theme="dark"] #accounting-review :is(.ar-summary,.ar-results-bar,.ar-table th,.ar-table td,.ar-detail-footer,.ar-limits,#ar-detail) { border-color:var(--fc-border); }
html[data-ui][data-theme="dark"] #accounting-review :is(.ar-review-note,.ar-table th,pre) { background:var(--fc-secondary); color:var(--fc-ink); }
html[data-ui][data-theme="dark"] #accounting-review .ar-table th { color:var(--fc-muted); }
html[data-ui="festival"][data-theme="dark"] #accounting-review :is(input,select) { background:var(--fc-card); color:var(--fc-ink); border-color:var(--fc-input); }
html[data-ui="festival"][data-theme="dark"] #accounting-review .ar-table tr.ar-selected td { background:var(--fc-selected); }
html[data-ui][data-theme="dark"] #accounting-review ::selection { color:var(--fc-ink); }
html[data-ui][data-theme="dark"] #accounting-review .ar-stale { background:color-mix(in oklab, var(--fc-warning) 14%, transparent); color:var(--fc-warning); }
