/* ════════════════════════════════════════════════
   MEF Perú — Portal de Transparencia
   Paleta: Capibarismo Navy + Rojo MEF
   Modo: Oscuro (default) / Claro
   ════════════════════════════════════════════════ */

/* ── Reset ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ══════════════════════════════════════════════════
   TOKENS — modo oscuro (default, estilo capibarismo)
══════════════════════════════════════════════════ */
:root {
  /* Capibarismo palette */
  --navy-900:   #0F1729;
  --navy-800:   #151f38;
  --navy-700:   #1c2a4a;
  --navy-600:   #243358;
  --navy-500:   #2e4070;
  --steel:      #3A5073;
  --steel-light:#4e6a93;
  --steel-dim:  rgba(58,80,115,.35);

  /* Acento MEF Perú */
  --red:        #C8102E;
  --red-dark:   #a50d26;
  --red-glow:   rgba(200,16,46,.25);

  /* Colores semánticos */
  --green:      #22c55e;
  --green-dim:  rgba(34,197,94,.15);
  --gold:       #f59e0b;
  --gold-dim:   rgba(245,158,11,.15);
  --blue-acc:   #60a5fa;
  --blue-dim:   rgba(96,165,250,.15);
  --purple-acc: #a78bfa;
  --purple-dim: rgba(167,139,250,.15);
  --orange-acc: #fb923c;
  --orange-dim: rgba(251,146,60,.15);

  /* Sistema de colores del tema */
  --bg:         var(--navy-900);
  --bg-card:    var(--navy-800);
  --bg-raised:  var(--navy-700);
  --bg-hover:   var(--navy-600);
  --border:     var(--steel);
  --border-dim: rgba(58,80,115,.4);
  --text:       #FFFFFF;
  --text-2:     rgba(255,255,255,.75);
  --text-3:     rgba(255,255,255,.45);
  --text-inv:   #0F1729;

  /* Tipografía */
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  22px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.4);
  --shadow:     0 4px 20px rgba(0,0,0,.5);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.6);
  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════════════════
   TOKENS — modo claro
══════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg:         #eef2fb;
  --bg-card:    #ffffff;
  --bg-raised:  #e2eaf6;
  --bg-hover:   #d4e0f2;
  --border:     #a4b9d9;
  --border-dim: rgba(58,80,115,.22);
  --text:       #0F1729;
  --text-2:     #2c3e5c;
  --text-3:     #5d718f;
  --text-inv:   #ffffff;
  --shadow-sm:  0 1px 4px rgba(15,23,41,.10), 0 2px 8px rgba(15,23,41,.07);
  --shadow:     0 4px 20px rgba(15,23,41,.13), 0 1px 4px rgba(15,23,41,.08);
  --shadow-lg:  0 12px 40px rgba(15,23,41,.18);
  --green-dim:  rgba(34,197,94,.14);
  --gold-dim:   rgba(245,158,11,.14);
  --blue-dim:   rgba(58,80,115,.12);
  --purple-dim: rgba(167,139,250,.12);
  --orange-dim: rgba(251,146,60,.12);
  --red-glow:   rgba(200,16,46,.13);
  --steel-dim:  rgba(58,80,115,.14);
}

/* ── Base ─────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  font-size: 16px;
  color-scheme: dark;
}
[data-theme="light"] { color-scheme: light; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--red);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--red-dark); text-decoration: underline; }
a:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 2px; }

img { display: block; max-width: 100%; }

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

/* ══════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-dim);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.header-brand { flex-shrink: 0; }

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-logo:hover { text-decoration: none; }

.logo-escudo { width: 40px; height: 40px; border-radius: 10px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-ministry { font-size: 13px; font-weight: 600; color: var(--text); }
.brand-portal   { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-link--active { color: var(--red); background: var(--red-glow); }
.nav-link--active:hover { background: rgba(200,16,46,.35); }
.nav-link--external { color: var(--text-3); font-size: 13px; }

/* Botón modo claro/oscuro */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dim);
  background: var(--bg-raised);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); border-color: var(--steel); }

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 36px; height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.mobile-menu-btn span {
  display: block; height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: transform var(--transition);
}
.mobile-menu-btn:hover { background: var(--bg-hover); }

/* Franja peruana */
.peru-stripe { display: flex; height: 3px; }
.stripe { flex: 1; }
.stripe--red   { background: var(--red); }
.stripe--white { background: rgba(255,255,255,.15); }
[data-theme="light"] .stripe--white { background: #e5e7eb; }

/* ══════════════════════════════════════════════════
   HERO
══════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, var(--navy-900) 0%, #111e3a 60%, #1a1022 100%);
  color: #fff;
  padding: 80px 0 92px;
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, rgba(15,23,41,.6));
  pointer-events: none;
}
[data-theme="light"] .hero {
  background: linear-gradient(135deg, #0F1729 0%, #1c2a4a 60%, #2e1a3a 100%);
}

.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%233A5073' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(58,80,115,.3);
  border: 1px solid rgba(58,80,115,.5);
  color: #93b4d8;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  color: #fff;
  letter-spacing: -.02em;
}

.hero-subtitle {
  font-size: 17px;
  color: rgba(255,255,255,.7);
  max-width: 520px;
  margin-bottom: 32px;
  line-height: 1.75;
}

/* Hero CTA buttons */
.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(200,16,46,.4);
}
.hero-cta:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200,16,46,.5);
  color: #fff;
  text-decoration: none;
}
.hero-cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.15);
  transition: all var(--transition);
}
.hero-cta-secondary:hover {
  color: #fff;
  border-color: rgba(255,255,255,.35);
  background: rgba(255,255,255,.06);
  text-decoration: none;
}

