:root {
  --bg: #eef3fb;
  --surface: #ffffff;
  --surface-2: #f7faff;
  --line: #d9e4f3;
  --text: #152b6b;
  --muted: #7b8aa9;
  --blue: #1f57e7;
  --blue-2: #2e8cff;
  --cyan: #22bfd0;
  --teal: #35c3a8;
  --purple: #815cf4;
  --yellow: #ffcb1c;
  --orange: #ffb22a;
  --soft-yellow: #fff4d6;
  --soft-blue: #eaf1ff;
  --soft-cyan: #e9fbfd;
  --shadow: 0 10px 30px rgba(16, 43, 107, .08);
  --radius: 22px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Montserrat, Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f7f9fd 0%, var(--bg) 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; }
.dashboard-shell { width: 100%; max-width: 1780px; margin: 0 auto; padding: 10px 18px 24px; }
.hero-card, .filters-card, .tabs-card, .panel, .kpi-card { background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-card { overflow: hidden; }
.hero-main { display: grid; grid-template-columns: minmax(520px, 1.1fr) minmax(540px, 1fr); min-height: 190px; }
.brand-block { display: flex; align-items: center; gap: 22px; padding: 26px 20px 20px 20px; }
.topbar-logo { width: 162px; height: auto; object-fit: contain; }
.title-block { min-width: 0; }
.eyebrow { display: inline-block; padding: 10px 14px; border: 1px solid #cad9f5; background: var(--soft-blue); border-radius: 14px; font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.title-block h1 { margin: 0; font-size: 26px; line-height: 1.15; color: #13317c; }
.subtitle-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 13px; }
.dot { width: 4px; height: 4px; background: #9db0d3; border-radius: 50%; }
.hero-side { position: relative; padding: 14px 18px 16px; display: grid; gap: 12px; }
.hero-image { position: absolute; inset: 0 0 auto 0; height: 110px; background: linear-gradient(90deg, rgba(255,255,255,.25), rgba(255,255,255,.1)), url('assets/hero-plant.png') center/cover no-repeat; border-top-right-radius: var(--radius); border-bottom-left-radius: 32px; opacity: .95; }
.hero-actions, .hero-meta { position: relative; z-index: 2; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.hero-actions { padding-top: 6px; }
.updated-pill { display: flex; flex-direction: column; justify-content: center; min-width: 165px; padding: 10px 14px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 14px; color: var(--muted); font-size: 12px; }
.updated-pill strong { color: var(--text); font-size: 13px; margin-top: 2px; }
.action-btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 14px; border: 1px solid #cfdcf4; background: #fff; color: var(--text); font-weight: 700; cursor: pointer; box-shadow: 0 8px 18px rgba(20, 49, 124, .05); }
.action-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-btn.primary { background: var(--yellow); border-color: #f1c300; color: #182a67; }
.action-btn.secondary:hover { background: var(--soft-blue); }
.hero-meta { margin-top: 24px; }
.period-pill, .user-card { display: inline-flex; align-items: center; gap: 10px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; min-height: 48px; }
.period-pill svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; color: var(--blue); }
.period-pill { color: var(--muted); font-weight: 700; }
.user-card strong { display: block; font-size: 14px; }
.user-card small { color: var(--muted); text-transform: uppercase; font-size: 11px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #1e327b; color: #fff; display: grid; place-items: center; font-weight: 800; }
.filters-card { margin-top: 12px; padding: 12px 16px; display: grid; grid-template-columns: 1.4fr 1fr .9fr; gap: 12px; align-items: end; }
.filter-group { display: grid; gap: 8px; }
.filter-title { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.filter-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--soft-blue); }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn { border: 1px solid #cad9f5; background: #fff; color: var(--text); border-radius: 12px; padding: 10px 14px; font-weight: 700; cursor: pointer; }
.chip-btn.is-active { background: #1d46b3; color: #fff; border-color: #1d46b3; }
.select-field { width: 100%; min-height: 46px; border: 1px solid #cad9f5; border-radius: 14px; padding: 0 14px; background: #fff; color: var(--text); font-weight: 700; }
.tabs-card { margin-top: 12px; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); overflow: hidden; }
.tab-item { padding: 16px 18px; text-align: center; font-weight: 700; color: #4261a0; border-right: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fbfdff); }
.tab-item:last-child { border-right: none; }
.tab-item.is-active { background: #103fa9; color: #fff; }
.kpi-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; }
.kpi-card { position: relative; padding: 14px 14px 12px; min-height: 96px; overflow: hidden; display: flex; gap: 10px; }
.kpi-card::after { content: ''; position: absolute; width: 74px; height: 74px; border-radius: 50%; top: -18px; right: -10px; opacity: .16; }
.kpi-chip { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: #edf3ff; font-size: 19px; flex-shrink: 0; }
.kpi-copy span { display: block; font-size: 12px; font-weight: 700; color: #2d3f75; }
.kpi-copy strong { display: block; margin-top: 8px; font-size: 18px; line-height: 1.1; font-weight: 800; color: #1d46c9; }
.kpi-copy small { display: block; margin-top: 8px; font-size: 11px; color: var(--muted); }
.accent-blue::after, .accent-lightblue::after { background: #2f69ff; }
.accent-purple::after { background: #8e67ff; }
.accent-cyan::after { background: #44d2df; }
.accent-yellow::after { background: #ffcf52; }
.accent-orange::after { background: #ffb22a; }
.accent-teal::after { background: #3cc6ac; }
.accent-indigo::after { background: #6087ff; }
.accent-purple .kpi-copy strong { color: #6c4bf0; }
.accent-cyan .kpi-copy strong { color: #0da8bd; }
.accent-yellow .kpi-copy strong, .accent-orange .kpi-copy strong { color: #eb8c00; }
.accent-teal .kpi-copy strong { color: #0f9f91; }
.cards-grid { margin-top: 12px; display: grid; gap: 12px; }
.four-col { grid-template-columns: 1.05fr .95fr .95fr 1fr; }
.three-col { grid-template-columns: 1.05fr 1fr 1fr; }
.two-col { grid-template-columns: 1fr 1.15fr; }
.mixed { grid-template-columns: 1.35fr .95fr .95fr; }
.span-2 { grid-column: span 2; }
.panel { padding: 14px 18px 14px; min-height: 250px; position: relative; }
.panel-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.panel-heading h2 { margin: 0; font-size: 16px; color: var(--text); }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.unit-chip, .top-summary { padding: 6px 10px; border-radius: 12px; background: var(--soft-blue); color: var(--blue); font-size: 12px; font-weight: 800; }
.column-chart { display: grid; grid-template-columns: 48px 1fr; gap: 10px; min-height: 250px; }
.column-chart .y-axis { display: grid; align-content: space-between; padding-top: 10px; color: #98a7c5; font-size: 11px; }
.column-chart .plot-area { position: relative; display: flex; align-items: flex-end; justify-content: space-around; gap: 18px; min-height: 250px; border-left: 1px solid #eef2f8; border-bottom: 1px solid #dce6f4; padding: 12px 8px 18px 12px; background: repeating-linear-gradient(to top, transparent, transparent 42px, rgba(220,230,244,.6) 42px, rgba(220,230,244,.6) 43px); }
.bar-column { display: grid; justify-items: center; align-content: end; gap: 8px; min-width: 84px; }
.bar-fill { width: 66px; border-radius: 10px 10px 3px 3px; background: linear-gradient(180deg, #22bbcd 0%, #1280f0 100%); box-shadow: inset 0 -10px 18px rgba(0,0,0,.08); }
.bar-column:nth-child(1) .bar-fill { background: linear-gradient(180deg, #2e63ea, #2156dd); }
.bar-column:nth-child(2) .bar-fill { background: linear-gradient(180deg, #26b8c9, #1ba2b8); }
.bar-column:nth-child(3) .bar-fill { background: linear-gradient(180deg, #1f91d6, #1680c6); }
.color-population .bar-column:nth-child(1) .bar-fill { background: linear-gradient(180deg, #1e57e5, #2b63ec); }
.color-population .bar-column:nth-child(2) .bar-fill { background: linear-gradient(180deg, #34a0ff, #328de9); }
.color-population .bar-column:nth-child(3) .bar-fill { background: linear-gradient(180deg, #f0c51d, #ffd12a); }
.bar-value { font-size: 13px; font-weight: 800; color: var(--text); }
.bar-label { font-size: 12px; color: #657698; text-align: center; }
.compact-chart { min-height: 180px; }
.compact-chart .plot-area { min-height: 180px; background: repeating-linear-gradient(to top, transparent, transparent 28px, rgba(220,230,244,.55) 28px, rgba(220,230,244,.55) 29px); }
.compact-chart .bar-fill { width: 86px; }
.usage-layout, .composition-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; min-height: 190px; }
.usage-donut, .donut { display: grid; place-items: center; min-height: 190px; }
.usage-note { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #f3f7ff; color: #5e6f92; font-size: 12px; }
.usage-side-stats, .composition-legend { display: grid; gap: 12px; }
.usage-side-stats div, .composition-legend div { display: grid; gap: 5px; padding: 10px 12px; border: 1px solid #dbe5f3; border-radius: 14px; background: #fbfdff; }
.usage-side-stats span, .composition-legend span { font-size: 12px; color: #6b7da1; }
.usage-side-stats strong, .composition-legend strong { font-size: 16px; font-weight: 800; color: var(--text); }
.composition-legend small { font-size: 12px; color: var(--text); font-weight: 700; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.legend-dot.blue { background: var(--blue); }
.legend-dot.cyan { background: var(--cyan); }
.stable-donut { width: 100%; max-width: 200px; height: auto; overflow: visible; }
.donut-ring { fill: none; stroke: #edf2fb; stroke-width: 28; }
.donut-segment { fill: none; stroke-width: 28; stroke-linecap: butt; }
.donut-segment.ambulatory { stroke: var(--blue); }
.donut-segment.hospital { stroke: var(--cyan); }
.donut-center-circle { fill: #fff; stroke: #d8e4f4; stroke-width: 1.4; }
.donut-center-label { fill: #8da0c3; font-size: 12px; font-weight: 600; }
.donut-center-value { fill: var(--text); font-size: 28px; font-weight: 700; }
.list-bars { display: grid; gap: 14px; }
.list-row { display: grid; grid-template-columns: minmax(130px, 170px) 1fr 52px; gap: 12px; align-items: center; }
.list-row .name { color: #42557f; font-size: 13px; }
.list-row .track { height: 11px; background: #edf2fb; border-radius: 999px; overflow: hidden; }
.list-row .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2e63ea, #3a90f8); }
.warning-bars .fill { background: linear-gradient(90deg, #f0bf1c, #ffcf2c); }
.list-row .value { text-align: right; font-weight: 800; color: var(--text); font-size: 13px; }
.is-compact .list-row { grid-template-columns: minmax(110px, 1fr) 1fr 46px; gap: 10px; }
.evolution-chart { min-height: 250px; position: relative; }
.evolution-chart svg { width: 100%; height: 250px; display: block; }
.impact-list { display: grid; gap: 8px; }
.h-row { display: grid; grid-template-columns: 28px minmax(140px, 1fr) minmax(160px, 1fr) 74px 64px; gap: 10px; align-items: center; font-size: 12px; }
.rank-badge { width: 24px; height: 24px; border-radius: 50%; background: #ffefc3; color: #8d6a00; display: grid; place-items: center; font-weight: 800; }
.h-name { color: #44567d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-track { height: 11px; background: #edf2fb; border-radius: 999px; overflow: hidden; }
.h-bar { height: 100%; background: linear-gradient(90deg, #2d62ea, #2459e1); border-radius: 999px; }
.h-value, .h-share { text-align: right; font-weight: 800; color: var(--text); }
.mini-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mini-kpis .mini-card, .time-kpis .mini-card { border: 1px solid #dbe5f3; border-radius: 16px; background: #fbfdff; padding: 12px; display: grid; gap: 6px; min-height: 86px; }
.mini-card span { color: #6d80a4; font-size: 12px; }
.mini-card strong { font-size: 24px; color: var(--text); font-weight: 800; }
.mini-card small { color: #6d80a4; font-size: 12px; }
.time-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.prevention-list { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: #3d5079; font-size: 14px; }
.reading-panel { overflow: hidden; }
.reading-title { display: flex; gap: 12px; align-items: center; }
.reading-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--soft-blue); }
.reading-title h2 { margin: 0; }
.reading-text { position: relative; z-index: 2; margin: 18px 0; color: #40547d; line-height: 1.75; font-size: 14px; max-width: 85%; }
.reading-highlights { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 2; }
.highlight-chip { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 999px; background: #eef3fb; color: #47597f; font-size: 12px; font-weight: 800; }
.reading-watermark { position: absolute; right: 24px; bottom: 22px; font-size: 84px; line-height: 1; opacity: .12; }
.dashboard-footer { margin-top: 12px; padding: 0 4px; display: flex; justify-content: space-between; gap: 12px; color: #7183a6; font-size: 12px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(14, 34, 82, .45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-backdrop.is-open { display: flex; }
.mapping-card { width: min(920px, 100%); background: #fff; border-radius: 22px; border: 1px solid var(--line); box-shadow: 0 30px 60px rgba(16, 43, 107, .18); padding: 20px; }
.drawer-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.drawer-header span { color: var(--muted); font-size: 12px; font-weight: 700; }
.drawer-header h2 { margin: 4px 0 0; }
.icon-button { border: 1px solid var(--line); background: #fff; width: 38px; height: 38px; border-radius: 12px; cursor: pointer; }
.mapping-intro { color: #586b92; font-size: 13px; }
.mapping-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mapping-grid label { display: grid; gap: 6px; color: #5f7196; font-size: 12px; font-weight: 700; }
.mapping-grid label.full { grid-column: 1 / -1; }
.mapping-grid input, .mapping-grid select { min-height: 42px; border-radius: 12px; border: 1px solid var(--line); padding: 0 12px; }
.drawer-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 10px; }
.loading-overlay { position: fixed; inset: 0; background: rgba(14, 34, 82, .35); display: none; align-items: center; justify-content: center; flex-direction: column; gap: 14px; color: #fff; z-index: 70; }
.loading-overlay.is-visible { display: flex; }
.loader { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .9s linear infinite; }
.toast { position: fixed; right: 16px; bottom: 16px; min-width: 250px; max-width: 420px; border-radius: 16px; padding: 12px 14px; color: #fff; background: #2a4dbd; box-shadow: 0 16px 35px rgba(16, 43, 107, .22); display: none; z-index: 80; }
.toast.is-visible { display: block; }
.toast.success { background: #1c9c73; }
.toast.error { background: #cf4136; }
body.exporting { background: #f5f8fd !important; }
body.exporting .dashboard-shell { width: 1760px !important; max-width: 1760px !important; padding: 10px 18px 20px !important; }
body.exporting .hero-main { grid-template-columns: 1.1fr 1fr !important; }
body.exporting .tabs-card { grid-template-columns: repeat(7, 1fr) !important; }
body.exporting .kpi-grid { grid-template-columns: repeat(8, 1fr) !important; }
body.exporting .four-col { grid-template-columns: 1.05fr .95fr .95fr 1fr !important; }
body.exporting .three-col { grid-template-columns: 1.05fr 1fr 1fr !important; }
body.exporting .two-col { grid-template-columns: 1fr 1.15fr !important; }
body.exporting .mixed { grid-template-columns: 1.35fr .95fr .95fr !important; }
body.exporting .reading-text { max-width: 88% !important; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1450px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .four-col, .mixed { grid-template-columns: repeat(2, 1fr); }
  .three-col, .two-col { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 1180px) {
  .hero-main, .filters-card, .tabs-card { grid-template-columns: 1fr; }
  .hero-side { padding-top: 100px; }
  .hero-actions, .hero-meta { justify-content: flex-start; }
  .mini-kpis, .time-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .dashboard-shell { padding: 10px; }
  .brand-block { flex-direction: column; align-items: flex-start; }
  .topbar-logo { width: 140px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .usage-layout, .composition-layout, .mini-kpis, .time-kpis { grid-template-columns: 1fr; }
  .tabs-card { overflow-x: auto; display: flex; }
  .tab-item { min-width: 190px; }
  .h-row { grid-template-columns: 24px minmax(100px,1fr) 1fr 56px; }
  .h-share { display:none; }
  .dashboard-footer { flex-direction: column; }
}
/* Revisión final V9: cuadrícula compacta, sin celdas vacías. */
:root { --blue:#174697; --yellow:#ffcb1c; --radius:16px; --muted:#607391; }
.dashboard-shell { max-width:1500px; padding:20px; }
.hero-main { grid-template-columns:1.15fr 1fr; }
.brand-block { gap:16px; }
.title-block h1 { font-size:24px; }
.topbar-logo { width:145px; }
.hero-side { padding-top:18px; }
.hero-image { opacity:.22; }
.hero-actions { gap:8px; }
.action-btn { font-size:12px; padding:10px 12px; }
.hero-meta { margin-top:4px; }
.filters-card { grid-template-columns:2fr 1.3fr 1.3fr; align-items:end; }
.chip-btn { font-size:12px; padding:9px 10px; }
.filter-icon { display:none; }
.filter-group label { font-size:14px; font-weight:700; }
.section-title { margin:25px 0 10px; border-left:4px solid var(--yellow); padding-left:12px; font-size:19px; color:#153b81; }
.scope-text { font-size:13px; color:#536783; line-height:1.6; margin-bottom:8px; }
.demo-notice { background:#fff4ca; border:1px solid #ebd57c; border-radius:8px; padding:10px 14px; font-size:12px; color:#62501c; }
.demo-notice.real-data { background:#eaf1fa; border-color:#ccdaeb; color:#345078; }
.kpi-grid { grid-template-columns:repeat(4,minmax(0,1fr)); margin-top:12px; }
.kpi-card { min-height:110px; }
.kpi-card::after,.reading-watermark,.kpi-chip { display:none; }
.kpi-copy strong { font-size:24px; font-weight:600; }
.kpi-copy { min-width:0; }
.four-col,.mixed,.three-col,.two-col { grid-template-columns:repeat(2,minmax(0,1fr)); }
.span-2 { grid-column:auto; }
#section-expense > article:first-child { grid-column:1/-1; }
#section-cases { grid-template-columns:1fr; }
#section-management { grid-template-columns:minmax(0,1.1fr) minmax(0,1fr); }
.panel { min-height:0; padding:20px; }
.panel-heading { margin-bottom:18px; }
.panel-heading h2 { font-size:16px; }
.panel-heading p { line-height:1.5; }
.list-row,.is-compact .list-row { grid-template-columns:minmax(110px,1fr) minmax(30px,.8fr) minmax(65px,auto); gap:12px; }
.list-row .value { font-size:12px; font-weight:600; }
.list-row .name { overflow-wrap:anywhere; }
.list-bars,#populationChart { display:grid; gap:15px; }
#populationChart { min-height:0; padding-top:15px; grid-template-columns:1fr; }
.stable-donut { max-width:165px; }
.donut-center-value { font-weight:400; }
.usage-layout,.composition-layout { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.h-row { grid-template-columns:24px minmax(70px,.9fr) minmax(25px,1fr) 104px 55px; gap:8px; }
.h-name { white-space:normal; overflow-wrap:anywhere; }
.h-value { font-weight:600; }
.h-share { display:block; }
.time-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
.mini-kpis { grid-template-columns:repeat(3,minmax(0,1fr)); }
.mini-card strong { font-size:23px; font-weight:600; }
.reading-text { max-width:100%; line-height:1.65; margin:15px 0; }
.reading-title p { font-size:12px; color:var(--muted); }
.reading-icon { display:none; }
.column-chart .plot-area { min-height:225px; gap:8px; padding-left:8px; }
.bar-column { min-width:0; flex:1; }
.bar-fill { width:45px; }
.bar-value { font-size:11px; white-space:nowrap; }
.bar-label { font-size:11px; }
.evolution-chart svg { height:auto; max-height:290px; }
.evolution-chart { min-height:0; }
.evolution-stats { display:flex; justify-content:space-between; gap:12px; font-size:12px; color:var(--muted); }
.evolution-stats b { display:block; margin-top:6px; color:var(--text); font-size:17px; }
.empty-state { color:var(--muted); padding:16px 0; font-size:13px; }
.table-wrap { overflow-x:auto; }
table { border-collapse:collapse; width:100%; font-size:12px; }
th { text-align:left; background:#eaf0fa; padding:12px 10px; }
td { border-bottom:1px solid #e4ebf5; padding:10px; overflow-wrap:anywhere; }
td:last-child { text-align:right; white-space:nowrap; }
td small { color:var(--muted); }
.method-note { color:#63738e; font-size:12px; line-height:1.6; margin:16px 4px; }
.pdf-stage { position:absolute; top:0; left:-1400px; width:1000px; padding:20px; background:#f4f7fc; }
.pdf-header { display:flex; gap:24px; align-items:center; margin-bottom:18px; color:#16366e; }
.pdf-header img { width:140px; }
.pdf-header h2 { font-size:22px; margin:8px 0; }
.pdf-header small { font-size:11px; line-height:1.5; }
.pdf-header p { font-size:11px; background:#fff4cf; padding:8px; margin-bottom:0; }
.pdf-stage .kpi-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
.pdf-stage .kpi-copy strong { font-size:21px; }
.pdf-stage .panel { padding:16px; box-shadow:none; }
.pdf-stage .four-col,.pdf-stage .mixed,.pdf-stage .three-col,.pdf-stage .two-col { grid-template-columns:repeat(2,minmax(0,1fr)); }
.pdf-stage #section-cases { grid-template-columns:1fr; }
.pdf-stage .column-chart,.pdf-stage .column-chart .plot-area { min-height:190px; }
.pdf-stage .hero-actions { display:none; }
.pdf-stage .table-wrap { overflow:visible; }
.pdf-stage table { table-layout:fixed; font-size:11px; }
.pdf-stage th,.pdf-stage td { padding:9px 7px; }
.pdf-stage td:nth-child(3) { width:25%; }
.pdf-stage .mini-kpis { grid-template-columns:repeat(3,minmax(0,1fr)); }
@media(max-width:1100px){.hero-main{grid-template-columns:1fr}.hero-side{padding-top:14px}.filters-card{grid-template-columns:1fr 1fr}.filter-group:first-child{grid-column:1/-1}#section-cases,#section-management{grid-template-columns:1fr}.hero-meta,.hero-actions{justify-content:flex-start}}
@media(max-width:650px){.dashboard-shell{padding:10px}.brand-block{padding:20px;flex-direction:column;align-items:flex-start}.title-block h1{font-size:22px}.filters-card,.four-col,.mixed,.two-col{grid-template-columns:1fr}.filter-group:first-child{grid-column:auto}.kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.kpi-copy strong{font-size:20px}.kpi-card{padding:12px}.panel{padding:15px}.hero-meta{flex-direction:column}.h-row{grid-template-columns:22px minmax(45px,1fr) 95px 50px}.h-track{display:none}.evolution-stats{flex-wrap:wrap}.list-row,.is-compact .list-row{grid-template-columns:minmax(90px,1fr) minmax(20px,.5fr) auto}.table-wrap{max-width:100%}.dashboard-footer{flex-direction:column}.usage-layout,.composition-layout{grid-template-columns:1fr 1fr}}
/* =========================================================
   RESUMEN EJECUTIVO - 7 INDICADORES SIN HUECOS
   ========================================================= */

#section-summary {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

/* Primera fila: 4 tarjetas */
#section-summary > .kpi-card {
  grid-column: span 3;
}

/* Segunda fila: 3 tarjetas iguales */
#section-summary > .kpi-card:nth-child(n+5) {
  grid-column: span 4;
}


/* Tablets */
@media (max-width: 860px) {

  #section-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #section-summary > .kpi-card {
    grid-column: auto;
  }

  #section-summary > .kpi-card:last-child {
    grid-column: 1 / -1;
  }
}


/* Celulares */
@media (max-width: 520px) {

  #section-summary {
    grid-template-columns: 1fr;
  }

  #section-summary > .kpi-card,
  #section-summary > .kpi-card:last-child {
    grid-column: auto;
  }
}
.evolution-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.evolution-stats > span {
  width: 100%;
}
#section-expense > .span-2 {
  grid-column: span 2;
}
/* =========================================================
   GESTIÓN ASESCOR - 3 INDICADORES
   ========================================================= */

#asescorMetrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

#asescorMetrics .mini-card {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 700px) {
  #asescorMetrics {
    grid-template-columns: 1fr;
  }
}

.top-claim-person {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.top-claim-person strong {
  color: #12398d;
  font-size: 14px;
  font-weight: 700;
}

.top-claim-person small {
  color: #60759b;
  font-size: 12px;
  font-weight: 500;
}
/* =========================================================
   CASOS DE MAYOR IMPACTO - TABLA
   MISMO ESTILO QUE DETALLE DE SINIESTROS PAGADOS
   ========================================================= */

#section-cases {
  grid-template-columns: 1fr;
}

.cases-impact-panel {
  width: 100%;
  grid-column: 1 / -1;
}

.impact-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: auto;
}

.impact-table th {
  text-align: left;
  background: #eaf0fa;
  padding: 12px 10px;
  color: #152b6b;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.impact-table td {
  border-bottom: 1px solid #e4ebf5;
  padding: 10px;
  color: #42557f;
  font-size: 12px;
  line-height: 1.35;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.impact-table tbody tr:last-child td {
  border-bottom: none;
}

.impact-table tbody tr:hover td {
  background: #f8faff;
}

.impact-table-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffefc3;
  color: #8d6a00;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.impact-rank-cell {
  width: 40px;
  text-align: center;
}

.impact-case-cell {
  white-space: nowrap;
}

.impact-case-cell strong,
.impact-insured-cell strong {
  color: #12398d;
  font-weight: 700;
}

.impact-insured-cell {
  min-width: 210px;
}

.impact-provider-cell {
  min-width: 170px;
  color: #174697 !important;
  font-weight: 600;
}

.impact-money-cell,
.impact-share-cell {
  text-align: right !important;
  white-space: nowrap;
  font-weight: 700;
  color: #152b6b !important;
}

.impact-empty-cell {
  text-align: center !important;
  color: #607391 !important;
  padding: 22px 12px !important;
}

.pdf-stage .impact-table {
  min-width: 0;
  table-layout: fixed;
  font-size: 9px;
}

.pdf-stage .impact-table th,
.pdf-stage .impact-table td {
  padding: 7px 5px;
  font-size: 9px;
}

.pdf-stage .impact-insured-cell,
.pdf-stage .impact-provider-cell {
  min-width: 0;
}

@media (max-width: 860px) {
  .impact-table {
    min-width: 1050px;
  }
}

/* =========================================================
   VISTA INDIVIDUAL / GRUPO FAMILIAR
   ========================================================= */

.person-view-toggle {
  margin-top: 8px;

  display: inline-flex;
  align-items: center;

  gap: 6px;

  padding: 4px;

  border: 1px solid #d5e0ef;
  border-radius: 12px;

  background: #f5f8fd;
}


.person-view-btn {
  border: none;

  background: transparent;

  color: #607391;

  padding: 8px 12px;

  border-radius: 9px;

  font-size: 12px;
  font-weight: 700;

  cursor: pointer;

  transition: all .2s ease;
}


.person-view-btn:hover:not(:disabled) {
  background: #eaf1ff;

  color: #174697;
}


.person-view-btn.is-active {
  background: #174697;

  color: #ffffff;

  box-shadow:
    0 3px 8px
    rgba(23, 70, 151, .18);
}


.person-view-btn:disabled {
  opacity: .40;

  cursor: not-allowed;
}


/* Celular */

@media (max-width: 650px) {

  .person-view-toggle {
    width: 100%;
  }

  .person-view-btn {
    flex: 1;
  }

}
/* =========================================================
   CONTEXTO INDIVIDUAL / GRUPO FAMILIAR
   ========================================================= */

.family-context {
  margin-top: 6px;
  color: #174697;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  min-height: 18px;
}

.family-context:empty {
  display: none;
}

/* =========================================================
   AJUSTES DE ACCESIBILIDAD Y ESTADO
   ========================================================= */

[hidden] {
  display: none !important;
}

.person-view-btn:focus-visible,
.chip-btn:focus-visible,
.action-btn:focus-visible,
.select-field:focus-visible {
  outline: 3px solid rgba(31, 87, 231, .20);
  outline-offset: 2px;
}

.person-view-toggle {
  max-width: 100%;
}

.person-view-btn {
  white-space: nowrap;
}

/* =========================================================
   PROVEEDORES MÁS UTILIZADOS
   MISMO ESTILO VISUAL QUE BENEFICIOS MÁS UTILIZADOS
   ========================================================= */

#section-providers {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.provider-panel {
  min-width: 0;
}

.provider-list {
  display: grid;
  gap: 15px;
}

.provider-list .provider-row {
  grid-template-columns: minmax(180px, 1.25fr) minmax(120px, 1fr) 92px;
  gap: 14px;
  align-items: center;
}

.provider-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.provider-name strong {
  color: #42557f;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.provider-name small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
}

.provider-list .track {
  height: 11px;
  background: #edf2fb;
  border-radius: 999px;
  overflow: hidden;
}

.provider-list .fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2e63ea, #3a90f8);
}

.provider-value {
  min-width: 82px;
  text-align: right;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.pdf-stage #section-providers {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pdf-stage .provider-list .provider-row {
  grid-template-columns: minmax(160px, 1.15fr) minmax(90px, 1fr) 78px;
}

@media (max-width: 900px) {
  #section-providers {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .provider-list .provider-row {
    grid-template-columns: minmax(120px, 1fr) minmax(70px, .8fr) 76px;
    gap: 10px;
  }

  .provider-name small {
    display: none;
  }
}

/* =========================================================
   ASESCOR · SISTEMA VISUAL CORPORATIVO V14
   Basado en manual visual:
   Azul noche      #191A37
   Azul profundo   #151C5C
   Azul corporativo#374E8C
   Amarillo        #FAE91C
   Dorado          #FBD13F
   Blanco          #FFFFFF
   Fondo claro     #F5F7FB
   Línea neutra    #E8ECF3
   Texto secundario#6F7789
   ========================================================= */

:root {
  --as-night: #191A37;
  --as-deep: #151C5C;
  --as-corporate: #374E8C;
  --as-yellow: #FAE91C;
  --as-gold: #FBD13F;

  --as-white: #FFFFFF;
  --as-bg: #F5F7FB;
  --as-line: #E8ECF3;
  --as-muted: #6F7789;

  --bg: var(--as-bg);
  --surface: var(--as-white);
  --surface-2: var(--as-bg);
  --line: var(--as-line);
  --text: var(--as-night);
  --muted: var(--as-muted);

  --blue: var(--as-corporate);
  --blue-2: var(--as-corporate);
  --yellow: var(--as-yellow);

  --soft-blue: #F1F3F8;
  --soft-yellow: #FFFCE3;
  --shadow: 0 8px 24px rgba(25, 26, 55, .055);
  --radius: 16px;
}

html,
body,
button,
select,
input,
textarea {
  font-family: "Montserrat", Aptos, Arial, sans-serif;
}

body {
  background: var(--as-bg);
  color: var(--as-night);
  font-size: 14px;
}

.dashboard-shell {
  max-width: 1500px;
  padding: 20px;
}

/* 60% fondos claros / blanco */
.hero-card,
.filters-card,
.panel,
.kpi-card,
.tabs-card,
.updated-pill,
.period-pill,
.user-card {
  background: var(--as-white);
  border-color: var(--as-line);
  box-shadow: var(--shadow);
}

/* HERO */
.hero-card {
  border-radius: 18px;
}

.hero-image {
  opacity: .07;
}

.title-block h1 {
  color: var(--as-night);
  font-size: 30px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -.02em;
}

.title-block::after {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--as-yellow);
}

.eyebrow {
  color: var(--as-corporate);
  background: var(--as-bg);
  border-color: var(--as-line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.subtitle-row,
.updated-pill,
.period-pill,
.user-card small {
  color: var(--as-muted);
}

.updated-pill strong,
.user-card strong {
  color: var(--as-night);
}

.avatar {
  background: var(--as-deep);
  color: var(--as-white);
}

.period-pill svg {
  color: var(--as-corporate);
}

/* BOTONES */
.action-btn {
  color: var(--as-deep);
  background: var(--as-white);
  border-color: var(--as-line);
  box-shadow: none;
  font-weight: 600;
}

.action-btn.secondary:hover {
  background: var(--as-bg);
  border-color: #D8DDE7;
}

.action-btn.primary {
  background: var(--as-yellow);
  border-color: var(--as-yellow);
  color: var(--as-night);
  font-weight: 700;
}

.action-btn.primary:hover {
  background: var(--as-gold);
  border-color: var(--as-gold);
}

/* FILTROS */
.filters-card {
  padding: 16px;
}

.filter-title,
.filter-group label {
  color: var(--as-night);
  font-weight: 600;
}

.chip-btn,
.select-field {
  background: var(--as-white);
  border-color: #DDE2EB;
  color: var(--as-night);
  font-weight: 600;
}

.chip-btn:hover:not(.is-active) {
  background: var(--as-bg);
}

.chip-btn.is-active {
  background: var(--as-deep);
  border-color: var(--as-deep);
  color: var(--as-white);
}

.person-view-toggle {
  background: var(--as-bg);
  border-color: var(--as-line);
}

.person-view-btn {
  color: var(--as-muted);
}

.person-view-btn:hover:not(:disabled) {
  background: var(--as-white);
  color: var(--as-deep);
}

.person-view-btn.is-active {
  background: var(--as-deep);
  color: var(--as-white);
  box-shadow: none;
}

.person-view-btn:focus-visible,
.chip-btn:focus-visible,
.action-btn:focus-visible,
.select-field:focus-visible {
  outline: 3px solid rgba(55, 78, 140, .18);
  outline-offset: 2px;
}

/* TÍTULOS: 25% azul noche/profundo */
.section-title {
  color: var(--as-night);
  border-left: 4px solid var(--as-yellow);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.scope-text {
  color: var(--as-muted);
  font-size: 12px;
}

.family-context {
  color: var(--as-corporate);
  font-weight: 600;
}

/* AVISOS */
.demo-notice {
  color: var(--as-night);
  background: #FFFCE3;
  border: 1px solid #F4E98A;
  border-left: 4px solid var(--as-yellow);
}

.demo-notice.real-data {
  color: var(--as-deep);
  background: var(--as-white);
  border-color: var(--as-line);
  border-left-color: var(--as-corporate);
}

/* KPI */
.kpi-card {
  min-height: 112px;
  border-radius: 16px;
  border-top: 3px solid transparent;
}

.kpi-copy span {
  color: var(--as-deep);
  font-size: 12px;
  font-weight: 600;
}

.kpi-copy strong {
  color: var(--as-corporate) !important;
  font-size: 27px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.02em;
}

.kpi-copy small {
  color: var(--as-muted);
  font-size: 11px;
}

/* El amarillo se reserva solo para énfasis clave */
.kpi-card.accent-yellow {
  border-top-color: var(--as-yellow);
}

.kpi-card.accent-yellow .kpi-copy strong {
  color: var(--as-night) !important;
}

/* PANELES */
.panel {
  border-radius: 16px;
}

.panel-heading h2,
.reading-title h2 {
  color: var(--as-night);
  font-weight: 700;
}

.panel-heading p,
.reading-title p,
.reading-text,
.method-note {
  color: var(--as-muted);
}

.unit-chip,
.top-summary {
  color: var(--as-deep);
  background: var(--as-bg);
  border: 1px solid var(--as-line);
  font-weight: 700;
}

/* 10% azul corporativo: datos y gráficos */
.list-row .fill,
.provider-list .fill,
.h-bar {
  background: var(--as-corporate);
}

.list-row .track,
.provider-list .track,
.h-track {
  background: var(--as-line);
}

.list-row .name,
.provider-name strong,
.h-name,
.bar-label {
  color: var(--as-muted);
}

.list-row .value,
.provider-value,
.h-value,
.h-share,
.evolution-stats b {
  color: var(--as-deep);
}

.provider-name small {
  color: var(--as-muted);
}

/* BARRAS / POBLACIÓN */
.bar-fill,
.bar-column:nth-child(1) .bar-fill,
.bar-column:nth-child(2) .bar-fill,
.bar-column:nth-child(3) .bar-fill {
  background: var(--as-corporate);
  box-shadow: none;
}

.color-population .bar-column:nth-child(1) .bar-fill {
  background: var(--as-deep);
}

.color-population .bar-column:nth-child(2) .bar-fill {
  background: var(--as-corporate);
}

.color-population .bar-column:nth-child(3) .bar-fill {
  background: var(--as-gold);
}

.bar-value {
  color: var(--as-night);
}

/* DONUTS */
.donut-ring {
  stroke: var(--as-line);
}

.donut-segment.ambulatory {
  stroke: var(--as-corporate);
}

.donut-segment.hospital {
  stroke: var(--as-deep);
}

.donut-center-circle {
  fill: var(--as-white);
  stroke: var(--as-line);
}

.donut-center-label {
  fill: var(--as-muted);
}

.donut-center-value {
  fill: var(--as-night);
  font-weight: 700;
}

.legend-dot.blue {
  background: var(--as-corporate);
}

.legend-dot.cyan {
  background: var(--as-deep);
}

/* TARJETAS SECUNDARIAS */
.usage-note,
.usage-side-stats div,
.composition-legend div,
#asescorMetrics .mini-card,
.time-kpis .mini-card {
  background: var(--as-bg);
  border-color: var(--as-line);
}

.usage-side-stats span,
.composition-legend span,
.mini-card span,
.mini-card small {
  color: var(--as-muted);
}

.usage-side-stats strong,
.composition-legend strong,
.mini-card strong {
  color: var(--as-corporate);
}

/* TABLAS */
table,
.impact-table {
  color: var(--as-night);
}

th,
.impact-table th {
  background: #F0F2F7;
  color: var(--as-deep);
  border-bottom: 1px solid var(--as-line);
  font-weight: 700;
}

td,
.impact-table td {
  border-bottom-color: var(--as-line);
  color: var(--as-muted);
}

.impact-table tbody tr:hover td,
tbody tr:hover td {
  background: #FAFBFD;
}

.impact-case-cell strong,
.impact-insured-cell strong,
.impact-provider-cell {
  color: var(--as-deep) !important;
}

.impact-money-cell,
.impact-share-cell {
  color: var(--as-night) !important;
}

.impact-table-rank,
.rank-badge {
  background: #FFF6C8;
  color: var(--as-night);
}

/* LECTURA EJECUTIVA */
.reading-text {
  color: #4F5668;
}

.highlight-chip {
  background: var(--as-bg);
  color: var(--as-deep);
  border: 1px solid var(--as-line);
}

/* FOOTER */
.dashboard-footer {
  color: var(--as-muted);
}

/* TOAST / ESTADOS */
.toast {
  background: var(--as-deep);
}

.toast.success {
  background: var(--as-corporate);
}

/* EXPORTACIÓN PDF */
body.exporting,
.pdf-stage {
  background: var(--as-bg) !important;
}

.pdf-header {
  color: var(--as-night);
}

.pdf-header p {
  color: var(--as-night);
  background: #FFFCE3;
  border-left: 4px solid var(--as-yellow);
}

/* RESPONSIVE */
@media (max-width: 650px) {
  .title-block h1 {
    font-size: 25px;
  }

  .section-title {
    font-size: 18px;
  }

  .kpi-copy strong {
    font-size: 23px;
  }
}

/* =========================================================
   ASESCOR · AJUSTE VISUAL V15
   Resumen ejecutivo limpio + paleta estricta
   ========================================================= */

/* 1. Resumen ejecutivo: eliminar textos secundarios debajo del dato */
#section-summary .kpi-copy small {
  display: none !important;
}

#section-summary .kpi-card {
  min-height: 96px;
  align-items: center;
}

#section-summary .kpi-copy strong {
  margin-top: 9px;
}

/* 2. Ocultar comentario de importación/demostración */
#demoNotice,
.demo-notice {
  display: none !important;
}

/* 3. Paleta estricta ASESCOR */
:root {
  --as-night: #191A37;
  --as-deep: #151C5C;
  --as-corporate: #374E8C;
  --as-yellow: #FAE91C;
  --as-gold: #FBD13F;
  --as-white: #FFFFFF;
  --as-bg: #F5F7FB;
  --as-line: #E8ECF3;
  --as-muted: #6F7789;
}

/* KPI: sin morados, verdes, cyan u otros azules */
#section-summary .kpi-copy strong,
.kpi-copy strong,
.accent-blue .kpi-copy strong,
.accent-lightblue .kpi-copy strong,
.accent-purple .kpi-copy strong,
.accent-cyan .kpi-copy strong,
.accent-teal .kpi-copy strong,
.accent-indigo .kpi-copy strong,
.accent-orange .kpi-copy strong {
  color: var(--as-corporate) !important;
}

#section-summary .accent-yellow .kpi-copy strong,
.accent-yellow .kpi-copy strong {
  color: var(--as-night) !important;
}

/* Eliminar adornos/acentos de colores heredados */
.kpi-card::after {
  display: none !important;
}

/* Barras: azul corporativo plano, sin degradados */
.bar-fill,
.bar-column:nth-child(1) .bar-fill,
.bar-column:nth-child(2) .bar-fill,
.bar-column:nth-child(3) .bar-fill,
.list-row .fill,
.warning-bars .fill,
.h-bar,
.provider-list .fill {
  background: var(--as-corporate) !important;
  background-image: none !important;
  box-shadow: none !important;
}

/* Población: solo azules institucionales */
.color-population .bar-column:nth-child(1) .bar-fill {
  background: var(--as-deep) !important;
}

.color-population .bar-column:nth-child(2) .bar-fill {
  background: var(--as-corporate) !important;
}

.color-population .bar-column:nth-child(3) .bar-fill {
  background: var(--as-night) !important;
}

/* Donuts: únicamente los dos azules institucionales */
.donut-segment.ambulatory {
  stroke: var(--as-corporate) !important;
}

.donut-segment.hospital {
  stroke: var(--as-deep) !important;
}

.legend-dot.blue {
  background: var(--as-corporate) !important;
}

.legend-dot.cyan {
  background: var(--as-deep) !important;
}

/* Botones activos */
.chip-btn.is-active,
.person-view-btn.is-active,
.tab-item.is-active {
  background: var(--as-deep) !important;
  border-color: var(--as-deep) !important;
  color: var(--as-white) !important;
  background-image: none !important;
}

/* Datos y textos */
.bar-value,
.list-row .value,
.provider-value,
.h-value,
.h-share,
.evolution-stats b {
  color: var(--as-deep) !important;
}

.list-row .name,
.provider-name strong,
.provider-name small,
.bar-label,
.h-name {
  color: var(--as-muted) !important;
}

/* Mini KPI / Gestión Asescor */
.mini-card strong,
.usage-side-stats strong,
.composition-legend strong {
  color: var(--as-corporate) !important;
}

/* Rangos, fondos y pistas neutrales */
.list-row .track,
.provider-list .track,
.h-track,
.donut-ring {
  background: var(--as-line) !important;
}

.donut-ring {
  stroke: var(--as-line) !important;
}

/* Amarillo únicamente como énfasis puntual */
.section-title {
  border-left-color: var(--as-yellow) !important;
}

.action-btn.primary {
  background: var(--as-yellow) !important;
  border-color: var(--as-yellow) !important;
  color: var(--as-night) !important;
  background-image: none !important;
}

.action-btn.primary:hover {
  background: var(--as-gold) !important;
  border-color: var(--as-gold) !important;
}

/* Evitar degradados heredados en fondos principales */
body {
  background: var(--as-bg) !important;
  background-image: none !important;
}

.hero-card,
.filters-card,
.tabs-card,
.panel,
.kpi-card,
.updated-pill,
.period-pill,
.user-card,
.usage-side-stats div,
.composition-legend div,
.mini-card {
  background-image: none !important;
}

/* =========================================================
   ASESCOR · MULTIPÓLIZA V16
   ========================================================= */

.filters-card {
  grid-template-columns: 1.55fr 1fr 1fr 1fr;
  align-items: end;
}

.period-group {
  grid-column: span 2;
}

.policy-group .select-field {
  border-color: #C9D2E3;
  background: #FFFFFF;
  color: #151C5C;
  font-weight: 700;
}

.policy-group .filter-title strong {
  color: #151C5C;
}

#policyFilter {
  min-height: 46px;
}

@media (max-width: 1100px) {
  .filters-card {
    grid-template-columns: 1fr 1fr;
  }

  .period-group {
    grid-column: 1 / -1;
  }
}

@media (max-width: 650px) {
  .filters-card {
    grid-template-columns: 1fr;
  }

  .period-group {
    grid-column: auto;
  }
}

/* =========================================================
   ASESCOR · AJUSTES V17 · ALICONSUMO / MULTIPÓLIZA
   ========================================================= */

/* Contratante fijo: se mantiene visualmente como dato, no como filtro editable */
#contractorFilter:disabled {
  opacity: 1;
  cursor: default;
  color: var(--as-night, #191A37);
  background: #FFFFFF;
  -webkit-text-fill-color: var(--as-night, #191A37);
}

/* Punto de equilibrio: sin borde amarillo */
#section-summary .balance-card {
  border-top-color: transparent !important;
  border-color: var(--as-line, #E8ECF3) !important;
  background: #FFFDF0 !important;
}

#section-summary .balance-card .kpi-copy strong {
  color: var(--as-night, #191A37) !important;
}

/* Amarillo/dorado como acento controlado para equilibrar la paleta */

/* Dependientes: barra dorada en población */
#populationChart .list-row:nth-child(3) .fill,
.color-population .bar-column:nth-child(3) .bar-fill {
  background: var(--as-gold, #FBD13F) !important;
  background-image: none !important;
}

/* Utilización: usado en azul corporativo, no usado en dorado */
#usageDonut .donut-segment.ambulatory {
  stroke: var(--as-corporate, #374E8C) !important;
}

#usageDonut .donut-segment.hospital {
  stroke: var(--as-gold, #FBD13F) !important;
}

/* Composición del gasto conserva los dos azules institucionales */
#compositionDonut .donut-segment.ambulatory {
  stroke: var(--as-corporate, #374E8C) !important;
}

#compositionDonut .donut-segment.hospital {
  stroke: var(--as-deep, #151C5C) !important;
}

/* Algunos indicadores secundarios usan dorado sin saturar la interfaz */
#usageUnused {
  color: var(--as-night, #191A37) !important;
}

#usageDonut + * {
  border-color: var(--as-line, #E8ECF3);
}

/* =========================================================
   ASESCOR · V18 · POBLACIÓN VIGENTE / EXCLUIDA
   ========================================================= */

#section-summary .excluded-card {
  background: #FFFDF0 !important;
  border-color: var(--as-line, #E8ECF3) !important;
  border-top-color: var(--as-line, #E8ECF3) !important;
}

#section-summary .excluded-card .kpi-copy strong {
  color: var(--as-night, #191A37) !important;
}

#section-summary .excluded-card .kpi-chip {
  background: var(--as-yellow, #FAE91C);
  color: var(--as-night, #191A37);
}

.population-panel {
  display: flex;
  flex-direction: column;
}

.population-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.population-status > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--as-line, #E8ECF3);
  border-radius: 12px;
  background: var(--as-bg, #F5F7FB);
}

.population-status span {
  display: block;
  margin-bottom: 4px;
  color: var(--as-muted, #6F7789);
  font-size: 11px;
  line-height: 1.3;
}

.population-status strong {
  color: var(--as-corporate, #374E8C);
  font-size: 18px;
  font-weight: 700;
}

.population-status .population-status-excluded {
  background: #FFFDF0;
}

.population-status .population-status-excluded strong {
  color: var(--as-night, #191A37);
}

@media (max-width: 650px) {
  .population-status {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   ASESCOR · V19 · ORDEN DE FILTROS + RESUMEN UNIFORME
   ========================================================= */

/* ---------- FILTROS: distribución continua, sin huecos ---------- */
.filters-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(240px, .78fr) !important;
  grid-template-areas:
    "period attention contractor"
    "policy person role" !important;
  gap: 14px 16px !important;
  align-items: end !important;
}

.filter-period {
  grid-area: period !important;
}

.filter-attention {
  grid-area: attention !important;
}

.filter-contractor {
  grid-area: contractor !important;
}

.filter-policy {
  grid-area: policy !important;
}

.filter-person {
  grid-area: person !important;
}

.filter-role {
  grid-area: role !important;
}

/* Si la versión actual no tiene clases específicas, ubicar por orden DOM */
.filters-grid > .filter-group:nth-of-type(1) { grid-area: period !important; }
.filters-grid > .filter-group:nth-of-type(2) { grid-area: attention !important; }
.filters-grid > .filter-group:nth-of-type(3) { grid-area: contractor !important; }
.filters-grid > .filter-group:nth-of-type(4) { grid-area: policy !important; }
.filters-grid > .filter-group:nth-of-type(5) { grid-area: person !important; }
.filters-grid > .filter-group:nth-of-type(6) { grid-area: role !important; }

.filters-card .filter-group,
.filters-card .filter-block {
  margin: 0 !important;
  min-width: 0;
}

/* El toggle Individual / Grupo familiar se mantiene pegado al selector de persona */
.person-view-toggle {
  margin-top: 8px !important;
  width: 100%;
}

/* Botón Restablecer: ocupa espacio natural y no deja huecos */
.reset-filters-wrap,
.filter-reset {
  align-self: end !important;
}

/* ---------- RESUMEN EJECUTIVO: todos los cuadros iguales ---------- */
#section-summary .kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 14px !important;
  align-items: stretch !important;
}

#section-summary .kpi-card {
  min-height: 96px !important;
  height: 100% !important;
  background: #FFFFFF !important;
  border: 1px solid var(--as-line, #E8ECF3) !important;
  border-top: 1px solid var(--as-line, #E8ECF3) !important;
  box-shadow: var(--shadow, 0 8px 24px rgba(25, 26, 55, .055)) !important;
}

/* Quitar fondos amarillos de Punto de equilibrio y Personas excluidas */
#section-summary .balance-card,
#section-summary .excluded-card {
  background: #FFFFFF !important;
  border-color: var(--as-line, #E8ECF3) !important;
}

/* Uniformar color de los valores */
#section-summary .kpi-card .kpi-copy strong,
#section-summary .balance-card .kpi-copy strong,
#section-summary .excluded-card .kpi-copy strong {
  color: var(--as-corporate, #374E8C) !important;
}

/* Ocultar iconos decorativos para que todos los KPI mantengan el mismo estilo */
#section-summary .kpi-chip {
  display: none !important;
}

/* La tarjeta Personas excluidas ya no usa amarillo */
#section-summary .excluded-card .kpi-chip {
  background: transparent !important;
}

/* Evitar hueco visual cuando hay 8 KPI: 4 + 4 */
#section-summary .kpi-card:nth-child(n) {
  grid-column: auto !important;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-areas:
      "period attention"
      "contractor policy"
      "person role" !important;
  }

  #section-summary .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 700px) {
  .filters-grid {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "period"
      "attention"
      "contractor"
      "policy"
      "person"
      "role" !important;
  }

  #section-summary .kpi-grid {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================
   ASESCOR · V20 · CORRECCIÓN DEFINITIVA DE LAYOUT
   ========================================================= */

/* ---------------------------------------------------------
   FILTROS
   Fila 1: Periodo | Tipo de atención | Contratante
   Fila 2: Póliza | Asegurado + vista | Relación + Restablecer
   --------------------------------------------------------- */
.filters-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1.15fr) minmax(0, .95fr) !important;
  grid-template-areas:
    "period attention contractor"
    "policy person role" !important;
  gap: 14px 16px !important;
  align-items: start !important;
}

.filters-card .period-group {
  grid-area: period !important;
}

.filters-card .type-group {
  grid-area: attention !important;
}

.filters-card .contractor-group {
  grid-area: contractor !important;
}

.filters-card .policy-group {
  grid-area: policy !important;
}

.filters-card .person-group {
  grid-area: person !important;
}

.filters-card .role-group {
  grid-area: role !important;
}

.filters-card .filter-group {
  min-width: 0 !important;
  margin: 0 !important;
}

/* Asegurado: selector + Individual/Grupo familiar en la misma línea */
.filters-card .person-group {
  grid-template-columns: minmax(0, 1fr) minmax(230px, .9fr) !important;
  grid-template-rows: auto 46px !important;
  column-gap: 10px !important;
  row-gap: 8px !important;
}

.filters-card .person-group > label {
  grid-column: 1 / -1 !important;
}

.filters-card .person-group > #personFilter {
  grid-column: 1 !important;
  grid-row: 2 !important;
}

.filters-card .person-group > .person-view-toggle {
  grid-column: 2 !important;
  grid-row: 2 !important;
  margin: 0 !important;
  min-height: 46px !important;
  height: 46px !important;
}

/* Relación: selector + botón en una sola línea */
.role-filter-actions {
  display: grid !important;
  grid-template-columns: minmax(130px, 1fr) minmax(150px, .95fr) !important;
  gap: 10px !important;
  align-items: stretch !important;
}

.role-filter-actions .select-field,
.role-filter-actions .clear-filters-btn {
  min-height: 46px !important;
  height: 46px !important;
  width: 100% !important;
}

.clear-filters-btn {
  white-space: nowrap !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
}

/* ---------------------------------------------------------
   RESUMEN EJECUTIVO
   8 KPI = 4 columnas x 2 filas, sin huecos.
   --------------------------------------------------------- */
#section-summary {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 14px !important;
  align-items: stretch !important;
}

#section-summary > .kpi-card,
#section-summary > .kpi-card:nth-child(n+5),
#section-summary > .kpi-card:last-child {
  grid-column: auto !important;
  min-width: 0 !important;
  width: auto !important;
  min-height: 96px !important;
  height: 100% !important;
  background: #FFFFFF !important;
  border: 1px solid var(--as-line, #E8ECF3) !important;
  border-top: 1px solid var(--as-line, #E8ECF3) !important;
  box-shadow: var(--shadow, 0 8px 24px rgba(25, 26, 55, .055)) !important;
}

/* Todos los KPI exactamente con el mismo tratamiento visual */
#section-summary .balance-card,
#section-summary .excluded-card,
#section-summary .accent-blue,
#section-summary .accent-purple,
#section-summary .accent-cyan,
#section-summary .accent-yellow,
#section-summary .accent-orange,
#section-summary .accent-teal,
#section-summary .accent-indigo,
#section-summary .accent-lightblue {
  background: #FFFFFF !important;
  border-color: var(--as-line, #E8ECF3) !important;
}

#section-summary .kpi-card .kpi-copy strong,
#section-summary .balance-card .kpi-copy strong,
#section-summary .excluded-card .kpi-copy strong {
  color: var(--as-corporate, #374E8C) !important;
}

/* Evitar corte de cifras largas */
#section-summary .kpi-copy {
  min-width: 0 !important;
  width: 100% !important;
}

#section-summary .kpi-copy strong {
  font-size: clamp(20px, 1.7vw, 27px) !important;
  line-height: 1.08 !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

/* ---------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------- */
@media (max-width: 1180px) {
  .filters-card {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-areas:
      "period attention"
      "contractor policy"
      "person role" !important;
  }

  #section-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  .filters-card {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "period"
      "attention"
      "contractor"
      "policy"
      "person"
      "role" !important;
  }

  .filters-card .person-group {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto 46px 46px !important;
  }

  .filters-card .person-group > label {
    grid-column: 1 !important;
  }

  .filters-card .person-group > #personFilter {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }

  .filters-card .person-group > .person-view-toggle {
    grid-column: 1 !important;
    grid-row: 3 !important;
  }

  .role-filter-actions {
    grid-template-columns: 1fr !important;
  }

  #section-summary {
    grid-template-columns: 1fr !important;
  }

  #section-summary .kpi-copy strong {
    font-size: 24px !important;
  }
}


/* Selección de vigencia / período: cinco frecuencias, fechas visibles. */
.period-range-hint{color:#536481;font-size:11px;font-weight:600;min-height:1.1em}
.frequency-group,.vigencia-group,.period-group{min-width:0}
#periodFilter{min-width:0;text-overflow:ellipsis}
@media(min-width:1181px){.filters-card{grid-template-columns:repeat(4,minmax(0,1fr))}.period-group{grid-column:span 2}}


/* ===============================================================
   ASESCOR V19.1 - Corrección estructural filtros
   Hijos directos, áreas declaradas: evita solapamiento de controles
   =============================================================== */
.filters-card {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  grid-template-areas:
    "vigencia vigencia vigencia policy policy policy frequency frequency frequency period period period"
    "attention attention attention attention contractor contractor person person person role role role" !important;
  gap: 18px 16px !important;
  align-items: start !important;
  padding: 22px 20px !important;
}
.filters-card > .vigencia-group { grid-area: vigencia !important; }
.filters-card > .policy-group { grid-area: policy !important; }
.filters-card > .frequency-group { grid-area: frequency !important; }
.filters-card > .period-group { grid-area: period !important; }
.filters-card > .type-group { grid-area: attention !important; }
.filters-card > .contractor-group { grid-area: contractor !important; }
.filters-card > .person-group { grid-area: person !important; }
.filters-card > .role-group { grid-area: role !important; }
.filters-card > .filter-group {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: start !important;
  gap: 8px !important;
  min-width: 0 !important;
  width: auto !important;
  grid-column: auto;
  grid-row: auto;
}
.filters-card .filter-group > label,
.filters-card .filter-title {
  font-size: 13px !important;
  font-weight: 700 !important;
  min-height: 18px;
  line-height: 18px;
  margin: 0 !important;
}
.filters-card .select-field {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 46px !important;
  height: 46px !important;
  font-size: 13px;
  padding-inline: 12px;
}
.filters-card > .person-group > #personFilter,
.filters-card > .person-group > .person-view-toggle,
.filters-card > .person-group > label {
  display: block;
  grid-column: auto !important;
  grid-row: auto !important;
  width: 100% !important;
}
.filters-card > .person-group > .person-view-toggle {
  display: flex !important;
  margin: 0 !important;
  min-height: 42px !important;
  height: 42px !important;
}
.filters-card > .person-group .person-view-btn {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 8px 5px;
}
.filters-card .chips-row { display: flex !important; gap: 7px; flex-wrap: wrap; }
.filters-card .type-group .chip-btn { min-height: 46px; padding: 10px 12px; font-size: 12px; }
.filters-card .role-filter-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  width: 100% !important;
}
.filters-card .role-filter-actions > .select-field,
.filters-card .role-filter-actions > .clear-filters-btn { width: 100% !important; height: 46px !important; min-height: 46px !important; }
.filters-card .period-range-hint {
  display: block;
  min-height: 30px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
@media (max-width: 1180px) {
  .filters-card {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-areas:
      "vigencia policy"
      "frequency period"
      "attention contractor"
      "person role" !important;
  }
}
@media (max-width: 680px) {
  .filters-card {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "vigencia"
      "policy"
      "frequency"
      "period"
      "attention"
      "contractor"
      "person"
      "role" !important;
    padding: 16px 14px !important;
    gap: 16px !important;
  }
  .filters-card > .person-group > .person-view-toggle { margin: 0 !important; }
}

/* En pantallas pequeñas, el detalle ancho debe desplazarse dentro del panel. */
#section-cases, #section-cases > .cases-impact-panel {
  min-width: 0 !important;
  max-width: 100% !important;
}
#section-cases .table-wrap {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: auto !important;
}
@media (max-width: 860px) {
  #section-cases .panel-heading { flex-wrap: wrap; min-width: 0; }
}
