/* Boot Trade Binance — tema dark conforme design-system.md (TradingView) */

:root {
  --primary: #2962FF;
  --primary-hover: #1E53E5;
  --primary-active: #1848CC;
  --primary-soft: rgba(41, 98, 255, .08);
  --bg: #131722;
  --surface: #1E222D;
  --surface-hover: #262B38;
  --surface-2: #262B38;
  --border: #2A2E39;
  --text: #D1D4DC;
  --text-strong: #FFFFFF;
  --muted: #787B86;
  --up: #089981;
  --down: #F23645;
  --warn: #F7A600;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-elevated: 0 4px 16px rgba(0,0,0,0.24);
  --font: -apple-system, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  /* Escala de espaçamento (nomeada; valores já em uso no arquivo) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

/* Reduced motion: qualquer transição/animação introduzida no redesign
   (RNF3, docs/requisitos/requisitos-frontend-design-2026-07-13.md) respeita esta regra. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }

h1 { font-size: 22px; font-weight: 700; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 16px; color: var(--text-strong); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 32px;
}

.login-sub { color: var(--muted); margin: 4px 0 24px; font-size: 12px; }
.login-note { color: var(--muted); font-size: 11px; margin: 20px 0 0; text-align: center; }

.login-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }

.login-card input,
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
}

.field textarea { resize: vertical; }

.login-card input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-error { color: var(--down); font-size: 12px; margin: 12px 0 0; }

/* ---------- Botões (pill, cf. design system) ---------- */
.btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  cursor: pointer;
  transition: background .15s ease;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); }
.btn.is-loading { position: relative; padding-left: 38px; }
.btn.is-loading::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); }

.btn-danger { background: var(--down); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-block { width: 100%; margin-top: 20px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--primary); font-size: 20px; }
.brand-name { font-weight: 700; color: var(--text-strong); }

.topbar-status { display: flex; align-items: center; gap: 8px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }

/* ---------- Badges e pills ---------- */
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}
.badge-mode { background: rgba(41, 98, 255, .15); color: var(--primary); border: 1px solid var(--primary); }
.badge-mode.testnet { background: rgba(247, 166, 0, .12); color: var(--warn); border-color: var(--warn); }
/* Mainnet = dinheiro real: alerta permanente no topo (token error/down #F23645) */
.badge-mode.mainnet { background: rgba(242, 54, 69, .15); color: var(--down); border-color: var(--down); }

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}
.pill-running { background: rgba(8, 153, 129, .15); color: var(--up); animation: pulse-running 2.4s ease-in-out infinite; }

/* Pulso sutil no status RUNNING (D5): reforça "vivo" sem chamar atenção
   demais; amplitude baixa, ciclo lento. Desativado por prefers-reduced-motion
   via regra global no :root. */
@keyframes pulse-running {
  0%, 100% { box-shadow: 0 0 0 0 rgba(8, 153, 129, .35); }
  50% { box-shadow: 0 0 0 4px rgba(8, 153, 129, 0); }
}
.pill-paused  { background: rgba(247, 166, 0, .15); color: var(--warn); }
.pill-idle    { background: rgba(120, 123, 134, .15); color: var(--muted); }
.pill-danger  { background: rgba(242, 54, 69, .15); color: var(--down); }

/* ---------- Banner de risco (destaque obrigatório) ---------- */
.risk-banner {
  background: rgba(242, 54, 69, .12);
  border: 1px solid var(--down);
  color: var(--down);
  font-weight: 600;
  padding: 12px 24px;
  text-align: center;
}

/* Variante informativa: aviso operacional sem risco de capital
   (ex.: preço acima da faixa, bot aguardando/recentralizando). */
.risk-banner.info {
  background: rgba(41, 98, 255, .12);
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 24px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tabs-inline { padding: 0; border-bottom: none; }

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  white-space: nowrap;
}

