/* =============================================================
   DIPRENA · Portal CMS — mockup estático
   Paleta extraída del logo oficial DIPRENA Panamá.
   ============================================================= */

:root {
  /* Marca */
  --navy:        #0B2451;
  --navy-deep:   #061735;
  --navy-soft:   #1F3D7A;
  --red:         #D72027;
  --red-soft:    #FAD5D7;
  --blue:        #1D6FE0;
  --blue-light:  #4090C8;
  --blue-pale:   #6AB7E8;
  --blue-bg:     #E6F0FB;

  /* Sistema */
  --bg:          #F7F8FB;
  --bg-soft:     #FAFBFD;
  --white:       #FFFFFF;
  --border:      #E4E8F0;
  --border-soft: #EEF1F6;
  --text:        #0E1A2D;
  --text-mute:   #5C6F87;
  --text-faint:  #8C9BB1;

  /* Estados / tendencias */
  --pos:         #14A76C;
  --pos-bg:      #DFF5EA;
  --warn:        #E0A007;
  --warn-bg:     #FFF3D3;
  --neg:         #D72027;

  /* Tipografía */
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display:'Lora', Georgia, serif;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(11, 36, 81, 0.04);
  --shadow-sm: 0 2px 6px rgba(11, 36, 81, 0.06);
  --shadow-md: 0 6px 24px rgba(11, 36, 81, 0.10);
  --shadow-lg: 0 14px 40px rgba(11, 36, 81, 0.14);
}

/* ─────────────── reset ligero ─────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Reserva el espacio del scrollbar siempre — evita el "salto" lateral cuando
     el contenido dinámico (fetch a la API, render de listas) cambia el alto de
     la página y aparece/desaparece la barra. */
  scrollbar-gutter: stable;
  overflow-y: scroll; /* fallback para navegadores sin soporte de scrollbar-gutter */
}

/* ─────────────── scrollbars finas y sutiles ───────────────
   Firefox: usa scrollbar-width + scrollbar-color (estándar).
   Chrome/Safari: usa los pseudos ::-webkit-scrollbar.
   El thumb queda casi invisible en reposo y se oscurece al hover. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 36, 81, 0.18) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: rgba(11, 36, 81, 0.18);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(11, 36, 81, 0.45);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─────────────── announcement bar ─────────────── */
.announcement,
.announcement-bar {
  background: var(--navy-deep);
  color: var(--white);
  font-size: 13px;
}
.announcement__inner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 24px; max-width: 1240px; margin: 0 auto;
}
/* En páginas internas el `__inner` viene dentro de `.container` (ya con padding
   horizontal) — ajustamos solo el vertical para mantener el mismo alto. */
.announcement-bar .announcement__inner { padding: 10px 0; }
.announcement-bar a { color: var(--white); }
.announcement-bar strong { font-weight: 700; }
/* Fuerza una sola línea con elipsis cuando el texto no entra en el ancho. */
.announcement__inner > p,
.announcement-bar .announcement__inner > p {
  margin: 0;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.announcement__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 14px;
}
.announcement__link {
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}
.announcement__link:hover { color: var(--blue-pale); }

