/* ZeroLoss Arb — estilo do app. Tokens do ZeroLoss Design System em /css (cores, tipografia, espaçamento).
   Regras da marca: fundo neutro (tinta violeta escura); violeta = ações, bordas de destaque, foco, setas;
   lime só na marca; verde/vermelho SÓ para lucro/prejuízo; âmbar = precisa de atenção. */
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap");
@import url("/css/colors.css");
@import url("/css/typography.css");
@import url("/css/spacing.css");

:root { color-scheme: dark; }
/* Fundo neutro (cinza grafite, pedido de José a partir da referência): as superfícies deixam de ter tom violeta.
   O violeta da marca continua só em ações, bordas de destaque, setas e foco. */
:root:not([data-theme="light"]) {
  --ink-0: #0E0F10; --ink-1: #131415; --ink-2: #18191B; --ink-3: #1E1F22; --ink-4: #26272B; --ink-5: #2F3034; --ink-6: #44454B;
  --surface-app: #0E0F10; --surface-sunken: #121314; --surface-card: #17181A; --surface-raised: #1D1E21; --surface-hover: #25262A; --surface-input: #121314;
  --surface-overlay: rgba(6, 6, 7, .62);
  --border-subtle: #232427; --border-default: #2E2F33; --border-strong: #44454B;
  --text-secondary: #CDCED4; --text-tertiary: #A3A4AC; --text-disabled: #60616A;
  --chart-grid: #232427; --chart-axis: #8A8B93;
  --status-cancelled-tint: rgba(138, 139, 147, .14); --status-done-tint: rgba(245, 246, 250, .07);
}
/* Robô: o único bloco com fundo verde (pedido de José, como a referência) */
:root { --bot-bg: #0F1E17; --bot-border: rgba(61, 214, 140, .30); --bot-inner: rgba(0, 0, 0, .28); --bot-chip: rgba(61, 214, 140, .14); }
:root[data-theme="light"] { --bot-bg: #EEF8F2; --bot-border: #A9E2C5; --bot-inner: rgba(255, 255, 255, .7); --bot-chip: #DDF2E6; }
:root[data-theme="light"] { color-scheme: light; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--surface-app); color: var(--text-primary); font: var(--type-body); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
code, pre, .mono { font: var(--type-code); }
pre { background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-3); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
small { font-size: var(--fs-caption); }
h1 { font: var(--type-h1); margin: 0; }
h2 { font: var(--type-h2); margin: 0 0 var(--space-3); }
h3 { font: var(--type-h3); margin: 0 0 var(--space-2); }
p { margin: 0 0 var(--space-2); }
.muted { color: var(--text-tertiary); }
.pos { color: var(--gain); }
.neg { color: var(--loss); }
.warn { color: var(--warning); }
.num, td, .kpi div { font-variant-numeric: tabular-nums lining-nums; }
[hidden] { display: none !important; }
@keyframes zl-pulse { 0% { box-shadow: 0 0 0 0 currentColor; opacity: 1 } 70% { box-shadow: 0 0 0 6px transparent; opacity: .85 } 100% { box-shadow: 0 0 0 0 transparent; opacity: 1 } }
@keyframes zl-spin { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Estrutura: menu lateral + topo + conteúdo ---------- */
.app { display: flex; min-height: 100vh; max-width: calc(var(--sidebar-w) + var(--content-max) + 80px); margin: 0 auto; }
@media (min-width: 1600px) { .app { border-left: 1px solid var(--border-subtle); } }
.side { width: var(--sidebar-w); flex: none; height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-5) var(--space-3); background: var(--surface-sunken); border-right: 1px solid var(--border-subtle); overflow-y: auto; }
.side .brand { display: block; padding: 4px 8px 22px; }
.side .brand img { height: 38px; display: block; }
.side .brand .light-mark { display: none; align-items: center; gap: 10px; font: 600 20px/1 var(--font-sans); letter-spacing: -0.03em; color: var(--text-primary); }
:root[data-theme="light"] .side .brand img.dark-only { display: none; }
:root[data-theme="light"] .side .brand .light-mark { display: inline-flex; }
.side .brand .light-mark img { height: 30px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--radius-md); color: var(--text-secondary); font: 500 14px/1 var(--font-sans); text-decoration: none !important; transition: background var(--dur-fast) var(--ease-out); }
.nav-item:hover { background: var(--surface-card); color: var(--text-primary); }
.nav-item.active { background: var(--surface-raised); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-default); }
.nav-item.active svg { color: var(--brand-text); }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-sep { height: 1px; background: var(--border-subtle); margin: var(--space-3) 8px; }
.side .spacer { flex: 1; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; border: 1px solid var(--border-subtle); background: var(--surface-card); }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 999px; background: var(--brand-tint); color: var(--brand-text); display: flex; align-items: center; justify-content: center; font: 600 12px/1 var(--font-sans); }
.user-card .who { flex: 1; min-width: 0; }
.user-card .who b { display: block; font: 600 13px/18px var(--font-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .who span { display: block; font: 400 11px/14px var(--font-sans); color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { flex: 1; min-width: 0; padding: var(--space-6) var(--space-8) var(--space-12); }
.main > .inner { max-width: var(--content-max); margin: 0; display: flex; flex-direction: column; gap: var(--space-5); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 56px; flex-wrap: wrap; }
.topbar p { margin: 4px 0 0; font: 400 13px/18px var(--font-sans); color: var(--text-tertiary); }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.clock { font: 400 13px/1 var(--font-mono); color: var(--text-tertiary); }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .side { position: fixed; z-index: 30; left: 0; top: 0; transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-out); box-shadow: var(--shadow-modal); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: var(--space-4) var(--space-4) var(--space-12); }
}

/* ---------- Cartões (cada <section> do app vira um cartão) ---------- */
section, .card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-card); padding: var(--space-5); box-shadow: var(--shadow-raised); min-width: 0; }
section.plain { background: none; border: 0; box-shadow: none; padding: 0; }
.card.brand, section.brand { border-color: var(--brand-border); }
.card.attention, section.attention { border-color: var(--warning-border); }
.card.dashed { border-style: dashed; border-color: var(--border-default); box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head p { margin: 2px 0 0; color: var(--text-tertiary); font-size: var(--fs-small); }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.label { font: var(--type-label); color: var(--text-tertiary); }
.hero { font: var(--type-hero); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums lining-nums; }
.hero .cur, .display .cur { font-size: .5em; font-weight: 500; color: var(--text-tertiary); margin-right: 4px; letter-spacing: 0; }
.display { font: var(--type-display); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Tabelas ---------- */
.table { overflow-x: auto; margin: 0 calc(-1 * var(--space-2)); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th { text-align: left; padding: 10px var(--space-3); font: var(--type-label); color: var(--text-tertiary); border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
td { padding: 12px var(--space-3); border-bottom: 1px solid var(--border-subtle); font: 400 13px/18px var(--font-sans); white-space: nowrap; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-raised); }
tr.clickable { cursor: pointer; }
td.wrap, th.wrap { white-space: normal; }
section table th[scope="row"], tbody th { color: var(--text-tertiary); font: 500 13px/18px var(--font-sans); width: 1%; white-space: nowrap; vertical-align: top; padding-top: 12px; }

/* ---------- Botões ---------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-h-md); padding: 0 16px; border-radius: var(--radius-control);
  border: 1px solid var(--border-default); background: var(--surface-raised); color: var(--text-primary); font: 600 14px/1 var(--font-sans); white-space: nowrap; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); text-decoration: none !important; }
button:hover, .btn:hover { background: var(--surface-hover); color: var(--text-primary); }
button:active, .btn:active { transform: translateY(1px); background: var(--surface-sunken); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.primary, .btn.primary, form button:not([type="button"]):not(.tab), button[data-exec] { background: var(--brand); border-color: transparent; color: var(--text-on-brand); }
button.primary:hover, .btn.primary:hover, form button:not([type="button"]):not(.tab):hover, button[data-exec]:hover { background: var(--brand-hover); }
button.primary:active, form button:not([type="button"]):not(.tab):active, button[data-exec]:active { background: var(--brand-press); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
button.ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
button.danger { background: var(--danger); border-color: transparent; color: #fff; }
button.danger:hover { background: var(--danger-hover); }
button.danger-outline { background: transparent; border-color: var(--loss-border); color: var(--loss); }
button.danger-outline:hover { background: var(--loss-tint); }
button.small, .btn.small { height: var(--control-h-sm); padding: 0 12px; font-size: 13px; }
button.icon { width: var(--control-h-sm); height: var(--control-h-sm); padding: 0; }
button svg, .btn svg { width: 16px; height: 16px; flex: none; }
button.small svg { width: 14px; height: 14px; }
button[aria-busy="true"] svg { animation: zl-spin .9s linear infinite; }

/* ---------- Campos ---------- */
input, select, textarea { font: 400 14px/20px var(--font-sans); color: var(--text-primary); background: var(--surface-input); border: 1px solid var(--border-default); border-radius: var(--radius-control);
  height: var(--control-h-md); padding: 0 12px; transition: border-color var(--dur-fast) var(--ease-out); min-width: 0; }
textarea { height: auto; padding: 10px 12px; }
input::placeholder { color: var(--text-disabled); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }
input[type="checkbox"], input[type="radio"] { height: 16px; width: 16px; padding: 0; accent-color: var(--brand); vertical-align: middle; }
input[type="number"] { font-variant-numeric: tabular-nums; }
label { color: var(--text-secondary); font-size: var(--fs-small); }
form { display: grid; gap: var(--space-3); max-width: 420px; }
form > button, form > div > button { justify-self: start; }
.row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: 6px; }
.field small { font-size: 12px; }

/* ---------- Selos de situação ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font: 500 12px/1 var(--font-sans); white-space: nowrap; background: var(--status-cancelled-tint); color: var(--text-secondary); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge.running, .badge.live { background: var(--status-running-tint); color: var(--status-running); }
.badge.running::before, .badge.live::before { animation: zl-pulse 1.8s var(--ease-out) infinite; }
.badge.done { background: var(--status-done-tint); color: var(--status-done); }
.badge.attention { background: var(--status-attention-tint); color: var(--status-attention); }
.badge.cancelled { background: var(--status-cancelled-tint); color: var(--status-cancelled); }
.badge.brand { background: var(--brand-tint); color: var(--brand-text); }
.badge.accent { background: var(--accent-tint); color: var(--accent); }

/* ---------- Alertas e mensagens ---------- */
.msg, .alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--brand-border); background: var(--brand-tint); color: var(--text-primary); font-size: var(--fs-small); margin: 0; }
.msg.err, .alert.error { border-color: var(--loss-border); background: var(--loss-tint); }
.alert.warning { border-color: var(--warning-border); background: var(--warning-tint); }
.alert.success { border-color: var(--gain-border); background: var(--gain-tint); }