.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab.active { color: var(--text-strong); border-bottom: 2px solid var(--primary); }
.tab { transition: color .15s ease, background .15s ease; }

/* ---------- Conteúdo ---------- */
.content { padding: 24px; max-width: 1280px; margin: 0 auto; }

/* Troca de aba: fade sutil ao entrar (dispara de novo a cada vez que sai de
   display:none, então não precisa de JS extra). */
.tab-panel:not(.hidden) { animation: tab-fade-in .18s ease; }
@keyframes tab-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Foco visível por teclado em qualquer elemento interativo (quality floor da
   metodologia frontend-design). Não interfere no clique de mouse (:focus-visible). */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.stats-grid {
  display: grid;
  /* auto-fit (nao auto-fill): linhas parciais esticam para cobrir a largura
     disponivel do card em vez de deixar espaco vazio a direita. */
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* item de grid nao encolhe abaixo do conteudo por padrao (min-width:auto):
     um IP/rotulo longo estourava para fora do card. */
  min-width: 0;
}

.stat-label { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
/* notas do card (ex.: IPv6 de saida, um token longo sem espacos) quebram
   dentro do card em vez de vazar. */
.stat-card .muted { overflow-wrap: anywhere; }
.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-value.up { color: var(--up); }
.stat-value.down { color: var(--down); }

/* ---------- Cockpit: gráfico + controle do bot no mesmo card ---------- */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  padding: 20px;
  margin-bottom: 24px;
}

/* Rótulo discreto para sub-blocos dentro de um card (evita 2 <h2> no cockpit) */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

/* Faixa de controle do bot, dentro do chart-card (RF1): divisor sutil em vez
   de uma segunda "caixa dentro da caixa". */
.chart-controls-strip {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.start-progress {
  margin-top: 12px;
  max-width: 520px;
}
.start-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.start-progress-head strong { color: var(--text-strong); }
.start-progress-bar {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--bg);
}
.start-progress-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  animation: progress-indeterminate 1.2s ease-in-out infinite;
}

.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.chart-symbol { color: var(--primary); font-variant-numeric: tabular-nums; }

.chart-controls { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.chart-controls .tab { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-md); }
.chart-controls .tab.active { border-bottom: none; background: rgba(41, 98, 255, .15); color: var(--primary); }

.btn-icon {
  padding: 4px 10px;
  font-size: 14px;
  line-height: 1.4;
}

