@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --navy:        #08101f;
  --blue:        #1e4fc2;
  --blue-bright: #2d6ef5;
  --accent:      #00d4ff;
  --accent2:     #f5a623;
  --green:       #00c96b;
  --red:         #ff4757;
  --white:       #eef2ff;
  --muted:       #6b7fa3;
  --card-bg:     #0c1a32;
  --card-border: rgba(45,110,245,0.15);
  --radius:      16px;
  --radius-sm:   10px;
}

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

/* ════════════════════════════
   DARK THEME (dashboard)
════════════════════════════ */
body {
  background: var(--navy);
  color: var(--white);
  font-family: 'Sora', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 5%,  rgba(30,79,194,0.16) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 85%,  rgba(0,212,255,0.07) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ════════════════════════════
   LIGHT THEME (relatórios)
════════════════════════════ */
body.light {
  background: #f0f4fa;
  color: #1a2744;
}

body.light::before { background: none; }

body.light .logo-img { filter: none; }

body.light .main-nav {
  border-bottom-color: rgba(30,79,194,0.14);
  background: transparent;
}
body.light .nav-link        { color: #8a9dc0; }
body.light .nav-link:hover  { color: #1a2744; background: rgba(30,79,194,0.06); }
body.light .nav-link.active { color: var(--blue); border-bottom-color: var(--blue); background: transparent; }

body.light .report-card {
  background: #fff;
  border-color: rgba(30,79,194,0.1);
  box-shadow: 0 2px 24px rgba(30,79,194,0.07);
}
body.light .chart-title  { color: #1a2744; }
body.light .chart-sub    { color: #8a9dc0; }
body.light .logo-text h1 { color: #1a2744; }
body.light .logo-text span { color: #8a9dc0; }
body.light footer { color: #8a9dc0; border-top-color: rgba(30,79,194,0.1); background: transparent; }
body.light footer a { color: var(--blue); }
body.light header  { border-bottom: 1px solid rgba(30,79,194,0.1); padding-bottom: 20px; margin-bottom: 0; }

/* ════════════════════════════
   LAYOUT
════════════════════════════ */
.container {
  max-width: 1340px;
  margin: 0 auto;
  padding: 28px 28px;
  position: relative;
  z-index: 1;
}

body.light .container { max-width: 100%; padding: 24px 36px; }

/* ════════════════════════════
   ANIMATIONS
════════════════════════════ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes borderGlow {
  0%,100% { box-shadow: 0 0 10px rgba(0,212,255,0.08); }
  50%     { box-shadow: 0 0 28px rgba(0,212,255,0.28); }
}

.anim { animation: fadeSlideUp .5s cubic-bezier(.22,.68,0,1.2) both; opacity: 0; }
.d1 { animation-delay: .04s; } .d2 { animation-delay: .12s; }
.d3 { animation-delay: .20s; } .d4 { animation-delay: .28s; }
.d5 { animation-delay: .36s; } .d6 { animation-delay: .44s; }
.d7 { animation-delay: .52s; } .d8 { animation-delay: .60s; }
.d9 { animation-delay: .68s; }

/* ════════════════════════════
   HEADER
════════════════════════════ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  flex-wrap: wrap;
  gap: 14px;
}

.logo-area { display: flex; align-items: center; gap: 14px; }

/* Logo real — filtro branco no dark, original no light */
.logo-img {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: .92;
  flex-shrink: 0;
}

.logo-text h1    { font-size: 17px; font-weight: 700; line-height: 1.1; }
.logo-text span  { font-size: 10px; color: var(--muted); font-weight: 400; letter-spacing: .4px; }

.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.last-update {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 6px 12px;
  border-radius: 8px;
}

.loading-badge {
  font-size: 11px;
  background: rgba(0,212,255,0.1);
  color: var(--accent);
  border: 1px solid rgba(0,212,255,0.28);
  padding: 5px 12px;
  border-radius: 20px;
  display: none;
}
.loading-badge.show { display: block; }

.error-msg {
  background: rgba(255,71,87,0.08);
  border: 1px solid rgba(255,71,87,0.3);
  color: var(--red);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
}

/* ════════════════════════════
   NAV — tab underline style
════════════════════════════ */
.main-nav {
  display: flex;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 28px;
  margin-top: 20px;
  gap: 0;
  background: transparent;
}

.nav-link {
  padding: 12px 26px 14px;
  border-radius: 0;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .18s, border-color .18s, background .18s;
}

.nav-link:hover  { color: var(--white); background: rgba(255,255,255,0.03); }
.nav-link.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ════════════════════════════
   BARRA MENSAL
════════════════════════════ */
.month-bar {
  background: rgba(0,212,255,0.04);
  border: 1px solid rgba(0,212,255,0.1);
  border-radius: 10px;
  padding: 9px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 11px;
}

.month-bar-label {
  font-weight: 700;
  color: var(--accent);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
  padding: 3px 10px;
  background: rgba(0,212,255,0.1);
  border-radius: 20px;
}

.mb-sep { width: 1px; height: 13px; background: var(--card-border); }
.mb-item { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.mb-item strong { color: var(--white); font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 12px; }

/* ════════════════════════════
   HERO KPIs
════════════════════════════ */
.hero-kpis {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 15px;
  margin-bottom: 18px;
}
@media (max-width: 900px) { .hero-kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .hero-kpis { grid-template-columns: 1fr; } }

.hero-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px 22px;
  position: relative;
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.hero-card:hover { transform: translateY(-2px); border-color: rgba(45,110,245,0.32); }

.hero-card.primary {
  border-color: rgba(0,212,255,0.3);
  animation: fadeSlideUp .5s cubic-bezier(.22,.68,0,1.2) .04s both, borderGlow 3.5s ease-in-out 1.2s infinite;
  opacity: 0;
}
.hero-card.primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 10% 20%, rgba(0,212,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero-card.primary::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--blue-bright));
}

.hero-icon  { font-size: 19px; margin-bottom: 10px; display: block; }
.hero-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin-bottom: 5px; }
.hero-value { font-family: 'JetBrains Mono', monospace; font-size: 38px; font-weight: 700; color: var(--white); line-height: 1; margin-bottom: 8px; }
.hero-card.primary .hero-value { font-size: 48px; color: var(--accent); }

.hero-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.hero-sub  { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

.delta {
  font-size: 10px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 7px; border-radius: 20px;
}
.delta-up   { background: rgba(0,201,107,0.12); color: var(--green); }
.delta-down { background: rgba(255,71,87,0.12);  color: var(--red); }
.delta-flat { background: rgba(245,166,35,0.12); color: var(--accent2); }

/* ════════════════════════════
   SECONDARY KPIs
════════════════════════════ */
.secondary-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 900px) { .secondary-kpis { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px) { .secondary-kpis { grid-template-columns: 1fr; } }

.sec-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: transform .2s, border-color .2s;
}
.sec-card:hover { transform: translateY(-2px); border-color: rgba(45,110,245,0.3); }
.sec-icon  { font-size: 14px; margin-bottom: 8px; display: block; }
.sec-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; margin-bottom: 4px; }
.sec-value { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 700; color: var(--white); line-height: 1; margin-bottom: 2px; }
.sec-sub   { font-size: 10px; color: var(--muted); }

/* ════════════════════════════
   RESUMO ANUAL
════════════════════════════ */
.annual-summary {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 22px;
  margin-bottom: 18px;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  align-items: center;
}
.annual-title    { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.annual-stat     { display: flex; flex-direction: column; gap: 2px; }
.annual-stat-val { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; color: var(--white); }
.annual-stat-lbl { font-size: 9px; color: var(--muted); font-weight: 500; }
.annual-divider  { width: 1px; height: 30px; background: var(--card-border); }

/* ════════════════════════════
   CHARTS
════════════════════════════ */
.charts-row {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 15px; margin-bottom: 15px;
}
@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }

.charts-row-2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 15px; margin-bottom: 15px;
}
@media (max-width: 768px) { .charts-row-2 { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
}
.chart-title { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.chart-sub   { font-size: 10px; color: var(--muted); margin-bottom: 14px; }

/* ════════════════════════════
   TABELA COLAPSÍVEL
════════════════════════════ */
details.table-collapsible {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

details.table-collapsible > summary {
  list-style: none;
  padding: 16px 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background .15s;
}
details.table-collapsible > summary::-webkit-details-marker { display: none; }
details.table-collapsible > summary:hover { background: rgba(45,110,245,0.05); }

.sum-left     { display: flex; flex-direction: column; gap: 2px; }
.sum-left h3  { font-size: 12px; font-weight: 700; }
.sum-left p   { font-size: 10px; color: var(--muted); }
.sum-right    { display: flex; align-items: center; gap: 10px; }
.sum-badge    { font-size: 10px; background: rgba(45,110,245,0.1); color: var(--blue-bright); border-radius: 20px; padding: 3px 10px; font-weight: 600; }
.sum-arrow    { font-size: 11px; color: var(--muted); transition: transform .25s; }
details[open] .sum-arrow { transform: rotate(180deg); }

.table-inner { border-top: 1px solid var(--card-border); overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 11px; }
thead th {
  background: rgba(45,110,245,0.05);
  padding: 9px 14px;
  text-align: left;
  font-size: 9px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .9px;
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.03); transition: background .12s; }
tbody tr:hover { background: rgba(45,110,245,0.055); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 10px 14px; color: var(--white); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
td.periodo-cell { font-family: 'Sora', sans-serif; font-size: 11px; color: var(--muted); }

.badge-var {
  display: inline-block; padding: 2px 7px; border-radius: 20px;
  font-size: 10px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
}

/* ════════════════════════════
   SAZONALIDADE
════════════════════════════ */
.alert-sazo {
  background: rgba(245,166,35,0.07);
  border: 1px solid rgba(245,166,35,0.28);
  border-radius: var(--radius-sm);
  padding: 12px 18px; margin-bottom: 16px;
  display: none; align-items: center; gap: 12px;
}
.alert-sazo.show { display: flex; }

.sazo-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 11px; margin-bottom: 18px;
}
@media (max-width: 768px) { .sazo-grid { grid-template-columns: 1fr; } }

.sazo-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
.sazo-icon    { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.sazo-content h4 { font-size: 11px; font-weight: 700; margin-bottom: 3px; }
.sazo-content p  { font-size: 10px; color: var(--muted); line-height: 1.5; }

/* ════════════════════════════
   FOOTER
════════════════════════════ */
footer {
  text-align: center;
  padding: 14px;
  color: var(--muted);
  font-size: 10px;
  border-top: 1px solid var(--card-border);
  margin-top: 4px;
}
footer a { color: var(--accent); text-decoration: none; }

/* ════════════════════════════
   PÁGINA RELATÓRIOS
════════════════════════════ */
.report-card {
  background: #fff;
  border: 1px solid rgba(30,79,194,0.1);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 2px 24px rgba(30,79,194,0.07);
}
.report-card-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid rgba(30,79,194,0.08);
}
.report-iframe-wrap { line-height: 0; }
.report-iframe-wrap iframe {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 700px;
  border: none;
  display: block;
}
