:root { --navy:#153a5b; --teal:#13766f; --ink:#203342; --muted:#667987; --line:#d7e1e6; --bg:#f2f6f7; }
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--ink); font-family:"Segoe UI",Arial,sans-serif; }
.module-nav { align-items:center; background:linear-gradient(90deg,#16827d,#2a9b91); border-bottom:3px solid #f0c75e; display:flex; gap:7px; min-height:48px; padding:6px 28px; }
.module-nav a { border:1px solid rgba(255,255,255,.34); border-radius:7px; color:#fff; font-size:13px; font-weight:800; padding:8px 15px; text-decoration:none; }
.module-nav a:hover { background:rgba(255,255,255,.18); color:#fff; }
.module-nav a.active { background:#fff4cf; border-color:#fff4cf; color:#125e61; box-shadow:0 2px 7px rgba(14,71,71,.2); }
.topbar { align-items:center; background:linear-gradient(115deg,#12334f,#176e70); color:#fff; display:flex; justify-content:space-between; min-height:92px; padding:17px 28px; }
.brand { align-items:center; display:flex; gap:15px; }.brand-mark { align-items:center; background:#fff; border-radius:10px; color:var(--teal); display:flex; font-size:20px; font-weight:900; height:54px; justify-content:center; width:54px; }
h1 { font-size:23px; margin:0 0 4px; }.brand p { color:#d7eeee; font-size:12px; font-weight:600; margin:0; }.update-box { background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.3); border-radius:8px; display:grid; padding:9px 13px; text-align:right; }.update-box span { font-size:10px; text-transform:uppercase; }.update-box strong { font-size:13px; }
main { margin:0 auto; max-width:1800px; padding:18px 22px 34px; }.filters { align-items:end; background:#fff; border:1px solid var(--line); border-radius:10px; display:grid; gap:11px; grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); padding:14px; }.filters label { color:#506574; display:grid; font-size:10px; font-weight:800; gap:5px; text-transform:uppercase; }.filters input,.filters select { background:#fff; border:1px solid #adbec8; border-radius:6px; color:#203342; height:36px; min-width:0; padding:5px 8px; width:100%; }.filter-actions { display:flex; flex-wrap:wrap; gap:6px; grid-column:span 2; }.button { border:1px solid #9cafb9; border-radius:6px; cursor:pointer; font-weight:800; height:36px; padding:0 12px; }.primary { background:var(--teal); border-color:var(--teal); color:#fff; }.secondary { background:#fff; color:#29495e; }.excel-button { background:#167348; border-color:#167348; color:#fff; }.excel-button:disabled { cursor:wait; opacity:.7; }
.alert { background:#fff0cf; border:1px solid #e3bd68; border-radius:8px; color:#754b00; font-weight:700; margin-top:14px; padding:12px 14px; }.kpis { display:grid; gap:12px; grid-template-columns:repeat(5,minmax(150px,1fr)); margin:15px 0; }.kpis article { background:#fff; border:1px solid var(--line); border-left:5px solid #6f99a7; border-radius:9px; box-shadow:0 5px 16px rgba(22,52,73,.05); display:grid; min-height:108px; padding:14px 16px; }.kpis span { color:var(--muted); font-size:11px; font-weight:900; text-transform:uppercase; }.kpis strong { color:var(--navy); font-size:31px; line-height:1.15; }.kpis small { color:#72828d; font-size:11px; }.kpis .danger { border-left-color:#dd5f5f; }.kpis .critical { border-left-color:#a62f3e; }.kpis .warning { border-left-color:#e4a93f; }.kpis .accent { border-left-color:var(--teal); }.kpis .recovered { border-left-color:#2e9d67; }.kpis .recovered strong { color:#176b43; }
.dashboard-grid { display:grid; gap:15px; grid-template-columns:minmax(0,1.6fr) minmax(360px,1fr); }.panel { background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 7px 20px rgba(22,52,73,.055); margin-bottom:15px; overflow:hidden; }.panel-heading { align-items:flex-start; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; padding:14px 17px; }.panel-heading h2 { color:var(--navy); font-size:17px; margin:0 0 3px; }.panel-heading p { color:var(--muted); font-size:11px; margin:0; }.chart-wrap { height:360px; padding:16px; }.heat-panel { margin-top:15px; }.heat-heading { gap:15px; }.legend { display:flex; flex-wrap:wrap; gap:5px; justify-content:flex-end; }.legend span,.risk { border-radius:4px; color:#233542; font-size:10px; font-weight:900; padding:4px 6px; white-space:nowrap; }.very-low { background:#68b983!important; }.low { background:#a8cd72!important; }.medium { background:#f2c14e!important; }.high { background:#ed8b49!important; }.very-high { background:#c83e4d!important; color:#fff!important; }.no-data { background:#edf1f3!important; color:#87959e!important; }
.table-scroll { max-height:520px; overflow:auto; }table { border-collapse:collapse; font-size:12px; min-width:780px; width:100%; }th { background:#eaf1f3; color:#375366; font-size:10px; letter-spacing:.02em; padding:9px 10px; position:sticky; text-align:right; text-transform:uppercase; top:0; z-index:2; }td { border-top:1px solid #e2e9ed; padding:8px 10px; text-align:right; }thead > tr:first-child > th:first-child,td.name { left:0; min-width:210px; position:sticky; text-align:left; }.heat-table thead > tr:first-child > th:first-child { z-index:3; }.heat-table td.name { background:#fff; font-weight:800; z-index:1; }.heat-cell { font-size:11px; font-weight:900; min-width:82px; text-align:center; }.empty { color:var(--muted); padding:35px; text-align:center; }.method-note { background:#e8f2f1; border:1px solid #bad3d0; border-radius:8px; color:#405862; font-size:11px; line-height:1.55; padding:12px 15px; }
@media(max-width:1050px){.kpis{grid-template-columns:repeat(3,1fr)}.dashboard-grid{grid-template-columns:1fr}.filter-actions{grid-column:auto}.topbar{align-items:flex-start;gap:12px}.chart-wrap{height:320px}}
@media(max-width:650px){main{padding:10px}.topbar{padding:14px;flex-direction:column}.kpis{grid-template-columns:1fr 1fr}.brand-mark{display:none}.heat-heading{display:block}.legend{justify-content:flex-start;margin-top:10px}}

/* Jerarquia territorial expandible */
.legend small { align-self:center; color:#667987; font-size:10px; font-weight:800; padding-left:4px; }
.tree-hidden { display:none; }
.tree-toggle { align-items:center; background:#e2efed; border:1px solid #8fb9b4; border-radius:4px; color:#0d625c; cursor:pointer; display:inline-flex; font-size:15px; font-weight:900; height:22px; justify-content:center; line-height:1; margin-right:7px; padding:0; vertical-align:middle; width:22px; }
.tree-toggle:hover,.tree-toggle:focus { background:#cbe3df; outline:2px solid rgba(19,118,111,.18); }
.tree-leaf { color:#82939d; display:inline-block; margin-right:8px; text-align:center; width:22px; }
.level-red td.name { background:#e8f2f1; color:#153a5b; font-weight:900; }
.level-microred td.name { background:#f5f8f9; font-weight:800; padding-left:28px; }
.level-eess td.name { background:#fff; color:#506574; padding-left:54px; }
.level-microred td { border-top-color:#ccdadd; }
.level-eess td { font-size:11px; }
.level-provincia td.name { background:#e8f2f1; color:#153a5b; font-weight:900; }
.level-distrito td.name { background:#fff; color:#506574; font-weight:800; padding-left:30px; }
.level-distrito td { font-size:11px; }

.monthly-heat-table { min-width:max-content; }
.monthly-heat-table .month-title { background:#dce9ec; border-left:3px solid #b4c9cf; color:#153a5b; min-width:270px; text-align:center; text-transform:capitalize; }
.monthly-heat-table .heat-month-groups th { height:35px; }
.monthly-heat-table .heat-month-fields th { height:34px; top:35px; }
.monthly-heat-table .heat-month-fields th:nth-child(3n+1),
.monthly-heat-table tbody td:nth-child(3n+2) { border-left:3px solid #d5e1e5; }
.monthly-heat-table .heat-metric { min-width:82px; text-align:center; }
.monthly-heat-table .heat-cell { min-width:96px; }
.monthly-heat-table thead > tr:first-child > th:first-child { left:0; min-width:245px; position:sticky; top:0; z-index:12; }

/* Escala poblacional DCI: degradado de rojo muy claro a rojo oscuro */
.very-low { background:#fff1f2!important; color:#5f1724!important; }
.low { background:#fecdd3!important; color:#6f1726!important; }
.medium { background:#fda4af!important; color:#631424!important; }
.high { background:#fb7185!important; color:#4c0b17!important; }
.very-high { background:#be123c!important; color:#fff!important; }

.nominal-open { background:#176e70; border:1px solid #176e70; border-radius:5px; color:#fff; cursor:pointer; font-size:10px; font-weight:800; padding:5px 8px; white-space:nowrap; }
.nominal-open:hover,.nominal-open:focus { background:#0f595b; outline:2px solid rgba(23,110,112,.2); }
.nominal-toolbar-modal { align-items:center; display:grid; gap:10px; grid-template-columns:minmax(300px,560px) auto; justify-content:space-between; margin-bottom:12px; }
.nominal-table-wrap { border:1px solid #d7e1e6; border-radius:7px; max-height:58vh; }
.nominal-table { margin:0; min-width:1550px; }
.anemia-nominal-table { min-width:2140px; }
.nominal-table th,.nominal-table td { position:static!important; text-align:center!important; }
.nominal-table th:first-child,.nominal-table td:first-child { min-width:auto; }
.nominal-table thead th { position:sticky!important; top:0; z-index:2; }
.nominal-message { color:#526674; font-size:12px; font-weight:700; min-height:22px; }.nominal-message.loading { color:#176e70; }.nominal-message.error { color:#a61b31; }
.nominal-footer { justify-content:space-between; }.nominal-footer > div { align-items:center; display:flex; gap:10px; }.nominal-footer span { color:#526674; font-size:12px; font-weight:800; }
.nominal-flag-value { align-items:center; border-radius:50%; display:inline-flex; font-size:11px; font-weight:900; height:24px; justify-content:center; width:24px; }.flag-one { background:#fee2e2; color:#b91c1c; }.flag-zero { background:#e9eef1; color:#647681; }
@media(max-width:700px){.nominal-toolbar-modal{grid-template-columns:1fr}.nominal-toolbar-modal .btn-success{width:100%}}

.territory-pager { align-items:center; border-top:1px solid #d7e1e6; display:flex; gap:12px; justify-content:center; min-height:52px; padding:8px 12px; }
.territory-pager span { color:#526674; font-size:12px; font-weight:900; min-width:190px; text-align:center; }
.territory-pager .button { height:32px; }
.territory-pager .button:disabled { cursor:not-allowed; opacity:.45; }
.monthly-summary-table { min-width:max-content; }
.monthly-summary-table .month-title { background:#dce9ec; border-left:3px solid #b4c9cf; color:#153a5b; min-width:610px; text-align:center; text-transform:capitalize; }
.monthly-summary-table .month-fields th { top:35px; }
.monthly-summary-table .month-fields th:nth-child(7n+1) { border-left:3px solid #b4c9cf; }
.monthly-summary-table tbody td:nth-child(7n+3) { border-left:3px solid #d5e1e5; }
.monthly-summary-table thead tr:first-child th { height:35px; }
.monthly-summary-table thead tr:nth-child(2) th { height:34px; }
.monthly-summary-table { --territory-width:245px; border-collapse:separate; border-spacing:0; }
.monthly-summary-table thead .month-groups > th:first-child,
.monthly-summary-table tbody > tr > td:first-child { left:0; min-width:var(--territory-width); width:var(--territory-width); max-width:var(--territory-width); position:sticky; }
.monthly-summary-table thead .month-groups > th:nth-child(2),
.monthly-summary-table tbody > tr > td:nth-child(2) { left:var(--territory-width); min-width:96px; width:96px; max-width:96px; position:sticky; }
.monthly-summary-table thead .month-groups > th:first-child,
.monthly-summary-table thead .month-groups > th:nth-child(2) { background:#eaf1f3; top:0; z-index:12; }
.monthly-summary-table tbody > tr > td:first-child,
.monthly-summary-table tbody > tr > td:nth-child(2) { z-index:4; }
.monthly-summary-table tbody > tr > td:nth-child(2) { box-shadow:5px 0 7px -6px rgba(23,55,73,.75); text-align:center; }
.monthly-summary-table .level-red > td:nth-child(2) { background:#e8f2f1; }
.monthly-summary-table .level-microred > td:nth-child(2) { background:#f5f8f9; }
.monthly-summary-table .level-eess > td:nth-child(2) { background:#fff; }
.monthly-summary-table .month-title,
.monthly-summary-table .month-fields th { z-index:6; }
.monthly-summary-table thead .month-groups > th:nth-child(2) { border-right:3px solid #b4c9cf; }
.anemia-monthly-summary .month-title { min-width:810px; }
.anemia-monthly-summary .month-fields th,
.anemia-monthly-summary tbody td { border-left:0; }
.anemia-monthly-summary .month-fields th:nth-child(9n+1) { border-left:3px solid #b4c9cf; }
.anemia-monthly-summary tbody td:nth-child(9n+3) { border-left:3px solid #d5e1e5; }
.anemia-heat-table .month-title { min-width:360px; }
.anemia-heat-table .heat-month-fields th,
.anemia-heat-table tbody td { border-left:0; }
.anemia-heat-table .heat-month-fields th:nth-child(4n+1),
.anemia-heat-table tbody td:nth-child(4n+2) { border-left:3px solid #d5e1e5; }
.recovered-value { color:#176b43; font-weight:900; }
.anemia-kpis { grid-template-columns:repeat(7,minmax(130px,1fr)); }
.cumulative-panel { margin-top:0; }
.cumulative-chart-wrap { height:390px; padding-top:8px; }
.cumulative-totals { display:grid; gap:10px; grid-template-columns:repeat(5,minmax(130px,1fr)); padding:14px 17px 5px; }
.cumulative-totals article { background:#f8fbfc; border:1px solid #d7e1e6; border-radius:7px; border-top:4px solid #6f99a7; display:grid; gap:3px; padding:9px 12px; }
.cumulative-totals span { color:#667987; font-size:10px; font-weight:900; text-transform:uppercase; }
.cumulative-totals strong { color:#203342; font-size:22px; }
@media(max-width:1150px){.anemia-kpis{grid-template-columns:repeat(3,1fr)}}
@media(max-width:900px){.cumulative-totals{grid-template-columns:repeat(3,1fr)}}
@media(max-width:650px){.module-nav{padding:6px 12px}.module-nav a{flex:1;text-align:center}.anemia-kpis,.cumulative-totals{grid-template-columns:1fr 1fr}}
