/* ==============================================================================
   FORNO & BRASA - CENTRAL DE RELATÓRIOS & BI OMNICHANNEL
   Estilos Executivos, Tabelas Analíticas, KPIs & Otimização de Impressão (A4)
   ============================================================================== */

:root {
  --rep-bg-dark: #070a10;
  --rep-bg-card: #0e1422;
  --rep-bg-card-hover: #141c30;
  --rep-border: rgba(255, 255, 255, 0.08);
  --rep-border-focus: rgba(56, 189, 248, 0.4);
  --rep-text-main: #f8fafc;
  --rep-text-muted: #94a3b8;
  --rep-accent-cyan: #38bdf8;
  --rep-accent-green: #10b981;
  --rep-accent-amber: #f59e0b;
  --rep-accent-purple: #a855f7;
  --rep-accent-rose: #f43f5e;
}

body.dark-theme {
  background-color: var(--rep-bg-dark);
  color: var(--rep-text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
}

.relatorios-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

/* ==============================================================================
   BOTÕES DO TOP HEADER & DESIGN SYSTEM HUB (RELATÓRIOS)
   ============================================================================== */
.hub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none !important;
  line-height: 1.2;
  white-space: nowrap;
  font-family: inherit;
  box-sizing: border-box;
}

.hub-btn svg {
  flex-shrink: 0;
}

.hub-btn-back {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--rep-text-muted);
}
.hub-btn-back:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(-2px);
}

.hub-btn-secondary {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}
.hub-btn-secondary:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: translateY(-1px);
}

.hub-btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.hub-btn-primary:hover {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
  transform: translateY(-1px);
  color: #fff;
}

.hub-btn-export {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.hub-btn-export:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.5);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
}

.rep-btn-refresh {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  padding: 6px 14px;
}
.rep-btn-refresh:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.45);
  color: #fff;
  transform: translateY(-1px);
}

/* ==============================================================================
   FILTROS E TOOLBAR DE PERÍODO
   ============================================================================== */
.rep-toolbar-card {
  background: var(--rep-bg-card);
  border: 1px solid var(--rep-border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.rep-period-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--rep-border);
  overflow-x: auto;
}

.rep-pill-btn {
  background: transparent;
  border: none;
  color: var(--rep-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.rep-pill-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.rep-pill-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.rep-custom-date-box {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--rep-border);
}

.rep-custom-date-box.visible {
  display: flex;
}

.rep-date-input {
  background: #111827;
  border: 1px solid var(--rep-border);
  color: #fff;
  font-size: 0.8rem;
  padding: 5px 8px;
  border-radius: 6px;
  outline: none;
  color-scheme: dark;
}

.rep-date-input:focus {
  border-color: var(--rep-accent-cyan);
}

.rep-channel-select {
  background: #111827;
  border: 1px solid var(--rep-border);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
}

.rep-channel-select:focus {
  border-color: var(--rep-accent-cyan);
}

.rep-quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ==============================================================================
   KPI GRID SUPERIOR
   ============================================================================== */
.rep-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.rep-kpi-card {
  background: var(--rep-bg-card);
  border: 1px solid var(--rep-border);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.rep-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.rep-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--card-accent, var(--rep-accent-cyan));
  border-radius: 4px 0 0 4px;
}

.rep-kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  color: var(--card-accent, var(--rep-accent-cyan));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rep-kpi-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rep-kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--rep-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.rep-kpi-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.rep-kpi-sub {
  font-size: 0.72rem;
  color: var(--rep-text-muted);
  margin-top: 3px;
}

/* ==============================================================================
   NAVEGAÇÃO POR ABAS DO RELATÓRIO
   ============================================================================== */
.rep-tabs-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--rep-border);
  margin-bottom: 1.5rem;
  padding: 0 0 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.25) transparent;
  -webkit-overflow-scrolling: touch;
}

.rep-tabs-nav::-webkit-scrollbar {
  height: 4px;
}
.rep-tabs-nav::-webkit-scrollbar-track {
  background: transparent;
}
.rep-tabs-nav::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.25);
  border-radius: 4px;
}

