@page {
  size: A4;
  margin: 1.6cm 1.4cm 1.8cm 1.4cm;

  @bottom-left {
    content: "Sistema de Ranking AtuaCAPES";
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 8pt;
    color: #64748b;
  }

  @bottom-right {
    content: "Página " counter(page) " de " counter(pages);
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 8pt;
    color: #64748b;
  }
}

:root {
  --ink: #0f172a;
  --muted: #475569;
  --accent: #0f3d68;
  --accent-2: #1d4ed8;
  --border: #e2e8f0;
  --bg-soft: #f8fafc;
  --bg-strong: #eef2f7;
  --success: #15803d;
  --danger: #b91c1c;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 10pt;
  line-height: 1.45;
  color: var(--ink);
  background: #ffffff;
}

.documento {
  width: 100%;
}

.force-page-break {
  page-break-before: always !important;
  break-before: page !important;
}

.no-break {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

h1, h2, h3, h4 {
  page-break-after: avoid;
  break-after: avoid;
}

.cover {
  border: 2px solid var(--accent);
  padding: 28px 32px;
  min-height: 23cm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-soft);
}

.cover-header {
  width: 100%;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-collapse: collapse;
}

.cover-header td {
  vertical-align: top;
}

.cover-title {
  font-size: 20pt;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 22px;
}

.cover-subtitle {
  color: var(--muted);
  font-size: 11pt;
  margin-top: 6px;
}

.cover-name {
  font-size: 16pt;
  font-weight: 700;
  margin: 18px 0 8px;
}

.cover-meta {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  border-collapse: collapse;
  font-size: 9.5pt;
  color: var(--muted);
}

.cover-meta td {
  padding: 4px 0;
}

.cover-meta strong {
  color: var(--ink);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--ink);
  font-size: 8.5pt;
  font-weight: 600;
  margin-right: 6px;
}

.badge.success {
  background: #dcfce7;
  color: var(--success);
}

.badge.danger {
  background: #fee2e2;
  color: var(--danger);
}

.section {
  padding: 10px 0 4px;
}

.section-title {
  font-size: 13pt;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.subsection-title {
  font-size: 11pt;
  font-weight: 600;
  color: var(--ink);
  margin: 16px 0 8px;
}

.lead {
  color: var(--muted);
  margin-bottom: 10px;
}

.kpi-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 8px;
  margin-bottom: 4px;
}

.kpi-table td {
  background: var(--bg-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  vertical-align: top;
}

.kpi-label {
  font-size: 8.5pt;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 14pt;
  font-weight: 700;
  color: var(--accent);
}

.kpi-sub {
  font-size: 9pt;
  color: var(--muted);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.data-table thead {
  background: var(--accent);
  color: #ffffff;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-size: 8.5pt;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.data-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.label {
  color: var(--muted);
  font-weight: 600;
  width: 35%;
}

.value {
  color: var(--ink);
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
}

.meta-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.meta-table tr:nth-child(even) {
  background: var(--bg-soft);
}

.tag-list {
  margin-top: 6px;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  margin: 0 6px 6px 0;
  background: var(--bg-strong);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 8.5pt;
}

.note {
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 9pt;
  margin-top: 10px;
}

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.footer {
  margin-top: 18px;
  font-size: 8.5pt;
  color: var(--muted);
}

.small {
  font-size: 8.5pt;
  color: var(--muted);
}

.right {
  text-align: right;
}

.center {
  text-align: center;
}

.cover-stats {
  margin: 24px 0;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stat-cell {
  padding: 16px 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-value {
  font-size: 24pt;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 9pt;
  color: var(--muted);
  margin-top: 4px;
}

.summary-section {
  page-break-before: always;
  padding-top: 20px;
}

.summary-section h2 {
  color: var(--accent);
  font-size: 14pt;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.summary-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.summary-box {
  flex: 1;
  min-width: 200px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 8px;
}

.summary-box h4 {
  font-size: 10pt;
  color: var(--muted);
  margin-bottom: 12px;
}

.team-section {
  margin-top: 24px;
}

.team-section h2 {
  color: var(--accent);
  font-size: 14pt;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.team-member {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  page-break-inside: avoid;
}

.member-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.member-rank {
  background: var(--accent);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11pt;
}

.member-info {
  flex: 1;
}

.member-name {
  font-size: 12pt;
  font-weight: 700;
  color: var(--ink);
}

.member-ies {
  font-size: 9pt;
  color: var(--muted);
}

.member-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.member-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
}

.stat-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9pt;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.stat-label {
  font-weight: 600;
  color: var(--muted);
}

.stat-value-inline {
  font-weight: 700;
  color: var(--accent);
}

.member-motivos {
  background: white;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 9pt;
}

.member-areas {
  font-size: 9pt;
  margin-bottom: 8px;
}

.member-pesquisa {
  font-size: 9pt;
}

.member-pesquisa ul {
  margin-left: 16px;
  margin-top: 4px;
}

.member-pesquisa li {
  margin-bottom: 2px;
}

.footer-section {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.disclaimer {
  font-size: 8pt;
  color: var(--muted);
  font-style: italic;
}

.generation-info {
  font-size: 8pt;
  color: var(--muted);
  margin-top: 8px;
}

.muted {
  color: var(--muted);
}
