:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f1f3f6;
  --fg: #0f172a; --muted: #64748b; --line: #e3e7ee;
  --accent: #0f172a; --on-accent: #ffffff;
  --buy: #059669; --wait: #d97706; --na: #64748b;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05);
  --radius: 14px;
}
:root[data-theme="dark"] {
  --bg: #0a0c10; --surface: #11141a; --surface-2: #181c24;
  --fg: #e8eaee; --muted: #8b94a3; --line: #1f2530;
  --accent: #e8eaee; --on-accent: #0a0c10;
  --buy: #34d399; --wait: #fbbf24; --na: #8b94a3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; transition: background .2s, color .2s;
}
.app { max-width: 920px; margin: 0 auto; padding: 0 20px 56px; }

/* topo */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -.01em; }
.logo { color: var(--buy); }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; cursor: pointer;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 10px;
}
.icon-btn:hover { background: var(--surface-2); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }

/* hero e formulário */
.hero { padding: 28px 0 8px; }
h1 { margin: 0; font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.1; letter-spacing: -.03em; font-weight: 700; }
.lede { margin: 10px 0 26px; color: var(--muted); font-size: 1.05rem; }

.search {
  display: flex; gap: 8px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.search:focus-within { border-color: var(--fg); }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none;
  font-size: 1.1rem; padding: 12px 14px; text-transform: uppercase;
}
.search input::placeholder { text-transform: none; color: var(--muted); }
.search input:focus-visible { outline: none; }

button.primary {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 11px;
  padding: 0 24px; background: var(--accent); color: var(--on-accent);
}
button.primary:hover { opacity: .9; }
button.primary:disabled { opacity: .55; cursor: progress; }

.panel {
  margin-top: 12px; padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; width: auto; color: var(--fg); }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: "▾"; color: var(--muted); font-size: .8rem; transition: transform .2s; }
.panel[open] > summary::after { transform: rotate(180deg); }
.panel[open] > summary { margin-bottom: 16px; }
.panel-title { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.params-resumo { margin-left: auto; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .8rem; color: var(--muted); }
.field small { font-size: .75rem; color: var(--muted); }

input {
  font: inherit; color: var(--fg); background: var(--surface-2); width: 100%;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 12px;
}
input:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--fg); outline-offset: 2px;
}
.input-suffix { position: relative; }
.input-suffix input { padding-right: 52px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }

.chips { display: flex; gap: 6px; }
.chip {
  font: inherit; font-size: .78rem; cursor: pointer; padding: 3px 10px; border-radius: 99px;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.chip:hover { color: var(--fg); border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

#manual { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
summary { cursor: pointer; font-size: .9rem; color: var(--muted); width: fit-content; }
summary:hover { color: var(--fg); }
.hint-text { margin: 8px 0 14px; font-size: .82rem; color: var(--muted); }

.erro {
  margin: 20px 0 0; padding: 12px 16px; border: 1px solid var(--wait); border-radius: 12px;
  color: var(--wait); background: color-mix(in srgb, var(--wait) 8%, transparent);
}

/* resultado */
#resultado { margin-top: 32px; }
.resumo { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; }
.resumo .tk { font-size: 1.1rem; font-weight: 700; padding: 3px 10px; border-radius: 8px; background: var(--surface-2); }
.resumo .px { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.resumo .meta { color: var(--muted); font-size: .82rem; }

.veredito {
  display: inline-block; margin-top: 14px; padding: 5px 12px; border-radius: 99px;
  font-size: .85rem; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 11%, transparent);
}
.veredito.todas { --c: var(--buy); } .veredito.parcial { --c: var(--fg); } .veredito.nenhuma { --c: var(--wait); } .veredito.sem-dados { --c: var(--na); }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 14px; }
.stat { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.stat .k { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .72rem; color: var(--muted); }
.stat.vazio .v { color: var(--muted); }
.stat.vazio .s, .stat.manual .s { color: var(--wait); }
.faltando { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }
.faltando button { font: inherit; color: var(--fg); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 18px; }
.card {
  padding: 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-head h2 { margin: 0; font-size: .95rem; font-weight: 650; }
.pill { font-size: .68rem; font-weight: 700; letter-spacing: .06em; padding: 3px 9px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.COMPRA { --c: var(--buy); } .AGUARDAR { --c: var(--wait); } .INDISPONIVEL { --c: var(--na); }

.alvo { margin-top: 14px; font-size: 2rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.alvo-rot { font-size: .78rem; color: var(--muted); }
.margem { margin-top: 6px; font-size: .88rem; color: var(--c); font-weight: 550; }

.gauge { margin: 16px 0 4px; }
.track { position: relative; height: 8px; border-radius: 99px; background: var(--surface-2); }
.fill { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 99px; background: var(--c); transition: width .5s ease; }
.mark { position: absolute; top: -4px; bottom: -4px; left: var(--m); width: 2px; background: var(--fg); border-radius: 2px; }
.legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: .74rem; color: var(--muted); }

dl { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .84rem; }
dt { color: var(--muted); } dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.nota { margin: 12px 0 0; font-size: .8rem; color: var(--wait); }

.avisos { margin: 20px 0 0; padding-left: 18px; color: var(--muted); font-size: .84rem; }
footer { margin-top: 48px; color: var(--muted); font-size: .75rem; text-align: center; }

@media (max-width: 520px) {
  .search { flex-direction: column; }
  button.primary { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ===== layout com barra lateral ===== */
:root {
  --c-graham: #2563eb; --c-bazin: #7c3aed; --c-growth: #0d9488;
}
:root[data-theme="dark"] {
  --c-graham: #60a5fa; --c-bazin: #a78bfa; --c-growth: #2dd4bf;
}
.app { max-width: 1180px; }
.layout {
  display: grid; gap: 0 28px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-areas: "hero side" "result side";
}
.hero { grid-area: hero; }
.resultado-col { grid-area: result; min-width: 0; }
.side { grid-area: side; position: sticky; top: 16px; display: grid; gap: 14px; margin-top: 28px; }

.side-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 10px; }
.side-block header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.side-block h2 { margin: 0; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.link { font: inherit; font-size: .78rem; color: var(--muted); background: none; border: 0; padding: 2px 4px; cursor: pointer; border-radius: 6px; }
.link:hover { color: var(--fg); background: var(--surface-2); }
.link:disabled { opacity: .5; cursor: progress; }
.vazio { margin: 4px 0 6px; font-size: .8rem; color: var(--muted); }
.side-nota { margin: 0; text-align: center; font-size: .72rem; color: var(--muted); }

.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.item { display: flex; align-items: center; gap: 2px; border-radius: 10px; }
.item:hover { background: var(--surface-2); }
.item.ativo { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--fg); }
.item.carregando { opacity: .55; }
.item-main {
  flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; text-align: left;
  font: inherit; color: var(--fg); background: none; border: 0; padding: 8px 8px; cursor: pointer; border-radius: 10px;
}
.item-tk { font-weight: 650; font-size: .92rem; }
.item-px { font-size: .88rem; font-variant-numeric: tabular-nums; text-align: right; }
.item-sub { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: .72rem; color: var(--muted); }
.dots { display: inline-flex; gap: 3px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.item-btn {
  font: inherit; font-size: .95rem; line-height: 1; width: 26px; height: 26px; cursor: pointer; flex: none;
  color: var(--muted); background: none; border: 0; border-radius: 7px; opacity: 0;
}
.item:hover .item-btn, .item:focus-within .item-btn { opacity: 1; }
.item-btn:hover { color: var(--fg); background: var(--surface); }
@media (hover: none) { .item-btn { opacity: 1; } }

/* ===== resultado: ações e tag de salvo ===== */
.resumo-linha { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.acoes { display: flex; gap: 8px; }
.ghost {
  font: inherit; font-size: .85rem; font-weight: 550; cursor: pointer; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px;
}
.ghost:hover { background: var(--surface-2); }
.ghost:disabled { opacity: .55; cursor: progress; }
.ghost[aria-pressed="true"] { color: var(--wait); border-color: color-mix(in srgb, var(--wait) 50%, var(--line)); }
.tag-salvo {
  font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  color: var(--muted); border: 1px solid var(--line);
}

/* ===== gráficos ===== */
.grafico-box { margin-top: 14px; }
.grafico-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grafico-head h2 { margin: 0; font-size: .95rem; font-weight: 650; }
.tabs { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.tab { font: inherit; font-size: .8rem; font-weight: 550; cursor: pointer; color: var(--muted); background: none; border: 0; border-radius: 8px; padding: 5px 12px; }
.tab[aria-selected="true"] { color: var(--fg); background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.grafico-area { position: relative; }
.grafico-area svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafico-vazio { padding: 36px 8px; text-align: center; font-size: .88rem; color: var(--muted); }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-txt { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-line { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--fg); opacity: .05; }
.ch-alvo { fill: none; stroke-width: 1.6; stroke-dasharray: 5 4; }
.ch-hover { stroke: var(--muted); stroke-width: 1; }
.ch-dot { fill: var(--fg); stroke: var(--surface); stroke-width: 2; }
.ch-bar { fill: var(--muted); opacity: .55; }
.ch-bar:hover { opacity: .85; }
.ch-val { fill: var(--fg); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.t-graham { stroke: var(--c-graham); color: var(--c-graham); }
.t-bazin { stroke: var(--c-bazin); color: var(--c-bazin); }
.t-growth { stroke: var(--c-growth); color: var(--c-growth); }
.t-minimo { stroke: var(--wait); color: var(--wait); }
.ch-lab { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ch-lab.t-graham, .ch-lab.t-bazin, .ch-lab.t-growth, .ch-lab.t-minimo { stroke: none; fill: currentColor; }
.tip {
  position: absolute; top: 0; pointer-events: none; padding: 4px 8px; border-radius: 8px; font-size: .75rem; white-space: nowrap;
  color: var(--bg); background: var(--fg); transform: translateX(-50%); font-variant-numeric: tabular-nums;
}
.grafico-legenda { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; font-size: .82rem; }
.grafico-legenda li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.grafico-legenda b { color: var(--fg); font-weight: 600; }
.sw { width: 18px; height: 0; border-top: 2px dashed currentColor; flex: none; }
.sw.cheio { border-top-style: solid; }
.grafico-nota { margin: 10px 0 0; font-size: .75rem; color: var(--muted); }

/* ===== telas menores: lateral vai para baixo da busca ===== */
@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "result" "side"; }
  .side { position: static; margin: 18px 0 0; grid-template-columns: 1fr 1fr; }
  .side-nota { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .side { grid-template-columns: 1fr; }
}

/* ===== login por PIN ===== */
[hidden] { display: none !important; }
.topbar-actions { display: flex; gap: 8px; }
.bloqueio { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg); padding: 20px; }
.lock-tema { position: absolute; top: 20px; right: 20px; }
.lock-card { width: min(100%, 340px); display: grid; justify-items: center; text-align: center; }
.lock-card .logo { color: var(--buy); }
.lock-card h1 { margin: 10px 0 4px; font-size: 1.6rem; }
.lock-sub { min-height: 1.5em; margin: 0 0 22px; font-size: .92rem; color: var(--muted); }
.lock-sub.aviso { color: var(--wait); }
.lock-dots { display: flex; gap: 12px; margin-bottom: 14px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); transition: background .12s, border-color .12s, transform .12s; }
.pin-dot.cheio { background: var(--fg); border-color: var(--fg); transform: scale(1.1); }
.lock-dots.tremer { animation: tremer .4s; }
.lock-hint { margin: 12px 0 0; font-size: .8rem; color: var(--muted); }
@keyframes tremer { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.keypad { display: none; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; max-width: 286px; margin-top: 18px; }
.key {
  font: inherit; font-size: 1.7rem; font-weight: 500; aspect-ratio: 1; border-radius: 50%; cursor: pointer;
  color: var(--fg); background: var(--surface); border: 1px solid var(--line); -webkit-tap-highlight-color: transparent;
}
.key:active { background: var(--surface-2); transform: scale(.95); }
.key.apagar { font-size: 1.4rem; background: transparent; border-color: transparent; color: var(--muted); }
@media (hover: none) and (pointer: coarse) {
  .keypad { display: grid; }
  .lock-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { .lock-dots.tremer { animation: none; } }

/* ===== parâmetros: select, checkbox ===== */
select {
  font: inherit; color: var(--fg); background: var(--surface-2); width: 100%;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 12px;
}
select:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--fg); cursor: pointer; }
.check-label input { width: 16px; height: 16px; accent-color: var(--fg); }
.chip[aria-pressed="true"][data-janela] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ===== método principal ===== */
.principal { margin-top: 14px; padding: 20px; }
.principal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.principal-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.principal-head p { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.principal-corpo { display: grid; gap: 20px 28px; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); margin-top: 16px; align-items: start; }
.principal-res .rot { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.principal-res .teto { font-size: 2.6rem; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.principal-res .margem { margin-top: 6px; }
.principal-res .menor { margin-top: 10px; font-size: .82rem; color: var(--muted); }
.principal-comp { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.bloco { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.bloco.limita { border-color: var(--fg); }
.bloco-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bloco-head h3 { margin: 0; font-size: .9rem; font-weight: 650; }
.bloco-res { font-weight: 700; font-variant-numeric: tabular-nums; }
.bloco-base { margin: 2px 0 10px; font-size: .74rem; color: var(--muted); }
.bloco .l { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: .83rem; }
.bloco .l .k { color: var(--muted); }
.bloco .l .v { font-variant-numeric: tabular-nums; text-align: right; }
.bloco .l.forte { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 7px; font-weight: 650; }
.bloco .l.forte .k { color: var(--fg); }
.bloco .l.min .v { color: var(--buy); font-weight: 650; }
.tag-limita { font-size: .66rem; font-weight: 700; letter-spacing: .05em; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--fg); }

/* proventos (exclusão manual) */
.proventos { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.proventos summary { font-size: .8rem; }
.prov-lista { list-style: none; margin: 8px 0 0; padding: 0; max-height: 220px; overflow: auto; }
.prov label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: .8rem; cursor: pointer; }
.prov input { width: 15px; height: 15px; accent-color: var(--fg); flex: none; }
.prov .pd { color: var(--muted); font-variant-numeric: tabular-nums; }
.prov .pv { margin-left: auto; font-variant-numeric: tabular-nums; }
.prov.off .pd, .prov.off .pv { text-decoration: line-through; opacity: .55; }
.tag-atip { font-size: .66rem; font-weight: 600; color: var(--wait); }
.prov-nota { margin: 8px 0 0; font-size: .74rem; color: var(--muted); }
.prov-nota button { font: inherit; color: var(--fg); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* ===== lucratividade e eficiência ===== */
.lucro { margin-top: 14px; }
.lucro-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.lucro-head h2 { margin: 0; font-size: .95rem; font-weight: 650; }
.lucro-head p { margin: 0; font-size: .76rem; color: var(--muted); }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 14px; }
.kpi { padding: 12px 14px; background: var(--surface-2); border-radius: 12px; }
.kpi .k { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .s { font-size: .72rem; color: var(--muted); }
.kpi.vazio .v { color: var(--muted); }
.lucro details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.tabela-wrap { overflow-x: auto; margin-top: 10px; }
.tabela { border-collapse: collapse; width: 100%; font-size: .82rem; font-variant-numeric: tabular-nums; }
.tabela th, .tabela td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tabela th:first-child, .tabela td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); color: var(--muted); }
.tabela thead th { color: var(--muted); font-weight: 600; }
.lucro .avisos { margin-top: 12px; }

/* ===== fontes dos dados ===== */
.fontes { margin: 14px 0 0; font-size: .76rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.fonte.ok::before { content: "✓ "; color: var(--buy); }
.fonte.falha::before { content: "✗ "; color: var(--wait); }

/* ===== painel da empresa ===== */
.empresa { border: 0; padding: 0; background: transparent; color: var(--fg); max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; }
.empresa::backdrop { background: rgba(0, 0, 0, .55); }
.empresa-box {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(100%, 580px); overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--line); padding: 20px; box-shadow: var(--shadow);
}
.empresa-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.empresa-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.empresa-corpo { display: grid; gap: 14px; margin-top: 14px; }
.sec { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.sec h3 { margin: 0 0 10px; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.emp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.emp-chip { font-size: .74rem; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.emp-chip.forte { color: var(--fg); font-weight: 600; }
.desc { margin: 0; font-size: .86rem; line-height: 1.55; color: var(--fg); }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.mais { font: inherit; font-size: .8rem; color: var(--muted); background: none; border: 0; padding: 4px 0 0; cursor: pointer; text-decoration: underline; }
.fatos { display: grid; gap: 8px 16px; grid-template-columns: 1fr 1fr; margin: 12px 0 0; font-size: .82rem; }
.fatos dt { color: var(--muted); font-size: .72rem; }
.fatos dd { margin: 0; overflow-wrap: anywhere; }
.fatos a { color: var(--fg); }
.tipo-papel { margin: 0; font-size: .86rem; }
.nota-sec { margin: 10px 0 0; font-size: .76rem; color: var(--muted); }
.t-irmaos { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
.t-irmaos th, .t-irmaos td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.t-irmaos th:first-child, .t-irmaos td:first-child { text-align: left; }
.t-irmaos thead th { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.t-irmaos .atual { font-weight: 700; }
.t-irmaos button { font: inherit; font-size: .76rem; cursor: pointer; padding: 3px 9px; color: var(--fg); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.comp-stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.comp-stats .kpi { background: var(--surface-2); }
.barra-comp { display: flex; height: 12px; margin: 14px 0 6px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.barra-comp span { display: block; height: 100%; }
.barra-comp .b-ins { background: var(--c-graham); }
.barra-comp .b-inst { background: var(--c-bazin); }
.legenda-comp { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .76rem; color: var(--muted); }
.legenda-comp i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.t-acion { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
.t-acion td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.t-acion td:last-child { text-align: right; }

@media (max-width: 920px) {
  .principal-corpo { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .principal-comp { grid-template-columns: 1fr; }
  .principal-res .teto { font-size: 2.2rem; }
  .empresa-box { top: auto; width: 100%; max-height: 92%; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; }
  .fatos { grid-template-columns: 1fr; }
}

/* ===== painel da empresa: classes usadas pelo JS ===== */
.emp-sub { margin: 0; font-size: .86rem; color: var(--muted); }
.emp-secao { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.emp-secao h3 { margin: 0 0 10px; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.emp-secao .stats { margin-top: 0; }
.emp-desc { margin: 0; font-size: .86rem; line-height: 1.55; }
.emp-desc.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.emp-nota { margin: 10px 0 0; font-size: .76rem; color: var(--muted); }
.emp-estado { padding: 28px 8px; text-align: center; color: var(--muted); }
.aviso-txt { color: var(--wait); }
.tab-emp { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
.tab-emp th, .tab-emp td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tab-emp th:first-child, .tab-emp td:first-child { text-align: left; }
.tab-emp thead th { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tab-emp tr.atual td { font-weight: 700; }
.emp-barra { display: flex; height: 12px; margin: 14px 0 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.emp-barra span { display: block; height: 100%; }
.emp-barra .ins, .pt.ins { background: var(--c-graham); }
.emp-barra .inst, .pt.inst { background: var(--c-bazin); }
.emp-barra .out, .pt.out { background: var(--line); }
.emp-leg { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
.emp-leg li { display: flex; align-items: center; gap: 8px; }
.pt { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.emp-secao .tabela-wrap { margin-top: 6px; }

/* linha do teto (método principal) nos gráficos */
.t-principal { stroke: var(--fg); color: var(--fg); }
.ch-lab.t-principal { stroke: none; fill: currentColor; }