/* ─────────────── header ─────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 100;
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 20px 32px;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; padding: 4px 0; }
.brand__logo { height: 104px; width: auto; }

.primary-nav__list { display: flex; align-items: center; gap: 2px; }
.primary-nav__item { position: relative; }
.primary-nav__btn {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 14px 14px;
  border-radius: 0;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  position: relative;
  transition: color .15s;
}
.primary-nav__btn:hover,
.primary-nav__btn[aria-expanded="true"] {
  color: var(--blue);
}
.primary-nav__item.is-active .primary-nav__btn {
  color: var(--text);
  font-weight: 600;
}
.primary-nav__item.is-active .primary-nav__btn::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 6px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}
.caret {
  font-size: 9px;
  color: var(--text-mute);
  transition: transform .15s;
  margin-left: 2px;
}
.primary-nav__btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

.dropdown {
  position: absolute; top: calc(100% + 0px); left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: 8px;
  display: none;
  z-index: 200;
}
.dropdown a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
.dropdown a:hover { background: var(--bg); color: var(--blue); }
.has-dropdown.is-open .dropdown { display: block; }

.search-btn {
  background: transparent;
  border: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: background .15s, color .15s;
}
.search-btn:hover { background: var(--bg); color: var(--blue); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px;
  cursor: pointer;
  width: 44px; height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: border-color .15s;
}
.nav-toggle:hover { border-color: var(--blue); }
.nav-toggle__bar {
  display: block; width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .15s;
}
/* Animación a X cuando está abierto */
.nav-toggle.is-open .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-open .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle.is-open .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Backdrop semi-transparente detrás del drawer móvil */
.nav-backdrop {
  position: fixed; inset: 0;
  background: rgba(11,36,81,.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
  z-index: 98;
}
.nav-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* ─────────────── hero (claro, con decor de arcos) ─────────────── */
.hero {
  background: var(--white);
  position: relative;
  overflow: hidden;
  padding: 48px 0 80px;
}
.hero__decor {
  position: absolute;
  top: 40px; left: -120px;
  width: 480px; height: 480px;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
  position: relative;
  z-index: 1;
}
.hero__title {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.08;
  margin-bottom: 22px;
  color: var(--text);
}
.hero__title em {
  color: var(--blue);
  font-style: normal;
  display: block;
}
.hero__desc {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-mute);
  max-width: 480px;
  margin-bottom: 28px;
}
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background-color .15s;
  border: 0;
  cursor: pointer;
}
.btn--primary {
  background: var(--blue);
  color: var(--white);
}
.btn--primary:hover {
  background: #155EC7;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(29,111,224,.30);
}
.btn--primary .btn__arrow {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  transition: transform .2s;
}
.btn--primary:hover .btn__arrow { transform: translateX(2px); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn--ghost:hover { background: var(--bg); border-color: var(--blue); color: var(--blue); }

/* Featured card (navy oscuro) */
.hero__featured { position: relative; padding: 0 28px; }
.featured-card {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--r-lg);
  padding: 28px 32px 24px;
  box-shadow: var(--shadow-lg);
}
.featured-card__header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.featured-card__star {
  color: #F8C732;
  font-size: 14px;
}
.featured-card__eyebrow {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.85);
}
.featured-card__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 18px;
}
.featured-card__title small {
  display: block;
  font-size: 17px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  margin-top: 2px;
}
.featured-card__viz {
  height: 240px;
  background: var(--white);
  border-radius: var(--r-md);
  margin-bottom: 18px;
}
.featured-card__cta {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,.28);
  color: var(--white);
  text-decoration: none;
  padding: 14px 18px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
.featured-card__cta:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.6); }
.featured-card__cta-arrow {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.featured-card__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.featured-card__dot {
  width: 8px; height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
  cursor: pointer;
  transition: background .2s ease, width .2s ease, border-radius .2s ease;
}
.featured-card__dot:hover { background: rgba(255,255,255,.55); }
.featured-card__dot.is-active {
  background: var(--white);
  width: 22px;
  border-radius: 4px;
}

.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--white);
  color: var(--blue);
  border: 1px solid var(--border);
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, box-shadow .15s;
  z-index: 2;
  box-shadow: var(--shadow-xs);
}
.carousel-btn:hover { border-color: var(--blue); box-shadow: var(--shadow-sm); }
.carousel-btn--prev { left: -8px; }
.carousel-btn--next { right: -8px; }

/* ─────────────── section heads ─────────────── */
.section { padding: 36px 0; }
.section--alt { background: var(--bg); }

.section__head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px;
  flex-wrap: wrap; gap: 8px;
}
.section__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.section__link {
  font-size: 13px;
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}
.section__link:hover { text-decoration: underline; }

/* Lift: la primera section sobresale del hero como en chile.jpeg */
.section--lift {
  margin-top: -52px;
  position: relative;
  z-index: 2;
  padding-top: 0;
  padding-bottom: 24px;
}

.section__head--block { display: block; }
.section__lead {
  font-size: 14px;
  color: var(--text-mute);
  margin-top: 4px;
}

/* ─────────────── KPI ciclo presupuestario (4 cards con barra) ─────── */
.kpi-grid--4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kpi-ciclo {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s, transform .2s;
  overflow: hidden;
}
.kpi-ciclo:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.kpi-ciclo::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--kpi-color, var(--blue));
}
.kpi-ciclo--azul     { --kpi-color: var(--blue);    --kpi-bg: var(--blue-bg); }
.kpi-ciclo--verde    { --kpi-color: var(--pos);     --kpi-bg: var(--pos-bg); }
.kpi-ciclo--amarillo { --kpi-color: var(--warn);    --kpi-bg: var(--warn-bg); }
.kpi-ciclo--naranja  { --kpi-color: #F08742;        --kpi-bg: #FCE6D5; }

.kpi-ciclo__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.kpi-ciclo__value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.05;
}
.kpi-ciclo__sub {
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 6px;
}
.progress {
  height: 6px;
  background: #ECEFF6;
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  border-radius: 3px;
  background: var(--kpi-color);
  transition: width .6s ease;
}

