/* P&L 96ex — tokens de cor no :root, tema escuro por preferência do sistema ou pelo botão. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f1ed;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --series-1: #2a78d6;
  --good: #0ca30c;
  --bad: #d03b3b;
  --good-text: #006300;
  --bad-text: #b42d2d;
  --warn: #fab219;
  /* a validação das automáticas (25/10): azul no green, amarelo no red */
  --val-good: #2563eb;
  --val-bad: #e3a908;
  --val-good-text: #1d4ed8;
  --val-bad-text: #9a6700;
  /* a MagicMarkets (26/10): o selo MM */
  --mm: #7c3aed;
  --focus: #2a78d6;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.04);
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --series-1: #3987e5;
    --good-text: #2fbf2f;
    --bad-text: #ef7070;
    --focus: #3987e5;
    --shadow: none;
    --val-good: #4f8ff7;
    --val-bad: #f5c518;
    --val-good-text: #8ab8ff;
    --val-bad-text: #f7d44c;
    --mm: #b69cff;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --series-1: #3987e5;
  --good-text: #2fbf2f;
  --bad-text: #ef7070;
  --focus: #3987e5;
  --shadow: none;
  --val-good: #4f8ff7;
  --val-bad: #f5c518;
  --val-good-text: #8ab8ff;
  --val-bad-text: #f7d44c;
  --mm: #b69cff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }

.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--good-text); }
.neg { color: var(--bad-text); }
.vpos { color: var(--val-good-text); }
.vneg { color: var(--val-bad-text); }
.zero, .muted { color: var(--muted); }
.sub { color: var(--muted); font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- topo */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 600; }
.sync { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; min-width: 0; flex: 1; }
.sync span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--good); }
.dot.busy { background: var(--series-1); animation: pulse 1s ease-in-out infinite; }
.dot.err { background: var(--bad); }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dot.busy { animation: none; } }
.top-actions { display: flex; gap: 8px; align-items: center; }
.linklike { all: unset; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.linklike:hover { color: var(--ink); }
.linklike:focus-visible { outline: 2px solid var(--focus); border-radius: 4px; }

.btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 7px 14px; cursor: pointer; font-weight: 550; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: var(--page); border-color: transparent; }
.btn.primary:hover { opacity: 0.88; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 6px 10px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.banner {
  margin: 12px 24px 0; padding: 12px 16px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent);
  background: color-mix(in srgb, var(--bad) 10%, var(--surface));
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.banner.info {
  border-color: color-mix(in srgb, var(--series-1) 40%, transparent);
  background: color-mix(in srgb, var(--series-1) 8%, var(--surface));
}
.banner strong { font-weight: 650; }
.banner .grow { flex: 1; min-width: 220px; }

main { padding: 16px 24px 48px; max-width: 1440px; margin: 0 auto; display: grid; gap: 16px; }
#dash { display: grid; gap: 16px; }
#dash.refetching { opacity: 0.6; transition: opacity 0.2s; }

/* ---------------------------------------------------------------- filtros */
.filters { display: grid; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--ink-2);
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--page); border-color: transparent; }
.chips.small .chip { padding: 4px 10px; font-size: 12.5px; }
.range { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.range input, .fld select, .fld input {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 5px 8px; min-height: 32px;
}
.range.active input { border-color: var(--ink-2); }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.fld { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.fld > span { padding-left: 2px; }
.fld.grow { flex: 1; min-width: 180px; }
.fld.grow input { width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 5px 12px; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--ink-2); min-height: 30px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--page); }

/* ---------------------------------------------------------------- cartões */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-foot { margin: 10px 0 0; color: var(--ink-2); font-size: 13px; }
.head-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.note { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }

/* ---------------------------------------------------------------- herói e indicadores */
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.hero-label { color: var(--ink-2); font-size: 13px; font-weight: 550; }
.hero-value { font-size: 52px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.05; margin: 4px 0 6px; }
.hero-sub { color: var(--ink-2); font-size: 13.5px; }
.hero-val { color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.hero-val strong { font-weight: 650; }
/* a chave da validação no topo (25/10): azul mostrando, riscada escondida */
.val-toggle[aria-pressed='true'] { color: var(--val-good-text); border-color: color-mix(in srgb, var(--val-good) 50%, transparent); background: color-mix(in srgb, var(--val-good) 10%, var(--surface)); }
.val-toggle[aria-pressed='false'] { color: var(--muted); text-decoration: line-through; }
.hero-side { display: grid; gap: 6px; justify-items: end; text-align: right; }
.today-chip { border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; background: var(--surface-2); }
.today-chip .lbl { color: var(--muted); font-size: 12px; display: block; }
.today-chip .val { font-size: 20px; font-weight: 650; }

.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; box-shadow: var(--shadow); }
.tile .lbl { color: var(--ink-2); font-size: 12.5px; }
.tile .val { font-size: clamp(18px, 1.55vw, 24px); font-weight: 650; margin: 2px 0; letter-spacing: -0.01em; white-space: nowrap; }
.tile .sub { line-height: 1.35; }

