/* ============================================================
   Simulador v2 — shell dashboard escuro (estilo Controle One)
   ============================================================ */
:root {
  --orange:#fa6400; --orange-soft:#ff7a1f; --orange-deep:#c44e00;
  --orange-12:rgba(250,100,0,0.12); --orange-18:rgba(250,100,0,0.18);
  --green:#85b363; --blue-light:#b1d4ec; --red:#d44343;
  --gold:#bd9533; --turquoise:#2fb7ab;
  --bg-0:#1a1a1a; --bg-1:#1e1e1e; --bg-2:#232323; --bg-3:#2b2b2b; --bg-4:#353535;
  --line:#3a3a3a; --line-soft:rgba(255,255,255,0.06);
  --text:#f1f1f1; --text-muted:#c9c9c9; --text-dim:#8a8a8a; --text-faint:#5a5a5a;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; background:var(--bg-0); color:var(--text);
  font-family:'Ubuntu', system-ui, sans-serif; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
.mono { font-family:'Ubuntu Mono', ui-monospace, monospace; }

/* ---------- App shell ---------- */
.app { display:grid; grid-template-columns:72px 1fr; min-height:100vh; align-items:start; }
.main { padding:26px 32px 40px; display:flex; flex-direction:column; gap:20px; min-width:0; }
@media (max-width:1024px){ .main { padding:18px 18px 32px; } .app { grid-template-columns:64px 1fr; } }

/* ---------- Sidebar (trilho enxuto) ---------- */
.sidebar { background:var(--bg-1); border-right:1px solid var(--line-soft); display:flex; flex-direction:column;
  width:72px; transition:width 200ms cubic-bezier(.2,.8,.2,1); position:sticky; top:0; height:100vh; overflow:hidden; z-index:50; }
.sidebar:hover { width:240px; box-shadow:18px 0 40px -20px rgba(0,0,0,.6); }
@media (max-width:1024px){ .sidebar, .sidebar:hover { width:64px; } .sidebar:hover .sb-word,.sidebar:hover .sb-item .label,.sidebar:hover .sb-user .meta{ opacity:0; } }

.sb-brand { display:flex; align-items:center; gap:12px; padding:18px 16px; height:72px; border-bottom:1px solid var(--line-soft); }
.sb-mark { width:40px; height:40px; position:relative; display:grid; place-items:center; flex-shrink:0; filter:drop-shadow(0 6px 14px rgba(250,100,0,.4)); }
.sb-mark .mk-shield { width:40px; height:40px; object-fit:contain; }
.sb-mark .mk-bird { position:absolute; width:21px; height:21px; object-fit:contain; left:50%; top:43%; transform:translate(-50%,-50%); }
.sb-word { font-weight:700; font-size:17px; letter-spacing:-.01em; white-space:nowrap; color:var(--text); opacity:0; transition:opacity 160ms ease 60ms; }
.sb-word span { color:var(--orange); }
.sidebar:hover .sb-word { opacity:1; }

.sb-section { font-family:'Ubuntu Mono', monospace; font-size:10px; color:var(--text-faint); letter-spacing:.16em; text-transform:uppercase; padding:18px 22px 8px; white-space:nowrap; opacity:0; transition:opacity 160ms ease; }
.sidebar:hover .sb-section { opacity:1; }
.sb-list { list-style:none; margin:0; padding:8px 12px; display:flex; flex-direction:column; gap:4px; }
.sb-item { display:flex; align-items:center; gap:14px; padding:10px 12px; border-radius:10px; color:var(--text-muted); cursor:pointer; white-space:nowrap; text-decoration:none; font-size:14px; transition:background 160ms ease, color 160ms ease; height:44px; overflow:hidden; border:0; background:none; width:100%; text-align:left; font-family:inherit; }
.sb-item:hover { background:var(--bg-3); color:var(--text); }
.sb-item .ico { width:22px; height:22px; flex-shrink:0; display:grid; place-items:center; }
.sb-item .ico svg { width:20px; height:20px; stroke-width:1.8; }
.sb-item .ico img { width:24px; height:24px; object-fit:contain; }
.sb-item .label { opacity:0; transition:opacity 160ms ease 60ms; }
.sidebar:hover .sb-item .label { opacity:1; }
.sb-item.active { background:var(--orange-12); color:var(--orange); }
.sb-spacer { flex:1; }
.ia-mark { color:var(--orange); font-weight:inherit; }
.ai-head-txt b .ia-mark { color:var(--orange); font-size:inherit; font-weight:inherit; }

.sb-oneia { margin:0 12px 4px; padding:10px 12px; height:auto; min-height:56px; border-radius:12px; background:linear-gradient(135deg, rgba(250,100,0,.16), rgba(250,100,0,.05)); border:1px solid var(--orange-18); display:flex; align-items:center; gap:12px; cursor:pointer; color:var(--text); overflow:hidden; }
.sb-oneia:hover { border-color:var(--orange); }
.sb-oneia.active { background:var(--orange-18); border-color:var(--orange); }
.sb-oneia .av { width:34px; height:34px; border-radius:50%; background:#fff; display:grid; place-items:center; flex-shrink:0; box-shadow:0 2px 8px rgba(0,0,0,.3); }
.sb-oneia .av img { width:24px; height:24px; object-fit:contain; }
.sb-oneia .av svg { width:20px; height:20px; color:var(--orange); }
.sb-oneia .meta { display:flex; flex-direction:column; gap:1px; white-space:nowrap; opacity:0; transition:opacity 160ms ease 60ms; }
.sidebar:hover .sb-oneia .meta { opacity:1; }
.sb-oneia .meta b { font-size:13px; font-weight:700; }
.sb-oneia .meta span { font-size:11px; color:var(--text-dim); }

.sb-user { border-top:1px solid var(--line-soft); padding:14px 16px; display:flex; align-items:center; gap:12px; height:64px; overflow:hidden; }
.sb-user .avatar { width:36px; height:36px; border-radius:50%; background:var(--orange); display:grid; place-items:center; font-weight:700; font-size:13px; color:#fff; flex-shrink:0; }
.sb-user .meta { display:flex; flex-direction:column; gap:2px; white-space:nowrap; opacity:0; transition:opacity 160ms ease 60ms; }
.sidebar:hover .sb-user .meta { opacity:1; }
.sb-user .name { font-size:13px; font-weight:500; color:var(--text); }
.sb-user .role { font-size:11px; color:var(--text-dim); }

/* ---------- Page head ---------- */
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; flex-wrap:wrap; }
.page-head .crumb { font-family:'Ubuntu Mono', monospace; font-size:11px; color:var(--text-dim); letter-spacing:.14em; text-transform:uppercase; margin-bottom:8px; display:flex; align-items:center; gap:8px; }
.page-head .crumb::before { content:""; width:24px; height:1px; background:var(--orange); }
.page-head h1 { font-size:clamp(26px,2.2vw,32px); font-weight:500; margin:0; letter-spacing:-.02em; line-height:1.15; }
.head-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.biz-field { display:flex; align-items:center; gap:8px; background:var(--bg-2); border:1px solid var(--line); border-radius:10px; padding:0 12px; height:42px; }
.biz-field svg { width:16px; height:16px; color:var(--text-dim); }
.biz-field input { background:none; border:0; color:var(--text); font-family:inherit; font-size:14px; outline:none; width:200px; }
.biz-field input::placeholder { color:var(--text-faint); }
.btn-ghost { height:42px; padding:0 16px; border-radius:10px; background:var(--bg-2); color:var(--text-muted); border:1px solid var(--line); font-family:inherit; font-size:13px; font-weight:500; cursor:pointer; display:inline-flex; align-items:center; gap:8px; transition:border-color 160ms ease, color 160ms ease; }
.btn-ghost:hover { border-color:var(--bg-4); color:var(--text); }
.btn-ghost svg { width:15px; height:15px; }
.btn-primary { height:42px; padding:0 18px; border-radius:10px; background:var(--orange); color:#fff; border:none; font-family:inherit; font-size:14px; font-weight:500; cursor:pointer; display:inline-flex; align-items:center; gap:8px; box-shadow:0 6px 18px -6px rgba(250,100,0,.55); transition:background 160ms ease; }
.btn-primary:hover { background:var(--orange-soft); }
.btn-primary svg { width:16px; height:16px; }

/* ---------- Panels ---------- */
.panel { background:var(--bg-1); border:1px solid var(--line-soft); border-radius:16px; overflow:hidden; }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 20px; }
.panel-head .ph-title { display:flex; align-items:center; gap:12px; min-width:0; }
.panel-head h2 { font-size:15px; font-weight:700; margin:0; letter-spacing:-.01em; }
.panel-head .ph-sub { font-size:12px; color:var(--text-dim); }
.panel-head .ph-actions { display:flex; align-items:center; gap:10px; }
.group-toggle { width:30px; height:30px; border-radius:8px; background:var(--bg-2); border:1px solid var(--line); color:var(--text-muted); cursor:pointer; display:grid; place-items:center; transition:transform 200ms ease, background 160ms ease; }
.group-toggle svg { width:16px; height:16px; }
.group-toggle:hover { background:var(--bg-3); color:var(--text); }
.panel.is-collapsed .group-toggle { transform:rotate(-90deg); }
.collapsible { transition:max-height 240ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease, padding 200ms ease; max-height:1200px; }
.collapsible.collapsed { max-height:0; opacity:0; padding-top:0!important; padding-bottom:0!important; pointer-events:none; }

/* ---------- Entradas (topo) — slider de valor ---------- */
.inputs-grid { display:grid; grid-template-columns:repeat(3, 1fr); gap:20px 60px; padding:8px 20px 24px; }
@media (max-width:1100px){ .inputs-grid { grid-template-columns:repeat(2,1fr); } }
@media (max-width:680px){ .inputs-grid { grid-template-columns:1fr; } }
.incard { display:flex; }
.incard-top { display:flex; align-items:center; justify-content:flex-start; gap:14px; width:100%; }
.incard-label { font-size:13.5px; font-weight:700; color:var(--text); display:flex; flex-direction:column; gap:2px; flex:none; width:155px; }
.incard-label .tech { display:none; }
.incard-sub { font-size:11.5px; font-weight:400; color:var(--text-dim); }
.incard-val { display:flex; align-items:baseline; gap:4px; width:200px; flex:none; color:var(--orange); border:1px solid var(--line); border-radius:9px; padding:7px 12px; background:var(--bg-2); cursor:text; transition:border-color 140ms ease, box-shadow 140ms ease; }
.incard-val::after { content:"\270E"; font-size:12px; color:var(--text-faint); opacity:0; transition:opacity 140ms ease; align-self:center; margin-left:2px; }
.incard-val:hover { border-color:var(--bg-4); }
.incard-val:hover::after { opacity:1; }
.incard-val:focus-within { border-color:var(--orange); box-shadow:0 0 0 3px rgba(250,100,0,.18); }
.incard-val:focus-within::after { opacity:0; }
.incard-val .cur { font-size:13px; font-weight:500; color:var(--text-dim); }
.incard-val input { flex:1; min-width:0; background:none; border:0; color:var(--orange); font-family:inherit; font-size:19px; font-weight:700; text-align:right; outline:none; letter-spacing:-.01em; padding:0; cursor:text; }
.incard-val input::-webkit-outer-spin-button,.incard-val input::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }

/* seletor de unidade do ticket */
.unit-row { padding:18px 20px 22px; margin-top:4px; border-top:1px solid var(--line-soft); }
.panel.is-collapsed .unit-row { display:none; }
.unit-q { font-size:13px; font-weight:700; color:var(--text); display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.unit-q .unit-hint { font-size:11.5px; font-weight:400; color:var(--text-dim); }
.unit-line { display:flex; align-items:center; gap:14px 22px; flex-wrap:wrap; }
.unit-opts { display:flex; flex-wrap:wrap; gap:8px; }
.unit-chip { display:inline-flex; align-items:center; gap:8px; padding:8px 13px 8px 10px; border-radius:999px; background:var(--bg-2); border:1px solid var(--line); color:var(--text-muted); font-family:inherit; font-size:12.5px; font-weight:600; cursor:pointer; transition:border-color .14s, color .14s, background .14s; }
.unit-chip:hover { border-color:var(--bg-4); color:var(--text); }
.unit-chip.active { background:var(--orange-12); border-color:var(--orange); color:var(--orange); }
.unit-chip .uc-ic { width:20px; height:20px; display:grid; place-items:center; flex:none; }
.unit-chip .uc-ic svg { width:17px; height:17px; }
.unit-chip .uc-ic img { width:18px; height:18px; object-fit:contain; border-radius:3px; }
.unit-custom { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding-left:22px; border-left:1px solid var(--line-soft); }
.unit-custom input[type=text] { background:var(--bg-2); border:1px solid var(--line); border-radius:8px; color:var(--text); font-family:inherit; font-size:13px; padding:8px 12px; outline:none; width:240px; }
.unit-custom input[type=text]:focus { border-color:var(--orange); }
.unit-custom input[type=text]::placeholder { color:var(--text-faint); }
.unit-upload { display:inline-flex; align-items:center; gap:7px; padding:8px 13px; border-radius:8px; background:var(--bg-2); border:1px solid var(--line); color:var(--text-muted); font-size:12.5px; font-weight:600; cursor:pointer; transition:border-color .14s, color .14s; }
.unit-upload:hover { border-color:var(--orange); color:var(--orange); }
.unit-upload svg { width:15px; height:15px; }

/* toggle da camada custo por unidade */
.layer-toggle { display:inline-flex; align-items:center; gap:8px; height:34px; padding:0 13px; border-radius:9px; background:var(--bg-2); border:1px solid var(--line); color:var(--text-dim); font-family:inherit; font-size:12.5px; font-weight:600; cursor:pointer; transition:border-color .14s, color .14s, background .14s; }
.layer-toggle .lt-dot { width:9px; height:9px; border-radius:50%; background:var(--text-faint); box-shadow:none; transition:background .14s, box-shadow .14s; }
.layer-toggle:hover { color:var(--text); }
.layer-toggle.on { color:#2fb7ab; border-color:rgba(47,183,171,.5); background:rgba(47,183,171,.12); }
.layer-toggle.on .lt-dot { background:#2fb7ab; box-shadow:0 0 0 3px rgba(47,183,171,.22); }

/* range — preenchimento laranja + thumb com halo (estilo da referência) */
.vrange { -webkit-appearance:none; appearance:none; width:100%; height:6px; border-radius:6px; outline:none; cursor:pointer;
  background:linear-gradient(to right, var(--orange) 0%, var(--orange) var(--fill,50%), var(--bg-4) var(--fill,50%), var(--bg-4) 100%); }
.vrange::-webkit-slider-thumb { -webkit-appearance:none; appearance:none; width:18px; height:18px; border-radius:50%; background:var(--orange); border:3px solid #2a2008; box-shadow:0 0 0 4px rgba(250,100,0,.22), 0 2px 6px rgba(0,0,0,.4); cursor:pointer; transition:box-shadow 140ms ease; }
.vrange::-webkit-slider-thumb:hover { box-shadow:0 0 0 6px rgba(250,100,0,.28), 0 2px 8px rgba(0,0,0,.5); }
.vrange::-moz-range-thumb { width:18px; height:18px; border-radius:50%; background:var(--orange); border:3px solid #2a2008; box-shadow:0 0 0 4px rgba(250,100,0,.22); cursor:pointer; }

/* ---------- View tabs + segmentos ---------- */
.viz-bar { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.seg { display:inline-flex; align-items:center; gap:4px; background:var(--bg-2); border:1px solid var(--line); border-radius:10px; padding:4px; }
.seg .lbl { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-faint); padding:0 6px 0 8px; }
.seg button { border:0; background:none; color:var(--text-dim); font-family:inherit; font-size:13px; font-weight:500; padding:7px 14px; border-radius:7px; cursor:pointer; display:inline-flex; align-items:center; gap:7px; transition:background 140ms ease, color 140ms ease; }
.seg button svg { width:15px; height:15px; }
.seg button:hover { color:var(--text); }
.seg button.active { background:var(--orange); color:#fff; }
.seg.subtle button.active { background:var(--bg-4); color:var(--text); }
.viz-right { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

/* ---------- Chart card ---------- */
.chart-card { background:var(--bg-1); border:1px solid var(--line-soft); border-radius:16px; padding:16px 18px; display:flex; flex-direction:column; gap:12px; }
.chart-toolbar { display:flex; align-items:center; justify-content:flex-end; gap:12px 16px; flex-wrap:wrap; }
.ctrl-group { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.pb-wrap { display:flex; align-items:center; gap:10px; }
.pb-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-faint); }
.pb-seg { display:inline-flex; gap:4px; background:var(--bg-2); border:1px solid var(--line); border-radius:9px; padding:4px; }
/* ---------- Legenda das velas (receita + lucro · real → simulado) ---------- */
.cdl-legend { display:flex; flex-wrap:wrap; gap:10px; padding:2px 2px 0; }
.cdl-item { flex:1 1 140px; max-width:260px; background:var(--bg-2); border:1px solid var(--line-soft); border-radius:10px; padding:9px 12px; display:flex; flex-direction:column; gap:5px; }
.cdl-realcard { border-color:rgba(201,201,201,0.22); background:var(--bg-3); }
.cdl-head { display:flex; align-items:center; gap:7px; font-size:12px; font-weight:700; color:var(--text); }
.cdl-dot { width:9px; height:9px; border-radius:50%; flex:none; }
.cdl-line { display:flex; align-items:baseline; justify-content:space-between; gap:8px; font-size:11.5px; }
.cdl-line .lbl { color:var(--text-dim); }
.cdl-nums { font-variant-numeric:tabular-nums; white-space:nowrap; }
.cdl-val { color:var(--text); font-weight:600; }
.cdl-before { color:var(--text-faint); }
.cdl-arrow { color:var(--text-faint); margin:0 4px; }
.cdl-pos { color:var(--green); font-weight:600; }
.cdl-neg { color:var(--red); font-weight:600; }
/* ---------- Painel "pra onde vai a receita" (barras horizontais sobre o gráfico) ---------- */
.rev-panel { position:absolute; top:38px; left:58px; width:min(31%,310px); z-index:3; pointer-events:none; display:flex; flex-direction:column; gap:7px; background:rgba(18,15,13,0.62); backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px); border:1px solid rgba(255,255,255,0.06); border-radius:10px; padding:10px 12px; }
.rev-cap { font-size:11px; font-weight:700; color:var(--text-muted); letter-spacing:.01em; }
.rev-key { display:flex; flex-wrap:wrap; gap:4px 11px; font-size:10px; color:var(--text-dim); }
.rev-key span { display:inline-flex; align-items:center; gap:4px; }
.rev-key i { width:9px; height:9px; border-radius:2px; display:inline-block; flex:none; }
.rev-bars { display:flex; flex-direction:column; gap:6px; margin-top:2px; }
.rb-row { display:flex; align-items:center; gap:8px; }
.rb-tag { font-size:11px; font-weight:700; width:20px; flex:none; text-align:right; font-variant-numeric:tabular-nums; }
.rb-track { position:relative; flex:1; height:15px; border-radius:3px; background:rgba(255,255,255,0.05); overflow:hidden; }
.rb-seg { position:absolute; top:0; height:100%; }
.rb-refline { position:absolute; top:0; height:100%; width:2px; background:rgba(255,255,255,0.9); }
.rb-imp { background:#ffa85c; }
.rb-var { background:#ff7a1f; }
.rb-fix { background:#e2540a; }
.rb-emp { background:#b24300; }
.rb-luc { background:#85b363; }
.rb-pre { background:rgba(212,67,67,0.82); }
.pb-seg button { border:0; background:none; color:var(--text-dim); font-family:inherit; font-size:12.5px; font-weight:600; padding:6px 12px; border-radius:6px; cursor:pointer; display:inline-flex; align-items:center; gap:6px; transition:background 140ms ease, color 140ms ease; }
.pb-seg button .dot { width:8px; height:8px; border-radius:50%; }
.pb-seg button:hover { color:var(--text); }
.pb-seg button.active { background:var(--bg-4); color:var(--text); }
.chart-box { background:transparent; border:0; border-radius:12px; padding:4px 4px 2px; height:clamp(504px, 67vh, 768px); position:relative; }
.chart-box canvas { width:100%!important; height:100%!important; }
.chart-hint { font-size:12px; color:var(--text-dim); display:flex; align-items:center; gap:8px; }
.chart-hint svg { width:14px; height:14px; color:var(--orange); }

/* ---------- Simulação (base) ---------- */
.sim-groups { display:grid; grid-template-columns:1fr; gap:0; }
.sim-block { padding:6px 20px 20px; }
.sim-block + .sim-block { border-top:1px solid var(--line-soft); padding-top:16px; }
.sim-block-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0 14px; }
.sim-block-head h3 { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.1em; color:var(--text-dim); margin:0; display:flex; align-items:center; gap:8px; }
.sim-block-head .group-toggle { width:26px; height:26px; }
.sim-grid { display:grid; grid-template-columns:repeat(2, 1fr); gap:16px 32px; }
.sim-grid.three { grid-template-columns:repeat(3, 1fr); gap:30px 40px; padding-bottom:4px; }
@media (max-width:1100px){ .sim-grid.three { grid-template-columns:repeat(2,1fr); } }
@media (max-width:820px){ .sim-grid, .sim-grid.three { grid-template-columns:1fr; } }
.simrow { display:flex; flex-direction:column; gap:8px; }
.simrow-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.simrow-label { font-size:13px; font-weight:600; color:var(--text); display:flex; align-items:center; gap:8px; }
.simrow-label .sw { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.simrow-read { font-size:12.5px; font-weight:700; color:var(--text-muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.simrow-read .pos { color:var(--green); } .simrow-read .neg { color:var(--red); }
.simrow-read .rd-before { color:var(--text-faint); font-weight:600; }
.simrow-read .rd-arrow { color:var(--text-faint); margin:0 5px; }
.simrow-read .rd-after { color:var(--text); }
.simrow-track { display:flex; align-items:center; gap:12px; }
.srange { -webkit-appearance:none; appearance:none; flex:1; height:5px; border-radius:5px; outline:none; cursor:pointer; background:var(--bg-4); }
.srange::-webkit-slider-thumb { -webkit-appearance:none; appearance:none; width:16px; height:16px; border-radius:50%; background:var(--gold); border:2.5px solid #211a06; box-shadow:0 0 0 3px rgba(189,149,51,.22); cursor:pointer; }
.srange::-moz-range-thumb { width:16px; height:16px; border-radius:50%; background:var(--gold); border:2.5px solid #211a06; cursor:pointer; }
.simrow-delta { font-size:12px; font-weight:700; color:var(--orange); width:44px; text-align:right; font-variant-numeric:tabular-nums; }

/* ---------- KPIs + Análise ---------- */
.kpis { display:grid; grid-template-columns:repeat(auto-fit, minmax(190px,1fr)); gap:14px; }
.kpi { background:var(--bg-2); border:1px solid var(--line-soft); border-radius:12px; padding:16px; display:flex; flex-direction:column; gap:6px; }
.kpi .kl { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-dim); }
.kpi .kv { font-size:24px; font-weight:700; color:var(--text); letter-spacing:-.01em; }
.kpi .ks { font-size:12px; color:var(--text-dim); }
.kpi .ks.pos { color:var(--green); } .kpi .ks.neg { color:var(--red); }

.veredito { display:grid; grid-template-columns:auto 1fr; grid-template-rows:auto auto; column-gap:18px; align-items:center; background:var(--bg-2); border:1px solid var(--line-soft); border-left:3px solid var(--green); border-radius:14px; padding:20px 22px; position:relative; overflow:hidden; }
.veredito.is-neg { border-left-color:var(--red); }
.veredito .bird { width:46px; height:46px; grid-row:1/3; object-fit:contain; opacity:.95; }
.veredito .vd-tagwrap { grid-column:2; }
.veredito .vd-eyebrow { grid-column:2; font-family:'Ubuntu Mono', monospace; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--text-dim); margin-bottom:4px; }
.veredito h2 { grid-column:2; font-size:19px; font-weight:500; margin:2px 0 6px; line-height:1.25; letter-spacing:-.01em; }
.veredito h2 em { font-style:normal; color:var(--orange); font-weight:700; }
.veredito p { grid-column:2; margin:0; font-size:13.5px; color:var(--text-muted); line-height:1.5; }
.veredito p b { color:var(--text); }
.vd-tag { display:inline-block; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; padding:4px 10px; border-radius:999px; background:rgba(133,179,99,.16); color:var(--green); }
.veredito.is-neg .vd-tag { background:rgba(212,67,67,.16); color:var(--red); }

.reading { display:flex; gap:14px; background:var(--bg-2); border:1px solid var(--line-soft); border-radius:14px; padding:18px 20px; }
.reading .rd-ic { width:40px; height:40px; border-radius:10px; background:var(--orange-12); display:grid; place-items:center; flex-shrink:0; }
.reading .rd-ic img { width:26px; height:26px; object-fit:contain; }
.reading .rd-h { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--orange); margin-bottom:8px; }
.reading .rd-body p { margin:0 0 8px; font-size:13.5px; color:var(--text-muted); line-height:1.55; }
.reading .rd-body p:last-child { margin-bottom:0; }
.reading .rd-body b { color:var(--text); }

/* ---------- DRE table ---------- */
.dre-wrap { overflow-x:auto; }
table.dre { width:100%; border-collapse:collapse; font-size:13px; }
table.dre th, table.dre td { padding:10px 12px; text-align:right; white-space:nowrap; }
table.dre th:first-child, table.dre td:first-child { text-align:left; color:var(--text-muted); }
table.dre thead th { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--text-dim); border-bottom:1px solid var(--line); }
table.dre thead th .dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }
table.dre tbody td { font-variant-numeric:tabular-nums; color:var(--text-muted); border-bottom:1px solid var(--line-soft); }
table.dre tr.sum td { color:var(--text); font-weight:600; }
table.dre tr.total td { color:var(--text); font-weight:700; border-top:1px solid var(--line); font-size:14px; }
table.dre td.dre-pos { color:var(--green); } table.dre td.dre-neg { color:var(--red); }

/* ---------- ONEIA drawer ---------- */
#oneiaScrim { position:fixed; inset:0; background:rgba(0,0,0,.5); opacity:0; pointer-events:none; transition:opacity 220ms ease; z-index:80; }
body.oneia-open #oneiaScrim { opacity:1; pointer-events:auto; }
.oneia-drawer { position:fixed; top:0; left:0; height:100vh; width:400px; max-width:90vw; background:var(--bg-1); border-right:1px solid var(--line); z-index:90;
  transform:translateX(-100%); transition:transform 260ms cubic-bezier(.2,.8,.2,1); display:flex; flex-direction:column; box-shadow:24px 0 60px -20px rgba(0,0,0,.7); }
body.oneia-open .oneia-drawer { transform:translateX(0); }
.oneia-head { display:flex; align-items:center; gap:12px; padding:18px 18px 16px; border-bottom:1px solid var(--line-soft); }
.oneia-head .ai-avatar { width:34px; height:34px; border-radius:0; background:none; display:grid; place-items:center; flex-shrink:0; box-shadow:none; }
.oneia-head .ai-avatar img { width:28px; height:28px; object-fit:contain; }
.oneia-head .ai-avatar svg { width:24px; height:24px; color:var(--orange); }
.ai-head-txt { display:flex; flex-direction:column; gap:1px; flex:1; min-width:0; }
.ai-head-txt b { font-size:15px; font-weight:700; }
.ai-head-txt span { font-size:11.5px; color:var(--text-dim); }
.ai-close { width:32px; height:32px; border-radius:8px; background:var(--bg-2); border:1px solid var(--line); color:var(--text-muted); cursor:pointer; display:grid; place-items:center; transition:background 140ms ease, color 140ms ease; }
.ai-close:hover { background:var(--bg-3); color:var(--text); }
.ai-close svg { width:16px; height:16px; }
.ai-msgs { flex:1; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:14px; scrollbar-width:thin; scrollbar-color:var(--bg-4) transparent; }
.ai-msgs::-webkit-scrollbar { width:6px; } .ai-msgs::-webkit-scrollbar-thumb { background:var(--bg-4); border-radius:6px; }
.ai-msg { display:flex; }
.ai-msg.user { justify-content:flex-end; }
.ai-msg .bubble { max-width:88%; padding:12px 14px; border-radius:14px; font-size:13.5px; line-height:1.55; }
.ai-msg.bot .bubble { background:var(--bg-2); border:1px solid var(--line-soft); color:var(--text-muted); border-top-left-radius:4px; }
.ai-msg.user .bubble { background:var(--orange); color:#fff; border-top-right-radius:4px; }
.ai-msg.full .bubble { max-width:100%; }
.ai-msg .bubble p { margin:0 0 8px; } .ai-msg .bubble p:last-child { margin-bottom:0; }
.ai-msg .bubble b, .ai-msg .bubble strong { color:var(--text); font-weight:700; }
.ai-msg.user .bubble b { color:#fff; }
.ai-msg .bubble .ai-h { font-weight:700; color:var(--text); }
.ai-msg .bubble ul { margin:6px 0; padding-left:18px; } .ai-msg .bubble li { margin:3px 0; }
.ai-msg .bubble table { width:100%; border-collapse:collapse; margin:8px 0; font-size:12.5px; }
.ai-msg .bubble th, .ai-msg .bubble td { border:1px solid var(--line); padding:6px 8px; text-align:left; }
.ai-msg .bubble th { background:var(--bg-3); color:var(--text); }
.ai-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.ai-action { display:inline-flex; align-items:center; gap:7px; padding:9px 14px; border-radius:9px; font-family:inherit; font-size:12.5px; font-weight:600; cursor:pointer; border:1px solid var(--line); transition:all 140ms ease; }
.ai-action svg { width:15px; height:15px; }
.ai-action.primary { background:var(--orange); color:#fff; border-color:var(--orange); }
.ai-action.primary:hover { background:var(--orange-soft); }
.ai-action.ghost { background:var(--bg-2); color:var(--text-muted); }
.ai-action.ghost:hover { color:var(--text); border-color:var(--bg-4); }
.ai-chips { display:flex; flex-wrap:wrap; gap:8px; }
.ai-chip { padding:8px 12px; border-radius:999px; background:var(--bg-2); border:1px solid var(--line); color:var(--text-muted); font-family:inherit; font-size:12px; cursor:pointer; transition:all 140ms ease; }
.ai-chip:hover { border-color:var(--orange); color:var(--orange); }
.ai-typing { display:inline-flex; gap:4px; } .ai-typing i { width:6px; height:6px; border-radius:50%; background:var(--text-dim); animation:aitb 1s infinite; }
.ai-typing i:nth-child(2){ animation-delay:.15s; } .ai-typing i:nth-child(3){ animation-delay:.3s; }
@keyframes aitb { 0%,60%,100%{ transform:translateY(0); opacity:.4; } 30%{ transform:translateY(-4px); opacity:1; } }
.ai-extract { display:flex; flex-direction:column; gap:10px; }
.ai-extract .ex-cap { font-size:12.5px; color:var(--text-dim); }
.ai-extract table { width:100%; border-collapse:collapse; font-size:12px; }
.ai-extract th, .ai-extract td { padding:6px 8px; border-bottom:1px solid var(--line-soft); text-align:left; }
.ai-extract td.num { text-align:right; } .ai-extract td.grp { width:120px; }
.ai-extract .ex-val { width:90px; background:var(--bg-3); border:1px solid var(--line); border-radius:6px; color:var(--text); padding:5px 7px; text-align:right; font-family:inherit; }
.ai-extract select { background:var(--bg-3); border:1px solid var(--line); border-radius:6px; color:var(--text); padding:6px 8px; font-family:inherit; font-size:12px; width:100%; }
.ai-extract .ex-summary { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.ai-extract .ex-kpi { background:var(--bg-2); border:1px solid var(--line-soft); border-radius:9px; padding:8px 10px; }
.ai-extract .ex-kpi .k { font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-dim); }
.ai-extract .ex-kpi .v { font-size:14px; font-weight:700; color:var(--text); }
.ai-extract .ex-note { font-size:11.5px; color:var(--text-faint); line-height:1.5; }
.ai-compose { display:flex; align-items:flex-end; gap:10px; padding:14px 16px; border-top:1px solid var(--line-soft); }
.ai-compose textarea { flex:1; resize:none; background:var(--bg-2); border:1px solid var(--line); border-radius:12px; color:var(--text); font-family:inherit; font-size:14px; padding:12px 14px; outline:none; min-height:128px; max-height:260px; line-height:1.5; }
.ai-compose textarea:focus { border-color:var(--orange); }
.ai-compose textarea::placeholder { color:var(--text-faint); }
.ai-send { width:42px; height:42px; flex-shrink:0; border-radius:11px; background:var(--orange); border:0; color:#fff; cursor:pointer; display:grid; place-items:center; transition:background 140ms ease; }
.ai-send:hover { background:var(--orange-soft); } .ai-send:disabled { opacity:.5; cursor:default; }
.ai-foot { padding:0 16px 12px; font-size:10.5px; color:var(--text-faint); line-height:1.45; }

/* ---------- toast ---------- */
.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px); background:var(--bg-3); border:1px solid var(--line); color:var(--text); padding:12px 18px; border-radius:12px; font-size:13px; opacity:0; pointer-events:none; transition:opacity 200ms ease, transform 200ms ease; z-index:120; box-shadow:0 12px 32px rgba(0,0,0,.4); display:flex; align-items:center; gap:8px; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
.toast .ok { color:var(--green); font-weight:700; }

/* ---------- Classificação das contas (planilha editável) ---------- */
.contas-view { display:flex; flex-direction:column; min-height:0; }
.cc-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; flex-wrap:wrap; margin:2px 0 16px; }
.cc-title h3 { margin:0 0 4px; font-size:18px; font-weight:700; color:var(--text); letter-spacing:-.01em; }
.cc-title p { margin:0; font-size:12.5px; color:var(--text-dim); max-width:620px; line-height:1.55; }
.cc-title p b { color:var(--text-muted); }
.cc-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.cc-btn { font-family:inherit; font-size:12.5px; font-weight:600; display:inline-flex; align-items:center; gap:7px; border-radius:8px; padding:9px 14px; cursor:pointer; border:1px solid var(--line); background:var(--bg-2); color:var(--text-muted); transition:background .16s, border-color .16s, color .16s; }
.cc-btn svg { width:15px; height:15px; }
.cc-btn:hover { border-color:var(--bg-4); color:var(--text); }
.cc-btn.primary { background:var(--orange); color:#fff; border-color:transparent; box-shadow:0 6px 18px -6px rgba(250,100,0,.55); }
.cc-btn.primary:hover { background:var(--orange-soft); color:#fff; }
.cc-btn:disabled { opacity:.5; cursor:default; }
.cc-status { font-size:12px; color:var(--text-dim); display:inline-flex; align-items:center; gap:6px; min-width:84px; }
.cc-status.saved { color:var(--green); } .cc-status.dirty { color:var(--gold); }
.cc-status .d { width:7px; height:7px; border-radius:50%; background:currentColor; flex:none; }

.cc-grid-wrap { border:1px solid var(--line); border-radius:12px; overflow:auto; background:var(--bg-1); }
table.cc-grid { border-collapse:collapse; width:100%; font-size:13px; }
table.cc-grid thead th { position:sticky; top:0; z-index:2; background:var(--bg-3); color:var(--text-dim); font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.07em; text-align:left; padding:11px 12px; border-bottom:1px solid var(--line); border-right:1px solid var(--line-soft); white-space:nowrap; }
table.cc-grid thead th:last-child { border-right:0; }
table.cc-grid thead th.num { text-align:right; }
table.cc-grid td { border-bottom:1px solid var(--line-soft); border-right:1px solid var(--line-soft); padding:0; height:38px; }
table.cc-grid td:last-child { border-right:0; }
table.cc-grid tbody tr:last-child td { border-bottom:0; }
.cc-name { display:flex; align-items:center; gap:5px; padding:7px 12px; min-width:300px; }
.cc-tw { flex:none; width:18px; height:18px; display:grid; place-items:center; border:0; background:none; cursor:pointer; color:var(--text-dim); border-radius:4px; }
.cc-tw:hover { color:var(--orange); background:var(--orange-12); }
.cc-tw svg { width:13px; height:13px; transition:transform .18s; }
.cc-tw.collapsed svg { transform:rotate(-90deg); }
.cc-tw.leaf { visibility:hidden; pointer-events:none; }
.cc-label { font-size:13px; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cc-code { font-family:'Ubuntu Mono', monospace; font-size:11px; color:var(--text-faint); padding:0 12px; white-space:nowrap; }
tr.cc-row.lvl0 > td { background:var(--bg-2); }
tr.cc-row.lvl0 .cc-label { font-weight:700; }
tr.cc-row.lvl1 .cc-label { font-weight:600; }
td.cc-valcell { text-align:right; min-width:140px; }
td.cc-valcell .cc-val { width:100%; box-sizing:border-box; border:0; background:transparent; font-family:'Ubuntu Mono', monospace; font-size:12.5px; text-align:right; color:var(--text); padding:8px 12px; outline:none; }
td.cc-valcell .cc-val:focus { background:var(--orange-12); box-shadow:inset 0 0 0 2px var(--orange); border-radius:3px; }
td.cc-valcell .cc-val-ro { display:block; font-family:'Ubuntu Mono', monospace; font-size:12.5px; text-align:right; color:var(--text-muted); padding:8px 12px; font-weight:700; }
td.cc-clscell { width:230px; min-width:210px; }
.cc-clswrap { display:flex; align-items:center; gap:8px; padding:0 10px; }
.cc-dot { flex:none; width:9px; height:9px; border-radius:3px; background:var(--bg-4); }
.cc-cls { flex:1; min-width:0; font-family:inherit; font-size:12.5px; font-weight:600; border:0; background:transparent; padding:8px 4px 8px 0; cursor:pointer; color:var(--text); outline:none; }
.cc-cls option { background:var(--bg-2); color:var(--text); }
.cc-cls:focus { color:var(--orange); }
td.cc-clscell .cc-cls-empty { padding:8px 12px; font-size:11.5px; color:var(--text-faint); }
.cc-actcol { width:78px; }
td.cc-actcell { width:78px; }
.cc-acts { display:flex; align-items:center; justify-content:flex-end; gap:4px; padding:0 8px; }
.cc-actbtn { width:28px; height:28px; flex:none; display:grid; place-items:center; border:1px solid transparent; background:none; border-radius:7px; color:var(--text-dim); cursor:pointer; transition:background .14s, color .14s, border-color .14s; }
.cc-actbtn svg { width:15px; height:15px; }
.cc-actbtn.add:hover { background:var(--orange-12); color:var(--orange); border-color:var(--orange); }
.cc-actbtn.del:hover { background:rgba(212,67,67,.14); color:var(--red); border-color:var(--red); }
.cc-nameinp { flex:1; min-width:0; background:transparent; border:1px solid transparent; border-radius:6px; color:var(--text); font-family:inherit; font-size:13px; padding:5px 8px; outline:none; transition:background .14s, border-color .14s; }
.cc-nameinp::placeholder { color:var(--text-faint); }
.cc-nameinp:hover { border-color:var(--line); }
.cc-nameinp:focus { background:var(--orange-12); border-color:var(--orange); }

.cc-summary { display:grid; grid-template-columns:repeat(4, 1fr); gap:12px; margin-top:16px; }
.cc-kpi { border:1px solid var(--line-soft); border-radius:12px; padding:14px 16px; background:var(--bg-2); }
.cc-kpi .k { font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-dim); display:flex; align-items:center; gap:6px; }
.cc-kpi .k .cc-dot { width:8px; height:8px; }
.cc-kpi .v { font-family:'Ubuntu Mono', monospace; font-weight:700; font-size:19px; color:var(--text); margin-top:5px; }
.cc-foot { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-top:14px; }
.cc-foot .cc-note { font-size:11.5px; color:var(--text-faint); max-width:580px; line-height:1.5; }
@media (max-width:760px){ .cc-summary { grid-template-columns:1fr 1fr; } }