/* ---------- Saldos por corretora ---------- */
.balances { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.bal { display: flex; flex-direction: column; gap: 12px; padding: var(--space-4); border: 1px solid var(--border-subtle); border-radius: var(--radius-card); background: var(--surface-sunken); min-width: 0; }
.bal.off { border-style: dashed; border-color: var(--border-default); background: transparent; }
.bal.err { border-color: var(--warning-border); }
.bal .top { display: flex; align-items: center; gap: 10px; }
.bal .name { font: 600 14px/20px var(--font-sans); }
.bal .st { display: flex; align-items: center; gap: 6px; font: 400 12px/16px var(--font-sans); color: var(--text-tertiary); }
.bal .st::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--brand-text); }
.bal.off .st::before { background: var(--text-disabled); }
.bal.err .st { color: var(--warning); } .bal.err .st::before { background: var(--warning); }
.bal .brl { font: 600 22px/28px var(--font-sans); font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-num); }
.bal .sub { font: 400 12px/16px var(--font-sans); color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.logo { width: 28px; height: 28px; flex: none; border-radius: 8px; object-fit: cover; background: #fff1; }
.logo.sm { width: 18px; height: 18px; border-radius: 5px; }
.mark.sm { width: 18px; height: 18px; border-radius: 5px; font-size: 8px; }
.leg { display: inline-flex; align-items: center; gap: 6px; }
.opp-route { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 500; }
.opp-route svg { width: 14px; height: 14px; color: var(--brand-text); flex: none; }
#breakdown code, .wrap-code code { word-break: break-all; }
.mark { width: 28px; height: 28px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-raised); border: 1px solid var(--border-default); color: var(--text-secondary); font: 600 11px/1 var(--font-sans); }
.total-strip { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }

/* ---------- Indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.kpi { border: 1px solid var(--border-subtle); background: var(--surface-sunken); border-radius: var(--radius-card); padding: 14px 16px; min-width: 0; }
.kpi small { font: var(--type-label); color: var(--text-tertiary); }
.kpi div { font: 600 20px/26px var(--font-sans); margin-top: 4px; letter-spacing: var(--tracking-num); }
.stats { display: grid; grid-template-columns: repeat(2, auto); gap: 16px 32px; align-content: start; }
.stat .label { display: block; }
.stat .v { font: 600 18px/24px var(--font-sans); font-variant-numeric: tabular-nums; }

/* ---------- Gráfico de barras ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; overflow-x: auto; padding-top: 8px; border-bottom: 1px solid var(--chart-grid); }
.bar { flex: 1 0 22px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bar span { width: 100%; max-width: 36px; background: var(--chart-1); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar small { font-size: 11px; color: var(--chart-axis); margin-top: 4px; }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0; }
.tab { height: 40px; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 0 12px; color: var(--text-secondary); font-weight: 500; }
.tab:hover { background: none; color: var(--text-primary); }
.tab.active { border-bottom-color: var(--brand); color: var(--text-primary); font-weight: 600; }

/* ---------- Rotas e linha do tempo ---------- */
.route { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.route .arrow { color: var(--brand-text); }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.steps li { display: flex; gap: 14px; }
.steps .node { width: 28px; height: 28px; flex: none; border-radius: 999px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-default); background: var(--surface-card); color: var(--text-tertiary); font: 600 12px/1 var(--font-sans); position: relative; z-index: 1; }
.steps .rail { display: flex; flex-direction: column; align-items: center; }
.steps .line { flex: 1; width: 2px; min-height: 14px; margin: 4px 0; border-radius: 2px; background: var(--border-default); }
.steps li:last-child .line { display: none; }
.steps li.done .node { background: var(--brand-tint); color: var(--brand-text); border-color: var(--brand-border); }
.steps li.done .line { background: var(--brand); }
.steps li.active .node { background: var(--brand); color: #fff; border-color: transparent; box-shadow: 0 0 0 4px var(--brand-tint); }
.steps li.active .node svg { animation: zl-spin 1s linear infinite; }
.steps li.error .node { background: var(--warning-tint); color: var(--warning); border-color: var(--warning-border); }
.steps .body { flex: 1; min-width: 0; padding: 3px 0 16px; }
.steps li:last-child .body { padding-bottom: 0; }
.steps .body b { font: 600 14px/20px var(--font-sans); }
.steps li.pending .body b { color: var(--text-tertiary); }
.steps .body small { display: block; color: var(--text-secondary); font-size: var(--fs-small); line-height: var(--lh-small); white-space: normal; }
.steps svg { width: 14px; height: 14px; }

/* ---------- Janela da operação: centralizada, fundo desfocado (foco total) ---------- */
body:has(.pop:not([hidden]))::before { content: ""; position: fixed; inset: 0; z-index: 19; background: var(--surface-overlay); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: zl-fade var(--dur-base) var(--ease-out); }
body:has(.pop:not([hidden])) { overflow: hidden; }
.pop { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: min(88vh, 860px); overflow: auto;
  background: var(--surface-raised); border: 1px solid var(--brand-border); border-radius: var(--radius-modal); box-shadow: var(--shadow-modal), 0 0 0 6px var(--brand-tint);
  padding: var(--space-6); display: grid; gap: var(--space-4); z-index: 20; animation: zl-rise var(--dur-slow) var(--ease-out); }
.pop p { margin: 0; }
.pop table td, .pop table th { padding: 8px 8px; }
.pop table th.wrap { width: auto; white-space: normal; }
@keyframes zl-fade { from { opacity: 0 } }
@keyframes zl-rise { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) } }

