/* Layout: coluna única de leitura, cartões de setor em grade, tabelas roláveis. */
:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --fg: #17201b;
  --muted: #5d6a62;
  --line: #dde2dc;
  --ok: #1f7a4d;
  --bad: #b23a30;
  --neutral: #7b8780;
  --accent: #2f5d50;
  --s1: #2f5d50; --s2: #c7772a; --s3: #3d6fb6; --s4: #8a5aa8; --s5: #b23a30; --s6: #6b8f2a;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121714; --panel: #1a211d; --fg: #e6ece7; --muted: #9aa8a0; --line: #2c3530;
    --ok: #4fbf86; --bad: #e46f63; --neutral: #8e9b94; --accent: #7fbfa9;
    --s1: #7fbfa9; --s2: #e6a35c; --s3: #7ea6e6; --s4: #c29ae0; --s5: #e46f63; --s6: #a6cc63;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121714; --panel: #1a211d; --fg: #e6ece7; --muted: #9aa8a0; --line: #2c3530;
  --ok: #4fbf86; --bad: #e46f63; --neutral: #8e9b94; --accent: #7fbfa9;
  --s1: #7fbfa9; --s2: #e6a35c; --s3: #7ea6e6; --s4: #c29ae0; --s5: #e46f63; --s6: #a6cc63;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font-body); }
.rs { max-width: 1120px; margin: 0 auto; display: grid; gap: 40px;
  padding-block: 32px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 5vw, 44px); line-height: 1.1; margin: 0; text-wrap: balance; }
h2 { font-size: 19px; font-weight: 600; margin: 0; text-wrap: balance; }
.rs-head { display: grid; gap: 10px; }
.rs-eyebrow { margin: 0; font: 500 12px/1.4 var(--font-mono); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.rs-lede { margin: 0; font-size: 19px; line-height: 1.4; max-width: 62ch; }
.rs-lede b { font-family: var(--font-mono); }
.rs-sub { margin: 0; color: var(--muted); font-size: 13px; max-width: 75ch; }
.rs-sec { display: grid; gap: 14px; min-width: 0; }
.rs > *, .rs-sec > * { min-width: 0; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.rs-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 16px 22px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; position: relative; overflow: hidden; min-width: 0; }
.rs-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--tone, var(--line)); }
.rs-card[data-sinal="COMPRA"] { --tone: var(--ok); }
.rs-card[data-sinal="VENDA"] { --tone: var(--bad); }
.rs-card[data-sinal="NEUTRO"] { --tone: var(--neutral); }
.rs-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rs-card h3 { margin: 0; font-size: 18px; font-weight: 600; }
.rs-pill { font: 600 11px/1 var(--font-mono); letter-spacing: .08em; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--tone); color: var(--tone); }
.rs-cesta { margin: 0; font: 12px/1.4 var(--font-mono); color: var(--muted); }
.rs-score { display: flex; align-items: center; gap: 14px; }
.rs-num { font-family: var(--font-display); font-size: 34px; font-variant-numeric: tabular-nums; min-width: 4ch; }
.rs-gauge { flex: 1 1 0; width: 100%; min-width: 0; height: 30px; display: block; }
.rs-gauge text { fill: var(--muted); font: 10px var(--font-mono); }
.rs-pil { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.rs-pil li { display: grid; grid-template-columns: 7.2em minmax(0, 1fr) 3.2em; align-items: center; gap: 10px; font-size: 13px; }
.rs-pil small { color: var(--muted); font-family: var(--font-mono); }
.rs-bar { position: relative; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); }
.rs-bar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); opacity: .5; }
.rs-bar span { position: absolute; top: -1px; bottom: -1px; border-radius: 4px; }
.rs-pv { text-align: right; font: 13px var(--font-mono); font-variant-numeric: tabular-nums; }
.rs-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.rs-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.rs-chart { position: relative; min-height: 280px; }
.rs-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.rs-chart text { fill: var(--muted); font: 11px var(--font-mono); }
.rs-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font: 12px var(--font-mono); white-space: nowrap; box-shadow: 0 4px 16px rgb(0 0 0 / .12); }
.rs-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.rs-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.rs-table th, .rs-table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rs-table th { color: var(--muted); font-weight: 500; }
.rs-table .n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-table tr:last-child td { border-bottom: 0; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
#bt-grafico { display: block; width: 100%; height: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.rs-metodo { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; }
.rs-metodo summary { cursor: pointer; font-weight: 600; }
.rs-metodo p, .rs-metodo li { max-width: 75ch; }
.rs-aviso { margin: 0; font-size: 12px; color: var(--muted); max-width: 75ch; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .rs-bar span { transition: width .5s ease-out, left .5s ease-out; } }

/* Navegação entre páginas */
.rs-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: -16px; }
.rs-nav a { font: 500 13px var(--font-body); color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); }
.rs-nav a[aria-current="page"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* Simulador */
.sim-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.sim-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.sim-tile small { display: block; color: var(--muted); font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.sim-tile b { display: block; font: 400 24px var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sim-tile em { display: block; font: 12px/1.4 var(--font-mono); font-style: normal; color: var(--muted); }
.sim-tile em.pos { color: var(--ok); } .sim-tile em.neg { color: var(--bad); }
.sim-hero { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; display: grid; gap: 12px; }
.sim-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sim-tabs { display: flex; gap: 6px; }
.sim-tabs button { font: 500 12px var(--font-mono); padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.sim-tabs button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.sim-two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }
.sim-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.sim-box p { margin: 0; }
.sim-box-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sim-tag { font: 600 11px var(--font-mono); padding: 4px 9px; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); white-space: nowrap; }
.sim-ordens { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.sim-ordens li { padding: 8px 10px; border-radius: 8px; background: var(--bg); }
.sim-recusada b { color: var(--bad); }
.sim-flat { border: 0; background: transparent; }
.sim-small { min-width: 0; }
.sim-small th, .sim-small td { padding: 8px 6px; }
.sim-mais { justify-self: start; font: 500 13px var(--font-body); padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; }
@media (max-width: 900px) { .sim-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .sim-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .sim-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sim-tile b { font-size: 20px; } }

/* Carteiras A e B */
.sim-tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sim-a { box-shadow: inset 3px 0 0 var(--s1); }
.sim-b { box-shadow: inset 3px 0 0 var(--s4); }
.sim-comp { min-width: 0; }
.sim-comp th[scope="row"] { color: var(--fg); font-weight: 500; }
.sim-comp td { width: 34%; }
@media (max-width: 900px) { .sim-tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Pregão ao vivo */
.sim-status { display: flex; align-items: center; gap: 8px; margin: 0; font: 12px/1.4 var(--font-mono); color: var(--muted); }
.sim-ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); flex: none; }
.sim-status.ao-vivo .sim-ponto { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.sim-h3 { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.sim-mono { font: 12px var(--font-mono); white-space: nowrap; }
.sim-noticias summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.sim-noticias ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; max-height: 320px; overflow-y: auto; }