.hero-stats {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  padding: 20px 24px;
  background: rgba(58,80,115,.15);
  border: 1px solid rgba(58,80,115,.25);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-size: 26px; font-weight: 800; color: #fff; letter-spacing: -.01em; }
.hero-stat span   { font-size: 11px; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; display: block; }
.hero-stat-divider { width: 1px; height: 44px; background: rgba(255,255,255,.12); }

/* Ilustración */
.hero-illustration { display: flex; justify-content: center; align-items: flex-start; padding-top: 8px; }
.illustration-card {
  background: rgba(58,80,115,.15);
  border: 1px solid rgba(58,80,115,.35);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%; max-width: 360px;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.illus-header { display: flex; justify-content: space-between; align-items: center; }
.illus-title { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.8); }
.illus-year  { font-size: 12px; color: rgba(255,255,255,.4); background: rgba(255,255,255,.08); padding: 2px 8px; border-radius: 100px; }
.illus-bars-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  height: 110px; padding-bottom: 20px; position: relative;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.illus-bar {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 4px;
  position: relative;
}
.illus-bar::before {
  content: '';
  display: block; width: 100%;
  height: calc(var(--h) * 1.1);
  background: var(--color);
  border-radius: 4px 4px 0 0;
  min-height: 16px; max-height: 100px;
  opacity: .85;
  transition: opacity .3s, transform .3s;
}
.illus-bar:hover::before { opacity: 1; transform: scaleY(1.04); transform-origin: bottom; }
.illus-bar span { font-size: 10px; color: rgba(255,255,255,.85); font-weight: 700; position: absolute; top: -18px; }
.illus-bar em   { font-size: 9px; color: rgba(255,255,255,.35); font-style: normal; text-align: center; position: absolute; bottom: -18px; white-space: nowrap; }
.illus-ring-row { display: flex; align-items: center; gap: 14px; padding-top: 4px; }
.illus-ring {
  width: 52px; height: 52px; flex-shrink: 0;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.illus-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.illus-ring span {
  position: absolute; font-size: 11px; font-weight: 700;
  color: #fff;
}
.illus-ring-info { display: flex; flex-direction: column; gap: 2px; }
.illus-ring-info strong { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); }
.illus-ring-info em { font-size: 11px; color: rgba(255,255,255,.45); font-style: normal; }

/* ══════════════════════════════════════════════════
   STEPS
══════════════════════════════════════════════════ */
.steps-guide {
  padding: 72px 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-dim);
  border-bottom: 1px solid var(--border-dim);
}

.section-title {
  font-size: 1.85rem; font-weight: 800;
  color: var(--text);
  text-align: center; margin-bottom: 12px;
  letter-spacing: -.01em;
}
.section-subtitle { text-align: center; color: var(--text-2); margin-bottom: 40px; font-size: 16px; }

.steps-list {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 0; list-style: none; margin-top: 40px;
  position: relative;
}
.steps-list::before {
  content: '';
  position: absolute;
  top: 52px; left: calc(50% / 3 + 24px); right: calc(50% / 3 + 24px);
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--steel), var(--red));
  opacity: .3;
  pointer-events: none;
}
.steps-list .step-card { margin: 0 12px; }

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.step-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--steel); }

.step-number {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  width: 28px; height: 28px;
  background: var(--red); color: #fff;
  font-size: 13px; font-weight: 700;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.step-icon { width: 56px; height: 56px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; background: var(--red-glow); border-radius: var(--radius-sm); color: var(--red); }
.step-icon svg { display: block; }
.step-card h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.step-card p  { font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ══════════════════════════════════════════════════
   CONSULTA
══════════════════════════════════════════════════ */
.consulta-section { padding: 32px 0 80px; background: var(--bg); }

/* Filtros */
.filters-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}

.filters-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}

.filters-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 17px; font-weight: 600; color: var(--text);
}

.btn-reset {
  display: flex; align-items: center; gap: 6px;
  background: none;
  border: 1px solid var(--border-dim);
  color: var(--text-2);
  font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font);
  transition: all var(--transition);
}
.btn-reset:hover { background: var(--bg-hover); border-color: var(--steel); color: var(--text); }

.filters-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 20px; margin-bottom: 24px;
}

.filter-group { display: flex; flex-direction: column; gap: 6px; }

.filter-label {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}

.filter-badge { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 100px; letter-spacing: .04em; text-transform: uppercase; }
.filter-badge--required { background: var(--red-glow); color: var(--red); }

.select-wrapper { position: relative; }

.filter-select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border: 1.5px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 14px; font-family: var(--font);
  cursor: pointer; appearance: none; -webkit-appearance: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.filter-select option { background: var(--bg-card); color: var(--text); }