/* Janelinha de teste: custo de voltar pela Chainless (no fim da página, sem cobrir o conteúdo) */
.mini { background: var(--surface-card); border: 1px dashed var(--border-default); border-radius: var(--radius-card); padding: 12px 16px; font-size: 13px; display: grid; gap: 6px; }
.mini summary { cursor: pointer; font-weight: 600; }
.mini p { margin: 0; }

details > summary { cursor: pointer; color: var(--text-secondary); }
details { margin-top: 6px; }

/* Selo discreto da conta de demonstração */
.demo-tag { position: fixed; right: 10px; bottom: 8px; font-size: 11px; color: var(--text-tertiary); opacity: .75; letter-spacing: .04em; pointer-events: none; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
.auth .box { width: min(420px, 100%); display: grid; gap: var(--space-5); }
.auth .box > img { height: 44px; justify-self: center; }
.auth form { max-width: none; }
.auth form > button { justify-self: stretch; }
.auth section h2 { margin-bottom: var(--space-4); }

/* ---------- Toque no celular: alvos de 44 px ---------- */
@media (pointer: coarse) { button, .btn, input, select { min-height: 44px; } button.small { min-height: 40px; } .nav-item { height: 44px; } }

/* ---------- Painel em página única ---------- */
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 12px 0 14px; }
.sec-head h2 { font: var(--type-h1); margin: 0; }
.sec-head p { margin: 4px 0 0; color: var(--text-tertiary); font-size: 13px; }
section.plain { scroll-margin-top: 16px; } section { scroll-margin-top: 16px; }

