/* ═══════════════════════════════════════════════════════════════════
   Resumo Estatístico B3 — Quantitus
   Identidade visual: fundo escuro, cinza grafite, verde neon (#39ff14)
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0f1117;
  --bg-card:     #181c26;
  --bg-header:   #13171f;
  --border:      #2a2f3d;
  --accent:      #39ff14;   /* verde Quantitus */
  --accent-dim:  #2acc10;
  --navy:        #002C63;   /* azul B3 original */
  --navy-mid:    #0a3d7a;
  --text:        #e8eaf0;
  --text-muted:  #8a90a4;
  --text-header: #ffffff;
  --row-alt:     #1d2130;
  --font:        'Inter', -apple-system, sans-serif;
  --radius:      8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  min-height: 100vh;
  line-height: 1.5;
}

/* ── HEADER ─────────────────────────────────────────────────────── */
.site-header {
  background: var(--bg-header);
  border-bottom: 2px solid var(--accent);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo-link { display: flex; align-items: center; flex-shrink: 0; }
.logo { height: 66px; width: auto; filter: brightness(1.1); }
.header-title { flex: 1; }
.header-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-header);
  line-height: 1.2;
}
.header-updated {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

/* ── CONTROLES ───────────────────────────────────────────────────── */
.controles {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}
.controles-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.controle-grupo { display: flex; flex-direction: column; gap: 4px; }
.controle-grupo label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
select, input[type="date"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 7px 12px;
  outline: none;
  transition: border-color .2s;
  min-width: 180px;
}
select:focus, input[type="date"]:focus { border-color: var(--accent); }
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}
.btn-consultar {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 22px;
  cursor: pointer;
  transition: background .2s, transform .1s;
  letter-spacing: 0.3px;
}
.btn-consultar:hover { background: var(--accent-dim); }
.btn-consultar:active { transform: scale(.97); }

.btn-download {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  cursor: pointer;
  transition: background .2s, color .2s, transform .1s;
  letter-spacing: 0.3px;
}
.btn-download:hover { background: var(--accent); color: #000; }
.btn-download:active { transform: scale(.97); }

/* ── SUBTÍTULO DO CONTRATO ──────────────────────────────────────── */
.contrato-titulo {
  background: var(--navy);
  padding: 10px 24px;
}
.contrato-titulo-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
#contrato-nome {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.mercado-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 7px;
}

/* ── TABELA ──────────────────────────────────────────────────────── */
.tabela-section {
  padding: 20px 24px 40px;
}
.tabela-wrap {
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: auto;
}

.estado {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
}
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Tabela principal */
.resumo-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Grupos de cabeçalho (Dados / Volume) */
.resumo-table thead tr.grupo th {
  background: var(--navy-mid);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-align: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 2px solid var(--navy);
}
.resumo-table thead tr.grupo th:last-child { border-right: none; }

/* Cabeçalhos das colunas */
.resumo-table thead tr.colunas th {
  background: var(--navy);
  color: #cdd5e0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: right;
  padding: 7px 10px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.07);
  border-bottom: 2px solid var(--accent);
}
.resumo-table thead tr.colunas th:first-child { text-align: left; }
.resumo-table thead tr.colunas th:last-child  { border-right: none; }

/* Linhas de dados */
.resumo-table tbody tr {
  transition: background .15s;
  border-bottom: 1px solid var(--border);
}
.resumo-table tbody tr:nth-child(even) { background: var(--row-alt); }
.resumo-table tbody tr:hover { background: #1f2638; }
.resumo-table tbody tr:last-child { border-bottom: none; }

.resumo-table tbody td {
  padding: 7px 10px;
  text-align: right;
  color: var(--text);
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.04);
}
.resumo-table tbody td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
}
.resumo-table tbody td:last-child { border-right: none; }

/* Valor zero — esmaecido */
.val-zero { color: var(--text-muted); }

/* Variação positiva/negativa */
.val-pos { color: #4ade80; }
.val-neg { color: #f87171; }

/* ── NOTAS ────────────────────────────────────────────────────────── */
.notas {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
}
.notas-inner {
  max-width: 1400px;
  margin: 0 auto;
}
.notas p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 4px;
}
.notas p:last-child { margin-bottom: 0; }
.notas a { color: var(--accent); text-decoration: none; }
.notas a:hover { text-decoration: underline; }
.fonte { margin-top: 6px !important; }

/* ── RESPONSIVO ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; }
  .controles-inner { flex-direction: column; align-items: stretch; }
  select, input[type="date"] { min-width: 100%; }
  .btn-consultar { width: 100%; }
}
