@page { size: A4; margin: 0; }

.report-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #16213A;
  background: #eef1f6;
  margin: 0;
}

.pdf-page {
  width: 210mm;
  min-height: 297mm;
  margin: 24px auto;
  background: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(11,21,38,0.18);
  padding: 16mm 15mm;
  box-sizing: border-box;
}

.watermark {
  position: absolute; top: 42%; left: 50%;
  transform: translate(-50%, -50%) rotate(-28deg);
  font-size: 68px; font-weight: 800; letter-spacing: 4px;
  color: rgba(224, 87, 76, 0.10);
  pointer-events: none; z-index: 0; white-space: nowrap;
}

.pg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; position: relative; z-index: 1; }
.pg-head .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: #0B1526; }
.pg-head .brand img { height: 16px; width: auto; }
.pg-head .meta { font-size: 10.5px; color: #798398; text-align: right; }

.pg-foot { position: absolute; bottom: 12mm; left: 15mm; right: 15mm; display: flex; justify-content: space-between; font-size: 9.5px; color: #98a1b0; border-top: 1px solid #e4e9f1; padding-top: 8px; }

/* ---- Cover ---- */
.cover {
  background: linear-gradient(160deg, #0B1526 0%, #0098B8 140%);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  padding: 22mm 18mm;
}
.cover .top { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.cover .top img { height: 26px; width: auto; filter: brightness(0) invert(1); }
.cover .tag { display:inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: rgba(255,255,255,0.12); padding: 6px 14px; border-radius: 999px; margin-top: 40px; }
.cover h1 { font-size: 40px; margin: 18px 0 6px; line-height: 1.1; font-weight: 800; }
.cover .subject { font-size: 22px; font-weight: 700; color: #8FD8DE; margin-top: 4px; }
.cover .period { font-size: 13px; color: #c8d3e0; margin-top: 10px; }
.cover .sample-stamp {
  display: inline-block; margin-top: 26px; border: 2px solid #F28B82; color: #F28B82;
  padding: 6px 16px; border-radius: 6px; font-weight: 800; font-size: 12px; letter-spacing: .08em; transform: rotate(-3deg);
}
.cover .bottom { font-size: 11px; color: #9fb0c4; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 16px; }
.cover .bottom b { color: #fff; }

/* ---- Typography ---- */
.section-title { font-size: 22px; font-weight: 800; color: #0B1526; margin-bottom: 4px; position: relative; z-index: 1; }
.section-sub { font-size: 12.5px; color: #5B6472; margin-bottom: 20px; position: relative; z-index: 1; }
.report-body h3 { font-size: 14px; margin: 0 0 10px; color: #0B1526; }
.report-body p { font-size: 12px; line-height: 1.6; color: #37425a; }

/* ---- KPI cards ---- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; position: relative; z-index: 1; }
.kpi-box { border: 1px solid #e4e9f1; border-radius: 10px; padding: 12px 14px; }
.kpi-box .l { font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: #8a93a3; letter-spacing: .04em; }
.kpi-box .v { font-size: 22px; font-weight: 800; color: #0B1526; margin-top: 4px; }
.kpi-box .d { font-size: 10px; font-weight: 700; margin-top: 2px; }
.d.up { color: #0098B8; } .d.down { color: #E0574C; }

/* ---- Findings box ---- */
.findings { background: #E3F7FA; border: 1px solid #cdeaee; border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; position: relative; z-index: 1; }
.findings h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #026F8A; margin: 0 0 8px; }
.findings ul { margin: 0; padding-left: 18px; }
.findings li { font-size: 12px; color: #16213A; margin-bottom: 6px; }

/* ---- Charts ---- */
.chart-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 20px; position: relative; z-index: 1; }
.chart-card { border: 1px solid #e4e9f1; border-radius: 10px; padding: 16px; }

.trend-svg { width: 100%; height: 130px; }
.trend-labels { display: flex; justify-content: space-between; font-size: 9px; color: #8a93a3; margin-top: 4px; }

.donut-lg { width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 14px; }
.donut-legend-pdf { font-size: 11px; }
.donut-legend-pdf li { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.donut-legend-pdf .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---- Topic bars ---- */
.topic-row { margin-bottom: 14px; position: relative; z-index: 1; }
.topic-row .top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.topic-track { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; display: flex; }
.topic-track i { height: 100%; }

/* ---- Register split ---- */
.register-split { display: flex; height: 34px; border-radius: 8px; overflow: hidden; margin-bottom: 18px; position: relative; z-index: 1; }
.register-split .formal { background: #0098B8; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }
.register-split .informal { background: #16213A; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }

.quote-card { border-left: 3px solid #0098B8; background: #f7f9fc; border-radius: 0 8px 8px 0; padding: 10px 14px; margin-bottom: 10px; position: relative; z-index: 1; }
.quote-card.informal { border-left-color: #E0574C; }
.quote-card .q { font-size: 12px; font-style: italic; color: #16213A; }
.quote-card .t { font-size: 10px; font-weight: 700; margin-top: 4px; }
.quote-card .t.neg { color: #E0574C; } .quote-card .t.pos { color: #0098B8; }

.glossary-box { background: #FDF3E2; border: 1px solid #f5dfae; border-radius: 10px; padding: 12px 16px; font-size: 11.5px; color: #7a5a10; position: relative; z-index: 1; }

/* ---- Risk flags ---- */
.risk-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid #e4e9f1; position: relative; z-index: 1; }
.risk-item:first-child { border-top: none; }
.risk-badge { font-size: 9.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; height: fit-content; white-space: nowrap; }
.risk-badge.medium { background: #FDF3E2; color: #ea9f2e; }
.risk-badge.low { background: #E3F7FA; color: #026F8A; }
.risk-badge.high { background: #fbeae8; color: #E0574C; }
.risk-item h5 { font-size: 12.5px; margin: 0 0 3px; }
.risk-item p { font-size: 11px; margin: 0; }

/* ---- Radar leaderboard (matches the live public panel) ---- */
.radar-pdf-total {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #0B1526; color: #fff; border-radius: 999px; padding: 6px 16px;
  font-size: 11px; font-weight: 700; margin-bottom: 6px; position: relative; z-index: 1;
}
.radar-pdf-total .val { color: #00D2FF; font-size: 13px; }
.radar-pdf-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #e4e9f1; border-radius: 8px; padding: 5px 12px; margin-bottom: 4px;
  position: relative; z-index: 1; border-left: 4px solid var(--party-color, #ccc);
}
.radar-pdf-rank { font-size: 11px; font-weight: 800; color: #8a93a3; width: 14px; flex-shrink: 0; }
.radar-pdf-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800;
}
.radar-pdf-info { flex: 1; min-width: 0; }
.radar-pdf-info .n { font-size: 11.5px; font-weight: 700; color: #0B1526; }
.radar-pdf-info .p { font-size: 9px; color: #8a93a3; }
.radar-pdf-pct { text-align: right; flex-shrink: 0; width: 60px; }
.radar-pdf-pct .v { font-size: 12.5px; font-weight: 800; color: #0B1526; }
.radar-pdf-bar { width: 50px; height: 4px; border-radius: 999px; background: #eef1f6; margin-top: 2px; overflow: hidden; }
.radar-pdf-bar span { display: block; height: 100%; background: linear-gradient(90deg, #00D2FF, #0098B8); }
.radar-pdf-legend { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; font-size: 9.5px; color: #5B6472; margin-bottom: 6px; position: relative; z-index: 1; }
.radar-pdf-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: middle; }

/* ---- Influence table ---- */
.inf-table { width: 100%; border-collapse: collapse; font-size: 11.5px; position: relative; z-index: 1; }
.inf-table th { text-align: left; font-size: 9.5px; text-transform: uppercase; color: #8a93a3; padding: 6px 8px; border-bottom: 2px solid #e4e9f1; }
.inf-table td { padding: 8px; border-bottom: 1px solid #eef1f6; }

/* ---- Recommendations ---- */
.rec-card { display: flex; gap: 14px; border: 1px solid #e4e9f1; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; position: relative; z-index: 1; }
.rec-num { width: 26px; height: 26px; border-radius: 50%; background: #0B1526; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.rec-card h5 { font-size: 12.5px; margin: 0 0 4px; }
.rec-card p { font-size: 11.5px; margin: 0; }

/* ---- Methodology ---- */
.method-list { font-size: 11.5px; }
.method-list dt { font-weight: 700; color: #0B1526; margin-top: 10px; }
.method-list dd { margin: 2px 0 0; color: #5B6472; }
.disclaimer-box { background: #16213A; color: #c8d3e0; border-radius: 10px; padding: 14px 18px; font-size: 11px; margin-top: 16px; position: relative; z-index: 1; }
.disclaimer-box b { color: #fff; }

/* ---- Glosario de palabras (positivas/negativas) ---- */
.glosario-chips { display: flex; flex-wrap: wrap; gap: 6px; position: relative; z-index: 1; }
.glosario-chip { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.glosario-chip.pos { background: #0098B8; color: #fff; }
.glosario-chip.neg { background: #E0574C; color: #fff; }

/* ---- Back cover ---- */
.back-cover { background: #0B1526; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.back-cover img { height: 34px; width: auto; margin-bottom: 14px; filter: brightness(0) invert(1); }
.back-cover h2 { font-size: 22px; margin-bottom: 8px; }
.back-cover p { color: #9fb0c4; max-width: 380px; margin: 0 auto 20px; }
.back-cover .contact { font-size: 12px; color: #8FD8DE; }

@media print {
  body { background: #fff; }
  .pdf-page { box-shadow: none; margin: 0; page-break-after: always; }
  .no-print { display: none !important; }
}