.rep-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--rep-text-muted);
  font-size: 0.80rem;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}

.rep-tab-btn svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.rep-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.rep-tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.3), rgba(3, 105, 161, 0.18));
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.25);
}

.rep-tab-btn.active svg {
  opacity: 1;
  stroke: var(--rep-accent-cyan);
}

/* Painel de Conteúdo de Abas */
.rep-tab-panel {
  display: none;
  animation: fadeInRep 0.25s ease-out;
}

.rep-tab-panel.active {
  display: block;
}

@keyframes fadeInRep {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==============================================================================
   GRIDS E CARDS DE GRÁFICOS / TABELAS
   ============================================================================== */
.rep-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.rep-card {
  background: var(--rep-bg-card);
  border: 1px solid var(--rep-border);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.rep-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rep-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rep-badge-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

/* ==============================================================================
   LISTAS DE BARRAS DE PROGRESSO (Canais, Pagamentos, Horas)
   ============================================================================== */
.rep-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rep-progress-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rep-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.rep-progress-label {
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rep-progress-vals {
  font-weight: 700;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.rep-progress-bar-bg {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.rep-progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gráfico de Barras Horárias SVG / CSS */
.rep-hourly-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 10px 0 4px;
  overflow-x: auto;
}

.rep-hour-col {
  flex: 1;
  max-width: 65px;
  min-width: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.rep-hour-bar {
  width: 100%;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  position: relative;
  min-height: 4px;
}

.rep-hour-bar:hover {
  background: linear-gradient(180deg, #7dd3fc, #38bdf8);
}

.rep-hour-label {
  font-size: 0.68rem;
  color: var(--rep-text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ==============================================================================
   TABELAS EXECUTIVAS
   ============================================================================== */
.rep-table-wrapper {
  background: var(--rep-bg-card);
  border: 1px solid var(--rep-border);
  border-radius: 14px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.rep-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.rep-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--rep-text-muted);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rep-border);
  white-space: nowrap;
}

.rep-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  vertical-align: middle;
}

.rep-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.rep-table tr:last-child td {
  border-bottom: none;
}

.rep-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.rep-tag-success {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.rep-tag-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.rep-tag-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.rep-tag-info {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.rep-tag-purple {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

/* ==============================================================================
   MODAL DE IMPRESSÃO / PRÉVIA EXECUTIVA
   ============================================================================== */
.rep-print-sheet {
  background: #ffffff;
  color: #0f172a;
  padding: 2.5rem;
  border-radius: 12px;
  max-width: 860px;
  margin: 0 auto;
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.rep-print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.rep-print-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
}

.rep-print-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

.rep-print-kpi-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

/* ==============================================================================
   REGRAS DE IMPRESSÃO NATIVA (@media print)
   ============================================================================== */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .hub-header,
  .rep-toolbar-card,
  .rep-tabs-nav,
  .master-nav-overlay,
  .hub-btn,
  #btn-pwa-install,
  .rep-quick-actions {
    display: none !important;
  }

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

  .rep-tab-panel {
    display: block !important;
    page-break-inside: avoid;
    margin-bottom: 2rem;
  }

  .rep-kpi-card,
  .rep-card,
  .rep-table-wrapper {
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    color: #000 !important;
  }

  .rep-kpi-val,
  .rep-card-title,
  .rep-table td,
  .rep-table th {
    color: #000 !important;
  }

  .rep-table th {
    background: #f1f5f9 !important;
  }
}

/* ==============================================================================
   RESPONSIVIDADE MOBILE (iPhone SE, Tablets)
   ============================================================================== */
@media (max-width: 768px) {
  .relatorios-container {
    padding: 0.75rem 0.75rem 2.5rem;
  }

  .rep-toolbar-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .rep-quick-actions {
    margin-left: 0;
    justify-content: stretch;
    width: 100%;
  }

  .rep-quick-actions button,
  .rep-quick-actions a {
    flex: 1;
    justify-content: center;
  }

  .rep-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .rep-kpi-val {
    font-size: 1.25rem;
  }

  .rep-cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .rep-kpi-grid {
    grid-template-columns: 1fr;
  }
}