/* Lucro de hoje: o número principal da tela */
.today { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; padding: 28px;
  background: linear-gradient(135deg, rgba(34, 178, 108, .12), rgba(34, 178, 108, 0) 55%), var(--surface-card); border-color: var(--gain-border); }
@media (max-width: 900px) { .today { grid-template-columns: minmax(0, 1fr); } }
.today-main { display: grid; gap: 8px; align-content: center; }
.today-main .label { font-size: 13px; color: var(--text-secondary); }
.hero.big { font-size: clamp(40px, 6vw, 60px); line-height: 1.05; }
.today-sub { font-size: 14px; color: var(--text-secondary); }
.today-side { display: grid; gap: 18px; align-content: center; padding-left: 24px; border-left: 1px solid var(--border-subtle); }
@media (max-width: 900px) { .today-side { padding-left: 0; border-left: 0; padding-top: 16px; border-top: 1px solid var(--border-subtle); } }
.today-side > .stat .v { font-size: 22px; line-height: 28px; }
.stat small { display: block; }

/* Saldos: borda e brilho interno na cor de cada corretora */
.bal { --exc: var(--border-default); border-color: color-mix(in srgb, var(--exc) 55%, var(--border-subtle));
  background: linear-gradient(180deg, color-mix(in srgb, var(--exc) 9%, transparent), transparent 70%), var(--surface-sunken);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--exc) 30%, transparent), inset 0 0 24px -12px color-mix(in srgb, var(--exc) 45%, transparent); }