.filter-select:focus {
  outline: none;
  border-color: var(--steel);
  box-shadow: 0 0 0 3px var(--steel-dim);
}
.filter-select:hover { border-color: var(--steel); }

.select-arrow {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--text-3);
}

.filter-hint { font-size: 12px; color: var(--text-3); }

/* Región animada */
#group-region:not([hidden]) { animation: slideDown .25s ease; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.filters-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border-dim);
}

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--red); color: #fff;
  border: none; padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: var(--font);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px var(--red-glow);
}
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(200,16,46,.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.btn-primary.loading {
  pointer-events: none; opacity: .8;
}
.btn-primary.loading::after {
  content: '';
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.filters-source { font-size: 12px; color: var(--text-3); }
.filters-source a { color: var(--text-2); }

/* Estado vacío */
.empty-state {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 48px 24px; text-align: center;
}
.empty-state-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-state-dots { display: flex; gap: 8px; margin-bottom: 4px; }
.empty-state-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
  animation: dot-pulse 1.4s ease-in-out infinite;
}
.empty-state-dots span:nth-child(2) { animation-delay: .2s; }
.empty-state-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot-pulse {
  0%, 80%, 100% { opacity: .3; transform: scale(.85); }
  40%            { opacity: 1;  transform: scale(1); }
}
.empty-state h3 { font-size: 17px; font-weight: 600; color: var(--text-2); }
.empty-state p  { font-size: 14px; color: var(--text-3); max-width: 380px; }

/* ══════════════════════════════════════════════════
   RESULTADOS
══════════════════════════════════════════════════ */
.results-panel { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

.results-summary { margin-bottom: 28px; }
.results-title    { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.results-subtitle { color: var(--text-2); font-size: 14px; }

/* KPI Grid */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 16px; margin-bottom: 28px;
}

.kpi-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow); }
.kpi-card--blue   { border-left-color: var(--blue-acc);   background: linear-gradient(135deg, var(--bg-card), var(--blue-dim)); }
.kpi-card--green  { border-left-color: var(--green);      background: linear-gradient(135deg, var(--bg-card), var(--green-dim)); }
.kpi-card--orange { border-left-color: var(--orange-acc); background: linear-gradient(135deg, var(--bg-card), var(--orange-dim)); }
.kpi-card--purple { border-left-color: var(--purple-acc); background: linear-gradient(135deg, var(--bg-card), var(--purple-dim)); }

.kpi-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { display: block; }
.kpi-icon--blue   { background: var(--blue-dim);   color: var(--blue-acc); }
.kpi-icon--green  { background: var(--green-dim);  color: var(--green); }
.kpi-icon--orange { background: var(--orange-dim); color: var(--orange-acc); }
.kpi-icon--purple { background: var(--purple-dim); color: var(--purple-acc); }
.kpi-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-label   { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.kpi-value   { font-size: 23px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.kpi-note    { font-size: 12px; color: var(--text-3); }

/* Barra de ejecución */
.execution-bar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 24px 28px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.execution-bar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.execution-bar-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.execution-pct-label { font-size: 24px; font-weight: 700; color: var(--green); }

.execution-bar-track {
  height: 18px; background: var(--bg-raised);
  border-radius: 100px; overflow: hidden; margin-bottom: 10px;
}
.execution-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #16a34a, var(--green), #4ade80);
  border-radius: 100px;
  position: relative;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 12px rgba(34,197,94,.3);
}
.execution-bar-legend { display: flex; gap: 20px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend-item::before { content: ''; width: 12px; height: 12px; border-radius: 3px; }
.legend-item--executed::before { background: var(--green); }
.legend-item--pending::before  { background: var(--bg-raised); border: 1px solid var(--border-dim); }

/* Glosario inline */
.glossary-inline {
  background: var(--bg-raised);
  border: 1px solid var(--steel-dim);
  border-radius: var(--radius);
  padding: 24px 28px; margin-bottom: 28px;
}
.glossary-inline-title { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 16px; }
.glossary-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.glossary-term {
  display: inline-block;
  background: var(--steel); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 6px;
}
.glossary-item p { font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* Gráfico */
.chart-section {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 24px 28px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.chart-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.chart-legend { display: flex; gap: 16px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.chart-legend-item::before { content: ''; width: 12px; height: 12px; border-radius: 3px; }
.chart-legend-item--pim::before { background: var(--steel); }
.chart-legend-item--dev::before { background: var(--red); }

.chart-container { overflow-x: auto; }
.chart-bars {
  display: flex; align-items: flex-end; gap: 8px;
  min-height: 260px; padding-bottom: 44px;
  position: relative;
}
.chart-bars::before {
  content: ''; position: absolute;
  bottom: 40px; left: 0; right: 0;
  height: 1px; background: var(--border-dim);
}
.chart-bar-group { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 48px; max-width: 90px; }
.chart-bar-pair  { display: flex; align-items: flex-end; gap: 3px; width: 100%; }
.chart-bar {
  flex: 1; border-radius: 4px 4px 0 0;
  transition: height .6s cubic-bezier(.4,0,.2,1), opacity .2s;
  cursor: pointer; position: relative;
}
.chart-bar--pim { background: var(--steel); opacity: .6; }
.chart-bar--dev { background: var(--red); opacity: .9; }
.chart-bar:hover { opacity: 1; filter: brightness(1.15); }
.chart-bar-label { font-size: 9px; color: var(--text-3); text-align: center; line-height: 1.2; word-break: break-word; max-width: 100%; }
.chart-bar-pct   { font-size: 10px; font-weight: 700; color: var(--text-2); line-height: 1; }
.chart-tooltip {
  position: fixed;
  background: var(--navy-900);
  border: 1px solid var(--steel);
  color: var(--text);
  font-size: 12px; padding: 8px 12px;
  border-radius: var(--radius-sm);
  pointer-events: none; z-index: 200;
  white-space: nowrap; box-shadow: var(--shadow-lg); display: none;
}

/* Aviso datos */
.demo-notice {
  display: flex; align-items: center; gap: 10px;
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 13px;
  color: var(--text-2); margin-bottom: 16px;
}
.demo-notice strong { font-weight: 600; color: var(--gold); }
.demo-notice a { color: var(--gold); }

/* Tabla */
.table-section {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.table-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.table-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }

.btn-export {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--border-dim);
  color: var(--text-2); font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font);
  transition: all var(--transition);
}
.btn-export:hover { background: var(--green-dim); border-color: var(--green); color: var(--green); }

.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead tr { border-bottom: 1px solid var(--border-dim); }
.data-table th {
  padding: 12px 14px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap; background: var(--bg-raised);
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text); }
.data-table th.sortable:hover .sort-icon { color: var(--red); }
.sort-icon { color: var(--border); transition: color var(--transition); }

.data-table tbody tr { border-bottom: 1px solid var(--border-dim); transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table td { padding: 13px 14px; color: var(--text-2); }

.status-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 100px; white-space: nowrap; }
.status-chip--high { background: var(--green-dim);  color: var(--green); }
.status-chip--mid  { background: var(--gold-dim);   color: var(--gold); }
.status-chip--low  { background: var(--red-glow);   color: var(--red); }

.mini-bar-track  { height: 6px; background: var(--bg-raised); border-radius: 100px; width: 100px; overflow: hidden; display: inline-block; vertical-align: middle; margin-left: 8px; }
.mini-bar-fill   { height: 100%; border-radius: 100px; background: var(--green); transition: width .4s ease; }
.mini-bar-fill--mid { background: var(--gold); }
.mini-bar-fill--low { background: var(--red); }

.table-disclaimer { font-size: 11px; color: var(--text-3); margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-dim); font-style: italic; }

/* ══════════════════════════════════════════════════
   GLOSARIO
══════════════════════════════════════════════════ */
.glosario-section { background: var(--bg-card); padding: 80px 0; border-top: 1px solid var(--border-dim); border-bottom: 1px solid var(--border-dim); }

.glosario-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-top: 40px; }