/* Modo expandido: gráfico em tela cheia (ESC ou ✕ para sair) */
.chart-card.expanded {
  position: fixed;
  inset: 0;
  z-index: 100;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.chart-card.expanded .chart-container { height: auto; flex: 1; min-height: 0; }
body.chart-lock { overflow: hidden; }

.chart-legend {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
}

.legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

.legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch-buy  { background: var(--up); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.swatch-sell { background: var(--down); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.swatch-limit { background: transparent; height: 0; border-top: 2px solid var(--primary); }
.swatch-grid  { background: transparent; height: 0; border-top: 2px dotted var(--muted); }
.swatch-order-buy  { background: transparent; height: 0; width: 7px; border-top: 2px dashed var(--up); }
.swatch-order-sell { background: transparent; height: 0; width: 7px; border-top: 2px dashed var(--down); }

.badge-source { background: rgba(120,123,134,.15); color: var(--muted); border: 1px solid var(--border); }

.chart-container { height: 380px; width: 100%; }
.chart-empty { text-align: center; padding: 24px 0 8px; }

.config-card, .table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 24px;
}

.controls { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ---------- Formulário de configuração ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* Campo booleano (checkbox): label na mesma linha, alinhado aos inputs.
   Registrado no design-system.md (Formulários > Checkbox). */
.field-check { display: flex; align-items: center; gap: 8px; padding-top: 18px; }
.field-check label { margin-bottom: 0; cursor: pointer; }
.field-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.config-result {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
}
.config-result.ok { background: rgba(8,153,129,.1); border: 1px solid var(--up); color: var(--up); }
.config-result.err { background: rgba(242,54,69,.1); border: 1px solid var(--down); color: var(--down); }
.config-result ul { margin: 8px 0 0; padding-left: 18px; }
.grid-preview { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Tabelas ---------- */
.table-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.table-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* Scroll interno: altura limitada, cabeçalho fixo (sticky) e rolagem X/Y */
.table-scroll {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.table-scroll::-webkit-scrollbar-track { background: transparent; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  /* border-bottom não acompanha o sticky com border-collapse; usar sombra interna */
  box-shadow: inset 0 -1px 0 var(--border);
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}

tbody tr:hover { background: var(--surface-hover); }
td.up { color: var(--up); font-weight: 600; }
td.down { color: var(--down); font-weight: 600; }
td .badge-side-buy { color: var(--up); font-weight: 700; }
td .badge-side-sell { color: var(--down); font-weight: 700; }
.empty { color: var(--muted); text-align: center; padding: 24px !important; }

.status-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: rgba(120,123,134,.15);
  color: var(--muted);
}
.status-chip.filled { background: rgba(8,153,129,.15); color: var(--up); }
.status-chip.new { background: rgba(41,98,255,.15); color: var(--primary); }
.status-chip.rejected { background: rgba(242,54,69,.15); color: var(--down); }

/* ---------- Log de decisões ---------- */
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.log-list::-webkit-scrollbar { width: 8px; }
.log-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); }
.log-list::-webkit-scrollbar-track { background: transparent; }

.log-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.log-time { color: var(--muted); font-size: 11px; min-width: 130px; font-variant-numeric: tabular-nums; }
.log-level { min-width: 70px; font-size: 11px; font-weight: 700; }
.log-level.INFO { color: var(--primary); }
.log-level.WARNING { color: var(--warn); }
.log-level.ERROR, .log-level.CRITICAL { color: var(--down); }
.log-event { min-width: 170px; color: var(--text-strong); font-weight: 600; font-size: 12px; }

/* ---------- Aba Métricas ---------- */
.metrics-group {
  margin: 20px 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
#metrics-period .tab { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-md); }
#metrics-period .tab.active { border-bottom: none; background: rgba(41, 98, 255, .15); color: var(--primary); }
.equity-chart {
  height: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
#metrics-updated { margin: 0 0 4px; }

/* Legenda da curva de capital: reaproveita .chart-legend do cockpit (era uma
   segunda definição duplicada do mesmo seletor — consolidada aqui via #id
   para as duas únicas diferenças reais: gap/margin mais compactos). */
#equity-legend { gap: 6px 14px; margin: 0 0 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.lg-line { background: var(--primary); }
.lg-loss { background: var(--down); }
.lg-recenter { background: var(--primary); outline: 1px solid var(--text); }
.lg-suspend { background: var(--muted); }
.lg-exit { background: var(--warn); }
.lg-stop { background: var(--down); border-radius: 2px; }
.lg-ref { background: transparent; border-top: 1px dashed var(--muted); height: 0; width: 14px; border-radius: 0; }

/* Tooltip do crosshair (curva de capital) */
.equity-tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  max-width: 220px;
}
/* Mesmo bug de CA3: span up/down sem escopo, achado na validação (RF3). */
.equity-tooltip .up { color: var(--up); font-weight: 600; }
.equity-tooltip .down { color: var(--down); font-weight: 600; }

/* ---------- Modal (ajuda da configuração) ---------- */
/* Tokens do design-system.md: surface escura, borda, radius-md e sombra de
   popover (shadow-lg 0 8px 24px). Overlay escurece o fundo do produto. */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; }
.modal-body {
  padding: 8px 20px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
/* Modal de confirmação MAINNET: variação de perigo do modal padrão */
.modal-danger { border-color: var(--down); max-width: 520px; }
.modal-danger .modal-head { border-bottom-color: var(--down); }
.modal-danger .modal-head h2 { color: var(--down); }
.mainnet-summary { margin: 8px 0 12px; padding-left: 18px; }
.mainnet-summary li { margin: 4px 0; }
.mainnet-warning {
  background: rgba(242, 54, 69, .12);
  border: 1px solid var(--down);
  border-radius: var(--radius-md);
  color: var(--down);
  font-size: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
}
#mainnet-confirm-input { text-transform: uppercase; }

.help-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.help-item:last-child { border-bottom: none; }
.help-item h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}
.help-item p { margin: 0 0 6px; font-size: 12px; line-height: 1.5; }
.help-item p:last-child { margin-bottom: 0; }
.help-item code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  font-size: 11px;
}
.help-example {
  color: var(--muted);
  border-left: 2px solid var(--primary);
  padding-left: 10px;
}

@media (max-width: 768px) {
  .modal { max-height: 92vh; }
  .modal-overlay { padding: 12px 8px; }
}

/* ---------- Multi-símbolo (docs/design/design-multi-simbolo.md, RF7) ---------- */

/* Config: seleção múltipla de símbolos + bloco de parâmetros por símbolo */
.field-symbols { margin-bottom: 8px; }
.symbol-checks { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 4px; }
.symbol-checks .field-check { padding-top: 0; }

.symbol-blocks { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.symbol-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 0;
}
.symbol-block legend {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}
.symbol-block .form-grid { margin-bottom: 0; }

/* Dashboard: cards por símbolo (estado independente — RF7) */
.symbol-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
/* Ticker card (assinatura visual, docs/design/design-frontend-design-2026-07-13.md §3):
   --range-color é setado inline pelo app.js a partir do range_state (RF5). */
.symbol-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--range-color, var(--border));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  transition: box-shadow .15s ease, transform .15s ease;
}
.symbol-card[role="button"] { cursor: pointer; }
.symbol-card:hover { box-shadow: var(--shadow-md); }
.symbol-card.selected {
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
}
.symbol-card.starting {
  opacity: .92;
  box-shadow: var(--shadow-md);
}
.symbol-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.symbol-card-head strong { font-size: 14px; color: var(--text-strong); }
.symbol-card-body { display: flex; flex-direction: column; gap: 6px; }
.symbol-card-body > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.symbol-card-body .muted { font-size: 12px; }

