/* Dashboard v3 — painel do forward test Donchian 4h.
   Escuro é o único tema em uso; as regras do tema claro ficam como fallback inerte (nenhum toggle as liga).
   Tokens lidos pelo main.js: --accent --good --bad --warn --text-dim --text-muted
   --border --border-strong --bg-elevated --bg-card --grid (não renomear).
   Hierarquia: status (números grandes) → forward test → posições → seções <details>. */

:root {
    color-scheme: dark;
    --bg-app:#0f1318; --bg-card:#161b22; --bg-elevated:#1d2430;
    --border:rgba(255,255,255,.08); --border-strong:rgba(255,255,255,.16); --grid:rgba(255,255,255,.06);
    --text:#e7ebf1; --text-dim:#9aa6b8; --text-muted:#6c788f;
    --accent:#3987e5; --accent-soft:rgba(57,135,229,.16);
    --good:#2fb55a; --good-soft:rgba(47,181,90,.14);
    --warn:#fab219; --warn-soft:rgba(250,178,25,.14);
    --bad:#e0524f; --bad-soft:rgba(224,82,79,.16);
    --focus:#8fbcff;
    /* fundo em gradiente + cartões de vidro (anel/hero); --bg-card continua o token lido pelo main.js */
    --bg-grad:linear-gradient(165deg,#0a0f2a 0%,#131a3f 45%,#2a1850 100%);
    --glass:rgba(255,255,255,.055); --glass-border:rgba(255,255,255,.10);
}
:root[data-theme="light"] {
    color-scheme: light;
    --bg-app:#f3f5f8; --bg-card:#ffffff; --bg-elevated:#eef1f6;
    --border:rgba(16,24,40,.10); --border-strong:rgba(16,24,40,.20); --grid:rgba(16,24,40,.07);
    --text:#111827; --text-dim:#4b5565; --text-muted:#7b869a;
    --accent:#2a78d6; --accent-soft:rgba(42,120,214,.12);
    --good:#1f8a3c; --good-soft:rgba(31,138,60,.12);
    --warn:#a86a00; --warn-soft:rgba(168,106,0,.12);
    --bad:#c93b38; --bad-soft:rgba(201,59,56,.12);
    --focus:#1d5fb8;
    --bg-grad:linear-gradient(165deg,#eef1fb 0%,#e9ecf8 45%,#f1e9fb 100%);
    --glass:rgba(255,255,255,.72); --glass-border:rgba(16,24,40,.10);
}

* { box-sizing:border-box; margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; }
body {
    background:var(--bg-app) var(--bg-grad) fixed; color:var(--text);
    font-family:system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
    font-size:13.5px; line-height:1.5; min-height:100vh; -webkit-font-smoothing:antialiased;
    padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px);
}
.mono, .tv, .track-h b, .kv td, .kvl dd, .table td, .pg-info, .ruler-l b, .pr-pnl, .pr-r, .pr-meta, .tr-stats b {
    font-family:'IBM Plex Mono',ui-monospace,SFMono-Regular,Menlo,monospace; font-variant-numeric:tabular-nums;
}
.pos { color:var(--good); } .neg { color:var(--bad); } .warn { color:var(--warn); } .dim { color:var(--text-muted); }
b { font-weight:600; }
:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
button { font:inherit; color:inherit; }
[hidden] { display:none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition:none !important; animation:none !important; } }