.glosario-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius); padding: 24px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.glosario-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--steel); }

.glosario-acronym { display: inline-block; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .08em; padding: 3px 10px; border-radius: 4px; margin-bottom: 10px; }
.glosario-card h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.glosario-card p  { font-size: 13px; color: var(--text-2); line-height: 1.6; }

/* ══════════════════════════════════════════════════
   FAQ
══════════════════════════════════════════════════ */
.ayuda-section { padding: 72px 0; background: var(--bg); }

.faq-list { margin-top: 40px; display: flex; flex-direction: column; gap: 12px; max-width: 800px; margin-left: auto; margin-right: auto; }

.faq-item { background: var(--bg-card); border: 1px solid var(--border-dim); border-radius: var(--radius); overflow: hidden; transition: box-shadow var(--transition), border-color var(--transition); }
.faq-item[open] { box-shadow: var(--shadow); border-color: var(--steel); }
.faq-item[open] .faq-question { background: var(--bg-raised); }

.faq-question {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; cursor: pointer;
  font-weight: 600; font-size: 15px; color: var(--text);
  list-style: none; transition: background var(--transition); user-select: none;
}
.faq-question:hover { background: var(--bg-hover); }
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after { content: '+'; font-size: 22px; font-weight: 300; color: var(--red); transition: transform var(--transition); flex-shrink: 0; margin-left: 16px; }
.faq-item[open] .faq-question::after { content: '−'; }

.faq-answer { padding: 16px 22px 18px; font-size: 14px; color: var(--text-2); line-height: 1.7; border-top: 1px solid var(--border-dim); }
.faq-answer a { color: var(--red); text-decoration: underline; }

/* ══════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════ */
.site-footer { background: var(--navy-900); border-top: 1px solid var(--border-dim); color: var(--text-2); }
[data-theme="light"] .site-footer { background: #0f1729; color: rgba(255,255,255,.65); }

.footer-inner {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px; padding: 56px 24px 40px;
}

.footer-logo { font-size: 28px; font-weight: 800; color: var(--red); letter-spacing: .05em; margin-bottom: 12px; }
.footer-brand p { font-size: 13px; margin-bottom: 6px; color: rgba(255,255,255,.6); }
.footer-disclaimer { font-size: 12px; color: rgba(255,255,255,.35); line-height: 1.6; margin-top: 12px; }

/* MoqueguaSoft credit */
.footer-moqueguasoft {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,.45);
}
.footer-moqueguasoft a { text-decoration: none; }
.footer-moqueguasoft-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(58,80,115,.2);
  border: 1px solid rgba(58,80,115,.4);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  color: var(--steel-light);
  transition: all var(--transition);
}
.footer-moqueguasoft-badge:hover {
  background: rgba(58,80,115,.4);
  border-color: var(--steel);
  color: #fff;
  text-decoration: none;
}