/* Correção do bug de cor do P&L (RF2/RF3): os spans gerados por pnlClass()
   dentro do card só tinham a classe up/down, sem regra CSS correspondente. */
.symbol-card-body .up { color: var(--up); font-weight: 700; }
.symbol-card-body .down { color: var(--down); font-weight: 700; }
.muted.up { color: var(--up); }
.muted.down { color: var(--down); }
/* Pendência operacional reversível (ex.: IP de saída ainda fora da whitelist):
   mesmo token do pill WAITING_IP_WHITELIST, nunca `down` — não é perda. */
.muted.warn { color: var(--warn); }

/* Barra de posição do preço na faixa (RF4) — visualiza o princípio da
   estratégia spot_grid_v1: onde o preço está entre lower_price e upper_price. */
.symbol-range-bar {
  height: 6px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  margin: 2px 0 4px;
}
.symbol-range-bar-fill {
  height: 100%;
  background: var(--range-color, var(--primary));
  border-radius: var(--radius-sm);
  transition: width .3s ease;
}

/* Tabelas: filtro de símbolo (select ao lado dos demais filtros) */
select.symbol-filter {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font);
}

@media (max-width: 768px) {
  .content { padding: 16px; }
  .topbar { flex-wrap: wrap; }
  td, th { white-space: normal; }
}

/* ---------- Responsividade — passe completo (RF6/RF7) ---------- */
/* Tablet: mantém colunas, mas reduz o mínimo de cada card para caber mais
   sem forçar 1 coluna cedo demais. */
