:root{--ui-page:#e6edf5;--ui-surface:#fff;--ui-soft:#edf2f7;--ui-text:#101b2d;--ui-card-text:#101b2d;--ui-muted:#42546b;--ui-border:#9aabc0;--ui-border-width:1px;--ui-header:#426b9d;--ui-header-text:#fff;--ui-accent:#4d48a3;--ui-accent-text:#fff;--ui-secondary:#39777a;--ui-secondary-text:#fff;--ui-summary:#fff;--ui-summary-text:#101b2d;--ui-table-header:#edf2f7;--ui-table-header-text:#101b2d;--ui-table-row:#fff;--ui-table-alt:#f8fafc;--ui-table-text:#101b2d;--ui-action-text:#1d4ed8;--ui-footer:#426b9d;--ui-footer-text:#fff;--ui-font-scale:1;--ui-control-y:.72rem;--ui-gap:1rem;color-scheme:light}
html[data-theme="dark"]{--ui-page:#0b1220;--ui-surface:#172235;--ui-soft:#223149;--ui-text:#f8fafc;--ui-card-text:#f8fafc;--ui-muted:#d7e0ec;--ui-border:#718198;--ui-border-width:1px;--ui-header:#172a46;--ui-header-text:#fff;--ui-accent:#9b97f0;--ui-accent-text:#111827;--ui-secondary:#317b80;--ui-secondary-text:#fff;--ui-button:#9b97f0;--ui-button-text:#111827;--ui-menu-button:#172235;--ui-menu-text:#f8fafc;--ui-menu-active:#9b97f0;--ui-menu-active-text:#111827;--ui-summary:#172235;--ui-summary-text:#f8fafc;--ui-table-header:#223149;--ui-table-header-text:#f8fafc;--ui-table-row:#172235;--ui-table-alt:#1d2a40;--ui-table-text:#f8fafc;--ui-action-text:#93c5fd;--ui-footer:#172a46;--ui-footer-text:#fff;color-scheme:dark}
html[data-theme="contrast"]{--ui-page:#000;--ui-surface:#000;--ui-soft:#000;--ui-text:#fff;--ui-card-text:#fff;--ui-muted:#fff;--ui-border:#fff;--ui-border-width:2px;--ui-header:#000;--ui-header-text:#fff;--ui-accent:#ffe500;--ui-accent-text:#000;--ui-secondary:#00b8cc;--ui-secondary-text:#000;--ui-button:#ffe500;--ui-button-text:#000;--ui-menu-button:#000;--ui-menu-text:#fff;--ui-menu-active:#ffe500;--ui-menu-active-text:#000;--ui-summary:#000;--ui-summary-text:#fff;--ui-table-header:#fff;--ui-table-header-text:#000;--ui-table-row:#000;--ui-table-alt:#111;--ui-table-text:#fff;--ui-action-text:#00e5ff;--ui-footer:#000;--ui-footer-text:#fff;color-scheme:dark}
html[data-theme="custom"]{--ui-page:var(--custom-page,#e6edf5);--ui-text:var(--custom-text,#101b2d);--ui-header:var(--custom-header,#426b9d);--ui-accent:var(--custom-primary,#4d48a3);--ui-secondary:var(--custom-secondary,#39777a);--ui-secondary-text:var(--custom-secondary-text,#fff);--ui-surface:var(--custom-cards,#fff);--ui-soft:var(--custom-cards,#fff);--ui-border:var(--custom-border,#9aabc0);--ui-border-width:var(--custom-border-width,1px);--ui-card-text:var(--custom-card-text,#101b2d);--ui-header-text:var(--custom-header-text,#fff);--ui-accent-text:var(--custom-primary-text,#fff);--ui-button:var(--custom-button,#4d48a3);--ui-button-text:var(--custom-button-text,#fff);--ui-menu-button:var(--custom-menu-button,#fff);--ui-menu-text:var(--custom-menu-text,#1f3855);--ui-menu-active:var(--custom-menu-active,#4d48a3);--ui-menu-active-text:var(--custom-menu-active-text,#fff);--ui-summary:var(--custom-summary,#fff);--ui-summary-text:var(--custom-summary-text,#101b2d);--ui-table-header:var(--custom-table-header,#edf2f7);--ui-table-header-text:var(--custom-table-header-text,#101b2d);--ui-table-row:var(--custom-table-row,#fff);--ui-table-alt:var(--custom-table-alt,#f8fafc);--ui-table-text:var(--custom-table-text,#101b2d);--ui-action-text:var(--custom-action-text,#1d4ed8);--ui-footer:var(--custom-footer,#426b9d);--ui-footer-text:var(--custom-footer-text,#fff)}
html[data-font="large"]{--ui-font-scale:1.1}html[data-font="xlarge"]{--ui-font-scale:1.2}html[data-density="compact"]{--ui-control-y:.48rem;--ui-gap:.65rem}html[data-density="comfortable"]{--ui-control-y:.9rem;--ui-gap:1.2rem}
html{font-size:calc(16px * var(--ui-font-scale))}body{background:var(--ui-page)!important;color:var(--ui-text)!important}
html[data-theme] body>header,html[data-theme] body>footer,html[data-theme] .hero{background-color:var(--ui-header)!important;background-image:none!important;border-color:var(--ui-border)!important;color:var(--ui-header-text)!important}
html[data-theme] body>header nav,html[data-theme] body>header nav a,html[data-theme] body>header nav a i,html[data-theme] body>header .global-brand,html[data-theme] body>header .global-brand i,html[data-theme] body>footer *,html[data-theme] .hero h1,html[data-theme] .hero p{color:var(--ui-header-text)!important}
html[data-theme] body>header .module-link:hover{background:var(--ui-secondary)!important;color:var(--ui-secondary-text)!important}
html[data-theme] body>header .module-link.active{background:var(--ui-accent)!important;border-color:color-mix(in srgb,var(--ui-accent),white 45%)!important;color:var(--ui-accent-text)!important}
html[data-theme] body>header .module-link.active *{color:var(--ui-accent-text)!important}
html[data-theme] body>header .session-link{background:var(--ui-secondary)!important;color:var(--ui-secondary-text)!important}
main,.module-area{color:var(--ui-text)}.bg-white,.module,.shortcut,aside>div,dialog:not(.theme-dialog),[role="dialog"]:not(.theme-dialog){background-color:var(--ui-surface)!important;color:var(--ui-card-text)!important;border-color:var(--ui-border)!important}.bg-slate-50,.bg-slate-100,.bg-gray-50,.bg-gray-100,thead,.shortcuts{background-color:var(--ui-soft)!important;color:var(--ui-card-text)!important}
.text-slate-900,.text-slate-800,.text-slate-700,.text-gray-900,.text-gray-800,.text-gray-700{color:var(--ui-text)!important}.text-slate-600,.text-slate-500,.text-slate-400,.text-gray-600,.text-gray-500,.module p,.section-heading p,.shortcut-empty{color:var(--ui-muted)!important}
.border,.border-t,.border-b,.border-l,.border-r,.border-slate-100,.border-slate-200,.border-slate-300,.divide-y>*{border-color:var(--ui-border)!important}table,th,td{border-color:var(--ui-border)}
input:not([type="color"]),select,textarea{background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;padding-top:var(--ui-control-y);padding-bottom:var(--ui-control-y)}option{background:var(--ui-surface)!important;color:var(--ui-text)!important}::placeholder{color:var(--ui-muted)!important;opacity:.9}
.context-link,main details .grid>a:not(.context-link){background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}.context-link:hover,main details .grid>a:not(.context-link):hover{background:var(--ui-soft)!important;color:var(--ui-accent)!important}.context-link.active,aside .context-link.active{background:var(--ui-accent)!important;border-color:var(--ui-accent)!important;color:var(--ui-accent-text)!important}.context-link.active *{color:var(--ui-accent-text)!important}
.module-link.active{background:var(--ui-accent)!important;color:var(--ui-accent-text)!important}.module-link:hover{background:var(--ui-secondary)!important;color:var(--ui-secondary-text)!important}.open-button,.primary-action,.btn-primary,.theme-save{background:var(--ui-accent)!important;border-color:var(--ui-accent)!important;color:var(--ui-accent-text)!important}.open-button *,.primary-action *,.btn-primary *{color:var(--ui-accent-text)!important}
/* Los colores con significado se conservan en todos los temas. */
.bg-red-50{background:#fff1f2!important}.bg-red-100{background:#fee2e2!important}.text-red-700,.text-red-800,.text-red-900{color:#991b1b!important}.bg-emerald-50,.bg-green-50{background:#ecfdf5!important}.bg-emerald-100,.bg-green-100{background:#d1fae5!important}.text-emerald-700,.text-emerald-800,.text-emerald-900,.text-green-700,.text-green-800{color:#065f46!important}.bg-amber-50{background:#fffbeb!important}.bg-amber-100{background:#fef3c7!important}.text-amber-700,.text-amber-800,.text-amber-900,.text-amber-950{color:#78350f!important}
html[data-theme="contrast"] *:focus-visible{outline:4px solid #00e5ff!important;outline-offset:3px!important}html[data-theme="contrast"] a{text-decoration:underline}html[data-theme="contrast"] button,html[data-theme="contrast"] .context-link{border-width:2px!important}
.theme-trigger{display:inline-flex!important;align-items:center;gap:.45rem;border:1px solid rgba(255,255,255,.65)!important;border-radius:.65rem;background:rgba(255,255,255,.14)!important;padding:.52rem .72rem!important;color:#fff!important;font-weight:800}.theme-trigger *{color:#fff!important}.theme-trigger:hover{background:rgba(255,255,255,.25)!important}
.theme-dialog{width:min(600px,calc(100% - 24px));border:1px solid #cbd5e1;border-radius:18px;padding:0;background:#fff!important;color:#17243a!important;box-shadow:0 24px 70px rgba(0,0,0,.35);color-scheme:light}.theme-dialog::backdrop{background:rgba(15,23,42,.65)}.theme-dialog,.theme-dialog *{color:#17243a!important}.theme-dialog-body{padding:22px}.theme-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:16px}.theme-choice{display:inline-flex!important;justify-content:flex-start!important;border:2px solid #cbd5e1!important;border-radius:12px!important;background:#f8fafc!important;padding:12px!important;color:#17243a!important;font-weight:800!important}.theme-choice i{color:#17243a!important}.theme-choice.active{border-color:#5752b4!important;background:#eeedfb!important;color:#302b87!important}.theme-custom{display:none;margin-top:15px;padding:14px;border:1px solid #d7dee8;border-radius:12px;background:#f8fafc}.theme-custom.visible{display:block!important}.theme-colors{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.theme-colors label,.theme-preference-label{font-size:.75rem;font-weight:800}.theme-colors input{display:block;width:100%;height:44px;margin-top:5px}.theme-preferences{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}.theme-preferences select{width:100%;margin-top:5px;border:1px solid #94a3b8!important;border-radius:9px;background:#fff!important;color:#17243a!important;padding:9px!important}.theme-warning{display:none!important}.theme-preview{margin-top:12px;border:1px solid #cbd5e1;border-radius:10px;padding:13px;background:var(--preview-surface,#fff)!important;color:#17243a!important}.theme-preview button{border:0!important;border-radius:8px!important;background:var(--preview-primary,#5752b4)!important;color:var(--preview-primary-text,#fff)!important;padding:8px 12px!important;font-weight:800!important}.theme-dialog-actions{display:flex;justify-content:space-between;gap:8px;margin-top:18px}.theme-dialog-actions button{display:inline-flex!important;border:1px solid #94a3b8!important;border-radius:9px!important;background:#f8fafc!important;color:#17243a!important;padding:9px 12px!important;font-weight:800!important}.theme-dialog-actions .theme-save{background:#5752b4!important;border-color:#454191!important;color:#fff!important;box-shadow:0 4px 10px rgba(87,82,180,.25)!important}
.theme-preview{border:var(--preview-border-width,1px) solid var(--preview-border,#cbd5e1)!important;background:var(--preview-surface,#fff)!important;color:var(--preview-card-text,#17243a)!important}.theme-preview b,.theme-preview p{color:var(--preview-card-text,#17243a)!important}
html[data-theme="custom"] .border,html[data-theme="custom"] .border-slate-100,html[data-theme="custom"] .border-slate-200,html[data-theme="custom"] .border-slate-300{border-width:var(--ui-border-width)!important}html[data-theme="custom"] .border-t{border-top-width:var(--ui-border-width)!important}html[data-theme="custom"] .border-b{border-bottom-width:var(--ui-border-width)!important}html[data-theme="custom"] .border-l,html[data-theme="custom"] [class*="border-l-"]{border-left-width:var(--ui-border-width)!important}html[data-theme="custom"] .border-r{border-right-width:var(--ui-border-width)!important}html[data-theme="custom"] input:not([type="color"]),html[data-theme="custom"] select,html[data-theme="custom"] textarea,html[data-theme="custom"] table,html[data-theme="custom"] th,html[data-theme="custom"] td{border-width:var(--ui-border-width)!important}
html[data-theme="custom"] main button:not([class*="bg-red"]):not([class*="bg-green"]):not([class*="bg-emerald"]):not(.theme-choice):not(.inventory-search-result),html[data-theme="custom"] aside .module-menu-order-button{background:var(--ui-button)!important;border-color:var(--ui-button)!important;color:var(--ui-button-text)!important}html[data-theme="custom"] main button:not([class*="bg-red"]):not([class*="bg-green"]):not([class*="bg-emerald"]):not(.theme-choice):not(.inventory-search-result) *,html[data-theme="custom"] aside .module-menu-order-button *{color:var(--ui-button-text)!important}
html[data-theme="custom"] aside .context-link{background:var(--ui-menu-button)!important;color:var(--ui-menu-text)!important}html[data-theme="custom"] aside .context-link *{color:var(--ui-menu-text)!important}html[data-theme="custom"] aside .context-link.active{background:var(--ui-menu-active)!important;border-color:var(--ui-menu-active)!important;color:var(--ui-menu-active-text)!important}html[data-theme="custom"] aside .context-link.active *{color:var(--ui-menu-active-text)!important}
@media(max-width:600px){.theme-options,.theme-colors,.theme-preferences{grid-template-columns:1fr}.theme-trigger span{display:none}}
@media print{html{font-size:16px!important;color-scheme:light!important}body,*{--ui-page:#fff;--ui-surface:#fff;--ui-soft:#fff;--ui-text:#000;--ui-muted:#334155;--ui-border:#cbd5e1}body{background:#fff!important;color:#000!important}.theme-trigger,.theme-dialog{display:none!important}}

/* Inventario: ayudas y estados con contraste real en las paletas oscuras. */
.inventory-monitor-badge{display:inline-flex;min-width:7.2rem;align-items:center;justify-content:center;border:1px solid transparent;line-height:1.25;text-align:center}
.inventory-monitor-badge.is-monitored{border-color:#6ee7b7;background:#d1fae5;color:#065f46}
.inventory-monitor-badge.is-unmonitored{border-color:#94a3b8;background:#e2e8f0;color:#1e293b}
html[data-theme="dark"] .inventory-quick-help{border-color:#60a5fa!important;background:#172f50!important;color:#dbeafe!important}
html[data-theme="dark"] .inventory-quick-help *{color:#dbeafe!important}
html[data-theme="dark"] .inventory-monitor-badge.is-monitored{border-color:#34d399!important;background:#064e3b!important;color:#ecfdf5!important}
html[data-theme="dark"] .inventory-monitor-badge.is-unmonitored{border-color:#94a3b8!important;background:#334155!important;color:#f8fafc!important}
html[data-theme="contrast"] .inventory-quick-help{border:2px solid #00e5ff!important;background:#000!important;color:#fff!important}
html[data-theme="contrast"] .inventory-quick-help *{color:#fff!important}
html[data-theme="contrast"] .inventory-monitor-badge.is-monitored{border:2px solid #00ff88!important;background:#000!important;color:#00ff88!important}
html[data-theme="contrast"] .inventory-monitor-badge.is-unmonitored{border:2px solid #fff!important;background:#000!important;color:#fff!important}

/* Encabezados estratégicos: forman parte del tema, igual que la barra superior. */
html[data-theme] main section.rounded-3xl[class*="bg-gradient-to-br"]{background:linear-gradient(135deg,var(--ui-header),color-mix(in srgb,var(--ui-header) 72%,var(--ui-accent)))!important;border:var(--ui-border-width) solid color-mix(in srgb,var(--ui-header),white 28%)!important;color:var(--ui-header-text)!important}
html[data-theme] main section.rounded-3xl[class*="bg-gradient-to-br"] h1,html[data-theme] main section.rounded-3xl[class*="bg-gradient-to-br"] p{color:var(--ui-header-text)!important}
html[data-theme] main section.rounded-3xl[class*="bg-gradient-to-br"]>div>div:first-child>span{border-color:color-mix(in srgb,var(--ui-header-text),transparent 60%)!important;background:color-mix(in srgb,var(--ui-header-text),transparent 88%)!important;color:var(--ui-header-text)!important}
html[data-theme] main section.rounded-3xl[class*="bg-gradient-to-br"] a.bg-white{background:var(--ui-accent)!important;color:var(--ui-accent-text)!important}
html[data-theme] main section.rounded-3xl[class*="bg-gradient-to-br"] a.bg-white *{color:var(--ui-accent-text)!important}
html[data-theme] main section.rounded-3xl[class*="bg-gradient-to-br"] a[class*="bg-white/10"]{background:var(--ui-secondary)!important;border-color:color-mix(in srgb,var(--ui-secondary),white 35%)!important;color:var(--ui-secondary-text)!important}html[data-theme] main section.rounded-3xl[class*="bg-gradient-to-br"] a[class*="bg-white/10"] *{color:var(--ui-secondary-text)!important}

/* Organización del configurador por áreas. */
.theme-dialog{width:min(780px,calc(100% - 24px));max-height:min(90vh,850px);overflow:auto}.theme-section-title{margin-top:16px}.theme-section-title b,.theme-area-heading b{display:block;font-size:.86rem}.theme-section-title small,.theme-area-heading small{display:block;margin-top:2px;color:#64748b!important;font-size:.7rem}.theme-options{margin-top:8px}.theme-choice{align-items:center!important;gap:10px!important}.theme-choice>i{width:26px;text-align:center;font-size:1.1rem}.theme-choice span{display:block}.theme-choice span b,.theme-choice span small{display:block}.theme-choice span small{margin-top:2px;color:#64748b!important;font-size:.68rem;font-weight:600}.theme-colors{display:block}.theme-area{margin-top:12px;border:1px solid #d7dee8;border-radius:12px;background:#fff;padding:12px}.theme-area:first-child{margin-top:0}.theme-area-fields{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:10px}.theme-area-fields label{font-size:.72rem;font-weight:800}.theme-area-fields input{display:block;width:100%;height:42px;margin-top:5px}.theme-preferences-area{padding:12px}.theme-preferences{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:10px}
@media(max-width:700px){.theme-area-fields,.theme-preferences{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Utilidades cromáticas legibles en fondos oscuros. */
html[data-theme="dark"] :is(.bg-blue-50,.bg-blue-100,.bg-cyan-50,.bg-cyan-100,.bg-violet-50,.bg-violet-100,.bg-indigo-50,.bg-indigo-100,.bg-fuchsia-50,.bg-fuchsia-100){background:#243754!important}
html[data-theme="dark"] :is(.bg-emerald-50,.bg-emerald-100,.bg-green-50,.bg-green-100){background:#173d35!important}
html[data-theme="dark"] :is(.bg-amber-50,.bg-amber-100,.bg-orange-50,.bg-orange-100){background:#46351d!important}
html[data-theme="dark"] :is(.bg-red-50,.bg-red-100){background:#4a252d!important}
html[data-theme="dark"] :is(.text-blue-600,.text-blue-700,.text-blue-800,.text-cyan-600,.text-cyan-700,.text-cyan-800){color:#93d5ff!important}
html[data-theme="dark"] :is(.text-violet-600,.text-violet-700,.text-violet-800,.text-indigo-600,.text-indigo-700,.text-indigo-800,.text-fuchsia-700,.text-fuchsia-800){color:#c4b5fd!important}
html[data-theme="dark"] :is(.text-emerald-600,.text-emerald-700,.text-emerald-800,.text-emerald-900,.text-green-700,.text-green-800){color:#6ee7b7!important}
html[data-theme="dark"] :is(.text-amber-700,.text-amber-800,.text-amber-900,.text-amber-950,.text-orange-700,.text-orange-800){color:#fcd34d!important}
html[data-theme="dark"] :is(.text-red-700,.text-red-800,.text-red-900){color:#fda4af!important}

/* Alto contraste evita combinaciones intermedias: negro, blanco, amarillo y cian. */
html[data-theme="contrast"] :is(.bg-white,.bg-slate-50,.bg-slate-100,.bg-blue-50,.bg-blue-100,.bg-cyan-50,.bg-cyan-100,.bg-violet-50,.bg-violet-100,.bg-indigo-50,.bg-indigo-100,.bg-fuchsia-50,.bg-fuchsia-100,.bg-emerald-50,.bg-emerald-100,.bg-green-50,.bg-green-100,.bg-amber-50,.bg-amber-100,.bg-orange-50,.bg-orange-100,.bg-red-50,.bg-red-100){background:#000!important;color:#fff!important}
html[data-theme="contrast"] :is(.text-blue-600,.text-blue-700,.text-blue-800,.text-cyan-600,.text-cyan-700,.text-cyan-800,.text-violet-600,.text-violet-700,.text-violet-800,.text-indigo-600,.text-indigo-700,.text-indigo-800,.text-fuchsia-700,.text-fuchsia-800){color:#00e5ff!important}
html[data-theme="contrast"] :is(.text-emerald-600,.text-emerald-700,.text-emerald-800,.text-emerald-900,.text-green-700,.text-green-800,.text-amber-700,.text-amber-800,.text-amber-900,.text-amber-950,.text-orange-700,.text-orange-800,.text-red-700,.text-red-800,.text-red-900){color:#ffe500!important}
html[data-theme="contrast"] :is(.border,.border-t,.border-b,.border-l,.border-r,[class*="border-"]){border-color:#fff!important}
html[data-theme] body>header .module-link:hover *,html[data-theme] body>header .session-link *{color:var(--ui-secondary-text)!important}.theme-warning{margin-top:12px;border:1px solid #f59e0b;border-radius:10px;background:#fffbeb;padding:10px;color:#78350f!important;font-size:.75rem}.theme-warning b,.theme-warning li{color:#78350f!important}.theme-warning ul{margin:6px 0 0 18px;list-style:disc}

/* Estados interactivos: nunca deben regresar a blanco dentro de un tema oscuro. */
html[data-theme] main [class*="hover:bg-slate-50"]:hover,html[data-theme] main [class*="hover:bg-slate-100"]:hover,html[data-theme] main [class*="hover:bg-gray-50"]:hover{background:var(--ui-soft)!important;color:var(--ui-text)!important}
html[data-theme] main [class*="hover:bg-slate-50"]:hover :is(b,span,small,i),html[data-theme] main [class*="hover:bg-slate-100"]:hover :is(b,span,small,i){color:inherit}
.quick-share-visit,.quick-share-visit:hover{background:var(--ui-secondary)!important;border:1px solid color-mix(in srgb,var(--ui-secondary),white 35%)!important;color:var(--ui-secondary-text)!important}.quick-share-visit *{color:var(--ui-secondary-text)!important}
html[data-theme="dark"] aside :is(.context-link,a),html[data-theme="dark"] aside :is(.context-link,a) *{color:#f8fafc!important}html[data-theme="dark"] aside .context-link{background:#172235!important;border-color:#718198!important}
html[data-theme="contrast"] aside :is(.context-link,a),html[data-theme="contrast"] aside :is(.context-link,a) *{color:#fff!important}html[data-theme="contrast"] aside .context-link{background:#000!important;border-color:#fff!important}html[data-theme="contrast"] aside .context-link.active,html[data-theme="contrast"] aside .context-link.active *{background:#ffe500!important;color:#000!important}
.theme-editing-note{display:flex;align-items:flex-start;gap:10px;margin-bottom:12px;border:1px solid #bfdbfe;border-radius:10px;background:#eff6ff;padding:10px}.theme-editing-note>i{margin-top:2px;color:#1d4ed8!important}.theme-editing-note span b,.theme-editing-note span small{display:block}.theme-editing-note span small{margin-top:2px;color:#475569!important;font-size:.7rem}

/* Controles específicos solicitados: indicadores, tablas, acciones y pie. */
html[data-theme="custom"] main .grid>a.rounded-xl[class*="border-l-"]{background:var(--ui-summary)!important;color:var(--ui-summary-text)!important}
html[data-theme="custom"] main .grid>a.rounded-xl[class*="border-l-"] :is(span,b,strong,small,i){color:var(--ui-summary-text)!important}
html[data-theme="custom"] main table thead,html[data-theme="custom"] main table thead tr,html[data-theme="custom"] main table th{background:var(--ui-table-header)!important;color:var(--ui-table-header-text)!important}
html[data-theme="custom"] main table tbody tr{background:var(--ui-table-row)!important;color:var(--ui-table-text)!important}
html[data-theme="custom"] main table tbody tr:nth-child(even){background:var(--ui-table-alt)!important}
html[data-theme="custom"] main table tbody td,html[data-theme="custom"] main table tbody td :is(b,span,small){color:var(--ui-table-text)!important}
html[data-theme="custom"] main table tbody a:not([class*="bg-"]),html[data-theme="custom"] main table tbody button:not([class*="bg-"]){color:var(--ui-action-text)!important}
html[data-theme="custom"] body footer,html[data-theme="custom"] .page>footer{background:var(--ui-footer)!important;background-image:none!important;border-color:color-mix(in srgb,var(--ui-footer),black 22%)!important;color:var(--ui-footer-text)!important}
html[data-theme="custom"] body footer *,html[data-theme="custom"] .page>footer *{color:var(--ui-footer-text)!important}
.theme-preview{display:grid;grid-template-columns:1fr 1.4fr;gap:10px}.theme-preview-summary{display:flex;min-height:82px;flex-direction:column;justify-content:center;border:var(--preview-border-width,1px) solid var(--preview-border);border-radius:9px;background:var(--preview-summary,#fff);padding:10px;color:var(--preview-summary-text,#101b2d)!important}.theme-preview-summary *{color:inherit!important}.theme-preview-summary b{font-size:1.4rem}.theme-preview-table{display:grid;grid-template-columns:1fr 1fr;overflow:hidden;border:var(--preview-border-width,1px) solid var(--preview-border);border-radius:9px}.theme-preview-table>*{padding:7px;color:var(--preview-table-text,#101b2d)!important}.theme-preview-table>b{background:var(--preview-table-header,#edf2f7);color:var(--preview-table-header-text,#101b2d)!important}.theme-preview-table>span,.theme-preview-table>a{background:var(--preview-table-row,#fff)}.theme-preview-table>*:nth-child(n+5){background:var(--preview-table-alt,#f8fafc)}.theme-preview-table>a{color:var(--preview-action,#1d4ed8)!important;font-weight:800}.theme-preview-footer{display:flex;grid-column:1/-1;align-items:center;justify-content:space-between;border-radius:9px;background:var(--preview-footer,#426b9d);padding:10px;color:var(--preview-footer-text,#fff)!important;font-weight:800}.theme-preview-footer button{background:var(--preview-primary,#4d48a3)!important;color:var(--preview-primary-text,#fff)!important}.theme-easy-contrast{display:flex!important;width:100%;align-items:center!important;gap:10px!important;margin-top:12px;border:1px solid #86a9d8!important;border-radius:10px!important;background:#edf6ff!important;padding:10px 12px!important;text-align:left!important}.theme-easy-contrast i{color:#1d4ed8!important}.theme-easy-contrast span b,.theme-easy-contrast span small{display:block}.theme-easy-contrast span small{margin-top:2px;color:#475569!important;font-size:.7rem}.theme-warning button{margin-top:8px;border:1px solid #d97706!important;border-radius:7px!important;background:#fff!important;padding:6px 9px!important;font-weight:800!important}
@media(max-width:600px){.theme-preview{grid-template-columns:1fr}.theme-preview-footer{grid-column:auto}}

/* Editor amplio: controles a la izquierda y diagnóstico/vista previa siempre visibles a la derecha. */
@media(min-width:901px){
  .theme-dialog{width:min(1180px,calc(100% - 32px));max-height:92vh}
  .theme-custom.visible{display:grid!important;grid-template-columns:minmax(0,1.12fr) minmax(390px,.88fr);grid-template-areas:"note note" "controls warning" "controls preview" "preferences preview";align-items:start;gap:14px;padding:16px}
  .theme-custom>.theme-editing-note{grid-area:note;margin:0}
  .theme-custom>.theme-colors{grid-area:controls;min-width:0}
  .theme-custom>.theme-preferences-area{grid-area:preferences;margin:0}
  .theme-custom>#theme-warning{grid-area:warning;margin:0}
  .theme-custom>#theme-preview{grid-area:preview;position:sticky;top:0;margin:0;align-self:start}
  .theme-custom .theme-area-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:900px){.theme-custom.visible{display:block!important}.theme-custom>#theme-preview{position:static}}

/* Módulo Clientes: todas sus pantallas consumen la paleta activa. */
html[data-theme] body[data-module="clients"] main header[class*="bg-gradient"]{
  background:linear-gradient(115deg,var(--ui-header),color-mix(in srgb,var(--ui-header) 64%,var(--ui-accent)))!important;
  border:var(--ui-border-width) solid color-mix(in srgb,var(--ui-header),white 28%)!important;
  color:var(--ui-header-text)!important;
}
html[data-theme] body[data-module="clients"] main header[class*="bg-gradient"] :is(h1,p,span,i){color:var(--ui-header-text)!important}
html[data-theme] body[data-module="clients"] main header[class*="bg-gradient"] a{
  background:var(--ui-accent)!important;border-color:color-mix(in srgb,var(--ui-accent),white 38%)!important;color:var(--ui-accent-text)!important;
}
html[data-theme] body[data-module="clients"] main header[class*="bg-gradient"] a *{color:var(--ui-accent-text)!important}
html[data-theme] body[data-module="clients"] main article[class*="bg-gradient-to-br"]{
  background:var(--ui-summary)!important;border-color:var(--ui-border)!important;color:var(--ui-summary-text)!important;
}
html[data-theme] body[data-module="clients"] main article[class*="bg-gradient-to-br"] :is(b,span,small){color:var(--ui-summary-text)!important}
html[data-theme] body[data-module="clients"] main :is(.bg-blue-600,.bg-blue-700,.bg-indigo-600,.bg-indigo-700,.bg-violet-600,.bg-violet-700){
  background:var(--ui-accent)!important;border-color:var(--ui-accent)!important;color:var(--ui-accent-text)!important;
}
html[data-theme] body[data-module="clients"] main :is(.bg-blue-600,.bg-blue-700,.bg-indigo-600,.bg-indigo-700,.bg-violet-600,.bg-violet-700) *{color:var(--ui-accent-text)!important}
html[data-theme] body[data-module="clients"] main :is(.bg-blue-50,.bg-blue-100,.bg-indigo-50,.bg-indigo-100,.bg-violet-50,.bg-violet-100),
html[data-theme] body[data-module="clients"] main [class*="bg-indigo-50"]{
  background:var(--ui-soft)!important;border-color:var(--ui-border)!important;color:var(--ui-card-text)!important;
}
html[data-theme] body[data-module="clients"] main :is(.text-blue-500,.text-blue-600,.text-blue-700,.text-blue-800,.text-indigo-500,.text-indigo-600,.text-indigo-700,.text-indigo-800,.text-violet-600,.text-violet-700,.text-violet-800){color:var(--ui-action-text)!important}
html[data-theme] body[data-module="clients"] main :is(section,article,div)[class*="border-indigo"],html[data-theme] body[data-module="clients"] main [class*="border-blue"]{border-color:var(--ui-border)!important}
html[data-theme="contrast"] body[data-module="clients"] main header[class*="bg-gradient"]{background:#000!important;border:2px solid #fff!important}
html[data-theme="contrast"] body[data-module="clients"] main header[class*="bg-gradient"] a{background:#ffe500!important;color:#000!important;border-color:#ffe500!important}
html[data-theme="contrast"] body[data-module="clients"] main header[class*="bg-gradient"] a *{color:#000!important}

/* Lenguaje visual unificado para todos los módulos privados. */
body[data-module]:not([data-module=""]){--module-radius:1rem;--module-shadow:0 8px 24px color-mix(in srgb,var(--ui-header),transparent 88%)}
body[data-module]:not([data-module=""]) main :is(section,article,div)[class*="rounded-xl"][class*="bg-white"],
body[data-module]:not([data-module=""]) main :is(section,article,div)[class*="rounded-2xl"][class*="bg-white"]{
  border-color:var(--ui-border)!important;background:var(--ui-surface)!important;color:var(--ui-card-text)!important;box-shadow:var(--module-shadow);
}
body[data-module]:not([data-module=""]) main :is(section,article,div)[class*="rounded-xl"],
body[data-module]:not([data-module=""]) main :is(section,article,div)[class*="rounded-2xl"]{border-color:var(--ui-border)}
body[data-module]:not([data-module=""]) main :is(a,button)[class*="rounded-xl"]{transition:transform .18s ease,box-shadow .18s ease,background-color .18s ease,border-color .18s ease}
body[data-module]:not([data-module=""]) main :is(a,button)[class*="rounded-xl"]:hover{transform:translateY(-1px)}
body[data-module]:not([data-module=""]) main section>header[class*="border-b"],
body[data-module]:not([data-module=""]) main section>div:first-child[class*="border-b"]{
  background:linear-gradient(90deg,var(--ui-soft),var(--ui-surface))!important;border-color:var(--ui-border)!important;
}
body[data-module]:not([data-module=""]) main :is(input,select,textarea){border-radius:.75rem!important;box-shadow:0 1px 2px color-mix(in srgb,var(--ui-text),transparent 92%)}
body[data-module]:not([data-module=""]) main :is(input,select,textarea):focus{border-color:var(--ui-accent)!important;outline:3px solid color-mix(in srgb,var(--ui-accent),transparent 78%)!important;outline-offset:0}
body[data-module]:not([data-module=""]) main table{background:var(--ui-surface);color:var(--ui-table-text)}
body[data-module]:not([data-module=""]) main table thead,body[data-module]:not([data-module=""]) main table thead tr{background:var(--ui-table-header)!important;color:var(--ui-table-header-text)!important}
body[data-module]:not([data-module=""]) main table tbody tr{background:var(--ui-table-row);color:var(--ui-table-text);transition:background-color .15s ease}
body[data-module]:not([data-module=""]) main table tbody tr:nth-child(even){background:var(--ui-table-alt)}
body[data-module]:not([data-module=""]) main table tbody tr:hover{background:color-mix(in srgb,var(--ui-accent),var(--ui-surface) 92%)!important}
body[data-module]:not([data-module=""]) main table :is(th,td){border-color:var(--ui-border);padding-block:.78rem}
body[data-module]:not([data-module=""]) main a:not([class*="text-red"]):not([class*="text-emerald"]):not([class*="text-amber"])[class*="text-blue"],
body[data-module]:not([data-module=""]) main a:not([class*="text-red"]):not([class*="text-emerald"]):not([class*="text-amber"])[class*="text-indigo"],
body[data-module]:not([data-module=""]) main a:not([class*="text-red"]):not([class*="text-emerald"]):not([class*="text-amber"])[class*="text-violet"]{color:var(--ui-action-text)!important}
body[data-module]:not([data-module=""]) main .primary-action,body[data-module]:not([data-module=""]) main .btn-primary,
body[data-module]:not([data-module=""]) main .search-action{border-radius:.75rem!important;box-shadow:0 5px 14px color-mix(in srgb,var(--ui-accent),transparent 72%)!important}
body[data-module]:not([data-module=""]) main :is(.grid,.flex)>:is(a,article,div)[class*="border-l-4"]{
  border-radius:1rem!important;background:var(--ui-summary)!important;color:var(--ui-summary-text)!important;box-shadow:var(--module-shadow);transition:transform .18s ease,box-shadow .18s ease;
}
body[data-module]:not([data-module=""]) main :is(.grid,.flex)>a[class*="border-l-4"]:hover{transform:translateY(-2px);box-shadow:0 12px 26px color-mix(in srgb,var(--ui-header),transparent 82%)}
html[data-theme="custom"] body[data-module]:not([data-module=""]) main :is(.grid,.flex)>:is(a,article,div)[class*="border-l-4"] :is(b,strong,small,span,p){color:var(--ui-summary-text)!important}
@media(max-width:640px){body[data-module]:not([data-module=""]) main table :is(th,td){padding-block:.65rem}body[data-module]:not([data-module=""]) main :is(section,article,div)[class*="rounded-2xl"]{border-radius:.85rem}}
