/* 360 Operations · capa visual incremental v1. No modifica lógica operativa. */
:root{--ui-blue:#2563eb;--ui-orange:#ed8b23;--ui-focus:#f59e0b;--ui-bg:#f3f6fa;--ui-surface:#fff;--ui-fg:#172033;--ui-border:#cbd5e1;--ui-muted:#64748b;color-scheme:light}
html[data-360-theme="dark"]{--ui-bg:#0f172a;--ui-surface:#1e293b;--ui-fg:#e2e8f0;--ui-border:#475569;--ui-muted:#a8bad0;color-scheme:dark}
html[data-360-theme="dark"] body{background:var(--ui-bg)!important;color:var(--ui-fg)!important}
html[data-360-theme="dark"] :is(.topbar,.head,.card,.kpi,.app-card,.panel,.filters,.grupo-cis,.modal,.content-card){background-color:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
html[data-360-theme="dark"] :is(.topbar-title,.user-name,h1,h2,h3,.kpi strong){color:var(--ui-fg)!important}
html[data-360-theme="dark"] :is(.muted,.app-muted,small){color:var(--ui-muted)!important}
html[data-360-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){background-color:#25344b!important;color:#f1f5f9!important;border-color:#60728c!important}
html[data-360-theme="dark"] :is(th,thead){background:#26364e!important;color:#e2e8f0!important}
html[data-360-theme="dark"] :is(td,tr){border-color:#43546d!important}
html[data-360-theme="dark"] :is(.tablewrap,.controls){color:var(--ui-fg)}
/* Visibilidad de controles en ambos temas */
:where(button,.btn,[role="button"],summary){transition:filter .15s ease,box-shadow .15s ease,transform .15s ease}
:where(button,.btn,[role="button"]):hover{filter:brightness(1.10)}
:where(button,.btn,[role="button"],a,input,select,textarea,summary):focus-visible{outline:3px solid var(--ui-focus)!important;outline-offset:2px}
:where(details>summary){cursor:pointer}
/* En Seguridad los botones eran del mismo color que el formulario */
body:has(#lista) button:not(.theme360-toggle){background:#2563eb!important;color:#fff!important;border:1px solid #60a5fa!important;font-weight:700;box-shadow:0 2px 8px #0002}
body:has(#lista) button[onclick^="historial"]{background:#ed8b23!important;color:#172033!important;border-color:#ffc178!important}
body:has(#lista) details>summary{color:#93c5fd!important;text-decoration:underline;text-underline-offset:3px}
html:not([data-360-theme="dark"]) body:has(#lista){background:#f3f6fa!important;color:#172033!important}
html:not([data-360-theme="dark"]) body:has(#lista) :is(.card,.grupo-cis){background:#fff!important;color:#172033!important;border-color:#cbd5e1!important}
html:not([data-360-theme="dark"]) body:has(#lista) :is(input,select,textarea){background:#fff!important;color:#172033!important;border-color:#94a3b8!important}
html:not([data-360-theme="dark"]) body:has(#lista) :is(.muted,small){color:#475569!important}
/* Selector flotante discreto y disponible también en móviles */
.theme360-toggle{position:fixed!important;right:16px!important;bottom:16px!important;z-index:9999!important;display:inline-flex!important;align-items:center!important;gap:8px!important;background:#2563eb!important;color:#fff!important;border:2px solid #93c5fd!important;border-radius:999px!important;padding:11px 15px!important;font:700 13px system-ui,sans-serif!important;box-shadow:0 5px 18px #0004!important;cursor:pointer!important;max-width:calc(100vw - 32px)}
.theme360-toggle:hover{background:#1d4ed8!important}
@media(prefers-reduced-motion:reduce){:where(button,.btn,[role="button"],summary){transition:none}}

/* 360 Operations · ajuste de contraste para KPIs y tablas del Index.
   Acotado a los componentes del dashboard; no modifica lógica ni datos. */
html[data-360-theme="light"] :is(.period-card,.dashboard-card){background:#fff!important;color:#172033!important}
html[data-360-theme="light"] :is(.period-head,.dashboard-card-title,.period-value,.dashboard-number,.dashboard-table td){color:#172033!important}
html[data-360-theme="light"] :is(.period-label,.dashboard-card-sub,.dashboard-note){color:#475569!important}
html[data-360-theme="dark"] :is(.period-card,.dashboard-card){background:#1e293b!important;color:#f1f5f9!important;border-color:#475569!important}
html[data-360-theme="dark"] :is(.period-head,.dashboard-card-title,.period-value,.dashboard-number,.dashboard-table td){color:#f1f5f9!important}
html[data-360-theme="dark"] :is(.period-label,.dashboard-card-sub,.dashboard-note){color:#b9c8db!important}
html[data-360-theme="dark"] :is(.period-head,.period-metric,.dashboard-card-head,.dashboard-table td){border-color:#475569!important}
html[data-360-theme="dark"] .dashboard-table tbody tr:hover{background:#293b54!important}
html[data-360-theme="light"] .dashboard-table tbody tr:hover{background:#eff6ff!important}

/* Dashboard de Cisternas: contraste accesible y filtros KPI (etapa piloto) */
#page-cisternas .cis-kpis [data-cis-kpi]{cursor:pointer;transition:box-shadow .15s,transform .15s;border:2px solid transparent}
#page-cisternas .cis-kpis [data-cis-kpi]:hover{transform:translateY(-2px);box-shadow:0 5px 16px #0003}
#page-cisternas .cis-kpis [data-cis-kpi][aria-pressed="true"]{border-color:#f28c28!important;box-shadow:0 0 0 2px #f28c2840}
#page-cisternas .cis-kpis [data-cis-kpi]:focus-visible,#page-cisternas .cis-dashboard-row:focus-visible{outline:3px solid #f28c28;outline-offset:2px}
#page-cisternas .dashboard-table tbody tr.cis-dashboard-row{background:transparent!important;cursor:pointer}
#page-cisternas .dashboard-table tbody tr.cis-dashboard-row td{color:var(--ui-fg,#172033)!important;background:transparent!important}
#page-cisternas .dashboard-table tbody tr.cis-dashboard-row:hover{background:rgba(59,130,246,.14)!important}
#page-cisternas .dashboard-table tbody tr.cis-dashboard-row .cis-detail-link{color:#60a5fa!important;font-weight:700}
html[data-360-theme="light"] #page-cisternas .dashboard-table tbody tr.cis-dashboard-row .cis-detail-link{color:#155eef!important}
#page-cisternas .dashboard-table tbody tr.cis-dashboard-row .badge{color:#172033!important;background:#e2e8f0!important}
#page-cisternas #cisClearKpi{margin-left:12px}

/* Mensajes contextuales globales */
.ops360-feedback{display:block;flex-basis:100%;box-sizing:border-box;width:100%;margin:8px 0;padding:10px 12px;border:1px solid;border-radius:9px;font:600 13px/1.45 system-ui,sans-serif;white-space:normal;overflow-wrap:anywhere;max-width:100%;background:#e9f8ef;color:#135c37;border-color:#8fd3aa}
.ops360-feedback[data-kind="error"]{background:#fff0f0;color:#9a1d24;border-color:#f1a6aa}
.ops360-feedback[data-kind="warning"]{background:#fff7e7;color:#805500;border-color:#e6c17a}
.ops360-invalid{outline:2px solid #db3b46!important;outline-offset:2px}
