/* =========================================================================
   Design tokens
   ========================================================================= */
:root {
  /* Tema creme, minimalista */
  --bg: #f7f2e8;
  --bg-2: #fbf8f1;
  --surface: #fffdf8;
  --surface-solid: #fffdf8;
  --border: #ebe3d3;
  --border-strong: #ddd2bd;
  --text: #2f2a23;
  --text-2: #5f574b;
  --text-3: #938a7b;

  --accent: #a0522d;
  --accent-soft: #f3e6d8;
  --accent-2: #c9a27e;
  --accent-3: #7d9a78;
  --warm: #c98a2b;
  --grad: var(--accent);
  --heat: linear-gradient(90deg, #f2cc8f, #e9a86b, #d9774b, #b4492f, #7a2a1e);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(60 45 25 / 0.04), 0 6px 18px -10px rgb(60 45 25 / 0.12);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Inter", system-ui, sans-serif;
  --font-display: "Dancing Script", "Segoe Script", cursive;
  --font-num: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--bg);
}

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-left: 4px;
}

/* =========================================================================
   Top bar
   ========================================================================= */
.topbar {
  height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
}
.brand-icon svg { width: 20px; height: 20px; fill: var(--accent); }
.brand h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700; line-height: 1.05;
  color: var(--text);
}
.brand p { color: var(--text-3); font-size: 12px; margin-top: 2px; }

.status {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-2);
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warm);
  animation: blink 1.2s infinite;
}
.status.ok .dot { background: #6a994e; animation: none; }
.status.err .dot { background: #b23a2e; animation: none; }

/* =========================================================================
   Layout
   ========================================================================= */
.layout {
  height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  padding: 18px;
}
.content { display: flex; flex-direction: column; gap: 18px; min-width: 0; min-height: 0; }

/* =========================================================================
   Sidebar
   ========================================================================= */
.sidebar {
  padding: 20px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 20px;
}
.sidebar::-webkit-scrollbar, .ranking::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb, .ranking::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }

.side-head { display: flex; justify-content: space-between; align-items: center; }
.side-head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 700; }

.btn-ghost {
  font: inherit; font-size: 12px; font-weight: 500;
  color: var(--text-2); background: transparent;
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 5px 13px; cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.filter { display: flex; flex-direction: column; gap: 9px; }
.filter-row { display: flex; justify-content: space-between; align-items: center; }
.filter-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3);
  display: flex; align-items: center;
}
.link {
  font: inherit; font-size: 11px; color: var(--accent);
  background: none; border: none; cursor: pointer; opacity: .85;
}
.link:hover { opacity: 1; text-decoration: underline; }

.select-wrap, .search-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%;
  width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg); pointer-events: none;
}
select, input {
  width: 100%;
  font: inherit; color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none; appearance: none;
  transition: border-color .2s, box-shadow .2s;
}
select option { background: var(--surface-solid); color: var(--text); }
select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2;
}
.search-wrap input { padding-left: 36px; padding-right: 34px; }
.search-wrap .clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--border); color: var(--text-2);
  cursor: pointer; font-size: 15px; line-height: 1;
  display: none;
}
.search-wrap.has-value .clear { display: block; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
/* Botão "i" e painel explicativo dos grupos tarifários */
.info-btn {
  width: 16px; height: 16px; margin-left: 6px; padding: 0; flex: none;
  display: inline-grid; place-items: center;
  font: italic 600 10.5px/1 Georgia, "Times New Roman", serif; text-transform: none;
  color: var(--text-3); background: transparent;
  border: 1px solid var(--border-strong); border-radius: 50%; cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.info-pop {
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border);
  animation: rise .25s var(--ease) both;
}
.info-pop[hidden] { display: none; }
.info-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.info-head h4 { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--text); }
.info-close {
  width: 20px; height: 20px; border: none; border-radius: 50%; background: transparent;
  color: var(--text-3); font-size: 15px; line-height: 1; cursor: pointer;
}
.info-close:hover { color: var(--accent); background: var(--accent-soft); }
.info-sub { font-size: 11px; color: var(--text-2); margin: 8px 0 5px; line-height: 1.4; }
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 11.5px; line-height: 1.35; }
.info-list dt { font-weight: 600; color: var(--accent); white-space: nowrap; }
.info-list dd { color: var(--text-2); }
.info-foot { font-size: 10.5px; color: var(--text-3); margin-top: 10px; line-height: 1.4; }
.filter-note { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.filter-note b { font-weight: 600; color: var(--text-2); }
.chip {
  font: inherit; font-size: 12px; font-weight: 500;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border);
  transition: color .2s, background .2s, border-color .2s;
  user-select: none;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

.legend { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.legend h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; }
.legend-bubbles { display: flex; align-items: flex-end; gap: 14px; min-height: 56px; }
.legend-bubbles .lb { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-2); }
.legend-bubbles .lb span.c {
  display: block; border-radius: 50%;
  background: rgb(160 82 45 / .2); border: 1.5px solid var(--accent);
}
.legend-bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 10.5px; color: var(--text-3); }
.legend-bar .grad { flex: 1; height: 6px; border-radius: 6px; background: var(--heat); }
.legend-note { font-size: 11px; color: var(--text-3); margin-top: 10px; line-height: 1.45; }

