:root {
  --bg: #0F1117;
  --surface: #181C27;
  --surface-2: #1F2430;
  --border: #2A3040;
  --accent: #3B82F6;
  --gold: #F59E0B;
  --green: #10B981;
  --red: #EF4444;
  --text: #E2E8F0;
  --text-muted: #64748B;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.glow {
  position: fixed;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  height: 360px;
  background: radial-gradient(ellipse at center, rgba(59,130,246,0.16), rgba(245,158,11,0.06) 45%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== shell: sidebar + conteúdo, ocupa a tela inteira ===== */

.shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 16px 22px 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 4px 14px rgba(59,130,246,0.25);
}

.brand h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand .sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background-color 0.15s, color 0.15s;
}

.nav-item .nav-ic { width: 16px; display: inline-block; text-align: center; opacity: 0.85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,0.15); color: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.phase-tag {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
}

.view { display: none; }
.view.active { display: block; }

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.view-head h2 { font-size: 17px; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
.view-head .hint { font-size: 11px; color: var(--text-muted); }
.view-head .updated { font-size: 10.5px; color: var(--text-muted); }

.head-tools { display: flex; align-items: center; gap: 8px; }

.notify-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.notify-pill:hover { border-color: var(--accent); color: var(--text); }
.notify-pill.active { border-color: rgba(16,185,129,0.4); color: var(--green); }
.notify-pill:disabled { cursor: default; opacity: 0.6; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
}

.status-pill.live { color: var(--green); border-color: rgba(16,185,129,0.35); }
.status-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.status-pill.live .dot { animation: pulse-dot 1.8s ease-in-out infinite; }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.55); }
  50% { box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

button.btn {
  background: linear-gradient(180deg, #4c8bf5, var(--accent));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(59,130,246,0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(59,130,246,0.4); }
button.btn:active { transform: translateY(0); }

button.btn:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: default;
  box-shadow: none;
  transform: none;
}

button.btn.secondary {
  background: transparent;
  border: 1px solid rgba(16,185,129,0.4);
  color: var(--green);
  box-shadow: none;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 12px 0 7px;
  position: relative;
  z-index: 1;
}

.section-title .updated { font-size: 10px; text-transform: none; letter-spacing: normal; opacity: 0.8; }

.pulse-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.pulse-pair {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px 13px;
  transition: border-color 0.2s;
}

.pulse-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;
}

.pulse-symbol { font-weight: 700; font-size: 13px; }
.pulse-spread { font-size: 12px; color: var(--text-muted); }
.pulse-spread b { color: var(--green); font-weight: 700; }

.pulse-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pulse-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 10px;
  min-width: 80px;
  transition: background-color 0.5s ease, border-color 0.2s;
}

.pulse-chip .ex-name { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.pulse-chip .ex-price { font-size: 12px; font-weight: 700; }

.pulse-chip.best-buy { border-color: rgba(16,185,129,0.5); }
.pulse-chip.best-buy .ex-name::after { content: " · compra"; color: var(--green); }
.pulse-chip.best-buy .ex-price { color: var(--green); }

.pulse-chip.best-sell { border-color: rgba(245,158,11,0.5); }
.pulse-chip.best-sell .ex-name::after { content: " · venda"; color: var(--gold); }
.pulse-chip.best-sell .ex-price { color: var(--gold); }

.pulse-chip.flash-up { background-color: rgba(16,185,129,0.22); }
.pulse-chip.flash-down { background-color: rgba(239,68,68,0.22); }
.pulse-chip { cursor: pointer; }
.pulse-chip:hover { border-color: var(--accent); }

.pulse-spark { display: block; margin-top: 8px; width: 100%; height: 34px; }
.pulse-spark polyline { fill: none; stroke-width: 1.6; }
.pulse-spark .zero-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.op-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 14px 17px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  transition: transform 0.15s ease, border-color 0.2s, box-shadow 0.15s ease;
}

.op-card.hot {
  border-color: rgba(16,185,129,0.5);
  background: linear-gradient(135deg, rgba(16,185,129,0.10), var(--surface) 60%);
  box-shadow: 0 4px 18px rgba(16,185,129,0.08);
}
.op-card:hover { transform: translateY(-1px); }

.op-symbol { font-weight: 700; font-size: 14px; }
.op-route { font-size: 12px; color: var(--text-muted); grid-column: 1 / -1; line-height: 1.5; }
.op-route b { color: var(--text); font-weight: 600; }
.op-route .arrow { color: var(--text-muted); margin: 0 2px; }

.op-net {
  font-size: 19px;
  font-weight: 800;
  text-align: right;
}
.op-net.pos { color: var(--green); }
.op-net.neg { color: var(--red); }