/* ─────────────── Semáforo de ejecución (strip navy) ─────────────── */
.semaforo-strip {
  background: var(--navy);
  color: rgba(255,255,255,.85);
  padding: 16px 0;
}
.semaforo-strip__inner {
  display: flex; align-items: center; gap: 24px;
  flex-wrap: wrap;
}
.semaforo-strip__label {
  font-size: 13px; font-weight: 600;
  color: var(--white);
}
.semaforo-strip__list {
  display: flex; align-items: center; gap: 22px;
  flex-wrap: wrap;
}
.semaforo-strip__item {
  font-size: 13px;
  color: rgba(255,255,255,.78);
}
.semaforo-strip__date {
  margin-left: auto;
  font-size: 12px;
  color: rgba(255,255,255,.55);
}

/* ─────────────── Accesos Rápidos (5 cards) ─────────────── */
.acceso-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.acceso-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 24px 14px 22px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.acceso-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
  border-color: var(--blue);
}
.acceso-card__icon {
  width: 56px; height: 56px;
  background: var(--blue-bg);
  color: var(--blue);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.acceso-card:hover .acceso-card__icon { background: var(--blue); color: var(--white); }
.acceso-card__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

/* ─────────────── KPI cards (3 con tendencia) ─────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 4px 18px;
  align-items: center;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.kpi-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); border-color: var(--blue-pale); }
.kpi-card__icon {
  grid-row: 1 / 4;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.kpi-card--blue   .kpi-card__icon { background: var(--blue-bg);   color: var(--blue); }
.kpi-card--red    .kpi-card__icon { background: var(--red-soft);  color: var(--red); }
.kpi-card--green  .kpi-card__icon { background: var(--pos-bg);    color: var(--pos); }

.kpi-card__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
  margin-bottom: 2px;
}
.kpi-card__value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.1;
}
.kpi-card__sub {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 2px;
}
.kpi-card__trend {
  font-size: 12px;
  font-weight: 600;
  color: var(--pos);
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 2px;
}
.kpi-card__trend--down { color: var(--neg); }

/* ─────────────── category cards (4 en fila) ─────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.cat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  position: relative;
}
.cat-card:hover {
  border-left-color: var(--blue);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.cat-card__icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  background: var(--blue-bg);
  color: var(--blue);
}
.cat-card--central { border-left-color: var(--blue); }
.cat-card--central .cat-card__icon { background: var(--blue-bg); color: var(--blue); }
.cat-card--locales { border-left-color: var(--red); }
.cat-card--locales .cat-card__icon { background: var(--red-soft); color: var(--red); }
.cat-card--proveedores .cat-card__icon { background: #E6F4EE; color: var(--pos); }
.cat-card--datos .cat-card__icon { background: #EEF1FA; color: var(--navy-soft); }

.cat-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.cat-card__desc {
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.45;
}
.cat-card__arrow {
  margin-left: auto;
  color: var(--text-mute);
  font-size: 18px;
}
.cat-card:hover .cat-card__arrow { color: var(--blue); }

/* ─────────────── panel (treemap section) ─────────────── */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.panel__header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px;
  padding: 24px 28px 8px;
  flex-wrap: wrap;
}
.panel__title-wrap { display: block; }
.panel__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.panel__desc {
  font-size: 13px;
  color: var(--text-mute);
  max-width: 560px;
  line-height: 1.6;
}
.panel__header-actions {
  display: flex; align-items: center; gap: 10px;
}
.panel__detail-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 16px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.panel__detail-btn:hover { border-color: var(--blue); color: var(--blue); }
.panel__detail-btn-arrow {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}

.view-toggle { display: flex; align-items: center; gap: 4px; }
.view-toggle__btn {
  background: var(--white);
  border: 1px solid var(--border);
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  color: var(--text-mute);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: color .15s, border-color .15s, background .15s;
}
.view-toggle__btn:hover { color: var(--blue); border-color: var(--blue); }
.view-toggle__btn.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--white);
}

