/* ============================================================
   style.css — Peso Faturado Mashup
   Fonte: Inter (Google Fonts via CDN)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
}

/* ── Page wrapper ──────────────────────────────────────────── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* ── Loader / hidden states ────────────────────────────────── */
.hidden { display: none !important; }

#loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 0;
  color: #64748b;
  font-size: 14px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error / fallback banner ───────────────────────────────── */
#error-box {
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: #854d0e;
  margin-bottom: 20px;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.header-accent {
  width: 5px;
  height: 52px;
  background: linear-gradient(180deg, #2563eb 0%, #7c3aed 100%);
  border-radius: 4px;
  flex-shrink: 0;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.subtitle {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
  font-weight: 400;
}

/* ── KPI Grid ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #2563eb;
  padding: 18px 20px 16px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: box-shadow .2s;
}

.kpi-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.kpi-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  margin-bottom: 4px;
  white-space: nowrap;
}

.kpi-sub {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 400;
}

/* Placeholder for native Qlik objects inside KPI cards */
.qlik-object {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Chart Card ────────────────────────────────────────────── */
.chart-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 24px 24px 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Loader inside chart area */
.chart-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 260px;
  color: #94a3b8;
  font-size: 13px;
}

/* Canvas wrapper */
.chart-wrapper {
  position: relative;
  height: 340px;
}

.chart-note {
  margin-top: 14px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

/* ── Reference Table ───────────────────────────────────────── */
.ref-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  overflow-x: auto;
}

.ref-title {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ref-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 9px 14px;
  text-align: left;
  border-radius: 4px;
}

.ref-table td {
  padding: 10px 14px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}

.ref-table tr.alt td { background: #fafbfc; }

.ref-table tr.total-row td {
  background: #f0fdf4;
  border-top: 2px solid #bbf7d0;
  border-bottom: none;
}

.ref-table td.bold  { font-weight: 700; }
.ref-table td.blue  { color: #2563eb; font-weight: 600; }
.ref-table td.green { color: #16a34a; }
.ref-table td.lg    { font-size: 15px; }

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  padding-top: 4px;
}