.bal.off { box-shadow: none; background: transparent; border-color: color-mix(in srgb, var(--exc) 35%, var(--border-default)); }
.ex-binance { --exc: #F0B90B; } .ex-bitget { --exc: #00D1E6; } .ex-bybit { --exc: #F7A600; } .ex-mexc { --exc: #2F5CF0; }
.ex-okx { --exc: #8C8C8C; } .ex-chainless { --exc: #F5C518; } .ex-kucoin { --exc: #24AE8F; }
:root[data-theme="light"] .ex-okx { --exc: #111111; }

/* Oportunidades em blocos */
.opp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1250px) { .opp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .opp-grid { grid-template-columns: minmax(0, 1fr); } }
.opp { display: grid; gap: 18px; padding: 22px; align-content: start; border-radius: var(--radius-card); background: var(--surface-card); border: 1px solid var(--border-subtle); min-width: 0; transition: border-color var(--dur-fast) var(--ease-out); }
.opp:hover { border-color: var(--border-strong); }
.opp.viable { border-color: color-mix(in srgb, var(--gain) 22%, var(--border-subtle)); }
.opp-top { display: flex; justify-content: space-between; align-items: center; }
.opp .badge.live { background: var(--gain-tint); color: var(--gain); }
.opp-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.opp-route-box { display: flex; align-items: center; gap: 10px; min-width: 0; }
.opp-route-box b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-route-box small { display: block; color: var(--text-tertiary); font-size: 12px; }
.stack { display: inline-flex; flex: none; }
.stack > * { width: 26px; height: 26px; border-radius: 999px; box-shadow: 0 0 0 2px var(--surface-card); }
.stack > * + * { margin-left: -8px; }
.opp-profit { text-align: right; flex: none; }
.opp-profit b { display: block; white-space: nowrap; font: 600 22px/26px var(--font-sans); font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-num); }
.opp-profit small { font-size: 12px; font-variant-numeric: tabular-nums; }
.opp-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 0; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.opp-metrics > div { min-width: 0; }
.opp-metrics b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.opp details { margin: 0; font-size: 12px; } .opp details small { display: block; margin-top: 6px; line-height: 18px; }
.opp > button, .opp > .btn { width: 100%; height: 44px; }
.btn.ghost-line { background: transparent; border: 1px dashed var(--border-default); color: var(--text-secondary); font-weight: 500; }
.btn.ghost-line:hover { border-color: var(--brand-border); color: var(--text-primary); background: var(--brand-tint); }
.card.empty { color: var(--text-tertiary); text-align: center; padding: 32px; grid-column: 1 / -1; }

/* Seletor de período */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-md); background: var(--surface-sunken); border: 1px solid var(--border-subtle); }
.seg button { height: 30px; padding: 0 12px; border: 0; background: transparent; color: var(--text-secondary); font-weight: 500; font-size: 13px; border-radius: 6px; }
.seg button:hover { background: var(--surface-hover); }
.seg button.on { background: var(--brand); color: #fff; }

/* Performance */
.perf-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; }
.perf-kpis .kpi { background: var(--surface-card); padding: 16px; display: grid; gap: 4px; }
.perf-kpis .kpi div { font-size: 20px; line-height: 26px; overflow-wrap: anywhere; }
.perf-kpis .kpi > span { font-size: 12px; }
.kpi.hi { border-color: var(--gain-border); background: linear-gradient(180deg, var(--gain-tint), transparent), var(--surface-card); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-tertiary); }
.legend i { width: 8px; height: 8px; border-radius: 999px; }
.line-chart svg { width: 100%; height: 240px; display: block; }
.empty-chart { padding: 60px 0; text-align: center; }
.perf-split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .perf-split { grid-template-columns: minmax(0, 1fr); } }
.rank { display: grid; gap: 14px; margin-top: 12px; }
.rank-row { display: flex; gap: 12px; align-items: flex-start; }
.pos-n { width: 24px; height: 24px; flex: none; border-radius: 999px; display: flex; align-items: center; justify-content: center; font: 600 12px/1 var(--font-sans); background: var(--surface-raised); border: 1px solid var(--border-default); color: var(--text-secondary); }
.rank-row:first-child .pos-n { background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent); }
.meter { display: block; height: 4px; border-radius: 999px; background: var(--surface-hover); margin: 8px 0 6px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; }

