:root {
  --bg1: #0f172a;
  --bg2: #1e293b;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #a2c522;
  --accent-2: #06b6d4;
  --prev-bar: #c5c5c5;
  /* Barra do ano atual — início do gradiente */
  --current-bar-start: #b92b2b;
  /* Barra do ano atual — fim do gradiente */
  --current-bar-end: #68da4b;
  --novos-bar: #22c55e;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg1);
}
.page {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  position: sticky;
  top: 0;
  background: var(--bg1);
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .title { font-size: 22px; font-weight: 700; }
.logo { width: 36px; height: 36px; border-radius: 8px; box-shadow: 0 6px 14px rgba(34,197,94,0.35); }
.content {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 16px;
  overflow-x: hidden;
}
.page-title {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10); border-radius: 12px; padding: 10px; text-align: center; }
.metric .label { font-size: 12px; color: var(--muted); }
.metric .value { font-size: 18px; font-weight: 700; color: var(--text); }
.list { display: grid; gap: 6px; }
.list-item { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10); }
.list-item .name { color: var(--text); }
.list-item .val { color: var(--muted); }
.empty { font-size: 13px; color: var(--muted); }
@media (min-width: 900px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}
 .card#totais { grid-column: 1 / -1; }
 .card.fullw { grid-column: 1 / -1; }
 .card-title .title-sub { font-size: 12px; font-weight: 500; color: var(--muted); }
 /* Filtro de período */
 .filter-card { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
 .filter-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 130px; min-width: 130px; }
 .filter-field label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
 .filter-field input {
   background: rgba(255,255,255,0.04);
   border: 1px solid rgba(255,255,255,0.12);
   border-radius: 10px;
   color: var(--text);
   padding: 9px 10px;
   font-size: 13px;
   font-family: inherit;
   outline: none;
   width: 100%;
 }
 .filter-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(162,197,34,0.25); }
 .filter-actions { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 4px; }
 .btn {
   border: 1px solid rgba(255,255,255,0.14);
   background: rgba(255,255,255,0.05);
   color: var(--text);
   border-radius: 10px;
   padding: 8px 14px;
   font-size: 12px;
   font-weight: 600;
   font-family: inherit;
   line-height: 1;
   cursor: pointer;
   text-decoration: none;
   display: inline-flex;
   align-items: center;
   gap: 5px;
   transition: all .15s;
 }
 .btn:hover { background: rgba(255,255,255,0.10); }
 .btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #0f172a; }
 .btn.primary:hover { filter: brightness(1.08); }
 .btn.ghost { background: transparent; }
 .filter-periodo { font-size: 11px; color: var(--muted); margin-top: 4px; width: 100%; }
 .filter-periodo strong { color: var(--text); }
 .chart-bars { display: grid; gap: 8px; }
 .bar-row { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; }
 .bar-label { font-size: 12px; color: var(--muted); }
 .bar-track { position: relative; height: 16px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10); border-radius: 10px; overflow: hidden; }
 .bar-fill { height: 100%; background: linear-gradient(90deg, var(--current-bar-start), var(--current-bar-end)); }
 .bar-fill-prev { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 3px; background: var(--prev-bar); }
 .bar-val { font-size: 14px; font-weight: 700; color: var(--text); }
 .chart-legend { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
 .legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
 .legend-swatch { width: 16px; height: 10px; border-radius: 4px; }
 .legend-swatch.current { background: linear-gradient(90deg, var(--current-bar-start), var(--current-bar-end)); }
 .legend-swatch.prev { background: var(--prev-bar); }
 #novos-mensal .bar-fill { background: var(--novos-bar); }
 .heat-inline { display: grid; gap: 6px; }
 .heat-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
 .heat-row.labels .heat-cell { font-size: 12px; color: var(--muted); text-align: center; }
 .heat-row.values .heat-cell { font-size: 14px; font-weight: 700; color: var(--text); text-align: center; }
 .table-inline { display: grid; gap: 6px; }
 .table-row { display: grid; grid-template-columns: 32px 56px 1fr 52px 80px; align-items: center; gap: 6px; }
 .table-row.head .cell { font-size: 9px; color: var(--muted); }
 .table-row.body .cell { font-size: 12px; color: var(--text); }
 .table-row .cell.val { text-align: right; }
 .table-row .cell:nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