/* Topo */
.top {
    position:sticky; top:env(safe-area-inset-top,0px); z-index:30;
    display:flex; align-items:center; gap:16px; flex-wrap:wrap;
    padding:10px 22px; background:color-mix(in srgb, var(--bg-app) 70%, transparent); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border-bottom:1px solid var(--border);
}
.top-id { display:flex; align-items:center; gap:10px; min-width:0; }
.top-title { font-size:15px; font-weight:600; letter-spacing:-.01em; white-space:nowrap; }
.env { font-size:11.5px; font-weight:500; padding:2px 8px; border-radius:4px; border:1px solid var(--border-strong); color:var(--text-dim); }
.env-mainnet { border-color:var(--bad); color:var(--bad); }
.state { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:500; color:var(--text-dim); }
.state::before { content:""; width:8px; height:8px; border-radius:50%; background:currentColor; }
.state.ok { color:var(--good); } .state.warn { color:var(--warn); } .state.bad { color:var(--bad); }
.top-meta { margin-left:auto; font-size:12px; color:var(--text-muted); }
.fx { display:inline-flex; align-items:center; gap:8px; font-size:12px; color:var(--text-dim); white-space:nowrap; }
.fx b { font-family:'IBM Plex Mono',ui-monospace,monospace; font-weight:500; color:var(--text); }
.fx-pill { font-size:11px; padding:2px 8px; border-radius:999px; background:var(--good-soft); color:var(--good); }
/* equivalente em BRL embaixo do valor em USD (brlTag no main.js) */
.brl { display:block; font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:11px; font-weight:400; letter-spacing:0; color:var(--text-muted); line-height:1.3; }
.pnl-lines summary .brl { display:inline; margin-left:6px; }
.clock { font-family:'IBM Plex Mono',ui-monospace,monospace; font-variant-numeric:tabular-nums; font-size:13px; color:var(--text-dim); white-space:nowrap; }
/* hero (equity + hoje no topo fixo) e barra inferior existem só no celular: mobile.css liga os dois. */
.hero, .tabbar { display:none; }
.card { scroll-margin-top:calc(var(--top-h, 56px) + 8px); }
.banner { padding:9px 22px; background:var(--warn-soft); color:var(--warn); border-bottom:1px solid var(--border); font-size:13px; font-weight:500; }
.banner.bad { background:var(--bad-soft); color:var(--bad); }

/* Botões */
.btn {
    display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:7px 12px;
    border-radius:6px; border:1px solid var(--border-strong); background:var(--bg-card); color:var(--text);
    font-size:12.5px; font-weight:500; cursor:pointer; transition:border-color .12s ease, background .12s ease;
}
.btn:hover { border-color:var(--accent); }
.btn:disabled { opacity:.45; cursor:not-allowed; }
.btn-quiet { background:transparent; border-color:var(--border); color:var(--text-dim); }
.btn-quiet:hover:not(:disabled) { color:var(--text); border-color:var(--border-strong); }
.btn-danger { color:var(--bad); }
.btn-danger:hover:not(:disabled) { border-color:var(--bad); color:var(--bad); }
.modal .btn-danger { background:var(--bad-soft); border-color:transparent; }