.op-gross {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.warn-flag {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  color: var(--gold);
}

.skeleton {
  border-radius: 13px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  height: 58px;
  margin-bottom: 8px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 40px 20px;
}

footer.note {
  margin-top: 26px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* --- CTA de operar + modais de confirmação/execução (simulação, sem ordem real) --- */

.op-card { grid-template-columns: 1fr auto; }
.op-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; margin-top: 2px; }

button.btn.cta {
  background: linear-gradient(180deg, #fb923c, #f97316);
  color: #1a0e00;
  border: none;
  border-radius: 9px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(249,115,22,0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
button.btn.cta:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(249,115,22,0.45); }
button.btn.cta:active { transform: translateY(0); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6,7,10,0.72);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 400px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modal-in 0.18s ease;
}

.modal.wide { max-width: 480px; }

.ob-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.ob-head .ex { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.ob-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ob-col-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.ob-col-label.asks { color: var(--red); }
.ob-col-label.bids { color: var(--green); }

.ob-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  padding: 2px 5px;
  margin-bottom: 1px;
  border-radius: 4px;
  overflow: hidden;
}
.ob-row .bar {
  position: absolute;
  top: 0; bottom: 0;
  z-index: 0;
}
.ob-row.ask .bar { right: 0; background: rgba(239,68,68,0.18); }
.ob-row.bid .bar { right: 0; background: rgba(16,185,129,0.18); }
.ob-row .px, .ob-row .amt { position: relative; z-index: 1; }
.ob-row.ask .px { color: var(--red); }
.ob-row.bid .px { color: var(--green); }
.ob-row .amt { color: var(--text-muted); }

.ob-spread-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 { margin: 0 0 2px; font-size: 15px; font-weight: 800; }
.modal .modal-sim-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 12px;
}

.modal-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.modal-stat-row:last-of-type { border-bottom: none; }
.modal-stat-row .v { color: var(--text); font-weight: 700; font-size: 13px; }
.modal-stat-row .v.pos { color: var(--green); }

.modal input[type="number"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
}

.modal-warn {
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 12px 0;
  line-height: 1.5;
}

.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions .btn { flex: 1; text-align: center; }

.progress-route {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.progress-route b { color: var(--text); }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  width: 0%;
  transition: width 0.4s ease;
}
.progress-pct { font-size: 11px; color: var(--text-muted); text-align: right; margin-bottom: 14px; }

.step-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.25s ease, color 0.25s ease;
}
.step.active { opacity: 1; color: var(--text); }
.step.done { opacity: 0.85; color: var(--green); }
.step .mark {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.step.active .mark { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.step.done .mark { border-color: var(--green); background: var(--green); color: #06110c; }

.result-hero { text-align: center; padding: 8px 0 4px; }
.result-hero .big { font-size: 28px; font-weight: 800; color: var(--green); }
.result-hero .cap { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== Oportunidades: banca, gráfico grande + painel de execução, books ===== */

.banca-config {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 5px 9px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.banca-prefix { color: var(--text-muted); }
.banca-config input {
  width: 70px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
}
.banca-config input:focus { outline: none; }

.opp-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 6px;
}

.chart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 0;
}

.chart-selectors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.selector-group {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
}

.sel-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-sans);
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.sel-btn:hover { color: var(--text); }
.sel-btn.active { background: var(--accent); color: white; }

.big-chart-wrap { position: relative; }
.big-chart-legend {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.big-chart-legend b { color: var(--text); font-weight: 700; }
.big-chart-legend .chg.pos { color: var(--green); }
.big-chart-legend .chg.neg { color: var(--red); }

.ticket-row { display: flex; gap: 6px; margin-bottom: 6px; }
.ticket {
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 9.5px;
  border: 1px solid;
}
.ticket .tl { display: block; font-size: 8.5px; opacity: 0.85; }
.ticket .tv { font-size: 11.5px; font-weight: 800; font-family: var(--font-mono); }
.ticket.sell { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); color: var(--red); }
.ticket.buy { border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.08); color: var(--accent); }

.big-candle-svg { width: 100%; height: 230px; display: block; }
.big-candle-svg .grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.big-candle-svg .axis-label { font-size: 9px; fill: var(--text-muted); font-family: var(--font-mono); }
.big-candle-svg .price-tag-bg { fill: var(--accent); }
.big-candle-svg .price-tag-text { fill: white; font-size: 9px; font-weight: 700; font-family: var(--font-mono); }
.big-candle-svg .price-dash { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; }

.exec-panel { min-width: 0; display: flex; flex-direction: column; }

.tv-cards-v {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
}

.tv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tv-card:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.18); }
.tv-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 20px rgba(59,130,246,0.15); }
.tv-card.hot { border-color: rgba(16,185,129,0.5); }
.tv-card.hot.selected { border-color: var(--accent); }

.tv-card-body { flex: 1; min-width: 0; }
.tv-card-head { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.tv-card-name { font-size: 11.5px; font-weight: 800; }
.tv-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.tv-card.hot .tv-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }

.tv-card-route { display: flex; gap: 5px; margin-bottom: 4px; }
.tv-ex-chip {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  cursor: pointer;
}
.tv-ex-chip:hover { border-color: var(--accent); color: var(--text); }
.tv-ex-chip.pinned { border-color: var(--gold); color: var(--gold); }

