/* Fundamenta — mesmo sistema visual do Finances e do Financeiro LXP:
   tokens neutros quentes, amarelo da marca nas ações principais, números em mono, tema claro/escuro. */
:root {
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;
  --r: 16px; --r-sm: 11px;
  --side-w: 232px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --accent: #EEE757; --accent-ink: #141513;
  --c1: #3B82F6; --c2: #EC6FA0; --c3: #A855F7; --c4: #F97316; --c5: #EAB308; --c6: #7C6CF0;
}
html[data-theme=dark] {
  color-scheme: dark;
  --bg: #0A0B09; --bg-2: #0E0F0D; --surface: #131412; --raised: #191A17; --raised-2: #20211D;
  --line: #24251F; --line-2: #31322B; --hover: #1C1D19;
  --fg: #EEEEE8; --fg-2: #C9CAC2; --muted: #8F908A; --faint: #5F605A;
  --pos: #3DDC8E; --pos-soft: rgba(61, 220, 142, .12); --neg: #FF6B6B; --neg-soft: rgba(255, 107, 107, .12);
  --warn: #F5B94A; --warn-soft: rgba(245, 185, 74, .12); --info: #82A7FF; --info-soft: rgba(130, 167, 255, .12);
  --accent-text: #EEE757; --accent-soft: rgba(238, 231, 87, .12); --accent-line: rgba(238, 231, 87, .35);
  --n-bom: #A9DC5C;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04);
  --grid: rgba(255, 255, 255, .05);
  --glow: radial-gradient(1200px 500px at 85% -10%, rgba(238, 231, 87, .06), transparent 60%);
}
html[data-theme=light] {
  color-scheme: light;
  --bg: #F3F3EE; --bg-2: #ECECE6; --surface: #FFFFFF; --raised: #FAFAF7; --raised-2: #F1F1EC;
  --line: #E6E6DF; --line-2: #D6D6CD; --hover: #F4F4EF;
  --fg: #131412; --fg-2: #34352F; --muted: #6E6F68; --faint: #A1A29A;
  --pos: #12854F; --pos-soft: #E3F5EA; --neg: #D23C36; --neg-soft: #FCE9E7; --warn: #A86A00; --warn-soft: #FCF2DC;
  --info: #2F5BD3; --info-soft: #E8EEFC;
  --accent-text: #6E6A10; --accent-soft: #F7F5CC; --accent-line: #DCD66A;
  --n-bom: #5E9A1C;
  --shadow: 0 1px 2px rgba(19, 20, 18, .04), 0 4px 16px rgba(19, 20, 18, .05);
  --shadow-lg: 0 24px 64px rgba(19, 20, 18, .18), 0 0 0 1px rgba(19, 20, 18, .05);
  --grid: rgba(19, 20, 18, .06);
  --glow: radial-gradient(1200px 500px at 85% -10%, rgba(238, 231, 87, .18), transparent 60%);
}
/* faixas da nota */
html { --n-forte: var(--pos); --n-neutro: var(--warn); --n-fraco: var(--neg); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font: 14px/1.5 var(--font); background: var(--bg); color: var(--fg);
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  -webkit-font-smoothing: antialiased; font-feature-settings: "ss01", "cv11";
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
p { margin: 0; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.chart svg { width: auto; height: auto; fill: initial; stroke: initial; stroke-width: initial; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--bg); }
kbd { font: 500 11px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); background: var(--raised); }
code { font: 12px var(--mono); background: var(--raised-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }

/* modo privado: esconde valores da carteira */
html.privado .priv { filter: blur(7px); transition: filter .2s; }
html.privado .priv:hover { filter: none; }

/* ---------- menu lateral ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 12px; border-right: 1px solid var(--line); background: var(--bg-2);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: 0 0 24px rgba(238, 231, 87, .25);
}
.brand-mark svg { width: 17px; height: 17px; stroke-width: 2.2; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; }
.brand-sub { color: var(--muted); font-size: 11px; }
.nav-sec { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
nav { display: flex; flex-direction: column; gap: 1px; }
nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 10px;
  color: var(--fg-2); font-weight: 500; font-size: 13.5px; position: relative; transition: background .15s, color .15s;
}
nav a:hover { background: var(--hover); color: var(--fg); }
nav a.ativo { background: var(--raised-2); color: var(--fg); }
nav a.ativo::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 4px; }
.perfil-box label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 0 0 6px 8px; }
.dados-info { font-size: 12px; color: var(--muted); line-height: 1.7; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.dados-info b { color: var(--fg-2); font: 500 12px var(--mono); }

.usuario { display: flex; align-items: center; gap: 10px; padding: 10px 4px 0 6px; border-top: 1px solid var(--line); }
.usuario:empty { display: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; object-fit: cover;
  background: linear-gradient(135deg, var(--accent), #9D9B32); color: var(--accent-ink); font-weight: 700; font-size: 13px; }
.usuario-txt { flex: 1; min-width: 0; line-height: 1.25; }
.usuario-txt b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-txt small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario form { margin: 0; }

/* ---------- campos e botões ---------- */
select, input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--fg); outline: none; transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238F908A' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
select:focus, input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 11px; font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, filter .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface); color: var(--fg); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--hover); }
.btn-primary:active, .btn-ghost:active { transform: translateY(1px); }
.btn-ghost[disabled], .btn-primary[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; color: var(--fg-2); cursor: pointer; font-size: 20px; line-height: 1;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn.girando svg { animation: gira 1s linear infinite; color: var(--accent-text); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }

/* ---------- barra superior ---------- */
main { min-width: 0; background: var(--glow); }
.topo { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topo-in { display: flex; align-items: center; gap: 8px; padding: 12px 28px; max-width: 1480px; margin: 0 auto; }
.topo-in .esp { flex: 1; }
.topo-sep { width: 1px; height: 26px; background: var(--line-2); margin: 0 4px; }
.busca { position: relative; width: 320px; }
.busca svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.busca input { height: 38px; padding-left: 36px; padding-right: 40px; background: var(--surface); border-color: var(--line); }
.busca kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.topbar-acoes { display: flex; gap: 6px; align-items: center; }
.btn-primary kbd { background: rgba(0, 0, 0, .08); border-color: rgba(0, 0, 0, .15); color: var(--accent-ink); }

.pagina { padding: 26px 28px 80px; max-width: 1480px; margin: 0 auto; }
.cab { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.crumb { color: var(--muted); font-size: 13px; margin-top: 4px; }
h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.025em; }
h1 em { font-style: normal; color: inherit; }
.view { animation: entra .35s var(--ease) both; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } }

.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.g-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt { margin-top: 16px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.card-sub { font-size: 12.5px; color: var(--muted); }

.kpi-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-valor { font: 600 25px/1.1 var(--mono); letter-spacing: -.04em; margin-top: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi-valor small { font-size: 15px; color: var(--muted); font-weight: 500; margin-right: 3px; }
.kpi-rodape { font-size: 12px; color: var(--muted); margin-top: 8px; }
.kpi-destaque { background: linear-gradient(140deg, var(--accent-soft), transparent 60%), var(--surface); border-color: var(--accent-line); }
.delta { font: 500 11.5px var(--mono); padding: 1px 6px; border-radius: 6px; }
.delta.pos { background: var(--pos-soft); } .delta.neg { background: var(--neg-soft); }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow-x: auto; margin: 0 -20px -18px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
th { text-align: right; font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th.l, td.l { text-align: left; }
th.ord { cursor: pointer; user-select: none; }
th.ord:hover { color: var(--fg); }
th.ord.on { color: var(--accent-text); }
td { text-align: right; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-family: var(--mono); font-size: 13px; letter-spacing: -.02em; }
td.l { font-family: var(--font); font-size: 13.5px; letter-spacing: normal; }
tbody tr { transition: background .12s; }
tbody tr.click { cursor: pointer; }
tbody tr:hover td { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
tr.inelegivel td { color: var(--muted); }
.ativo-cel { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  font: 700 10px var(--mono); letter-spacing: -.02em; color: var(--fg-2); background: var(--raised-2); border: 1px solid var(--line);
}
.ativo-tk { font-weight: 600; font-family: var(--font); }
.ativo-nm { font-size: 12px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-family: var(--font); letter-spacing: normal; }

/* ---------- nota, tags ---------- */
.nota-pill { display: inline-flex; align-items: center; gap: 8px; font: 600 13px var(--mono); }
.nota-pill .barra { width: 52px; height: 6px; border-radius: 6px; background: var(--raised-2); overflow: hidden; }
.nota-pill .barra i { display: block; height: 100%; border-radius: inherit; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 7px;
  font: 600 11.5px var(--font); white-space: nowrap; letter-spacing: normal;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.simples { background: var(--raised-2); color: var(--fg-2) !important; font-weight: 500; }
.tag.simples::before { display: none; }
.pilares-mini { display: inline-flex; gap: 3px; align-items: flex-end; height: 22px; }
.pilares-mini i { width: 6px; border-radius: 2px; }

/* ---------- filtros ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filtros input { width: 240px; height: 36px; border-radius: 10px; }
.filtros select { width: auto; min-width: 200px; height: 36px; border-radius: 10px; }
.chips { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--raised-2); border: 1px solid var(--line); gap: 2px; }
.chips button { height: 30px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 500; font-size: 13px; cursor: pointer; }
.chips button:hover { color: var(--fg); }
.chips button.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
html[data-theme=dark] .chips button.on { background: var(--line-2); }
.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-2); cursor: pointer; user-select: none; font-size: 13px; }
.toggle input { width: 38px; height: 22px; appearance: none; border-radius: 22px; padding: 0; border: 0; background: var(--line-2); position: relative; cursor: pointer; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s var(--ease); }
.toggle input:checked { background: var(--pos); }
.toggle input:checked::after { left: 19px; }
.toggle input:focus { box-shadow: none; }

/* ---------- pódio ---------- */
.podio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.podio .card { cursor: pointer; position: relative; overflow: hidden; transition: transform .2s var(--ease), border-color .2s; }
.podio .card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.podio .card:first-child { background: linear-gradient(140deg, var(--accent-soft), transparent 60%), var(--surface); border-color: var(--accent-line); }
.podio .pos-n { position: absolute; right: 18px; top: 12px; font: 600 13px var(--mono); color: var(--faint); }
.podio .linha { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.podio .metricas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.metrica-l { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.metrica-v { font: 600 13px var(--mono); margin-top: 2px; }
.nota-grande { font: 600 38px/1 var(--mono); letter-spacing: -.05em; margin-bottom: 8px; }

/* ---------- empresa ---------- */
.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; }
.hero .logo { width: 56px; height: 56px; border-radius: 14px; font-size: 13px; }
.hero-nome { font-size: 22px; font-weight: 600; letter-spacing: -.025em; line-height: 1.2; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.hero-preco { text-align: right; }
.hero-preco .v { font: 600 28px var(--mono); letter-spacing: -.04em; }
.anel { position: relative; width: 116px; height: 116px; }
.anel svg { width: 116px; height: 116px; transform: rotate(-90deg); }
.anel .centro { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.anel .centro b { font: 600 30px var(--mono); letter-spacing: -.05em; display: block; line-height: 1; }
.anel .centro span { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.hero-nota { display: flex; align-items: center; gap: 22px; }
.ind-grupo + .ind-grupo { margin-top: 18px; }
.ind-grupo h4 { margin: 0 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; display: flex; justify-content: space-between; }
.ind-grupo h4 span:last-child { font: 600 12.5px var(--mono); letter-spacing: -.02em; }
.ind { display: grid; grid-template-columns: 1fr 90px 120px; gap: 14px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ind:last-child { border-bottom: 0; }
.ind-nome { color: var(--fg-2); font-size: 13.5px; }
.ind-nome small { display: block; color: var(--muted); font-size: 11.5px; }
.ind-valor { text-align: right; font: 600 13px var(--mono); letter-spacing: -.02em; }
.pct { height: 6px; border-radius: 6px; background: var(--raised-2); position: relative; overflow: hidden; }
.pct i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; }

/* alertas em faixa, como no Finances */
.lista-alertas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lista-alertas li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 11px; line-height: 1.45;
  font-size: 13px; color: var(--fg-2); border: 1px solid var(--line); background: var(--raised); }
.lista-alertas li svg { margin-top: 1px; width: 16px; height: 16px; }
.ins-risco { background: linear-gradient(90deg, var(--neg-soft), transparent 70%) !important; }
.ins-risco svg { color: var(--neg); }
.ins-atencao { background: linear-gradient(90deg, var(--warn-soft), transparent 70%) !important; }
.ins-atencao svg { color: var(--warn); }
.ins-info svg { color: var(--info); }

.vazio { padding: 48px 20px; text-align: center; color: var(--muted); }
.vazio h3 { font-size: 18px; color: var(--fg); margin: 0 0 6px; }
.vazio p { max-width: 460px; margin: 0 auto 20px; line-height: 1.6; }
.chart { width: 100%; height: 300px; }
.chart.sm { height: 240px; }
.legenda { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legenda i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* ---------- configurações ---------- */
.form-cfg { display: flex; flex-direction: column; gap: 12px; }
.form-cfg label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.form-cfg.linha { flex-direction: row; max-width: 640px; }
.form-cfg.linha input { font-family: var(--mono); }
.cfg-rodape { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.cfg-rodape .btn-primary { margin-left: auto; }
.cfg-ajuda { font-size: 13px; line-height: 1.55; margin-bottom: 14px; }

/* ---------- metodologia ---------- */
.prosa { line-height: 1.7; color: var(--fg-2); }
.prosa h3 { font-size: 15px; color: var(--fg); margin: 0 0 6px; }
.peso-barra { display: flex; height: 8px; border-radius: 8px; overflow: hidden; margin: 10px 0 6px; gap: 2px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: start center; padding-top: 12vh;
  background: rgba(5, 6, 5, .55); backdrop-filter: blur(3px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.modal-card { width: min(560px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px;
  padding: 22px; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.grid2 label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; flex-direction: column; gap: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 12px; background: var(--raised-2); border: 1px solid var(--line); gap: 2px; }
.seg input { display: none; }
.seg label { text-align: center; height: 32px; display: grid; place-items: center; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; }
.seg label:hover { color: var(--fg); }
.seg input:checked + label { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
html[data-theme=dark] .seg input:checked + label { background: var(--line-2); }
#t-compra:checked + label { color: var(--pos); }
#t-venda:checked + label { color: var(--neg); }
#t-provento:checked + label { color: var(--accent-text); }
.form-total { margin-top: 14px; font-size: 13px; color: var(--muted); min-height: 18px; }
.form-total b { color: var(--fg); font-family: var(--mono); }
.form-erro { color: var(--neg); font-size: 13px; min-height: 18px; margin-top: 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin: 14px -22px -22px; padding: 14px 22px; border-top: 1px solid var(--line); }

.toast { position: fixed; z-index: 120; top: 76px; right: 24px; max-width: 400px; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: 14px; background: var(--surface); color: var(--fg); border: 1px solid var(--line-2);
  border-left: 4px solid var(--pos); box-shadow: var(--shadow-lg); font-size: 13.5px;
  opacity: 0; transform: translateX(24px); pointer-events: none; transition: .3s var(--ease); }
.toast.on { opacity: 1; transform: none; }

.skeleton { background: linear-gradient(90deg, var(--raised), var(--raised-2), var(--raised)); background-size: 200% 100%; animation: brilho 1.4s infinite; }
@keyframes brilho { to { background-position: -200% 0; } }
.aviso { font-size: 12px; color: var(--faint); margin-top: 24px; line-height: 1.6; max-width: 900px; }

/* ---------- IA ---------- */
.ia-card { background: linear-gradient(160deg, var(--accent-soft), transparent 45%), var(--surface); border-color: var(--accent-line); }
.ia-titulo { display: flex; align-items: center; gap: 8px; }
.ia-titulo svg { color: var(--accent-text); }
.ia-vazio p { color: var(--fg-2); line-height: 1.6; max-width: 760px; margin: 0 0 16px; }
.chave-form { display: flex; gap: 8px; max-width: 560px; }
.chave-form input { font-family: var(--mono); }
.ia-progresso { display: flex; align-items: center; gap: 12px; padding: 14px 0; color: var(--fg-2); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent-text); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.ia-topo { display: flex; flex-direction: column; gap: 10px; }
.ia-resumo { font-size: 17px; line-height: 1.55; margin: 0; color: var(--fg); max-width: 1000px; letter-spacing: -.01em; }
.ia-bloco { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.ia-bloco h4 { margin: 0 0 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.ia-bloco p { margin: 0; line-height: 1.6; color: var(--fg-2); font-size: 13.5px; }
.ia-destaque { border-color: var(--accent-line); }
.ia-lista { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--fg-2); line-height: 1.5; font-size: 13.5px; }
.fonte { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 6px;
  font: 600 10px var(--mono); color: var(--accent-text); background: var(--accent-soft); vertical-align: 1px; }
.fonte:hover { outline: 1px solid var(--accent-line); }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 12px 84px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); line-height: 1.5; font-size: 13.5px; }
.tl-item:last-child { border-bottom: 0; }
.tl-ponto { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.tl-data { color: var(--muted); font: 12px var(--mono); padding-top: 2px; }
.ia-fontes { margin-top: 14px; color: var(--muted); font-size: 13px; }
.ia-fontes summary { cursor: pointer; }
.ia-fontes ol { line-height: 1.8; }
.ia-fontes a { color: var(--fg-2); }
.ia-fontes a:hover { color: var(--accent-text); }

@media (max-width: 1280px) {
  .g-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 10px; }
  .brand { padding: 0 8px 0 0; }
  .nav-sec { display: none; }
  nav { flex-direction: row; flex-wrap: wrap; }
  nav a.ativo::before { display: none; }
  .sidebar-foot { margin: 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .dados-info { display: none; }
  .topo-in, .pagina { padding-left: 16px; padding-right: 16px; }
  .busca { width: auto; flex: 1; }
  .g-2-1, .g-1-1, .g-3, .podio { grid-template-columns: 1fr; }
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .hero-preco { text-align: left; }
}
@media (max-width: 560px) {
  .g-kpi { grid-template-columns: 1fr; }
  .topo-sep, .btn-primary .rot-longo { display: none; }
  .filtros input, .filtros select { width: 100%; }
  .grid2 { grid-template-columns: 1fr; }
}