/* Impostos */
.tax-card { padding: 0; overflow: hidden; }
.tax-banner { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px; background: var(--brand-tint); border-bottom: 1px solid var(--border-subtle); }
.tax-banner svg { width: 20px; height: 20px; flex: none; color: var(--brand-text); }
.tax-banner b { display: block; } .tax-banner small { color: var(--text-secondary); }
.tax-card.attention .tax-banner { background: var(--warning-tint); } .tax-card.attention .tax-banner svg { color: var(--warning); }
.tax-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .tax-grid { grid-template-columns: minmax(0, 1fr); } }
.tax-grid > div { display: grid; gap: 4px; padding: 18px 20px; border-bottom: 1px solid var(--border-subtle); }
.tax-grid > div:nth-child(odd) { border-right: 1px solid var(--border-subtle); }
.tax-grid b { font: 600 22px/28px var(--font-sans); font-variant-numeric: tabular-nums; }
.tax-pay { padding: 18px 20px; display: grid; gap: 10px; }
.pay { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--surface-sunken); }
.pay svg { width: 18px; height: 18px; color: var(--brand-text); flex: none; }
.pay > div { flex: 1; min-width: 0; } .pay small { display: block; }
.month-nav { gap: 4px; }

/* ---------- Animações (com propósito; desligadas com "reduzir movimento") ---------- */
@keyframes zl-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes zl-flash-gain { 0% { text-shadow: 0 0 0 transparent; } 30% { text-shadow: 0 0 22px rgba(61, 214, 140, .55); } 100% { text-shadow: 0 0 0 transparent; } }
@keyframes zl-grow-y { from { transform: scaleY(0); } }
@keyframes zl-grow-x { from { transform: scaleX(0); } }
@keyframes zl-draw { from { stroke-dashoffset: var(--len, 2000); } }
@keyframes zl-marquee { to { transform: translateX(-50%); } }
@keyframes zl-glow { 0%, 100% { box-shadow: 0 0 0 1px var(--bot-border), 0 12px 40px -14px rgba(34, 178, 108, .20); } 50% { box-shadow: 0 0 0 1px var(--bot-border), 0 12px 48px -10px rgba(34, 178, 108, .38); } }
@media (prefers-reduced-motion: no-preference) {
  /* entrada da página: cada bloco sobe em sequência */
  .main .inner > *:not(.pop):not(.mini):not(.msg) { animation: zl-in .5s var(--ease-out) both; }
  .main .inner > *:nth-child(2) { animation-delay: .04s; } .main .inner > *:nth-child(3) { animation-delay: .08s; }
  .main .inner > *:nth-child(4) { animation-delay: .12s; } .main .inner > *:nth-child(5) { animation-delay: .16s; }
  .main .inner > *:nth-child(n+6) { animation-delay: .2s; }
  .opp.enter, .bal.enter { animation: zl-in .4s var(--ease-out) both; }
  /* cartões: levantam de leve no mouse */
  .opp, .bal, .kpi { transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
  .opp:hover, .bal:not(.off):hover { transform: translateY(-3px); box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .8); }
  .opp.viable:hover { border-color: var(--gain-border); }
  /* número mudou: brilho verde rápido */
  .flash { animation: zl-flash-gain 1.2s var(--ease-out); }
  /* gráficos crescem ao aparecer */
  .bar span { transform-origin: bottom; animation: zl-grow-y .6s var(--ease-out) both; }
  .meter span { transform-origin: left; animation: zl-grow-x .7s var(--ease-out) both; }
  .line-chart path.ln { stroke-dasharray: var(--len, 2000); animation: zl-draw 1.1s var(--ease-out) both; }
  /* robô ligado: respira devagar */
  .bot.on { animation: zl-glow 3.2s ease-in-out infinite; }
  /* botão principal: brilho no mouse */
  button.primary:hover, .opp button.primary:hover { box-shadow: 0 6px 20px -6px rgba(121, 82, 245, .65); }
}
/* faixa de cotações corre sozinha (para no mouse) */
.ticker { position: relative; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker .track { display: inline-flex; width: max-content; }
@media (prefers-reduced-motion: no-preference) { .ticker .track.run { animation: zl-marquee 40s linear infinite; } .ticker:hover .track { animation-play-state: paused; } }
@media (prefers-reduced-motion: reduce) { .ticker { overflow-x: auto; } }

/* Saldos mais largos: 3 por linha (2 e 1 em telas menores); valor nunca sai do cartão */
@media (max-width: 1000px) { .balances { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .balances { grid-template-columns: minmax(0, 1fr); } }
.bal { padding: 18px 20px; gap: 14px; }
.bal .brl { font-size: clamp(20px, 2.2vw, 28px); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Divisor de seção (número + título, como na referência) ---------- */
.block { display: grid; gap: 16px; scroll-margin-top: 16px; }
.sx { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0 22px; padding-top: 36px; margin-top: 16px; border-top: 1px solid var(--border-subtle); position: relative; }
.sx::before { content: ""; position: absolute; top: -1px; left: 0; width: 64px; height: 1px; background: var(--brand); }
.sx-n { font: 200 52px/1 var(--font-sans); letter-spacing: -0.04em; color: var(--text-disabled); font-variant-numeric: tabular-nums; padding-right: 22px; border-right: 1px solid var(--border-default); min-height: 56px; display: flex; align-items: center; }
.sx-t h2 { font: 500 28px/34px var(--font-sans); letter-spacing: -0.02em; margin: 0; text-transform: lowercase; }
.sx-t h2::first-letter { text-transform: uppercase; }
.sx-t p { margin: 4px 0 0; font: 500 11px/16px var(--font-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--text-tertiary); }
.sx-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sx-r .row { justify-content: flex-end; }
section.plain > .sx { margin-bottom: 16px; }
@media (max-width: 900px) { .sx { grid-template-columns: auto minmax(0, 1fr); } .sx-r { grid-column: 1 / -1; justify-content: flex-start; margin-top: 12px; } .sx-n { font-size: 38px; min-height: 44px; } .sx-t h2 { font-size: 22px; line-height: 28px; } }

.more-wrap { text-align: center; margin-top: 14px; }
.more-wrap button { min-width: 220px; }
/* ---------- Celular ---------- */
@media (max-width: 760px) {
  .main { padding: 12px 14px 48px; }
  .main > .inner { gap: 14px; }
  .topbar h1 { font-size: 20px; line-height: 26px; }
  .topbar .right .clock { display: none; }
  .today { padding: 20px; gap: 16px; }
  .today-side .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .sx { padding-top: 26px; margin-top: 8px; gap: 0 14px; }
  .sx-n { font-size: 32px; min-height: 36px; padding-right: 14px; }
  .sx-t h2 { font-size: 20px; line-height: 26px; }
  .sx-t p { font-size: 10px; letter-spacing: .08em; }
  .sx-r { gap: 6px; }
  .sx-r .row { justify-content: flex-start; gap: 8px; }
  .sx-r input[type="number"] { width: 92px !important; }
  .opp { padding: 16px; gap: 14px; }
  .opp-profit b { font-size: 20px; }
  .opp-metrics { gap: 8px; }
  .bot { padding: 18px; }
  .bot-panel { padding: 14px; gap: 18px; }
  .bot-foot .row { justify-content: stretch; } .bot-foot .row button { flex: 1; }
  .perf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .perf-kpis .kpi div { font-size: 17px; line-height: 22px; }
  .line-chart svg { height: 180px; }
  .tax-grid b { font-size: 18px; }
  /* histórico: tabela larga rola de lado dentro do cartão */
  #historico section { padding: 12px; }
}

/* Gráfico de volume com escala de valores à esquerda (rótulos e linhas pela mesma conta) */
.vchart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin-top: 16px; }
.vaxis { position: relative; height: 200px; min-width: 68px; font-size: 11px; color: var(--chart-axis); font-variant-numeric: tabular-nums; }
.vaxis span { position: absolute; right: 0; transform: translateY(50%); white-space: nowrap; line-height: 1; }
.vchart .bars { position: relative; height: 200px; padding: 0; border: 0; gap: 6px; overflow: visible; }
.vchart .gl { position: absolute; left: 0; right: 0; height: 1px; background: var(--chart-grid); }
.vchart .bar { position: relative; z-index: 1; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) 20px; align-items: end; justify-items: center; }
.vchart .bar span { width: 100%; max-width: 36px; }
.vchart .bar small { margin-top: 0; align-self: center; }
@media (max-width: 760px) {
  .balances { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bal { padding: 12px; gap: 10px; }
  .bal .top { gap: 8px; } .bal .logo { width: 24px; height: 24px; }
  .bal .name { font-size: 13px; } .bal .st { font-size: 11px; }
  .bal .brl { font-size: 17px; }
  .bal .sub { font-size: 11px; }
  #historico .leg-t, #historico .c-src, #historico .c-pct { display: none; }
  #historico td, #historico th { padding: 10px 8px; }
}

select.small-select { height: var(--control-h-sm); padding: 0 8px; font-size: 13px; }