@media (max-width: 900px) {
  .content { max-width: 100%; padding: 20px; }
  .stats-grid, .symbol-cards-grid, .form-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .chart-container { height: 320px; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes progress-indeterminate {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(70%); }
  100% { transform: translateX(240%); }
}

/* Celular: 1 coluna, controles empilhados, alvos de toque maiores. */
@media (max-width: 600px) {
  .topbar { padding: 10px 12px; gap: 8px 12px; }
  .brand-name { font-size: 14px; }
  .topbar-status, .topbar-user { flex-wrap: wrap; gap: 6px; }

  .tabs { padding: 6px 12px 0; }
  .tab { padding: 8px 12px; font-size: 13px; }

  .content { padding: 12px; }
  .chart-card, .config-card, .table-card { padding: 14px; margin-bottom: 16px; }
  .chart-container { height: 240px; }

  .chart-head { gap: 8px 12px; }
  .chart-controls { width: 100%; margin-left: 0; flex-wrap: wrap; gap: 8px; }
  .chart-legend { gap: 4px 10px; }

  .chart-controls-strip .controls { gap: 8px; }
  .chart-controls-strip .controls .btn {
    flex: 1 1 calc(50% - 8px);
    padding: 10px 8px;
    font-size: 13px;
    text-align: center;
  }

  .stats-grid, .symbol-cards-grid, .form-grid { grid-template-columns: 1fr; }

  .table-head { flex-direction: column; align-items: stretch; }
  .table-actions { width: 100%; }
  select.symbol-filter { flex: 1 1 auto; }

  /* Log de decisões: em telas largas é uma linha; em mobile empilha
     (min-width fixo do desktop força overflow em ~360px de viewport). */
  .log-list li { flex-wrap: wrap; gap: 4px 12px; }
  .log-time, .log-level { min-width: 0; }
  .log-event { min-width: 0; flex-basis: 100%; }

  .login-card { padding: 24px 20px; }
}

/* ---------- Aba Símbolos: CRUD dinâmico (docs/design/design-simbolos-dinamicos.md §6) ---------- */

.symbol-add-row { display: flex; gap: var(--space-3); align-items: flex-end; flex-wrap: wrap; }
.symbol-add-row .field { flex: 1 1 220px; margin: 0; }
.symbol-add-row input { text-transform: uppercase; }

/* Feedback do cadastro: mesmo vocabulário do .help-example (borda esquerda),
   com semântica de sucesso/erro. */
.symbol-feedback {
  margin-top: var(--space-3);
  padding: 10px 12px;
  font-size: 12px;
  border-left: 2px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.symbol-feedback.err { border-left-color: var(--down); background: rgba(242, 54, 69, .08); color: var(--down); }

/* Accent de estado na 1ª célula (mesma linguagem do .symbol-card do cockpit):
   primary = ativo, borda = inativo. */
#tbody-symbols td:first-child { border-left: 3px solid var(--primary); font-weight: 600; color: var(--text-strong); }
tr.symbol-row-inactive td:first-child { border-left-color: var(--border); }
tr.symbol-row-inactive td { opacity: .55; }
tr.symbol-row-inactive td:last-child { opacity: 1; }

.badge-active { background: rgba(41, 98, 255, .15); color: var(--primary); border: 1px solid var(--primary); }
.badge-inactive { background: rgba(120, 123, 134, .15); color: var(--muted); border: 1px solid var(--border); }

/* Preço MOCK editável inline: valor clicável (sublinhado pontilhado) vira input. */
.symbol-price-btn {
  background: none; border: none; padding: 0;
  font: inherit; color: var(--text); cursor: pointer;
  text-decoration: underline dotted var(--muted);
  text-underline-offset: 3px;
}
.symbol-price-btn:hover { color: var(--text-strong); }
.symbol-price-input {
  width: 110px; padding: 4px 6px; font: inherit;
  background: var(--bg); color: var(--text-strong);
  border: 1px solid var(--primary); border-radius: var(--radius-sm);
}