.tv-card-margin { font-size: 16px; font-weight: 800; line-height: 1.1; }
.tv-card-margin.pos { color: var(--green); }
.tv-card-margin.neg { color: var(--red); }
.tv-card-profit { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.tv-card-profit b { color: var(--text); font-weight: 700; }
.tv-card-warn { font-size: 9px; color: var(--gold); margin-top: 2px; }

.tv-card-foot { flex-shrink: 0; }
.tv-card-foot .btn.cta { padding: 6px 11px; font-size: 10.5px; }

@media (max-width: 1080px) {
  .opp-layout { grid-template-columns: 1fr; }
}

/* ===== Visão Geral: stat cards + painéis ===== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 13px;
}
.stat-card .label { font-size: 9.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.stat-card .value { font-size: 17px; font-weight: 800; }
.stat-card .value.pos { color: var(--green); }
.stat-card .value.neg { color: var(--red); }
.stat-card .sub { font-size: 9.5px; color: var(--text-muted); margin-top: 2px; }

.panel-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 0;
}
.panel-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }

.line-chart { width: 100%; height: 130px; display: block; }
.line-chart .fill { fill: url(#pnlGradient); stroke: none; }
.line-chart polyline.stroke { fill: none; stroke: var(--green); stroke-width: 2; }
.line-chart .zero-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.line-chart .axis-label { font-size: 9px; fill: var(--text-muted); font-family: var(--font-mono); }

/* ===== Livro de ofertas: sempre lado a lado, dividido igualmente (máx. 3 colunas) — grid-template-columns setado via JS ===== */

.book-grid {
  display: grid;
  gap: 10px;
}

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 10px 12px;
  min-width: 0;
}
.book-card .bc-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.book-card .bc-title { font-size: 11px; font-weight: 700; }
.book-card .bc-title .ex { color: var(--text-muted); font-weight: 500; text-transform: uppercase; font-size: 9px; }
.book-card .bc-unpin { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.book-card .bc-unpin:hover { color: var(--red); }

/* ===== Histórico: tabela ===== */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  overflow-x: auto;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 560px; }
.data-table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table td.pos { color: var(--green); font-weight: 700; }
.data-table td.neg { color: var(--red); font-weight: 700; }

/* ===== Configurações: central do usuário ===== */

.env-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.env-copy { flex: 1; min-width: 220px; }
.env-copy h2 { font-size: 14px; margin: 0 0 4px; font-weight: 700; }
.env-copy p { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.5; }

.env-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.env-opt {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-sans);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}
.env-opt.active { background: var(--green); color: #06110c; }
.env-opt[data-env="real"].active { background: var(--red); color: white; }

.mode-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.35);
}
.mode-badge.real {
  background: rgba(239,68,68,0.15);
  color: var(--red);
  border-color: rgba(239,68,68,0.4);
}

.risk-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.35);
  vertical-align: middle;
}
.risk-badge.killed { background: rgba(239,68,68,0.15); color: var(--red); border-color: rgba(239,68,68,0.4); }

.risk-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.risk-stats b { color: var(--text); font-family: var(--font-mono); }

.confirm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface-2);
  border-radius: 9px;
  padding: 10px 12px;
  margin: 4px 0 14px;
  cursor: pointer;
}
.confirm-check input { width: 16px; height: 16px; }

.settings-intro { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; max-width: 680px; margin: 0 0 20px; }

.exchange-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.exchange-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.exchange-card .ec-name { font-size: 15px; font-weight: 800; }
.exchange-card .ec-status { font-size: 11px; color: var(--text-muted); }
.exchange-card .ec-status.connected { color: var(--green); }
.exchange-card .ec-hint { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.form-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.form-field label { font-size: 11px; color: var(--text-muted); }
.form-field input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
}
.form-field input:focus { outline: none; border-color: var(--accent); }

.conn-result {
  font-size: 11.5px;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 4px 0 10px;
  line-height: 1.5;
}
.conn-result.ok { background: rgba(16,185,129,0.12); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.conn-result.err { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }

/* ===== login ===== */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 26px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-card .brand h1 { font-size: 18px; }
.login-card .form-field label { font-size: 11px; }
.login-card .form-field input {
  padding: 10px 11px;
  font-size: 13px;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-sans);
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); }

.user-chip {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.user-chip b { color: var(--text); }

@media (max-width: 900px) {
  .panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    gap: 14px;
    overflow-x: auto;
  }
  .nav { flex-direction: row; gap: 4px; }
  .nav-item span:not(.nav-ic) { display: none; }
  .sidebar-footer { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .phase-tag { display: none; }
  .content { padding: 18px 16px 70px; }
}

@media (max-width: 420px) {
  .op-net { font-size: 17px; }
  .pulse-chip { min-width: 72px; padding: 5px 8px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .book-grid { grid-template-columns: 1fr !important; }
}