/* =========================================================================
   KPIs
   ========================================================================= */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.kpi {
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
  transition: border-color .3s;
}
.kpi:hover { border-color: var(--border-strong); }
.kpi-label { font-family: var(--font-display); font-size: 18px; color: var(--text-2); font-weight: 600; }
.kpi-value {
  font-family: var(--font-num); font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text);
  transition: opacity .3s;
}
.kpi-value.updating { opacity: .35; }
.kpi-sub { font-size: 11px; color: var(--text-3); }

/* =========================================================================
   Map + charts grid
   ========================================================================= */
.main-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 340px; gap: 18px;
}
.map-card { position: relative; overflow: hidden; padding: 0; min-height: 360px; }
#map { position: absolute; inset: 0; background: var(--bg-2); border-radius: var(--radius); }

.map-overlay {
  position: absolute; top: 14px; right: 66px; z-index: 500;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.map-overlay.show { opacity: 1; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.map-info {
  position: absolute; left: 14px; bottom: 14px; z-index: 500;
  font-size: 11.5px; color: var(--text-2);
  padding: 7px 12px; border-radius: 999px;
  background: rgb(255 253 248 / .92); border: 1px solid var(--border);
}

.charts { display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow-y: auto; }
.chart-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.chart-card h3 { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--text); line-height: 1.15; }
.chart-box { position: relative; height: 190px; }
.chart-box.donut { height: 170px; }
.chart-box.tall { height: 230px; }

.donut-legend { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.donut-legend li {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; column-gap: 14px;
  padding: 5px 8px; border-radius: 8px; font-size: 12px; cursor: pointer;
  transition: background .2s;
}
.donut-legend li:hover { background: var(--bg); }
.donut-legend .nm { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend .pct, .donut-legend .val { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.donut-legend .pct { color: var(--text-2); min-width: 46px; }
.donut-legend .val { color: var(--text); font-weight: 500; min-width: 72px; }

.ranking { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.ranking li {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; position: relative; overflow: hidden;
  transition: background .2s;
}
.ranking li:hover { background: var(--bg); }
.ranking li .bar {
  position: absolute; left: 0; bottom: 0; height: 2px;
  background: var(--accent-2); opacity: .7; border-radius: 2px;
  transition: width .6s var(--ease);
}
.ranking .pos { font-family: var(--font-num); font-weight: 600; color: var(--text-3); font-size: 12px; }
.ranking .nm { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking .nm small { color: var(--text-3); font-weight: 400; margin-left: 4px; }
.ranking .val { font-size: 12px; font-weight: 600; color: var(--accent); }
.ranking .empty { color: var(--text-3); cursor: default; grid-template-columns: 1fr; }

/* =========================================================================
   Leaflet overrides
   ========================================================================= */
.leaflet-container { font-family: var(--font); }
.leaflet-bar { border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a {
  background: var(--surface-solid) !important; color: var(--text-2) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { color: var(--accent) !important; }
.leaflet-control-attribution { background: rgb(255 253 248 / .8) !important; color: var(--text-3) !important; font-size: 10px; }
.leaflet-control-layers {
  background: var(--surface-solid) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: 10px !important;
  box-shadow: var(--shadow) !important;
}
.leaflet-control-layers-expanded { padding: 10px 14px !important; font-size: 12px; }
.leaflet-control-layers label { margin: 4px 0; cursor: pointer; }
.leaflet-control-layers input { width: auto; padding: 0; appearance: auto; -webkit-appearance: radio; accent-color: var(--accent); margin-right: 6px; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.leaflet-tooltip.tt {
  background: var(--surface-solid); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px 12px; font-size: 12px;
}
.leaflet-tooltip.tt::before { display: none; }
.tt b { font-family: var(--font); font-weight: 600; font-size: 13.5px; display: block; color: var(--text); }
.tt span { color: var(--text-2); }

/* =========================================================================
   Toast
   ========================================================================= */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120px);
  background: #fbeee9; border: 1px solid #e3b5a8; box-shadow: var(--shadow);
  color: #8a2c1f; padding: 12px 18px; border-radius: 12px; font-size: 13px;
  z-index: 2000; transition: transform .4s var(--ease); max-width: 80vw;
}
.toast.show { transform: translate(-50%, 0); }

/* =========================================================================
   Animations
   ========================================================================= */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.kpi, .map-card, .chart-card, .sidebar { animation: rise .6s var(--ease) both; }
.kpi:nth-child(2) { animation-delay: .05s; }
.kpi:nth-child(3) { animation-delay: .1s; }
.kpi:nth-child(4) { animation-delay: .15s; }
.chart-card:nth-child(2) { animation-delay: .1s; }
.chart-card:nth-child(3) { animation-delay: .2s; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1280px) {
  .main-grid { grid-template-columns: 1fr; grid-template-rows: minmax(420px, 1fr) auto; }
  .charts { flex-direction: row; overflow: visible; }
  .chart-card { flex: 1; min-width: 0; }
  .content { overflow-y: auto; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .charts { flex-direction: column; }
  .main-grid { grid-template-rows: 460px auto; }
}

/* =========================================================================
   Navegação entre painéis (Consumo / Geração)
   ========================================================================= */
.nav {
  display: flex; gap: 4px; padding: 4px; margin-left: auto; margin-right: 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
}
.nav a {
  font-size: 12.5px; font-weight: 500; color: var(--text-3); text-decoration: none;
  padding: 6px 16px; border-radius: 999px; transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }

/* =========================================================================
   Painel de geração
   ========================================================================= */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; flex: none; }
.range-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; color: var(--text-3); font-size: 12px; }
.range-row select { padding: 9px 12px; }
.legend-tipos { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 11px; color: var(--text-2); }
.legend-tipos span { display: inline-flex; align-items: center; }
.ranking .nm .dot { margin-right: 6px; }
.tt .tt-row { display: flex; align-items: center; margin-top: 3px; font-size: 11.5px; }
.tt .tt-row i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
@media (max-width: 900px) { .nav { margin-right: 8px; } .nav a { padding: 6px 10px; } }

/* Camada de bolhas em canvas único: eventos de mouse ficam com o mapa */
.camada-bolhas { pointer-events: none; }

/* =========================================================================
   Seleção múltipla de estados/municípios e comparação
   ========================================================================= */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags:empty { display: none; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  font-size: 12px; font-weight: 500; color: var(--accent);
  padding: 4px 4px 4px 10px; border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid transparent;
  animation: rise .3s var(--ease) both;
}
.tag > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag small { color: var(--text-2); font-weight: 500; margin-left: 2px; }
.tag button {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: none; background: transparent; color: var(--accent);
  cursor: pointer; font-size: 13px; line-height: 1;
}
.tag button:hover { background: rgb(160 82 45 / .15); }
select option:disabled { color: var(--text-3); }

.compare-box { gap: 6px; }
.btn-compare {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--accent);
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--accent);
  transition: background .2s, color .2s, opacity .2s;
}
.btn-compare svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-compare:hover:not(:disabled) { background: var(--accent); color: var(--surface); }
.btn-compare:disabled { cursor: not-allowed; opacity: .4; color: var(--text-3); border-color: var(--border-strong); }
.compare-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }

.ranking li.sel { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }

body.modal-open { overflow: hidden; }
.modal {
  position: fixed; inset: 0; z-index: 1500;
  display: grid; place-items: center; padding: 24px 16px;
  background: rgb(60 48 32 / .28);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(1040px, 100%); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-solid); animation: rise .35s var(--ease) both;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; }
.modal-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }

.table-wrap { overflow-x: auto; }
.comp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.comp-table th {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); text-align: right; padding: 0 10px 8px; white-space: nowrap;
}
.comp-table td {
  text-align: right; padding: 9px 10px; border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2);
}
.comp-table .l { text-align: left; }
.comp-table td.l strong { color: var(--text); font-weight: 600; }
.comp-table td.l small { color: var(--text-3); margin-left: 4px; }
.comp-table td:nth-child(2) { color: var(--text); font-weight: 600; min-width: 150px; }
.comp-table tbody tr:hover td { background: var(--bg-2); }
.cell-val { display: block; }
.cell-bar { display: block; height: 3px; margin-top: 5px; border-radius: 2px; background: var(--border); }
.cell-bar i { display: block; height: 100%; margin-left: auto; border-radius: 2px; background: var(--accent-2); }