/* Redes sociales */
.social-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.social-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.5);
  font-size: 13px;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  border: 1px solid transparent;
}
.social-link:hover {
  background: rgba(58,80,115,.2);
  border-color: rgba(58,80,115,.3);
  color: rgba(255,255,255,.9);
  text-decoration: none;
}
.social-link svg { flex-shrink: 0; }

/* Botón flotante WhatsApp */
.whatsapp-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  width: 56px;
  height: 56px;
  background: #25D366;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,.4);
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.whatsapp-float:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 28px rgba(37,211,102,.55);
  color: #fff;
  text-decoration: none;
}
.whatsapp-float svg { display: block; }
.whatsapp-tooltip {
  position: absolute;
  right: 64px;
  background: var(--navy-800);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  border: 1px solid var(--border-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  box-shadow: var(--shadow);
}
.whatsapp-float:hover .whatsapp-tooltip { opacity: 1; }

.footer-links h4 { color: rgba(255,255,255,.85); font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.footer-links ul  { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-links a   { font-size: 13px; color: rgba(255,255,255,.5); transition: color var(--transition); }
.footer-links a:hover { color: rgba(255,255,255,.9); }

.footer-bottom { border-top: 1px solid rgba(255,255,255,.06); padding: 16px 0; }
.footer-bottom .container { display: flex; align-items: center; justify-content: space-between; }
.footer-bottom p { font-size: 12px; color: rgba(255,255,255,.3); }

.peru-flag-small { display: flex; width: 36px; height: 24px; border-radius: 2px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); }
.peru-flag-small div { flex: 1; }
.peru-flag-small div:nth-child(1),
.peru-flag-small div:nth-child(3) { background: var(--red); }
.peru-flag-small div:nth-child(2) { background: #fff; }

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .filters-grid { grid-template-columns: repeat(2,1fr); }
  .kpi-grid     { grid-template-columns: repeat(2,1fr); }
  .glossary-grid{ grid-template-columns: repeat(2,1fr); }
  .glosario-grid{ grid-template-columns: repeat(2,1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .hero-inner    { grid-template-columns: 1fr; }
  .hero-illustration { display: none; }
  .hero          { padding: 48px 0; }
  .hero::after   { display: none; }
  .hero-title    { font-size: 1.9rem; }
  .hero-actions  { flex-direction: column; align-items: flex-start; }
  .steps-list    { grid-template-columns: 1fr; gap: 20px; }
  .steps-list::before { display: none; }
  .steps-list .step-card { margin: 0; }
  .filters-grid  { grid-template-columns: 1fr; }
  .kpi-grid      { grid-template-columns: 1fr 1fr; }
  .glossary-grid { grid-template-columns: 1fr 1fr; }
  .glossary-inline { display: none; }
  .glosario-grid { grid-template-columns: 1fr; }
  .footer-inner  { grid-template-columns: 1fr; gap: 28px; }
  .header-nav    { display: none; }
  .header-nav.nav--open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 12px 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    z-index: 999;
    border-bottom: 1px solid var(--border-dim);
    gap: 2px;
  }
  .mobile-menu-btn { display: flex; }
  .filters-panel { padding: 20px; }
  .hero-stats    { gap: 16px; padding: 16px; }
  .chart-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-bars { min-width: 360px; }
}
@media (max-width: 480px) {
  .kpi-grid   { grid-template-columns: 1fr; }
  .glossary-grid { grid-template-columns: 1fr; }
  .hero-stat-divider { display: none; }
  .filters-footer { flex-direction: column; align-items: stretch; }
  .btn-primary { justify-content: center; }
  .whatsapp-float { bottom: 16px; right: 16px; width: 50px; height: 50px; }
  .table-header { flex-direction: column; align-items: stretch; }
  .table-header-left { flex-direction: column; gap: 8px; }
  .table-header-right { flex-wrap: wrap; gap: 6px; }
  .table-search-wrap { width: 100%; }
  .table-search { width: 100% !important; }
  .table-search:focus { width: 100% !important; }
}

/* ══════════════════════════════════════════════════
   LIGHT MODE — overrides de componentes específicos
══════════════════════════════════════════════════ */
[data-theme="light"] .filters-panel {
  border-color: var(--border);
  box-shadow: 0 2px 12px rgba(15,23,41,.10), 0 1px 3px rgba(15,23,41,.08);
}
[data-theme="light"] .filter-select {
  background: #fff;
  border-color: #c4d3e8;
}
[data-theme="light"] .filter-select:focus {
  border-color: #3A5073;
  box-shadow: 0 0 0 3px rgba(58,80,115,.15);
}
[data-theme="light"] .step-card {
  border-color: #c4d3e8;
  box-shadow: 0 2px 8px rgba(15,23,41,.10);
}
[data-theme="light"] .step-card:hover {
  box-shadow: 0 6px 24px rgba(15,23,41,.15);
  border-color: #3A5073;
}
[data-theme="light"] .kpi-card {
  border-color: #c4d3e8;
  box-shadow: 0 2px 8px rgba(15,23,41,.09);
}
[data-theme="light"] .kpi-card--blue   { background: linear-gradient(135deg, #fff, rgba(58,80,115,.08)); }
[data-theme="light"] .kpi-card--green  { background: linear-gradient(135deg, #fff, rgba(34,197,94,.09)); }
[data-theme="light"] .kpi-card--orange { background: linear-gradient(135deg, #fff, rgba(251,146,60,.09)); }
[data-theme="light"] .kpi-card--purple { background: linear-gradient(135deg, #fff, rgba(167,139,250,.09)); }
[data-theme="light"] .glosario-card {
  background: #fff;
  border-color: #c4d3e8;
  box-shadow: 0 2px 8px rgba(15,23,41,.08);
}
[data-theme="light"] .glosario-card:hover {
  box-shadow: 0 6px 20px rgba(15,23,41,.14);
}
[data-theme="light"] .faq-item {
  border-color: #c4d3e8;
  box-shadow: 0 1px 4px rgba(15,23,41,.07);
}
[data-theme="light"] .faq-item[open] { border-color: #3A5073; }
[data-theme="light"] .header-nav.nav--open {
  background: #fff;
  border-bottom-color: #c4d3e8;
  box-shadow: 0 8px 24px rgba(15,23,41,.14);
}
[data-theme="light"] .chart-section,
[data-theme="light"] .table-section,
[data-theme="light"] .execution-bar-section {
  border-color: #c4d3e8;
  box-shadow: 0 2px 8px rgba(15,23,41,.09);
}
[data-theme="light"] .empty-state {
  border-color: #c4d3e8;
  background: #fff;
}
[data-theme="light"] .glossary-inline {
  background: #e8f0fb;
  border-color: #b8cce4;
}
[data-theme="light"] .glossary-term {
  background: #2c3e5c;
}
[data-theme="light"] .chart-tooltip {
  background: #fff;
  border-color: #a4b9d9;
  color: #0F1729;
  box-shadow: 0 4px 16px rgba(15,23,41,.15);
}
[data-theme="light"] .execution-bar-track {
  background: #dce8f5;
}
[data-theme="light"] .legend-item--pending::before {
  background: #dce8f5;
  border-color: #a4b9d9;
}
[data-theme="light"] .steps-guide {
  background: #f4f8ff;
  border-color: #c4d3e8;
}
[data-theme="light"] .whatsapp-tooltip {
  background: #fff;
  color: #0F1729;
  border-color: #c4d3e8;
}

/* ══════════════════════════════════════════════════
   CHATBOT
══════════════════════════════════════════════════ */

/* FAB */
.chat-fab {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 200;
  width: 56px; height: 56px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--red-glow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.chat-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 28px rgba(200,16,46,.5);
}
.chat-fab-tooltip {
  position: absolute;
  left: 64px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 12px; font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  border: 1px solid var(--border-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  box-shadow: var(--shadow);
}
.chat-fab:hover .chat-fab-tooltip { opacity: 1; }

/* Panel */
.chat-panel {
  position: fixed;
  bottom: 96px;
  left: 28px;
  z-index: 199;
  width: 340px;
  max-height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideUp .2s ease;
}
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--red);
  color: #fff;
  flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
  width: 34px; height: 34px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-header-info strong { display: block; font-size: 14px; font-weight: 600; }
.chat-header-info span   { display: block; font-size: 11px; opacity: .75; }
.chat-close {
  background: rgba(255,255,255,.15);
  border: none; color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}
.chat-close:hover { background: rgba(255,255,255,.3); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-dim); border-radius: 4px; }

.chat-msg {
  max-width: 85%;
  animation: chatMsgIn .2s ease;
}
@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 12px;
}
.chat-msg--bot { align-self: flex-start; }
.chat-msg--bot p {
  background: var(--bg-raised);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-dim);
}
.chat-msg--user { align-self: flex-end; }
.chat-msg--user p {
  background: var(--red);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg--typing p {
  letter-spacing: .15em;
  opacity: .65;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-dim);
  background: var(--bg-card);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--red); }
.chat-input::placeholder { color: var(--text-3); }
.chat-send {
  width: 36px; height: 36px;
  background: var(--red); color: #fff;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}
.chat-send:hover { background: var(--red-dark); }

[data-theme="light"] .chat-msg--bot p {
  background: #eef4ff;
  border-color: #c4d3e8;
}
[data-theme="light"] .chat-input {
  background: #fff;
  border-color: #c4d3e8;
}
[data-theme="light"] .chat-fab-tooltip {
  background: #fff;
  border-color: #c4d3e8;
}

/* ── Suggestion chips ─────────────────────────────── */
.chat-sugs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 0 2px;
}
.chat-sug-btn {
  background: rgba(96,165,250,.12);
  border: 1px solid rgba(96,165,250,.35);
  border-radius: 20px;
  color: var(--blue-acc);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.3;
  padding: 5px 11px;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-sug-btn:hover {
  background: rgba(96,165,250,.25);
  border-color: var(--blue-acc);
}
[data-theme="light"] .chat-sug-btn {
  background: #e8f0ff;
  border-color: #a0b8e8;
  color: #1a4a9f;
}
[data-theme="light"] .chat-sug-btn:hover {
  background: #d0e0ff;
  border-color: #1a4a9f;
}

@media (max-width: 480px) {
  .chat-fab  { bottom: 16px; left: 16px; width: 50px; height: 50px; }
  .chat-panel { left: 12px; right: 12px; width: auto; bottom: 80px; max-height: 420px; }
  .chat-fab-tooltip { display: none; }
}

/* ══════════════════════════════════════════════════
   MEJORAS: SKELETON · ERROR BANNER · BÚSQUEDA · TENDENCIA
            PRINT · COMPARACIÓN · DRILL-DOWN · TIMESTAMP
══════════════════════════════════════════════════ */

/* ── Skeleton loaders ────────────────────────────── */
@keyframes skelPulse {
  0%, 100% { opacity: .4; }
  50%       { opacity: .9; }
}
.skeleton-row td { padding: 10px 14px; }
.skel {
  display: inline-block;
  background: var(--bg-hover);
  border-radius: 6px;
  animation: skelPulse 1.4s ease-in-out infinite;
}
.skel--name  { width: 120px; height: 14px; }
.skel--num   { width: 80px;  height: 14px; }
.skel--bar   { width: 100%;  height: 12px; }
.skel--chip  { width: 72px;  height: 22px; border-radius: 20px; }
.skel-pulse  { animation: skelPulse 1.4s ease-in-out infinite; opacity: .4; }

/* ── Banner de error API ─────────────────────────── */
.api-error-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: rgba(200,16,46,.08);
  border: 1px solid rgba(200,16,46,.25);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}
.api-error-banner svg { color: var(--red); flex-shrink: 0; margin-top: 1px; }
.api-error-banner span { flex: 1; }
.api-error-close {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 14px; padding: 0 4px; flex-shrink: 0;
  line-height: 1;
}
.api-error-close:hover { color: var(--text); }
[data-theme="light"] .api-error-banner {
  background: rgba(200,16,46,.06);
  border-color: rgba(200,16,46,.2);
  color: #2c3e5c;
}

/* ── Búsqueda en tabla ───────────────────────────── */
.table-header { flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.table-header-left {
  display: flex; flex-direction: column; gap: 8px;
}
.table-header-right {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.table-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.table-search-icon {
  position: absolute; left: 10px; color: var(--text-3); pointer-events: none;
}
.table-search {
  padding: 7px 10px 7px 30px;
  border: 1.5px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  width: 200px;
  transition: border-color var(--transition), width var(--transition);
}
.table-search:focus { border-color: var(--red); width: 240px; }
.table-search::placeholder { color: var(--text-3); }
[data-theme="light"] .table-search {
  background: #fff; border-color: #c4d3e8; color: #0F1729;
}

/* ── Botón imprimir ──────────────────────────────── */
.btn-print {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  background: transparent;
  border: 1.5px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; white-space: nowrap;
  transition: all var(--transition);
}
.btn-print:hover {
  border-color: var(--steel-light);
  background: var(--bg-raised);
  color: var(--text);
}
[data-theme="light"] .btn-print { color: #2c3e5c; border-color: #a4b9d9; }
[data-theme="light"] .btn-print:hover { background: #eef4ff; }

/* ── Tendencia histórica ─────────────────────────── */
.trend-section {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 20px;
  animation: fadeIn .25s ease;
}
.trend-chart-container { width: 100%; overflow-x: auto; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-loading, .trend-empty {
  color: var(--text-3); font-size: 13px; text-align: center;
  padding: 32px 0;
}
.trend-delta-badge {
  font-size: 12px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.trend-delta--up   { background: var(--green-dim); color: var(--green); }
.trend-delta--down { background: rgba(200,16,46,.1); color: var(--red); }
.trend-legend {
  display: flex; gap: 20px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border-dim);
}
.trend-ref { font-size: 11px; color: var(--text-3); }
.trend-ref--good { color: rgba(34,197,94,.7); }
.trend-ref--mid  { color: rgba(245,158,11,.7); }
[data-theme="light"] .trend-section {
  background: #fff; border-color: #c4d3e8;
}
[data-theme="light"] .trend-loading,
[data-theme="light"] .trend-empty { color: #5a7499; }

/* ── Botón tendencia ─────────────────────────────── */
.chart-header-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn-trend {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1.5px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12px; font-weight: 500; font-family: var(--font);
  cursor: pointer; white-space: nowrap;
  transition: all var(--transition);
}
.btn-trend:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-glow);
}
.btn-trend--active {
  border-color: var(--red);
  background: rgba(200,16,46,.08);
  color: var(--red);
}
[data-theme="light"] .btn-trend { color: #2c3e5c; border-color: #a4b9d9; }
[data-theme="light"] .btn-trend:hover,
[data-theme="light"] .btn-trend--active { border-color: #C8102E; color: #C8102E; background: rgba(200,16,46,.06); }

/* ── Responsive: tabla en móvil con comparación ──── */
@media (max-width: 640px) {
  .th-compare, td:has(.cmp-val) { display: none; }
  .table-search { width: 140px; }
  .table-search:focus { width: 160px; }
  .table-header-right { gap: 6px; }
  .btn-print span { display: none; }
  .results-summary-top { flex-direction: column; align-items: flex-start; }
  .btn-compare { font-size: 12px; padding: 7px 12px; }
  .row-detail-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .table-wrapper { font-size: 12px; }
  .btn-print { padding: 7px 10px; }
}

/* ── Print ───────────────────────────────────────── */
@media print {
  .site-header, .hero, .steps-guide, .filters-panel,
  .glosario-section, .ayuda-section, .site-footer,
  .chat-fab, .chat-panel, .whatsapp-float,
  .btn-export, .btn-compare, .btn-trend, .btn-print,
  .table-search-wrap, .table-search-icon,
  #btn-reset, .api-error-banner, .trend-section,
  .execution-bar-legend, .chart-section,
  .glossary-inline, .demo-notice, .table-disclaimer,
  .update-badge { display: none !important; }

  * { color: #000 !important; background: #fff !important; box-shadow: none !important; }
  body { font-size: 11pt; }

  .results-panel { display: block !important; }
  .kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .kpi-card { border: 1px solid #ccc; border-radius: 6px; padding: 10px; }
  .kpi-value { font-size: 14pt; font-weight: 700; }
  .kpi-label { font-size: 8pt; }
  .execution-bar-section { margin: 16px 0; }
  .execution-bar-track { border: 1px solid #ccc; }
  .execution-bar-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  .data-table { font-size: 9pt; border-collapse: collapse; width: 100%; }
  .data-table th, .data-table td { border: 1px solid #ddd; padding: 5px 8px; }
  .data-table thead { background: #f0f0f0 !important; }
  .sort-icon { display: none; }
  .mini-bar-track, .mini-bar-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .row-detail { display: none; }

  .results-title::after {
    content: ' — MEF Perú · Transparencia Presupuestal';
    font-size: 12pt; color: #666;
  }

  @page { margin: 1.5cm; }
}

/* ── Layout cabecera resultados ───────────────────── */
.results-summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Botón comparar ──────────────────────────────── */
.btn-compare {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: transparent;
  border: 1.5px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-compare:hover {
  border-color: var(--blue-acc);
  color: var(--blue-acc);
  background: var(--blue-dim);
}
.btn-compare--active {
  border-color: var(--blue-acc);
  background: var(--blue-dim);
  color: var(--blue-acc);
}
.btn-compare:disabled { opacity: .5; cursor: not-allowed; }
.btn-compare-spinner {
  width: 13px; height: 13px;
  border: 2px solid rgba(96,165,250,.3);
  border-top-color: var(--blue-acc);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
[data-theme="light"] .btn-compare {
  color: #2c3e5c;
  border-color: #a4b9d9;
}
[data-theme="light"] .btn-compare:hover,
[data-theme="light"] .btn-compare--active {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59,130,246,.08);
}

/* ── Badge última actualización ──────────────────── */
.update-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 12px;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,.25);
  border-radius: 20px;
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
}
[data-theme="light"] .update-badge {
  background: rgba(34,197,94,.1);
  color: #16a34a;
  border-color: rgba(34,197,94,.3);
}

/* ── Comparación: columna y barras ───────────────── */
.th-compare {
  color: var(--blue-acc);
  font-weight: 600;
  font-size: 12px;
}
.th-compare-note {
  display: block;
  font-size: 10px;
  font-weight: 400;
  opacity: .65;
}
.cmp-val { display: block; font-size: 13px; }
.cmp-delta {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}
.cmp-up   { color: var(--green); }
.cmp-down { color: var(--red); }
.cmp-na   { opacity: .4; }

.chart-bar--cmp {
  background: linear-gradient(to top, var(--blue-acc), rgba(96,165,250,.6));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  flex-shrink: 0;
  width: 8px;
  align-self: flex-end;
  transition: height .5s cubic-bezier(.4,0,.2,1);
}
.chart-legend-item--cmp {
  background: var(--blue-acc);
}

/* ── Drill-down: fila expandible ─────────────────── */
.data-row {
  cursor: pointer;
  transition: background var(--transition);
}
.data-row:hover { background: var(--bg-hover); }
.data-row[aria-expanded="true"] { background: var(--bg-hover); }
.data-row[aria-expanded="true"] td:first-child strong { color: var(--blue-acc); }

.row-expand-icon {
  display: inline-block;
  font-size: 9px;
  margin-right: 7px;
  color: var(--text-3);
  transition: transform var(--transition);
  vertical-align: middle;
}
[data-theme="light"] .data-row:hover { background: #e8f0fa; }
[data-theme="light"] .data-row[aria-expanded="true"] { background: #e8f0fa; }

.row-detail td {
  padding: 0 !important;
  background: var(--bg-raised);
  border-bottom: 2px solid var(--blue-acc) !important;
}
.row-detail-inner {
  padding: 14px 18px;
  animation: fadeIn .2s ease;
}
.row-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 20px;
}
.row-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 500;
}
.detail-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}
[data-theme="light"] .row-detail td { background: #f0f6ff; }
[data-theme="light"] .detail-label  { color: #5a7499; }
[data-theme="light"] .detail-value  { color: #0F1729; }

/* ── Accesibilidad ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.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; }
