*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:           #1a3560;
  --navy-mid:       #1e4080;
  --blue:           #2563b0;
  --blue-light:     #3a7bd5;
  --blue-btn:       #2d5fa8;
  --blue-btn-hover: #1e4a8c;
  --accent:         #e8a020;
  --bg:             #f4f6fa;
  --card-bg:        #ffffff;
  --text:           #1e2a3a;
  --text-muted:     #5a6a80;
  --border:         #d0daea;
  --map-peru:       #b8cce4;
  --map-ll:         #2563b0;
  --map-ll-hover:   #1a3560;
  --azul-oscuro:    #003876;
  --azul-medio:     #0057A8;
  --azul-claro:     #1A7EC8;
  --dorado:         #C8A217;
  --blanco:         #ffffff;
  --col-grey:       #4a5568;
  --col-orange:     #e07b00;
  --col-red:        #d63030;
  --col-blue:       #2563b0;
  --col-green:      #0a8a4e;
}
.WEB_MAPA{
  background: linear-gradient(#b8cde8, #dce9f5);
}

.WEB_CAJAFONDO_AZUL{
  background-color: var(--blue-btn);
}

body { font-family: 'Source Sans 3', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* fix herencia KiraEngine */
.content div:after, .page-layout div:after { content: inherit !important; }

/* ─── MAIN CONTENT ─── */
.content {
  max-width: 1020px;
  margin: 28px auto;
  padding: 0 24px;
}

/* ─── MAP + CARDS LAYOUT ─── */
.estadisticas-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 28px;
  align-items: start;
}

.map-panel   { order: 1; }
.cards-panel { order: 2; }

/* ─── MAP PANEL ─── */
.map-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  animation: fadeUp .5s ease both;
}

.map-info-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 16px 16px 0;
  font-size: .8rem;
  line-height: 1.8;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.map-info-box strong { font-size: .88rem; color: var(--navy); display: block; margin-bottom: 4px; }
.map-info-box a { color: var(--blue); text-decoration: none; font-weight: 600; }
.map-info-box a:hover { text-decoration: underline; }

.map-container {
  padding: 30px 16px 16px;
  position: relative;
}

.map-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.map-tab {
  padding: 5px 14px;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  transition: all .2s;
}

.map-tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}


.map-svg { width: 100%; height: auto; display: block; padding-top: 20px; }

/* etiquetas de provincias */
.prov-label {
  font-size: 7px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  fill: #0d2a5c;
  pointer-events: none;
  text-anchor: middle;
  paint-order: stroke fill;
  stroke: rgba(255,255,255,0.92);
  stroke-width: 2.8px;
  stroke-linejoin: round;
}

.province-path {
  fill: rgba(200, 26, 26, 0.06);
  stroke: rgba(255,255,255,0.55);
  stroke-width: 1.1;
  cursor: pointer;
  transition: fill .25s, stroke .25s, stroke-width .25s;
}

.province-path:hover {
  fill: rgba(26, 74, 200, 0.38);
  stroke: rgba(255,255,255,0.95);
  stroke-width: 1.6;
}

.peru-path { fill: var(--map-peru); stroke: #94afc8; stroke-width: .8; cursor: default; }
.peru-path-ll { fill: var(--map-ll); stroke: #1a3560; stroke-width: 1; cursor: pointer; transition: fill .2s; }
.peru-path-ll:hover { fill: var(--navy); }

/* tooltip mapa */
.tooltip {
  position: absolute;
  background: var(--navy);
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: .75rem;
  pointer-events: none;
  display: none;
  z-index: 10;
  white-space: nowrap;
}

/* ─── CARDS PANEL ─── */
.cards-panel { animation: fadeUp .5s ease both; animation-delay: .1s; }

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  position: relative;
}

.stat-card {
  background: var(--blue-btn);
  color: #fff;
  border-radius: 9px;
  padding: 28px 20px;
  text-align: center;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Source Sans 3', sans-serif;
  letter-spacing: .01em;
  box-shadow: 0 3px 10px rgba(37,99,176,.25);
  transition: background .2s, transform .2s, box-shadow .2s;
  cursor: pointer;
}

.stat-card:hover {
  background: var(--blue-btn-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(26,53,96,.35);
  color: white;
}

.stat-card .card-icon { font-size: 1.7rem; opacity: .9; }
.stat-card.wide { grid-column: span 2; }

/* ─── OBJECTIVES GRID ─── */
.objectives-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 36px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
}

.obj-general {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff;
  padding: 28px;
}

.obj-general h3 { font-family: 'Merriweather', serif; font-size: 1.1rem; margin-bottom: 14px; }
.obj-general p  { font-size: .92rem; line-height: 1.7; opacity: .9; }

.obj-specific { background: #eef3fa; padding: 28px; }
.obj-specific h3 { font-family: 'Merriweather', serif; font-size: 1.05rem; color: var(--navy); margin-bottom: 16px; }
.obj-specific ul { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.obj-specific li { font-size: .88rem; line-height: 1.6; color: var(--text); padding-left: 20px; position: relative; }
.obj-specific li::before { content: '▸'; position: absolute; left: 0; color: var(--blue); font-size: .9rem; }

/* ─── CARDS GENÉRICAS ─── */
.publico-title { font-family: 'Merriweather', serif; font-size: 1.2rem; color: var(--navy); margin-bottom: 18px; }

.cards-grid-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 36px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .2s, transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.card:hover { box-shadow: 0 4px 16px rgba(37,99,176,.13); transform: translateY(-2px); }

.card-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}

.card h4 { font-family: 'Merriweather', serif; font-size: .95rem; color: var(--navy); }
.card p  { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }

/* ─── SECTION TITLE / HEADER ─── */
.section-title {
  font-family: 'Merriweather', serif;
  font-size: 1.1rem;
  color: var(--navy);
  padding-bottom: 6px;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  animation: fadeUp .4s ease both;
}

.section-meta { font-size: .8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.section-meta select { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: .8rem; color: var(--text); }

/* ─── KPI GRID ─── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ─── KPI CARD ─── */
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.055);
  transition: transform .2s, box-shadow .2s;
  animation: fadeUp .5s ease both;
}

.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(37,99,176,.14); }

