/* ==========================================================================
   Relatórios V1 — relatório mensal consolidado. Usa só os tokens e primitivas do design system (.ds-card,
   .ds-status-badge, .ds-progress-*, .ds-action-button); nada de identidade visual própria. Carregado depois de
   design-system.css e antes de mobile-shell.css. Em até 760px as tabelas viram listas de cartões (data-label).
   ========================================================================== */
.reports-page { display: grid; gap: 14px; min-width: 0; }
.reports-page-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }

.reports-competence-select select { min-width: 240px; min-height: 38px; }

.reports-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 20px; padding: 16px 18px; }
.reports-status-copy { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.reports-status-copy h3 { margin: 0; color: var(--ink); font-size: 20px; font-weight: 560; }
.reports-status-copy p { margin: 0; color: var(--text-secondary); font-size: 13.5px; line-height: 1.5; }
.reports-status-copy p strong { color: var(--ink); font-weight: 560; }
.reports-notice.is-error { color: var(--danger, #fb7185); }
.reports-kicker { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.reports-status-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.reports-status-actions .ds-action-button { min-height: 40px; }

.reports-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 10px; border: 1px solid var(--card-border, rgba(148, 163, 184, .3)); border-radius: 999px; font-size: 12px; font-weight: 560; white-space: nowrap; }
.reports-badge.is-generated { border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .1); color: #22c55e; }
.reports-badge.is-pending { border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .1); color: #f59e0b; }
html[data-theme="light"] .reports-badge.is-generated { color: var(--success); }
html[data-theme="light"] .reports-badge.is-pending { color: var(--warning); }

.reports-document { display: grid; gap: 14px; min-width: 0; }
.reports-document-head h3 { margin: 4px 0; color: var(--ink); font-size: 26px; font-weight: 560; }
.reports-document-head p { margin: 0; color: var(--text-secondary); font-size: 13.5px; }

.reports-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.reports-kpi { display: grid; align-content: start; gap: 3px; min-width: 0; padding: 14px 16px; }
.reports-kpi span { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.reports-kpi strong { color: var(--ink); font-size: 26px; font-weight: 560; line-height: 1.15; overflow-wrap: anywhere; }
.reports-kpi small { color: var(--text-secondary); font-size: 12.5px; line-height: 1.35; }

.reports-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.reports-card { display: grid; gap: 12px; min-width: 0; padding: 16px 18px; }
.reports-card .ds-section-head { margin: 0; }
.reports-card-note { margin: 0; color: var(--text-secondary); font-size: 12.5px; line-height: 1.45; }
.reports-empty { margin: 0; padding: 14px 0 4px; color: var(--text-secondary); font-size: 13.5px; }

.reports-table-wrap { min-width: 0; overflow-x: auto; }
.reports-table { width: 100%; border-collapse: collapse; }
.reports-table th,
.reports-table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--card-border, rgba(148, 163, 184, .18)); color: var(--text-secondary); font-size: 13.5px; font-weight: 420; text-align: left; vertical-align: top; }
.reports-table thead th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.reports-table tbody th { min-width: 200px; color: var(--ink); font-size: 13.5px; font-weight: 520; letter-spacing: 0; text-transform: none; }
.reports-table tbody th span { display: block; }
.reports-table tbody tr:last-child th,
.reports-table tbody tr:last-child td { border-bottom: 0; }
.reports-bar { margin-top: 6px; height: 6px; }
.reports-bar.is-large { flex: 1 1 120px; height: 8px; min-width: 100px; margin: 0; }

.reports-split { height: 12px; overflow: hidden; border-radius: 999px; background: rgba(244, 63, 94, .55); }
.reports-split .is-correct { display: block; height: 100%; background: #22c55e; }
.reports-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.reports-facts dt { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.reports-facts dd { margin: 2px 0 0; color: var(--ink); font-size: 22px; font-weight: 560; }
.reports-facts dd.is-good { color: #22c55e; }
.reports-facts dd.is-bad { color: #fb7185; }
html[data-theme="light"] .reports-facts dd.is-good { color: var(--success); }
html[data-theme="light"] .reports-facts dd.is-bad { color: var(--danger); }

.reports-edital-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.reports-edital-total strong { color: var(--ink); font-size: 26px; font-weight: 560; }
.reports-edital-total span { color: var(--text-secondary); font-size: 13px; }

.reports-notes { display: grid; gap: 8px; padding: 14px 18px; }
.reports-notes h4 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 560; }
.reports-notes ul { display: grid; gap: 6px; margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 12.5px; line-height: 1.45; }
.reports-integrity { border-color: rgba(244, 63, 94, .4); }
.reports-integrity strong { color: #fb7185; }
.reports-integrity p { margin: 0; color: var(--text-secondary); font-size: 13.5px; }

.reports-history { display: grid; gap: 10px; padding: 16px 18px; }
.reports-history .ds-section-head { margin: 0; }
.reports-history-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.reports-history-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 12px; border: 1px solid var(--card-border, rgba(148, 163, 184, .18)); border-radius: 10px; }
.reports-history-list li.is-viewing { border-color: rgba(139, 92, 246, .5); background: rgba(139, 92, 246, .07); }
.reports-history-list li div:first-child { display: grid; gap: 2px; min-width: 0; }
.reports-history-list strong { color: var(--ink); font-size: 14px; font-weight: 540; }
.reports-history-list span { color: var(--text-secondary); font-size: 12.5px; }
.reports-history-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reports-history-actions .ds-action-button { min-height: 36px; font-size: 13px; }
.reports-history-actions .ds-action-button:disabled { opacity: .45; cursor: default; }

.reports-empty-state { min-height: 240px; }

@media (max-width: 1100px) {
  .reports-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Celular: mais compacto e com mais elementos por linha. KPIs em 3 colunas; cada linha de tabela vira um cartão com o nome e
   uma barra CURTA na mesma linha (barras de largura total pareciam outra divisão horizontal) e os valores em 3 colunas. */
@media (max-width: 760px) {
  .reports-page,
  .reports-page-body,
  .reports-document,
  .reports-columns { gap: 10px; }
  .reports-competence-select { width: 100%; }
  .reports-competence-select select { width: 100%; min-width: 0; }
  .reports-status { gap: 10px; padding: 12px; }
  .reports-status-copy h3 { font-size: 17px; }
  .reports-status-copy p { font-size: 12px; line-height: 1.4; }
  .reports-status-actions { justify-content: flex-start; width: 100%; gap: 8px; }
  .reports-status-actions .ds-action-button { flex: 1 1 auto; min-height: 36px; font-size: 13px; }
  .reports-badge { min-height: 22px; padding: 2px 8px; font-size: 10.5px; }
  .reports-document-head h3 { margin: 2px 0; font-size: 19px; }
  .reports-document-head p { font-size: 12px; }
  .reports-kicker { font-size: 9.5px; }
  .reports-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .reports-kpi { gap: 1px; padding: 8px 9px; }
  .reports-kpi span { font-size: 9px; letter-spacing: .03em; }
  .reports-kpi strong { font-size: 18px; }
  .reports-kpi small { font-size: 10px; line-height: 1.25; }
  .reports-card { gap: 8px; padding: 12px; }
  .reports-card .ds-card-heading { font-size: 12px; }
  .reports-card-note { font-size: 11.5px; line-height: 1.35; }
  .reports-empty { padding: 6px 0 2px; font-size: 12.5px; }
  .reports-facts { gap: 6px; }
  .reports-facts dt { font-size: 9.5px; }
  .reports-facts dd { font-size: 16px; }
  .reports-split { height: 8px; }
  .reports-edital-total { gap: 4px 8px; }
  .reports-edital-total strong { font-size: 18px; }
  .reports-edital-total span { font-size: 11.5px; }

  .reports-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .reports-table,
  .reports-table tbody,
  .reports-table tr { display: block; }
  .reports-table tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px 8px; padding: 8px 0; border-bottom: 1px solid var(--card-border, rgba(148, 163, 184, .18)); }
  .reports-table tbody tr:last-child { border-bottom: 0; }
  .reports-table tbody th { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; min-width: 0; padding: 0; border: 0; font-size: 13px; }
  .reports-table tbody th span { flex: 1 1 auto; min-width: 0; }
  .reports-table tbody th .reports-bar { flex: 0 0 64px; width: 64px; height: 5px; margin: 0; }
  .reports-table td { display: grid; gap: 0; padding: 0; border: 0; font-size: 12.5px; }
  .reports-table td::before { content: attr(data-label); color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
  .reports-history-list li { padding: 8px 10px; }
  .reports-history-actions { width: 100%; }
  .reports-history-actions .ds-action-button { flex: 1 1 auto; min-height: 32px; font-size: 12px; }
  .reports-notes { padding: 10px 12px; }
  .reports-notes ul { font-size: 11.5px; }
}

@media print {
  .reports-status-actions,
  .reports-history { display: none; }
}
