/* Radar Investidor
   Layout: no celular, coluna única com abas fixas embaixo (Painel, Operações, Carteiras, Opções, Mais);
   a partir de 1024px as abas sobem para o cabeçalho e o painel vira duas colunas
   (gráfico à esquerda, operação/níveis/indicadores à direita). */
:root {
  --bg: #EEF2F7;
  --bg-glow: #DCE6F7;
  --surface: #FFFFFF;
  --surface-2: #F4F6FA;
  --fg: #0F1624;
  --muted: #5B6679;
  --line: #DDE3EC;
  --accent: #2A55E5;
  --accent-soft: #E4EAFD;
  --on-accent: #FFFFFF;
  --up: #0A9463;
  --up-soft: #DDF4EA;
  --up-vol: rgba(10, 148, 99, .28);
  --up-fill: rgba(10, 148, 99, .18);
  --down: #D23B32;
  --down-soft: #FBE4E2;
  --down-vol: rgba(210, 59, 50, .28);
  --down-fill: rgba(210, 59, 50, .16);
  --warn: #B7791F;
  --warn-soft: #FBF0DC;
  --flat: #7A8496;
  --flat-soft: #E9ECF1;
  --ema-fast: #2A55E5;
  --ema-slow: #D9860F;
  --vwap: #0E95A3;
  --bb: #8B5CF6;
  --sma: #475569;
  --grid: #EEF1F5;
  --c1: #2A55E5; --c2: #0A9463; --c3: #D9860F; --c4: #8B5CF6; --c5: #0E95A3; --c6: #D23B32; --c7: #475569; --c8: #C2410C;
  --shadow: 0 1px 2px rgba(15, 22, 36, .05), 0 6px 24px rgba(15, 22, 36, .06);
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070B13; --bg-glow: #0F1A30; --surface: #0E1522; --surface-2: #141D2D; --fg: #E6EBF3; --muted: #8B97AB;
    --line: #1E293B; --accent: #6E8CFF; --accent-soft: #18234A; --on-accent: #0A0F1A;
    --up: #34D399; --up-soft: #0E2C24; --up-vol: rgba(52, 211, 153, .25); --up-fill: rgba(52, 211, 153, .16);
    --down: #F87171; --down-soft: #351719; --down-vol: rgba(248, 113, 113, .25); --down-fill: rgba(248, 113, 113, .14);
    --warn: #E3B04F; --warn-soft: #3A2E16;
    --flat: #8B97AB; --flat-soft: #1A2333; --ema-fast: #6E8CFF; --ema-slow: #F5B041; --vwap: #3CC8D6;
    --bb: #B794F6; --sma: #A3B1C6; --grid: #131C2B;
    --c1: #6E8CFF; --c2: #34D399; --c3: #F5B041; --c4: #B794F6; --c5: #3CC8D6; --c6: #F87171; --c7: #A3B1C6; --c8: #FB923C;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070B13; --bg-glow: #0F1A30; --surface: #0E1522; --surface-2: #141D2D; --fg: #E6EBF3; --muted: #8B97AB;
  --line: #1E293B; --accent: #6E8CFF; --accent-soft: #18234A; --on-accent: #0A0F1A;
  --up: #34D399; --up-soft: #0E2C24; --up-vol: rgba(52, 211, 153, .25); --up-fill: rgba(52, 211, 153, .16);
  --down: #F87171; --down-soft: #351719; --down-vol: rgba(248, 113, 113, .25); --down-fill: rgba(248, 113, 113, .14);
  --warn: #E3B04F; --warn-soft: #3A2E16;
  --flat: #8B97AB; --flat-soft: #1A2333; --ema-fast: #6E8CFF; --ema-slow: #F5B041; --vwap: #3CC8D6;
  --bb: #B794F6; --sma: #A3B1C6; --grid: #131C2B;
  --c1: #6E8CFF; --c2: #34D399; --c3: #F5B041; --c4: #B794F6; --c5: #3CC8D6; --c6: #F87171; --c7: #A3B1C6; --c8: #FB923C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 500px at 50% -200px, var(--bg-glow), transparent 70%) no-repeat, var(--bg);
  color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.45; min-height: 100vh;
}
[hidden] { display: none !important; }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
h1 { font-size: 24px; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Cabeçalho ---------- */
.topbar { position: sticky; top: 0; z-index: 6; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.nav-top { display: none; gap: 2px; margin-left: 8px; }
.nav-top button { background: none; border: 0; border-radius: 9px; padding: 7px 11px; color: var(--muted); font-weight: 500; position: relative; white-space: nowrap; }
.nav-top button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap; background: var(--surface); }
button.pill:hover { border-color: var(--accent); color: var(--fg); }
.pill.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--flat); flex: none; }
.dot.live { background: var(--up); animation: pulse 1.6s infinite; }
.dot.err { background: var(--down); }
@keyframes pulse { 50% { opacity: .3; } }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 14px; display: grid; place-items: center; flex: none; }
.btn { border: 0; border-radius: 10px; padding: 9px 14px; font-weight: 600; background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
a.btn { text-decoration: none; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn.ghost { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); }
.btn.danger { background: var(--down-soft); color: var(--down); border: 1px solid var(--down); }
.btn.buy { background: var(--up); color: #fff; }
.btn.sell { background: var(--down); color: #fff; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; text-decoration: underline; }

/* ---------- Estrutura ---------- */
.app { max-width: 1280px; margin: 0 auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.view { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex;
  flex-direction: column; gap: 12px; min-width: 0; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.status { font-size: 13px; border-radius: 12px; padding: 10px 12px; background: var(--down-soft); border: 1px solid var(--down); }
.status.aviso { background: var(--flat-soft); border-color: var(--line); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* ---------- Mercados ---------- */
.markets { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(118px, 1fr); gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.markets::-webkit-scrollbar { display: none; }
.mkt { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; box-shadow: var(--shadow); transition: border-color .2s, transform .15s; }
.mkt:hover { transform: translateY(-1px); }
.mkt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.mkt-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.mkt-price { font-family: var(--font-data); font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-chg { font-family: var(--font-data); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt.add { align-items: center; justify-content: center; color: var(--accent); font-weight: 600; border-style: dashed; box-shadow: none; background: transparent; }
.mkt .tirar { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--muted);
  font-size: 13px; line-height: 1; display: none; place-items: center; padding: 0; }
.mkt:hover .tirar, .mkt[aria-pressed="true"] .tirar { display: grid; }
.bdot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--flat); }
.bdot.buy { background: var(--up); } .bdot.sell { background: var(--down); }

/* ---------- Destaque (preço + viés) ---------- */
.hero { gap: 14px; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--flat); }
.hero[data-bias="buy"]::before { background: var(--up); }
.hero[data-bias="sell"]::before { background: var(--down); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.sym { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.price { font-family: var(--font-data); font-size: 40px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.chg { font-family: var(--font-data); font-size: 14px; font-weight: 500; color: var(--muted); }
.bias-box { border-radius: 14px; padding: 10px 14px; background: var(--flat-soft); min-width: 150px; display: flex; flex-direction: column; gap: 2px; }
.hero[data-bias="buy"] .bias-box { background: var(--up-soft); }
.hero[data-bias="sell"] .bias-box { background: var(--down-soft); }
.bias-word { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: .02em; color: var(--flat); line-height: 1.15; }
.hero[data-bias="buy"] .bias-word { color: var(--up); }
.hero[data-bias="sell"] .bias-word { color: var(--down); }
.small-muted { font-size: 12px; color: var(--muted); }
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter-fill { position: absolute; top: 0; bottom: 0; transition: left .3s, width .3s, background .3s; }
.meter::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--muted); opacity: .6; }
.meter-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.signals { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 18px; }
.signals li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.signals li.extra span:first-child::after { content: "extra"; font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); margin-left: 6px; }
.chip { font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; color: var(--surface); background: var(--flat); }
.chip.up { background: var(--up); } .chip.down { background: var(--down); } .chip.acc { background: var(--accent); } .chip.warn { background: var(--warn); }
.chip.soft { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- Gráfico ---------- */
.seg { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 4px 9px; font-size: 12px; color: var(--muted); white-space: nowrap; flex: none; }
.seg.mono button { font-family: var(--font-data); }
.seg.big button { padding: 7px 12px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chart { position: relative; width: 100%; height: 320px; }
.chart-msg { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 14px; padding: 16px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: gira .8s linear infinite; margin: 0 auto 8px; }
@keyframes gira { to { transform: rotate(360deg); } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---------- Operação ---------- */
.trade { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tcell { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lbl { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.val { font-family: var(--font-data); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-family: var(--font-data); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note { font-size: 13px; color: var(--muted); }
.trade-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trade-btns .btn { flex-direction: column; gap: 0; padding: 9px 10px; line-height: 1.25; }
.trade-btns .btn small { font-family: var(--font-data); font-weight: 500; font-size: 12px; opacity: .9; }
.minhas { display: flex; flex-direction: column; gap: 6px; }
.minha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.minha .res { margin-left: auto; font-family: var(--font-data); font-weight: 600; }
select, input[type="number"], input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="date"], input[type="search"] {
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 13px; min-width: 0; }

/* ---------- Níveis ---------- */
.ladder { display: flex; flex-direction: column; }
.rung { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rung:last-child { border-bottom: 0; }
.rung .tag { font-size: 12px; font-weight: 600; }
.rung.res .tag { color: var(--down); } .rung.sup .tag { color: var(--up); } .rung.piv .tag { color: var(--muted); }
.rung.now { background: var(--accent-soft); border-radius: 8px; padding-inline: 8px; margin-inline: -8px; border-bottom-color: transparent; }
.rung.now .tag { color: var(--accent); }
.rung .dist { font-family: var(--font-data); font-size: 12px; color: var(--muted); text-align: right; }

/* ---------- Indicadores ---------- */
.ind-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ind { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ind.extra { box-shadow: inset 0 0 0 1px var(--accent-soft); }

/* ---------- Operações / carteiras ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .val { font-size: 22px; }
.eq { position: relative; width: 100%; height: 220px; }
.tblwrap { overflow-x: auto; margin-inline: -4px; padding-inline: 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: right; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 4px 6px; white-space: nowrap; }
.tbl td { text-align: right; padding: 8px 6px; border-top: 1px dashed var(--line); font-family: var(--font-data); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child, .tbl .l { text-align: left; }
.tbl td.l { font-family: var(--font-body); }
.tbl tr.total td { font-weight: 600; border-top: 1px solid var(--line); }
.tick-name { display: flex; flex-direction: column; }
.tick-name small { color: var(--muted); font-size: 11px; font-family: var(--font-body); white-space: normal; max-width: 220px; }
.ops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.op { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; border-left: 3px solid var(--flat); }
.op.gain { border-left-color: var(--up); } .op.loss { border-left-color: var(--down); } .op.aberta { border-left-color: var(--accent); }
.op-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.op-res { margin-left: auto; font-family: var(--font-data); font-weight: 600; font-size: 14px; }
.op-sub { font-family: var(--font-data); font-size: 12px; color: var(--muted); }
.op-acts { display: flex; gap: 6px; justify-content: flex-end; }
.bar-alloc { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); }
.bar-alloc span { display: block; height: 100%; }
.alloc-lg { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.alloc-lg i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.bt-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; align-items: end; height: 110px; }
.bt-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 2px; position: relative; }
.bt-pair { display: flex; gap: 2px; align-items: center; height: 100%; width: 100%; justify-content: center; position: relative; }
.bt-pair span { width: 42%; position: absolute; border-radius: 2px; }
.bt-lbl { font-size: 10px; color: var(--muted); font-family: var(--font-data); }
.cv-cart { position: relative; width: 100%; height: 230px; }
@media (min-width: 700px) { .cv-cart { height: 280px; } }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Alertas e ajustes ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.setting small { display: block; color: var(--muted); font-size: 12px; }
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 21px; }
.switch:disabled { opacity: .4; cursor: not-allowed; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 0; }
.field input, .field select { width: 100%; font-size: 15px; padding: 8px 10px; }
.field input[type="number"] { font-family: var(--font-data); }
.field small { color: var(--muted); font-size: 11px; }
.field.changed input { border-color: var(--accent); background: var(--accent-soft); }
.extra-card.off .fields { opacity: .5; }
.view-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.view-opt { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.view-opt b { font-family: var(--font-display); font-size: 15px; }
.view-opt span { font-size: 12px; color: var(--muted); }
.view-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alert-item { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; }
.alert-item .when { font-family: var(--font-data); font-size: 12px; color: var(--muted); }
.alert-item .msg { grid-column: 1 / -1; font-family: var(--font-data); font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; padding-inline: 8px; }

/* ---------- Opções (simulador embutido) ---------- */
.opcoes-frame { width: 100%; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  height: calc(100dvh - 190px - env(safe-area-inset-bottom, 0px)); min-height: 520px; box-shadow: var(--shadow); }

/* ---------- Assinantes ---------- */
.sub-list { display: flex; flex-direction: column; gap: 8px; }
.sub-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.sub-item .info { display: flex; flex-direction: column; min-width: 0; }
.sub-item .info b { font-size: 14px; }
.sub-item .info span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.sub-item .info .chip { font-size: 10px; color: var(--surface); vertical-align: 2px; }
.sub-item .meta { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.sub-item .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sub-item.bloq { opacity: .6; }

/* ---------- Login ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { width: 44px; height: 44px; border-radius: 12px; }
.auth-brand b { font-family: var(--font-display); font-size: 22px; display: block; }
.auth-brand span { font-size: 13px; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-err { font-size: 13px; color: var(--down); background: var(--down-soft); border-radius: 10px; padding: 8px 12px; }
.ou { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.ou::before, .ou::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#gBtn { display: flex; justify-content: center; min-height: 44px; }

/* ---------- Abas do celular ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tab { background: none; border: 0; padding: 9px 2px 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); position: relative; }
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--down); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; padding-inline: 4px; }
.nav-top .badge { top: -4px; left: auto; right: -4px; }
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-list button { display: flex; align-items: center; gap: 12px; text-align: left; background: none; border: 0; border-radius: 10px; padding: 12px; font-size: 15px; }
.menu-list button:hover { background: var(--surface-2); }
.menu-list svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }

/* ---------- Aviso e janelas ---------- */
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 12px); transform: translate(-50%, -160%); width: min(460px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
  transition: transform .35s ease; z-index: 30; display: flex; gap: 12px; align-items: flex-start; }
.toast.show { transform: translate(-50%, 0); }
.toast img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.toast b { font-family: var(--font-display); }
.toast .msg { font-family: var(--font-data); font-size: 12px; color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--surface); color: var(--fg); width: min(460px, calc(100% - 24px)); max-height: calc(100dvh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(5, 8, 15, .55); backdrop-filter: blur(3px); }
.dlg { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dlg h3 { font-size: 18px; }
.link-box { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 12px; }
.link-box code { flex: 1; min-width: 0; font-family: var(--font-data); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.busca-res { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.busca-res button { display: flex; justify-content: space-between; gap: 10px; text-align: left; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; }
.busca-res button:hover { border-color: var(--accent); }
.busca-res b { font-family: var(--font-data); }
.busca-res span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Telas maiores ---------- */
@media (min-width: 700px) {
  .signals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid, .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chart { height: 400px; }
  .eq { height: 280px; }
  .mkt-price { font-size: 20px; }
  .markets { grid-auto-columns: minmax(150px, 1fr); }
}
@media (min-width: 1180px) {
  .nav-top { display: flex; }
  .tabbar { display: none; }
  .app { padding-bottom: 32px; }
}
@media (min-width: 1024px) {
  .app { padding-top: 18px; }
  .dash { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .col.side { position: sticky; top: 74px; }
  .chart { height: 480px; }
  .price { font-size: 46px; }
  .markets { grid-auto-columns: minmax(170px, 230px); }
  .opcoes-frame { height: calc(100dvh - 130px); }
}
@media (max-width: 380px) {
  .trade, .ind-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price { font-size: 34px; }
  .mkt { padding: 8px 9px; }
  .mkt-price { font-size: 15px; }
  .share-txt { display: none; }
}
@media (max-width: 520px) {
  .tbl .pts, .tbl .hide-sm { display: none; }
  /* Topo do celular: só ícones (o ponto verde já diz que está ao vivo) */
  #fonteTxt, .share-txt { display: none; }
  #fonte { padding: 8px; }
  .brand { font-size: 16px; gap: 8px; }
  .topbar-inner { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