.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.kpi-card.c-grey::before   { background: var(--col-grey); }
.kpi-card.c-orange::before { background: var(--col-orange); }
.kpi-card.c-red::before    { background: var(--col-red); }
.kpi-card.c-blue::before   { background: var(--col-blue); }
.kpi-card.c-green::before  { background: var(--col-green); }

.kpi-card .wm-icon { position: absolute; right: 14px; top: 14px; font-size: 3.2rem; opacity: .07; pointer-events: none; line-height: 1; }

.kpi-label  { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.kpi-name   { font-family: 'Merriweather', serif; font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 10px; line-height: 1.3; }
.kpi-value  { font-size: 2.4rem; font-weight: 700; line-height: 1; margin-bottom: 14px; letter-spacing: -.01em; }

.kpi-value.c-grey   { color: var(--col-grey); }
.kpi-value.c-orange { color: var(--col-orange); }
.kpi-value.c-red    { color: var(--col-red); }
.kpi-value.c-blue   { color: var(--col-blue); }
.kpi-value.c-green  { color: var(--col-green); }

.kpi-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border); font-size: .75rem; color: var(--text-muted); }

.kpi-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #fff; }
.kpi-badge.c-grey   { background: var(--col-grey); }
.kpi-badge.c-orange { background: var(--col-orange); }
.kpi-badge.c-red    { background: var(--col-red); }
.kpi-badge.c-blue   { background: var(--col-blue); }
.kpi-badge.c-green  { background: var(--col-green); }

.kpi-footer-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.kpi-year  { font-weight: 700; color: var(--text-muted); }
.kpi-place { font-size: .68rem; letter-spacing: .05em; color: #94a3b8; text-transform: uppercase; }

.kpi-card:nth-child(1) { animation-delay: .05s; }
.kpi-card:nth-child(2) { animation-delay: .10s; }
.kpi-card:nth-child(3) { animation-delay: .15s; }
.kpi-card:nth-child(4) { animation-delay: .20s; }
.kpi-card:nth-child(5) { animation-delay: .25s; }
.kpi-card:nth-child(6) { animation-delay: .30s; }

/* ─── SIDEBAR (gráficos) ─── */
.sidebar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  animation: fadeUp .4s ease both;
}

.sidebar-header { background: var(--navy); color: #fff; padding: 10px 14px; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

.sidebar-item { padding: 11px 14px; font-size: .88rem; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .15s, color .15s; color: var(--text); font-weight: 500; }
.sidebar-item:last-child { border-bottom: none; }
.sidebar-item:hover { background: #eef3fa; color: var(--navy); }
.sidebar-item.active { background: var(--navy); color: #fff; font-weight: 700; }

/* ─── CHART PANEL ─── */
.chart-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  animation: fadeUp .4s ease both .05s;
}

.chart-title    { font-family: 'Merriweather', serif; font-size: 1rem; color: var(--navy); margin-bottom: 4px; line-height: 1.4; }
.chart-subtitle { font-size: .78rem; color: var(--text-muted); margin-bottom: 20px; }

.chart-wrapper { position: relative; height: 300px; transition: opacity .3s; }
.chart-wrapper.loading { opacity: .4; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.legend-item  { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--text-muted); }
.legend-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.chart-source { margin-top: 14px; font-size: .72rem; color: #94a3b8; line-height: 1.6; }
.chart-source strong { color: var(--text-muted); }

/* ─── PAGE LAYOUT (sidebar + gráfico) ─── */
.page-layout {
  max-width: 1040px;
  margin: 28px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 20px;
  align-items: start;
}

/* ─── ANIMACIÓN ─── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ─── RESPONSIVE ─── */
@media (max-width: 800px) {
  .estadisticas-layout { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .objectives-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .page-layout { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
}
