/* ==========================================================================
   Etapa 12D — Estilos de Relatórios, Fechamento e Conferência do Leilão
   Design System: Inter, responsivo (320px+), botões >= 44px, @media print
   ========================================================================== */

.relatorios-container {
  padding: 1.5rem 1rem;
  max-width: 1400px;
  margin: 0 auto;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--cor-texto, #1e293b);
}

/* Cabeçalho */
.relatorios-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--cor-borda, #e2e8f0);
}

.relatorios-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: var(--cor-titulo, #0f172a);
}

.relatorios-subtitulo {
  font-size: 0.875rem;
  color: var(--cor-mutada, #64748b);
}

.relatorios-acoes-topo {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Botões com acessibilidade e alvo >= 44px */
.btn-relatorio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.btn-relatorio-primary {
  background: var(--cor-primaria, #0f766e);
  color: #ffffff;
}

.btn-relatorio-primary:hover {
  background: #115e59;
}

.btn-relatorio-secondary {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-relatorio-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-relatorio-danger {
  background: #b91c1c;
  color: #ffffff;
}

.btn-relatorio-danger:hover {
  background: #991b1b;
}

.btn-relatorio-warning {
  background: #d97706;
  color: #ffffff;
}

.btn-relatorio-warning:hover {
  background: #b45309;
}

/* Indicador de Fila Offline */
.offline-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.offline-banner.offline {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.offline-banner.pendencias {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* Cartões de Indicadores */
.relatorios-metricas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.relatorio-card-metrica {
  background: #ffffff;
  border: 1px solid var(--cor-borda, #e2e8f0);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.relatorio-card-metrica .metrica-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.relatorio-card-metrica .metrica-valor {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.relatorio-card-metrica .metrica-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Navegação por Abas */
.relatorios-tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  min-height: 44px;
  padding: 0 1.25rem;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #0f766e;
}

.tab-btn.active {
  color: #0f766e;
  border-bottom-color: #0f766e;
}

/* Tabelas */
.tabela-responsiva-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 1.5rem;
}

.tabela-relatorio {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.tabela-relatorio th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.tabela-relatorio td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.tabela-relatorio tbody tr:hover {
  background-color: #f8fafc;
}

.tabela-relatorio td.num,
.tabela-relatorio th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Badges de Situação */
.badge-rel {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.badge-rel.vendido { background: #dcfce7; color: #166534; }
.badge-rel.nao_vendido { background: #fee2e2; color: #991b1b; }
.badge-rel.em_negociacao { background: #fef3c7; color: #92400e; }
.badge-rel.retirado { background: #f1f5f9; color: #475569; }
.badge-rel.quitado, .badge-rel.liquidado { background: #dcfce7; color: #166534; }
.badge-rel.parcial { background: #e0f2fe; color: #075985; }
.badge-rel.aberto, .badge-rel.pendente { background: #fef3c7; color: #92400e; }

/* Modal de Conferência e Fechamento */
.modal-fechamento-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-fechamento-card {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
}

.modal-fechamento-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.modal-fechamento-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #0f172a;
}

.lista-alertas-conferencia {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-alerta {
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-alerta.aviso { background: #fee2e2; color: #991b1b; }
.item-alerta.atencao { background: #fef3c7; color: #92400e; }
.item-alerta.sucesso { background: #dcfce7; color: #166534; }

.modal-fechamento-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
}

/* ==========================================================================
   ESTILOS DE IMPRESSÃO (@media print)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt !important;
  }

  .relatorios-acoes-topo,
  .relatorios-tabs,
  .offline-banner,
  .btn-relatorio,
  nav,
  header,
  footer,
  .app-sidebar,
  .app-header {
    display: none !important;
  }

  .relatorios-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .relatorios-header {
    border-bottom: 2px solid #000000 !important;
    margin-bottom: 1rem !important;
  }

  .tabela-relatorio {
    border: 1px solid #000000 !important;
  }

  .tabela-relatorio th,
  .tabela-relatorio td {
    border: 1px solid #cccccc !important;
    padding: 4px 6px !important;
    font-size: 8.5pt !important;
  }

  .tabela-relatorio th {
    background: #f0f0f0 !important;
    color: #000000 !important;
  }

  .badge-rel {
    border: 1px solid #000000 !important;
    color: #000000 !important;
    background: none !important;
  }

  .tabela-responsiva-wrap {
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
  }

  tr {
    page-break-inside: avoid !important;
  }
}