/* Layout */
.wrap { max-width:1360px; margin:0 auto; padding:16px 22px 48px; display:flex; flex-direction:column; gap:14px; }
.card { background:var(--glass); border:1px solid var(--glass-border); border-radius:20px; padding:16px 18px; min-width:0; backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.two { display:grid; grid-template-columns:1.4fr 1fr; gap:14px; align-items:start; }
.ch { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:12px; flex-wrap:wrap; }
h2 { font-size:14.5px; font-weight:600; letter-spacing:-.01em; }
.cs { font-size:12px; color:var(--text-muted); margin-top:2px; max-width:80ch; }
.badge { background:var(--bg-elevated); color:var(--text-dim); padding:1px 8px; border-radius:999px; font-size:11.5px; font-weight:500; white-space:nowrap; font-variant-numeric:tabular-nums; vertical-align:middle; }
.badge.ok { color:var(--good); } .badge.warn { color:var(--warn); } .badge.bad { color:var(--bad); }
.empty { color:var(--text-muted); font-size:12.5px; padding:10px 0; }
.legend { display:flex; flex-wrap:wrap; gap:4px 14px; font-size:11.5px; color:var(--text-muted); margin-top:8px; align-items:center; }
.sw { display:inline-block; width:14px; height:3px; border-radius:2px; background:var(--accent); vertical-align:middle; margin-right:5px; }
.sw-dot { width:8px; height:8px; border-radius:50%; background:var(--text-dim); }
.sw-area { height:8px; background:var(--bad); opacity:.45; }
.sw-neg { width:10px; height:10px; border-radius:2px; background:var(--bad); }
.sw-zero { width:10px; height:10px; border-radius:2px; background:var(--bg-elevated); border:1px solid var(--border); }
.sw-pos { width:10px; height:10px; border-radius:2px; background:var(--accent); }

/* Seções recolhíveis */
details.card > summary { list-style:none; cursor:pointer; display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin:-16px -18px; padding:14px 18px; border-radius:20px; }
details.card > summary::-webkit-details-marker { display:none; }
details.card > summary::before { content:"▸"; color:var(--text-muted); font-size:12px; width:12px; flex:none; align-self:center; transition:transform .12s ease; }
details.card[open] > summary::before { transform:rotate(90deg); }
details.card[open] > summary { margin-bottom:0; }
details.card > summary .cs, details.card > summary .badge { margin-left:auto; }
details.card > :not(summary):first-of-type { margin-top:10px; }

/* Anel da carteira: um arco por par (∝ notional), saldo no centro, badges com o ticker em volta. */
.ring-card { padding:14px 18px 18px; display:flex; flex-wrap:wrap; align-items:center; gap:4px 28px; }
.ring-head { flex-basis:100%; }
/* a linha de status (tiles) é movida pra cá pelo main.js no martingale: vira um grid de métricas ao lado do anel */
.ring-card .status { flex:1 1 360px; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px 18px; background:none; border:0; border-radius:0; margin-top:8px; }
.ring-card .tile { background:none; backdrop-filter:none; -webkit-backdrop-filter:none; padding:0; }
.ring-card .tl { white-space:normal; }
.ring-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ring-state { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; padding:4px 11px; border-radius:999px; background:var(--glass); border:1px solid var(--glass-border); color:var(--text-dim); }
.ring-state::before { content:""; width:7px; height:7px; border-radius:50%; background:currentColor; }
.ring-state.ok { color:var(--good); } .ring-state.warn { color:var(--warn); } .ring-state.bad { color:var(--bad); }
.ring-wrap { position:relative; width:min(100%, 300px); aspect-ratio:1; margin:8px auto 0; }
.ring { width:100%; height:100%; display:block; }
.ring-track { fill:none; stroke:var(--glass-border); stroke-width:3; }
.ring-seg { fill:none; stroke-width:22; stroke-linecap:round; cursor:pointer; transition:stroke-width .15s ease, opacity .15s ease; }
.ring-seg:hover { opacity:.85; }
/* par selecionado: o arco vira contorno ("esvaziou" pro centro) */
.ring-seg.sel { stroke-width:7; stroke-dasharray:3 7; }
.ring-mk { stroke:var(--bg-app); stroke-width:2; fill:var(--text-muted); pointer-events:none; }
.ring-mk.pos { fill:var(--good); filter:drop-shadow(0 0 4px var(--good)); } .ring-mk.neg { fill:var(--bad); filter:drop-shadow(0 0 4px var(--bad)); }
.ring-badge { position:absolute; transform:translate(-50%,-50%); min-width:36px; height:36px; padding:0 8px; border-radius:999px; border:1px solid var(--glass-border); background:var(--bg-elevated); color:var(--text); font-size:11.5px; font-weight:700; letter-spacing:.02em; cursor:pointer; box-shadow:0 2px 10px rgba(0,0,0,.25); }
.ring-badge.on { border-color:var(--text); }
.ring-badge.drain { opacity:.45; }
.ring-center { position:absolute; inset:0; margin:auto; width:62%; height:62%; border-radius:50%; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:2px; cursor:pointer; }
.rc-l { font-size:12px; color:var(--text-dim); font-weight:500; }
.rc-v { font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:24px; font-weight:600; letter-spacing:-.02em; line-height:1.1; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rc-t { font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:13px; font-weight:500; }
.rc-s { font-size:11.5px; color:var(--text-muted); }
.ring-center .brl { margin-top:2px; }
.rc-sub { max-width:72%; line-height:1.25; }   /* pico · capital: quebra em 2 linhas pra não encostar no arco */
/* Pernas ativas: ações em pílulas (Pausar / Retomar / Fechar tudo) e uma linha-cartão por perna. */
.pills { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:6px; }
.pills .btn { border-radius:999px; padding:8px 16px; background:var(--glass); border-color:var(--border-strong); white-space:nowrap; }
.pills .btn:hover:not(:disabled) { background:var(--accent-soft); border-color:var(--accent); }
.pills .btn-danger:hover:not(:disabled) { background:var(--bad-soft); }

/* Status: a linha que responde "está vivo? onde estou?" */
.status { display:grid; grid-template-columns:repeat(8, minmax(0,1fr)); gap:1px; background:var(--border); border:1px solid var(--glass-border); border-radius:20px; overflow:hidden; }
/* Fora do Donchian somem 2 tiles; :where mantém a especificidade para os breakpoints abaixo vencerem. */
.status:where(:has(.tile[hidden])) { grid-template-columns:repeat(6, minmax(0,1fr)); }
.tile { background:var(--glass); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); padding:12px 14px 10px; display:flex; flex-direction:column; gap:2px; min-width:0; }
.tl { font-size:11.5px; color:var(--text-muted); white-space:nowrap; }
.tv { font-size:22px; font-weight:500; letter-spacing:-.02em; line-height:1.15; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tile-main .tv { font-size:26px; }
.tf { font-size:11px; color:var(--text-muted); line-height:1.35; }

/* Forward test */
.verdict { font-size:12.5px; font-weight:600; padding:5px 11px; border-radius:6px; background:var(--bg-elevated); color:var(--text-dim); border:1px solid var(--border); }
.verdict.ahead { background:var(--good-soft); color:var(--good); border-color:transparent; }
.verdict.behind { background:var(--warn-soft); color:var(--warn); border-color:transparent; }
.verdict.failed { background:var(--bad-soft); color:var(--bad); border-color:transparent; }
.tracks { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:18px 24px; }
.track-h { display:flex; justify-content:space-between; align-items:baseline; gap:8px; font-size:12.5px; color:var(--text-dim); }
.track-h b { font-size:17px; color:var(--text); font-weight:500; white-space:nowrap; }
.track-h b.pos { color:var(--good); } .track-h b.neg { color:var(--bad); }
.track-f { font-size:11.5px; color:var(--text-muted); margin-top:4px; }
.meter { position:relative; height:6px; border-radius:3px; background:var(--bg-elevated); margin-top:8px; }
.meter i { position:absolute; left:0; top:0; height:100%; border-radius:3px; background:var(--accent); width:0; transition:width .4s ease; }
.meter-dd i { background:var(--text-dim); }
.meter-dd.hot i { background:var(--bad); }
.meter-max { position:absolute; top:-3px; width:2px; height:12px; background:var(--bad); border-radius:1px; text-decoration:none; }

/* Tabelas chave→valor (performance, calendário) e lista do motor */
.kv { width:100%; border-collapse:collapse; font-size:12.5px; }
.kv th, .kv td { padding:6px 8px; text-align:left; border-top:1px solid var(--border); white-space:nowrap; }
.kv thead th { border-top:0; color:var(--text-muted); font-weight:500; font-size:11.5px; }
.kv tbody th { font-weight:400; color:var(--text-dim); }
.kv .r { text-align:right; }
.kvl { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:0 20px; font-size:12.5px; }
.kvl div { display:flex; justify-content:space-between; gap:10px; padding:6px 0; border-top:1px solid var(--border); }
.kvl dt { color:var(--text-dim); } .kvl dd { text-align:right; }
.ci { margin-top:14px; }
.ci-plot { width:100%; height:110px; display:block; }
.ci-plot .axis { stroke:var(--border-strong); stroke-width:1; }
.ci-plot .zero { stroke:var(--text-dim); stroke-width:1.5; }
.ci-plot .band { fill:var(--accent); opacity:.22; }
.ci-plot .mean { fill:var(--accent); }
.ci-plot .research { stroke:var(--text-muted); stroke-width:1.5; stroke-dasharray:3 3; }
.ci-plot text { font-family:'IBM Plex Sans',system-ui,sans-serif; font-size:11px; fill:var(--text-muted); }
.ci-plot text.strong { fill:var(--text-dim); font-weight:500; }

/* Gráficos */
.cv { position:relative; width:100%; }
.cv-eq { height:220px; } .cv-dd { height:80px; margin-top:4px; } .cv-r { height:200px; }
.two-cv { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:8px; }
.chips { display:inline-flex; gap:2px; background:var(--bg-elevated); padding:2px; border-radius:7px; margin-bottom:8px; }
.chip { border:0; background:transparent; color:var(--text-dim); font-size:12px; font-weight:500; padding:4px 10px; border-radius:5px; cursor:pointer; }
.chip:hover { color:var(--text); }
.chip.on { background:var(--bg-card); color:var(--text); box-shadow:0 0 0 1px var(--border); }
.chips-cal { margin-top:12px; }

/* Posições */
.prow { padding:10px 0; border-top:1px solid var(--border); }
.prow:first-child { border-top:0; padding-top:2px; }
.prow-top { display:grid; grid-template-columns:1.2fr 1fr 1fr 1fr auto; align-items:baseline; gap:10px; }
#mg-list .prow-top { grid-template-columns:1.2fr 1fr 1fr 1fr auto auto; }
.pr-close { display:inline-flex; align-items:center; gap:6px; justify-content:flex-end; font-size:12px; color:var(--text-dim); white-space:nowrap; }
.btn-xs { padding:3px 8px; font-size:11.5px; }
.psym { font-weight:600; font-size:14px; display:inline-flex; align-items:center; gap:8px; }
.side { font-size:11px; font-weight:500; padding:1px 7px; border-radius:4px; }
.side.l { background:var(--good-soft); color:var(--good); } .side.s { background:var(--bad-soft); color:var(--bad); }
.side.w { background:var(--warn-soft); color:var(--warn); } .side.u { background:var(--bg-elevated); color:var(--text-muted); }
.pr-pnl, .pr-r { font-size:15px; font-weight:500; text-align:right; }
.pr-pnl small, .pr-r small { font-weight:400; color:var(--text-muted); font-size:11.5px; margin-left:6px; }
.pr-meta { font-size:12px; color:var(--text-dim); text-align:right; }
/* distância até a próxima adição: trilho com gradiente fixo (TP=verde → adição=vermelho); o <i> cobre o resto pela direita */
.addbar { display:flex; align-items:center; gap:8px; margin-top:8px; }
.addbar-t { flex:1; display:flex; height:6px; border-radius:3px; background:linear-gradient(90deg, var(--good), var(--warn) 55%, var(--bad)); overflow:hidden; }
.addbar-t i { display:block; margin-left:auto; height:100%; background:var(--bg-elevated); }
.addbar.max .addbar-t { background:var(--border-strong); }
.addbar small { font-size:11px; color:var(--text-muted); white-space:nowrap; font-variant-numeric:tabular-nums; }
.ruler { position:relative; height:22px; margin:4px 2px 0; }
.ruler .line { position:absolute; left:0; right:0; top:10px; height:2px; background:var(--border-strong); border-radius:1px; }
.ruler .zone { position:absolute; top:10px; height:2px; background:var(--good); opacity:.5; }
.ruler .mk { position:absolute; top:3px; width:2px; height:16px; transform:translateX(-50%); border-radius:1px; }
.ruler .mk.stop { background:var(--bad); }
.ruler .mk.entry { background:var(--text-muted); }
.ruler .mk.exit { background:var(--accent); }
.ruler .mk.trail { background:var(--good); }
.ruler .mk.mark { top:5px; width:12px; height:12px; border-radius:50%; background:var(--text); border:2px solid var(--bg-card); }
.ruler-l { display:flex; justify-content:space-between; gap:8px; font-size:11px; color:var(--text-muted); flex-wrap:wrap; margin-top:2px; }
.ruler-l b { color:var(--text-dim); font-weight:500; }

/* Motor */
.skips { list-style:none; margin-top:8px; font-size:12px; color:var(--text-dim); display:flex; flex-direction:column; gap:3px; }
.skips li::before { content:"· "; color:var(--text-muted); }

/* Saúde */
.hlist { list-style:none; display:flex; flex-direction:column; }
.hlist li { display:flex; justify-content:space-between; align-items:baseline; gap:12px; padding:8px 0; border-top:1px solid var(--border); font-size:12.5px; }
.hlist li:first-child { border-top:0; }
.hlist .hl { color:var(--text-dim); }
.hlist .hv { text-align:right; font-weight:500; }
.hlist .hv small { display:block; color:var(--text-muted); font-weight:400; font-size:11.5px; }
.dotc { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:7px; vertical-align:middle; background:var(--text-muted); }
.dotc.ok { background:var(--good); } .dotc.warn { background:var(--warn); } .dotc.bad { background:var(--bad); }

/* Trades */
.filters { display:flex; gap:12px; flex-wrap:wrap; font-size:12px; color:var(--text-muted); align-items:center; }
.filters select { font:inherit; color:var(--text); background:var(--bg-elevated); border:1px solid var(--border); border-radius:6px; padding:4px 8px; margin-left:4px; }
.tr-stats { display:flex; flex-wrap:wrap; gap:6px 22px; font-size:12.5px; color:var(--text-dim); padding:8px 0 10px; }
.tr-stats b { color:var(--text); font-weight:500; }
.table-scroll { overflow-x:auto; margin:0 -6px; }
.table { width:100%; border-collapse:collapse; font-size:12.5px; }
.table th, .table td { padding:7px 9px; text-align:left; border-top:1px solid var(--border); white-space:nowrap; }
.table thead th { border-top:0; color:var(--text-muted); font-weight:500; font-size:11.5px; position:sticky; top:0; background:var(--bg-card); z-index:1; }
.table th button { background:none; border:0; padding:0; cursor:pointer; color:inherit; font:inherit; }
.table th[aria-sort="ascending"] button::after { content:" ↑"; } .table th[aria-sort="descending"] button::after { content:" ↓"; }
.table th.r, .table td.r { text-align:right; }
.table tbody tr:hover { background:var(--bg-elevated); }
.table td small { color:var(--text-muted); font-family:'IBM Plex Sans',system-ui,sans-serif; }
.table td.sans { font-family:'IBM Plex Sans',system-ui,sans-serif; }
.sheet tr.cur td { background:var(--accent-soft); font-weight:600; } .sheet tr.cur td:first-child { box-shadow:inset 3px 0 0 var(--accent); }
.sheet-coins { max-width:none; display:flex; flex-wrap:wrap; gap:4px; align-items:center; margin-top:10px; }
.sheet-coins .side { font-size:11px; } .sheet-coins .side.on { outline:2px solid var(--accent); }
.rbar { display:inline-block; width:48px; height:5px; border-radius:3px; background:var(--bg-elevated); position:relative; vertical-align:middle; margin-right:6px; }
.rbar i { position:absolute; top:0; height:100%; border-radius:3px; }
.rbar i.pos { background:var(--good); left:50%; } .rbar i.neg { background:var(--bad); right:50%; }
.pager { display:flex; align-items:center; justify-content:flex-end; gap:10px; padding:10px 2px 0; }
.pg-btn { width:28px; height:28px; border-radius:6px; border:1px solid var(--border); background:var(--bg-elevated); color:var(--text); font-size:15px; cursor:pointer; }
.pg-btn:disabled { opacity:.35; cursor:not-allowed; }
.pg-info { font-size:12px; color:var(--text-dim); min-width:42px; text-align:center; }

/* Calendário */
.cal { display:grid; grid-auto-flow:column; grid-template-rows:repeat(7, 14px); grid-auto-columns:14px; gap:3px; overflow-x:auto; padding-bottom:4px; margin-top:8px; }
.cal i { display:block; width:14px; height:14px; border-radius:3px; background:var(--bg-elevated); border:1px solid var(--border); }
.cal i.pos { border-color:transparent; background:var(--accent); }
.cal i.neg { border-color:transparent; background:var(--bad); }
.cal i.future { opacity:.35; }

/* Modal */
.modal { position:fixed; inset:0; background:rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center; z-index:100; padding:16px; }
.modal-card { background:var(--bg-card); border:1px solid var(--border-strong); border-radius:10px; padding:22px; width:min(440px,100%); }
.modal-card h3 { font-size:16px; font-weight:600; margin-bottom:8px; }
.modal-card p { color:var(--text-dim); margin-bottom:20px; }
.modal-actions { display:flex; gap:10px; justify-content:flex-end; }

/* Responsivo */
@media (max-width: 1180px) { .status { grid-template-columns:repeat(4, minmax(0,1fr)); } }
/* Fora do Donchian o Motor some e a Saúde ocupa a linha inteira em vez de deixar um buraco. */
#eng-card[hidden] + .card, #rdist-card[hidden] + .card { grid-column:1 / -1; }
@media (max-width: 1100px) { .two { grid-template-columns:1fr; } }
@media (max-width: 860px) {
    .tracks { grid-template-columns:repeat(2, minmax(0,1fr)); }
    .two-cv { grid-template-columns:1fr; }
    .prow-top { grid-template-columns:1fr 1fr; }
    .pr-meta { grid-column:2; }
    #mg-list .prow-top { grid-template-columns:1fr 1fr; }
    .pr-close { grid-column:1 / -1; justify-content:flex-start; }
}
@media (max-width: 760px) {
    .top { gap:10px; padding:10px 16px; }
    .top-meta { display:none; }
    .top-id { flex-wrap:wrap; }
    .fx { flex-basis:100%; font-size:11px; gap:6px; }
    .clock { margin-left:auto; }
    .btn { padding:7px 10px; font-size:12px; }
    .wrap { padding:12px 16px 32px; gap:12px; }
    .card { padding:14px; }
    details.card > summary { margin:-14px; padding:12px 14px; }
    .status { grid-template-columns:repeat(2, minmax(0,1fr)); }
    .tv { font-size:19px; } .tile-main .tv { font-size:22px; }
    .tracks { grid-template-columns:1fr; gap:14px; }
    .kvl { grid-template-columns:1fr; }
    .cv-eq { height:180px; }
    .ch { flex-direction:column; align-items:flex-start; }
    .filters { width:100%; }
    .kv thead th:last-child, #perf td:last-child { display:none; }
    .kv th, .kv td { white-space:normal; }
    html { overflow-x:hidden; } /* só no html: overflow no body vira scroll container e quebra o sticky do topo */
}

/* Ganhos e Perdas de Futuros (estilo app da Binance) */
.pnl h3 { font-size:13.5px; font-weight:600; }
.pnl .ch { margin-top:18px; margin-bottom:8px; align-items:center; }
.pnl .chips { margin-bottom:10px; }
.pnl .chip:disabled { opacity:.4; cursor:not-allowed; }
.pnl .chip { white-space:nowrap; }
.pnl-period .chips, .pnl-tabs { flex-wrap:wrap; }
.pnl-today { display:flex; flex-direction:column; gap:2px; margin:6px 0 12px; }
.pnl-today .tv { font-size:30px; }
.pnl-pct { font-size:13px; font-weight:500; color:var(--text-dim); }
.pnl-wins { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:12px; padding:12px 0; border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.pnl-wins div { display:flex; flex-direction:column; min-width:0; }
.pnl-wins b { font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:16px; font-weight:500; margin-top:2px; white-space:nowrap; }
.pnl-wins small { font-size:11.5px; color:var(--text-muted); }
.pnl-wins small.pos { color:var(--good); } .pnl-wins small.neg { color:var(--bad); }
.pnl-period { display:flex; flex-wrap:wrap; gap:10px 16px; align-items:center; margin-top:12px; }
.pnl-period .chips { margin-bottom:0; }
.pnl-custom { display:flex; gap:8px; align-items:center; font-size:12px; color:var(--text-muted); flex-wrap:wrap; }
.pnl-custom input { font:inherit; color:var(--text); background:var(--bg-elevated); border:1px solid var(--border); border-radius:6px; padding:3px 6px; margin-left:4px; color-scheme:inherit; }
.pnl-lines { margin-top:12px; border:1px solid var(--border); border-radius:8px; padding:10px 12px; }
.pnl-lines summary { list-style:none; cursor:pointer; display:flex; flex-wrap:wrap; gap:6px 22px; font-size:12.5px; color:var(--text-dim); align-items:baseline; }
.pnl-lines summary::-webkit-details-marker { display:none; }
.pnl-lines summary::after { content:"⌄"; margin-left:auto; color:var(--text-muted); font-size:16px; line-height:1; transition:transform .12s ease; }
.pnl-lines[open] summary::after { transform:rotate(180deg); }
.pnl-lines summary b { font-family:'IBM Plex Mono',ui-monospace,monospace; font-weight:500; color:var(--text); margin-left:6px; }
.pnl-lines .kvl { margin-top:8px; }
.pnl-tabs { margin-top:14px; flex-wrap:wrap; }
.pnl-val { font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:15px; font-weight:500; }
.cv-pnl { height:200px; }
.pnl-cal-nav { display:flex; align-items:center; justify-content:center; gap:14px; margin-bottom:8px; }
.pnl-cal-nav b { font-family:'IBM Plex Mono',ui-monospace,monospace; font-weight:500; }
.pnl-cal { display:grid; grid-template-columns:repeat(7, minmax(0,1fr)); gap:3px; }
.pnl-cal .wd { text-align:center; font-size:11px; color:var(--text-muted); padding-bottom:2px; }
.pnl-cal .day { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; min-height:46px; border-radius:6px; background:var(--bg-elevated); padding:4px 2px; min-width:0; }
.pnl-cal .day small { font-size:10.5px; color:var(--text-muted); }
.pnl-cal .day b { font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:11px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
.pnl-cal .day.pos { background:var(--good-soft); } .pnl-cal .day.pos b { color:var(--good); }
.pnl-cal .day.neg { background:var(--bad-soft); } .pnl-cal .day.neg b { color:var(--bad); }
.pnl-cal .day.zero b { color:var(--text-muted); }
.pnl-cal .day.off { background:transparent; border:1px dashed var(--border); }
.pnl-donut { display:flex; gap:20px; align-items:center; flex-wrap:wrap; }
.cv-donut { width:150px; height:150px; flex:none; }
.donut-center { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:14px; font-weight:500; pointer-events:none; }
.pnl-assets { list-style:none; font-size:12.5px; display:flex; flex-direction:column; gap:6px; }
.pnl-assets b { font-family:'IBM Plex Mono',ui-monospace,monospace; font-weight:500; margin-left:6px; }
.pnl-assets small { color:var(--text-muted); margin-left:6px; }
@media (max-width: 760px) {
    .pnl-wins { grid-template-columns:1fr; gap:8px; }
    .pnl-wins div { flex-direction:row; justify-content:space-between; align-items:baseline; gap:8px; flex-wrap:wrap; }
    .pnl-today .tv { font-size:26px; }
    .pnl-cal .day { min-height:40px; } .pnl-cal .day b { font-size:9.5px; }
    .cv-pnl { height:170px; }
}