/* Treemap layout — sidebar + viz */
.treemap-wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  border-top: 1px solid var(--border-soft);
}
.treemap-side {
  padding: 22px 24px;
  border-right: 1px solid var(--border-soft);
}
.treemap-side__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.year-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.year-btn {
  background: var(--white);
  border: 0;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  flex: 1;
  text-align: center;
  border-right: 1px solid var(--border);
  transition: background .15s, color .15s;
}
.year-btn:last-child { border-right: 0; }
.year-btn:hover { background: var(--bg); color: var(--text); }
.year-btn.is-active {
  background: var(--blue);
  color: var(--white);
}
.year-dropdown {
  background: var(--white);
  border: 0;
  width: 32px;
  color: var(--text-mute);
  font-size: 10px;
  border-left: 1px solid var(--border);
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.select {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  padding-right: 36px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%235C6F87' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  margin-bottom: 16px;
  transition: border-color .15s;
}
.select:focus { border-color: var(--blue); outline: 0; }

.total-card {
  background: var(--blue-bg);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  position: relative;
}
.total-card__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.total-card__value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.total-card__icon {
  position: absolute;
  top: 14px; right: 16px;
  color: var(--blue);
}

.treemap-views {
  position: relative;
  width: 100%;
}
.treemap {
  width: 100%;
  height: 480px;
}

/* ─────────── Tabla alternativa (toggle view) ─────────── */
.treemap-table {
  width: 100%;
  max-height: 480px;
  overflow-y: auto;
  font-size: 14px;
}
.treemap-table[hidden] { display: none !important; }
.treemap-table table {
  width: 100%;
  border-collapse: collapse;
}
.treemap-table thead th {
  position: sticky; top: 0;
  background: var(--bg-soft);
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.treemap-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.treemap-table tbody tr:hover td { background: var(--bg-soft); }
.treemap-table .ttbl-rank {
  color: var(--text-faint);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  width: 36px;
}
.treemap-table .ttbl-swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 10px; vertical-align: middle;
}
.treemap-table .ttbl-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.treemap-table .ttbl-pct {
  text-align: right;
  width: 220px;
}
.treemap-table .ttbl-pct-bar {
  display: inline-block;
  width: 140px;
  height: 6px;
  border-radius: 3px;
  background: var(--border-soft);
  vertical-align: middle;
  margin-right: 10px;
  overflow: hidden;
}
.treemap-table .ttbl-pct-bar-fill { display: block; height: 100%; background: var(--navy); }
.treemap-table .ttbl-pct-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.treemap-table .ttbl-empty {
  padding: 32px; text-align: center; color: var(--text-mute);
}

/* ─────────── Pantalla completa del panel del treemap ─────────── */
.panel.is-fullscreen {
  position: fixed; inset: 0; z-index: 9999;
  border-radius: 0;
  margin: 0;
}
.panel.is-fullscreen .treemap { height: calc(100vh - 240px); }
.panel.is-fullscreen .treemap-table { max-height: calc(100vh - 240px); }

.panel__footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-soft);
  font-size: 13px;
  color: var(--text-mute);
  flex-wrap: wrap;
}
.panel__footer-left { display: flex; align-items: center; gap: 8px; }
.panel__footer-right {
  display: flex; gap: 8px; align-items: center;
  font-weight: 500;
  color: var(--text-mute);
}
.download-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.download-link:hover { background: var(--blue-bg); }

/* how to read */
.how-to-read {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 12px;
}
.how-to-read summary {
  padding: 16px 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 10px;
}
.how-to-read summary::-webkit-details-marker { display: none; }
.how-to-read summary::after {
  content: '▾';
  font-size: 10px;
  margin-left: auto;
  color: var(--text-mute);
  transition: transform .2s;
}
.how-to-read[open] summary::after { transform: rotate(180deg); }
.how-to-read__body {
  padding: 0 22px 18px 54px;
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.7;
}
.how-to-read__body p { margin-bottom: 10px; }