.comp-graficos { display: flex; flex-direction: column; gap: 16px; }
.comp-graficos[hidden] { display: none; }
.comp-table td.erro { color: #b23a2e; white-space: normal; }
.comp-toolbar { display: flex; justify-content: space-between; align-items: center; }
.comp-toolbar > span { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.seg button {
  font: inherit; font-size: 12px; font-weight: 500; color: var(--text-3);
  background: none; border: none; border-radius: 999px; padding: 5px 12px; cursor: pointer;
}
.seg button.active { color: var(--accent); background: var(--accent-soft); }
.comp-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.comp-charts .chart-card { background: var(--bg-2); box-shadow: none; animation: none; }
@media (max-width: 900px) {
  .comp-charts { grid-template-columns: 1fr; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
}

/* Previsão de consumo de uma nova UC (janela de comparação) */
.prev { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 1px solid var(--border); }
.comp-toolbar > .prev-badge { font-family: var(--font); font-size: 11px; font-weight: 500; color: var(--text-2); }
.prev-badge {
  font-size: 11px; color: var(--text-2); padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-2);
}
.prev-intro { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.prev-intro strong { color: var(--text); }
.prev-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.prev-form[hidden] { display: none; }
.pf { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pf[hidden] { display: none; }
.pf > label { font-size: 11px; font-weight: 600; color: var(--text-3); }
.pf > label small { font-weight: 400; }
.pf select, .pf input[type=number] { padding: 8px 12px; font-size: 12.5px; }
.pf .select-wrap::after { right: 12px; }
.pf .select-wrap select { padding-right: 30px; text-overflow: ellipsis; }
.pf-wide .seg { align-self: flex-start; }
.pf-checks { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 15px; height: 15px; padding: 0; appearance: auto; accent-color: var(--accent); }
.pf-checks .link { margin-left: auto; }
.prev-status { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.prev-status:empty { display: none; }
.prev-status.erro { color: #b23a2e; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; flex: none; }
.prev-result { display: flex; flex-direction: column; gap: 14px; }
.prev-result[hidden] { display: none; }
.prev-result .chart-card { background: var(--bg-2); box-shadow: none; animation: none; }
.prev-result .chart-card h3 small { font-family: var(--font); font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.comp-table td.destaque { color: var(--accent); font-weight: 700; }
.comp-table td.destaque small { color: var(--text-3); font-weight: 400; margin-left: 2px; }
.comp-table td .sub { display: block; font-size: 11px; color: var(--text-3); margin-top: 3px; white-space: normal; max-width: 360px; }
.prev-nota { font-size: 11.5px; color: var(--text-3); line-height: 1.55; }
.prev-nota strong { color: var(--text-2); }
.prev-nota .inf { color: var(--accent); font-weight: 600; }
.prev-nota .aviso { color: var(--warm); }

/* Previsão de expansão da geração: medidor de probabilidade */
.meter { display: inline-block; width: 54px; height: 6px; margin-right: 8px; vertical-align: 1px;
  border-radius: 3px; background: var(--border); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.comp-table small.muted { color: var(--text-3); font-weight: 400; margin-left: 4px; }