/* ---------------------------------------------------------------- gráficos */
.chart-box { min-height: 120px; }
.chart { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .panel-title { fill: var(--ink-2); font-size: 12px; font-weight: 550; }
.chart .end-label { fill: var(--ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .line-1 { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area-1 { fill: var(--series-1); fill-opacity: 0.1; }
.chart .dot-1 { fill: var(--series-1); }
.chart .line-bad { fill: none; stroke: var(--bad); stroke-width: 1.5; stroke-linejoin: round; }
.chart .area-bad { fill: var(--bad); fill-opacity: 0.16; }
.chart .dot-bad { fill: var(--bad); }
.chart .ring { stroke: var(--surface); stroke-width: 2; }
.chart .cross-line { stroke: var(--ink-2); stroke-width: 1; }
.chart .bar-good { fill: var(--good); }
.chart .bar-bad { fill: var(--bad); }
.chart .bar-zero { stroke: var(--muted); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .hit:hover, .chart .hit:focus-visible { fill: var(--ink); fill-opacity: 0.04; outline: none; }

/* calendário */
.cal-nav { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; color: var(--muted); font-size: 11.5px; padding-bottom: 2px; }
.cal-cell {
  position: relative; min-height: 64px; border-radius: 8px; padding: 6px 6px 4px;
  background: var(--surface-2); display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid transparent;
}
.cal-cell.blank { background: transparent; }
.cal-cell.future { opacity: 0.45; }
.cal-cell[tabindex] { cursor: pointer; }
.cal-cell[tabindex]:hover { border-color: var(--ink-2); }
.cal-cell.today { border-color: var(--series-1); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-day { font-size: 11px; color: var(--ink-2); }
.cal-value { font-size: 13.5px; font-weight: 650; text-align: right; }
.cal-count { font-size: 10.5px; color: var(--ink-2); text-align: right; }
/* greens e reds do dia (17/10, calendário do Over à frente): fica também no celular */
.cal-badge { font-size: 10.5px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.cal-cell.strong .cal-day, .cal-cell.strong .cal-value, .cal-cell.strong .cal-count, .cal-cell.strong .cal-badge { color: #0b0b0b; }

/* tooltip */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 340px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); font-size: 12.5px;
}
.tip-title { font-weight: 600; margin-bottom: 2px; }
.tip-sub { color: var(--ink-2); margin-bottom: 4px; }
.tip-row { display: flex; gap: 8px; align-items: center; }
.tip-value { font-weight: 650; min-width: 86px; }
.tip-label { color: var(--ink-2); }
.tip-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tip-key.k-series-1 { background: var(--series-1); }
.tip-key.k-bad { background: var(--bad); }

/* ---------------------------------------------------------------- tabelas */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--grid); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 550; font-size: 12px; white-space: nowrap; }
.tbl .left { text-align: left; }
.tbl td.num { white-space: nowrap; }
.tbl td.num.strong { font-weight: 600; }
.tbl td .alt { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.tbl td.grp { min-width: 120px; }
.tbl .ev { min-width: 150px; }
.tbl .col-bar { width: 120px; min-width: 90px; padding-left: 4px; padding-right: 4px; }
@media (max-width: 760px) {
  .tbl .col-opt, .tbl .col-bar { display: none; }
}
.tbl tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tbl td.num, .tbl td .num { font-variant-numeric: tabular-nums; }
.th-btn { all: unset; cursor: pointer; }
.th-btn:focus-visible { outline: 2px solid var(--focus); border-radius: 4px; }
th.sortable.active { color: var(--ink); }
.tbl .ev { font-weight: 550; }
.tbl .grp { font-weight: 550; }
.tbl tr.is-void { opacity: 0.55; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover .grp { text-decoration: underline; text-underline-offset: 3px; }
.tbl tr.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.active-filter {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--series-1) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--series-1) 45%, transparent);
  font-size: 13px; font-weight: 550;
}
.active-filter button { all: unset; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; text-align: center; line-height: 20px; color: var(--ink-2); }
.active-filter button:hover { background: var(--surface-2); color: var(--ink); }
.active-filter button:focus-visible { outline: 2px solid var(--focus); }
.edge { font-size: 11.5px; }
.more { margin-top: 8px; }
.tbl.inner { font-size: 12.5px; }
.tbl.inner td { border-bottom: 1px dashed transparent; padding: 4px 8px; }
.game-detail > td { background: var(--surface-2); padding: 4px 8px 8px; }
.game-row.open td { border-bottom-color: transparent; }
.expander { all: unset; cursor: pointer; width: 18px; display: inline-block; text-align: center; color: var(--ink-2); }
.expander:focus-visible { outline: 2px solid var(--focus); border-radius: 4px; }
.divbar { position: relative; height: 20px; }
.divbar-axis { position: absolute; left: 50%; top: 2px; bottom: 2px; width: 1px; background: var(--axis); }
.divbar-fill { position: absolute; top: 4px; height: 12px; }
.divbar-fill.good { background: var(--good); border-radius: 0 4px 4px 0; }
.divbar-fill.bad { background: var(--bad); border-radius: 4px 0 0 4px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); white-space: nowrap; }
.pill.st-won { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.pill.st-lost { color: var(--bad-text); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.pill.st-open { color: var(--series-1); border-color: color-mix(in srgb, var(--series-1) 45%, transparent); }
.pill.st-won.val { color: var(--val-good-text); border-color: color-mix(in srgb, var(--val-good) 45%, transparent); }
.pill.st-lost.val { color: var(--val-bad-text); border-color: color-mix(in srgb, var(--val-bad) 60%, transparent); }
.pill.st-void, .pill.st-push { color: var(--muted); }
.side { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; letter-spacing: 0.02em; }
.side.back { background: color-mix(in srgb, #3987e5 18%, transparent); color: var(--ink); }
.side.lay { background: color-mix(in srgb, #e87ba4 22%, transparent); color: var(--ink); }
.legs-hint { color: var(--muted); text-decoration: underline dotted; cursor: help; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 13px; }

/* onde entra e onde sai o dinheiro (18/10, no lugar do "O que seguir" e do "O que evitar") */
.flow-sum { display: grid; gap: 8px; margin: 0 0 18px; }
.flow-line { display: grid; grid-template-columns: 52px minmax(0, 1fr) 116px; gap: 12px; align-items: center; }
.flow-line .lbl { color: var(--ink-2); font-size: 13px; font-weight: 550; }
.flow-line .val { text-align: right; font-size: 17px; font-weight: 650; white-space: nowrap; }
.flow-track { height: 18px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.flow-fill { display: flex; gap: 2px; height: 100%; min-width: 3px; border-radius: 0 6px 6px 0; overflow: hidden; }
.flow-seg { flex: 1 1 0; min-width: 2px; height: 100%; }
.flow-fill.good .flow-seg { background: var(--good); }
.flow-fill.bad .flow-seg { background: var(--bad); }
.flow-fill.good .flow-seg.val { background: var(--val-good); }
.flow-fill.bad .flow-seg.val { background: var(--val-bad); }
.flow-net { font-size: 13.5px; color: var(--ink-2); padding-left: 64px; }
.flow-net strong { font-weight: 650; }
.flow-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; align-items: start; }
.flow-col h3 { font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.flow-col h3 .sub { font-weight: 450; }
.flow-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: 'name spark val' 'bar bar bar' 'meta meta meta';
  column-gap: 12px; row-gap: 4px; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; border-top: 1px solid var(--grid); padding: 9px 8px; cursor: pointer;
}
.flow-row:hover { background: var(--surface-2); }
.flow-row.active { background: color-mix(in srgb, var(--series-1) 10%, var(--surface)); box-shadow: inset 3px 0 0 var(--series-1); }
.flow-name { grid-area: name; display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; font-size: 13.5px; }
.flow-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-pill {
  flex: none; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; letter-spacing: 0.03em;
  text-transform: uppercase; border: 1px solid var(--border); color: var(--ink-2);
}
.flow-pill.auto { color: var(--series-1); border-color: color-mix(in srgb, var(--series-1) 45%, transparent); }
.flow-pill.new { color: #0b0b0b; background: var(--warn); border-color: transparent; }
.flow-pill.mm { color: var(--mm); border-color: color-mix(in srgb, var(--mm) 50%, transparent); }
/* a BLACK (BetInAsia, 03/11): o selo em preto e branco, invertido no tema escuro */
.flow-pill.black { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.flow-row .spark { grid-area: spark; }
.flow-val { grid-area: val; font-weight: 650; font-size: 14px; text-align: right; white-space: nowrap; min-width: 88px; }
.flow-bar { grid-area: bar; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.flow-bar-fill { display: block; height: 100%; border-radius: 2px; }
.flow-bar-fill.good { background: var(--good); }
.flow-bar-fill.bad { background: var(--bad); }
.flow-bar-fill.good.val { background: var(--val-good); }
.flow-bar-fill.bad.val { background: var(--val-bad); }
.flow-meta { grid-area: meta; font-size: 12px; color: var(--muted); }
.flow-meta > span { white-space: nowrap; }
.flow-meta > span + span::before { content: ' · '; white-space: normal; }
.flow-empty { color: var(--muted); font-size: 13px; margin: 8px 0; }
.flow-more { margin-top: 6px; }
.flow-idle strong { font-weight: 600; color: var(--ink); }
.spark { display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-line.good { stroke: var(--good); }
.spark-line.bad { stroke: var(--bad); }
.spark-line.good.val { stroke: var(--val-good); }
.spark-line.bad.val { stroke: var(--val-bad); }
.spark-zero { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 2 2; }
/* nas tabelas: a automática que fez a aposta */
.auto-tag {
  margin-left: 6px; font-size: 10.5px; font-weight: 600; padding: 0 6px; border-radius: 999px; white-space: nowrap;
  color: var(--series-1); border: 1px solid color-mix(in srgb, var(--series-1) 40%, transparent);
}
/* o selo da MagicMarkets (26/10) */
.casa-tag { margin-left: 6px; font-size: 10px; font-weight: 750; padding: 0 5px; border-radius: 4px; letter-spacing: 0.04em; white-space: nowrap; }
.casa-tag.mm { color: #fff; background: var(--mm); }
.casa-tag.black { color: var(--surface); background: var(--ink); }
.auto-tag.val { color: var(--val-good-text); border-color: color-mix(in srgb, var(--val-good) 45%, transparent); background: color-mix(in srgb, var(--val-good) 8%, transparent); }
@media (max-width: 900px) { .flow-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .flow-line { grid-template-columns: 40px minmax(0, 1fr) 96px; gap: 8px; }
  .flow-line .val { font-size: 15px; }
  .flow-net { padding-left: 0; }
  .flow-row { column-gap: 8px; padding: 8px 4px; }
  .flow-row .spark { width: 52px; height: 18px; }
  .flow-val { min-width: 0; }
  .flow-name { flex-wrap: wrap; row-gap: 2px; }
  .flow-name .nm { white-space: normal; }
  .flow-meta .opt { display: none; }
}

/* destaques */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 0 0 14px; }
.fact .lbl { color: var(--muted); font-size: 12px; }
.fact .val { font-weight: 650; font-size: 15px; }
.fact .val small { font-weight: 450; color: var(--ink-2); font-size: 12px; }
.kinds h3 { font-size: 13px; font-weight: 600; margin: 4px 0 8px; }
.kind-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }
.kind-row .count { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- conexão */
dialog { border: 1px solid var(--border); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dlg { padding: 18px 22px 22px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.steps { margin: 8px 0 14px; padding-left: 20px; display: grid; gap: 10px; }
.steps li { padding-left: 4px; }
.bookmarklet {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 9px;
  background: var(--ink); color: var(--page); font-weight: 650; text-decoration: none; cursor: grab;
}
.code-box { width: 100%; min-height: 70px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font: 12px/1.4 ui-monospace, Consolas, monospace; resize: vertical; }
.dlg-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.dlg-actions.shutdown { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 16px; }
.msg { font-size: 13px; margin: 8px 0 0; }
.msg.err { color: var(--bad-text); }
.msg.ok { color: var(--good-text); }
details.alt { margin-top: 12px; color: var(--ink-2); font-size: 13px; }
details.alt code { display: block; margin-top: 6px; padding: 8px; background: var(--surface-2); border-radius: 8px; font-size: 11.5px; word-break: break-all; }
.why { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 0 0 6px; }

.onboarding { max-width: 760px; margin: 24px auto; padding: 26px 28px; }
.onboarding h1 { font-size: 22px; margin: 0 0 6px; }
.onboarding p { color: var(--ink-2); }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 1180px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  /* os botões do topo quebram linha: numa linha só passavam da tela e a página rolava de lado */
  .top-actions { flex-wrap: wrap; max-width: 100%; }
  .sync { order: 3; flex-basis: 100%; }
  main { padding: 12px 16px 40px; }
  .banner { margin: 12px 16px 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-value { font-size: 40px; }
  .hero-side { justify-items: start; text-align: left; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .kind-row { grid-template-columns: 110px minmax(0, 1fr) 90px; }
  .cal-cell { min-height: 52px; padding: 4px; }
  .cal-value { font-size: 12px; }
  .cal-count { display: none; }
  .cal-badge { font-size: 9.5px; letter-spacing: -0.02em; }
  .range { margin-left: 0; }
}

/* botão em forma de link (o painel usa no "Ao vivo") */
a.btn { text-decoration: none; color: inherit; display: inline-block; }

/* o menu das páginas no painel (28/10, "quando entra no painel o menu lateral some"): o mesmo das outras páginas
   (public/js/menu.js), sempre como a gaveta do ☰, no computador e no celular, para não apertar o topo do painel */
body.painel .menu-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 36px; height: 36px; padding: 0; flex: none; order: -1; position: relative; z-index: 51; }
body.painel .menu-btn span { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform 0.2s, opacity 0.2s; }
body.painel.menu-aberto .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.painel.menu-aberto .menu-btn span:nth-child(2) { opacity: 0; }
body.painel.menu-aberto .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
body.painel .appnav {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: min(80vw, 300px);
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; overflow-y: auto;
  padding: calc(56px + env(safe-area-inset-top)) 10px calc(16px + env(safe-area-inset-bottom));
  border-right: 1px solid var(--border); background: var(--surface); box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35);
  transform: translateX(-105%); visibility: hidden; transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
body.painel .appnav::before { content: 'Páginas'; padding: 0 12px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
body.painel.menu-aberto .appnav { transform: none; visibility: visible; transition: transform 0.22s ease; }
body.painel .appnav a { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
body.painel .appnav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
body.painel .appnav svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
body.painel .appnav a[aria-current='page'] { color: var(--ink); background: color-mix(in srgb, var(--accent, #4f8cff) 16%, transparent); box-shadow: inset 3px 0 0 var(--accent, #4f8cff); }
body.painel .appnav .appnav-pc { display: none; }
body.painel.menu-aberto .topbar { z-index: 60; }
body.painel .menu-fundo { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0.55); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
body.painel.menu-aberto .menu-fundo { opacity: 1; pointer-events: auto; }
body.painel.menu-aberto { overflow: hidden; }
/* com a gaveta aberta o topo perde o desfoque: com ele, a gaveta "fixa" ficava presa dentro do topo */
body.painel.menu-aberto .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; transform: none; filter: none; }

/* a tela das estratégias do Over (01/11, /estrategia): a linha da estratégia aberta no comparativo e as medidas de pressão
   de cada entrada (verde = passou do corte) */
.estr-seg { flex-wrap: wrap; }
.tbl.estr-comp tr.estr-atual td { background: color-mix(in srgb, var(--series-1) 10%, transparent); }
.tbl.estr-comp tr.estr-atual .grp { color: var(--series-1); }
/* Todas (02/11): a última linha do comparativo, as cinco juntas */
.tbl.estr-comp tr.estr-total td { border-top: 2px solid var(--border); font-weight: 600; }
.estr-pressao { font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.estr-pressao strong { color: var(--ink); }
.estr-pressao .estr-on { color: var(--good-text); font-weight: 600; }
.estr-pressao .estr-off { color: var(--muted); }
.tbl.estr-lista .sub, .tbl.estr-comp .alt { font-size: 11.5px; color: var(--muted); font-weight: 400; }
@media (max-width: 640px) {
  .estr-seg button { padding: 5px 9px; font-size: 12.5px; }
}
.estr-curto { display: none; }
@media (max-width: 640px) {
  .estr-longo { display: none; }
  .estr-curto { display: inline; }
}