/* ─────────────── footer ─────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.78);
  padding: 56px 0 20px;
  font-size: 13px;
  margin-top: 24px;
}
.site-footer__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  gap: 48px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.site-footer__brand-logo {
  height: 78px;
  filter: brightness(0) invert(1);
  opacity: .95;
  margin-bottom: 18px;
}
.site-footer__mission {
  color: rgba(255,255,255,.65);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 18px;
  max-width: 360px;
}
.social-list {
  display: flex; gap: 10px;
}
.social-list a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.social-list a:hover { background: var(--blue); color: var(--white); }

.footer-col__title {
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
}
.footer-col__list a {
  display: block;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  margin-bottom: 8px;
  text-decoration: none;
}
.footer-col__list a:hover { color: var(--white); }

.entity-list {
  display: flex; gap: 14px; flex-wrap: wrap;
}
.entity {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-md);
  padding: 14px 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-width: 150px;
  text-align: center;
}
.entity__emblem {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
}
.entity__name {
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.3;
}
.entity__sub {
  color: rgba(255,255,255,.5);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 600;
}

.site-footer__bottom {
  padding-top: 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: rgba(255,255,255,.55);
  flex-wrap: wrap;
}
.site-footer__bottom .heart { color: var(--red); }

.footer-credit-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid currentColor;
  transition: color .15s, border-color .15s;
}
.footer-credit-link:hover { color: var(--white); border-bottom-color: var(--white); }

/* ─────────────── focus ring (a11y) ─────────────── */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─────────────── responsive ─────────────── */
@media (max-width: 1080px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .acceso-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 980px) {
  /* Announcement bar más compacta en mobile */
  .announcement,
  .announcement-bar { font-size: 11.5px; }
  .announcement__inner { padding: 7px 16px; gap: 8px; }
  .announcement-bar .announcement__inner { padding: 7px 0; }
  .announcement__icon svg { width: 12px; height: 12px; }

  .hero { padding: 32px 0 56px; }
  .hero__grid { grid-template-columns: 1fr; gap: 32px; }
  .hero__title { font-size: 44px; }
  .hero__featured { padding: 0; }
  .hero__decor { width: 320px; height: 320px; opacity: .5; }

  .kpi-grid { grid-template-columns: 1fr; }
  .semaforo-strip__inner { gap: 14px; }
  .semaforo-strip__date  { margin-left: 0; }
  .section--lift { margin-top: -36px; }

  .treemap-wrap { grid-template-columns: 1fr; }
  .treemap-side { border-right: 0; border-bottom: 1px solid var(--border-soft); }

  .site-footer__top { grid-template-columns: 1fr; gap: 32px; }

  /* Header: hamburger visible, logo más compacto */
  .site-header__inner { padding: 16px 20px; gap: 12px; }
  .brand__logo { height: 64px; }

  .primary-nav, .search-btn { display: none; }
  .nav-toggle  { display: inline-flex; }

  /* Drawer lateral desde la derecha — patrón nativo de apps móviles */
  .primary-nav {
    position: fixed;
    top: 0; right: 0;
    width: min(80vw, 320px); height: 100vh; height: 100dvh;
    background: var(--white);
    box-shadow: -8px 0 32px rgba(11,36,81,.18);
    padding: 80px 0 24px;
    transform: translateX(100%);
    transition: transform .25s ease;
    overflow-y: auto;
    z-index: 99;
  }
  .primary-nav.is-open {
    display: block;
    transform: translateX(0);
  }
  .primary-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    margin: 0;
    list-style: none;
  }
  .primary-nav__item { border-bottom: 1px solid var(--border-soft); }
  .primary-nav__btn {
    width: 100%;
    justify-content: flex-start;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 500;
  }
  .primary-nav__item.is-active .primary-nav__btn {
    background: var(--blue-bg);
    color: var(--blue);
    font-weight: 600;
  }
  .primary-nav__item.is-active .primary-nav__btn::after { display: none; }
  .primary-nav .dropdown {
    position: static; box-shadow: none; border: 0; padding: 0 0 8px 24px;
    background: transparent;
  }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .panel__header { flex-direction: column; }
  .panel__header,
  .panel__footer { padding-left: 18px; padding-right: 18px; }
  .panel__title { font-size: 18px; }
  .hero__title { font-size: 36px; }
  .kpi-card__value { font-size: 24px; }
  .treemap { height: 360px; }
  .cat-grid { grid-template-columns: 1fr; }
  .kpi-grid--4 { grid-template-columns: 1fr; }
  .acceso-grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer__bottom { flex-direction: column; align-items: flex-start; }
  .hero__title { font-size: 36px; }
}
