/* Bex Quant — Terminal (complementa styles.css) */
:root {
  --up: #199e70;      /* ALTA  */
  --mid: #6b7280;     /* NEUTRO (cinza: ponto médio divergente) */
  --down: #e66767;    /* BAIXA */
  --series: #3987e5;  /* curva de hoje */
  --ref: #8b95a7;     /* curva de referência (tracejada) */
}

main.term { align-items: start; }
.full { grid-column: 1 / -1; }
.muted { color: var(--text-dim); font-weight: 400; font-size: 13px; }

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 18px 0 2px;
  letter-spacing: -0.01em;
}
.section-title:first-child { margin-top: 0; }

.banner {
  background: #4a2a00;
  color: #ffd08a;
  border-bottom: 1px solid #7a4a00;
  padding: 8px 20px;
  font-weight: 600;
  font-size: 13px;
}
.dq-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px 0;
  max-width: 1800px;
  margin: 0 auto;
}
.chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.chip.stale { color: var(--warn); border-color: #5a3c10; }

.headline { font-size: 15px; line-height: 1.45; margin: 6px 0 14px; }
.target { font-family: var(--mono); color: var(--text-dim); font-size: 12px; }

/* --- Barras de probabilidade (valor vs. taxa base) --- */
.prob-row {
  display: grid;
  grid-template-columns: 70px 1fr 120px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.prob-label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.prob-label::before {
  content: "";
  width: 8px; height: 8px; border-radius: 2px;
  background: var(--c);
}
.prob-track {
  position: relative;
  height: 14px;
  background: var(--bg-3);
  border-radius: 4px;
}
.prob-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--c);
  border-radius: 0 4px 4px 0;
}
.prob-base {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--text);
  border-radius: 1px;
}
.prob-val { font-family: var(--mono); font-size: 13px; text-align: right; }
.prob-val .pp { color: var(--text-dim); font-size: 11px; margin-left: 4px; }
.legend-note { font-size: 11px; color: var(--text-dim); margin-top: 8px; }
.legend-note i {
  display: inline-block; width: 2px; height: 10px; background: var(--text);
  vertical-align: -1px; margin: 0 4px;
}

/* --- Veredito --- */
.verdict {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
  background: var(--bg-3); text-transform: none; letter-spacing: 0;
}
.verdict.COM_VANTAGEM { color: var(--up); }
.verdict.VANTAGEM_MARGINAL { color: var(--warn); }
.verdict.SEM_VANTAGEM, .verdict.AMOSTRA_INSUFICIENTE { color: var(--down); }

/* --- Fatores (por quê) --- */
.why-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .why-grid { grid-template-columns: 1fr; } }
.why-col h3 { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.factor {
  padding: 8px 0;
  border-bottom: 1px solid rgba(42, 49, 66, 0.6);
}
.factor-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.factor-name { font-weight: 600; font-size: 13px; }
.factor-state { color: var(--text-dim); font-weight: 400; }
.factor-lift { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.factor-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.warn-small { color: var(--warn); }
.empty-note { color: var(--text-dim); font-size: 12px; padding: 6px 0; }

/* --- Escada VTC --- */
.ladder { display: grid; grid-template-columns: 1fr; gap: 3px; margin-bottom: 12px; }
.rung {
  display: grid;
  grid-template-columns: 110px 1fr 70px;
  align-items: center;
  font-family: var(--mono);
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--bg-3);
}
.rung .lvl { color: var(--text-dim); font-family: system-ui, sans-serif; font-size: 12px; }
.rung .dist { text-align: right; color: var(--text-dim); font-size: 11px; }
.rung.fair { background: #1d2a40; border: 1px solid #2c4366; font-weight: 700; }
.rung.up2, .rung.dn2 { opacity: 0.85; }
.kv {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 14px;
}
.kv div { display: flex; flex-direction: column; }
.kv .k { font-size: 11px; color: var(--text-dim); }
.kv .v { font-family: var(--mono); font-size: 13px; }

/* --- Gráficos --- */
.chart { width: 100%; height: 220px; display: block; }
.chart .grid line { stroke: var(--border); stroke-width: 1; }
.chart .axis text { fill: var(--text-dim); font-size: 10px; font-family: var(--mono); }
.chart .line { fill: none; stroke-width: 2; }
.chart .line.today { stroke: var(--series); }
.chart .line.ref { stroke: var(--ref); stroke-dasharray: 4 4; }
.chart .dot { fill: var(--series); stroke: var(--bg-2); stroke-width: 2; }
.chart .lbl { font-size: 10px; font-family: var(--mono); fill: var(--text); }
.chart .lbl.ref { fill: var(--text-dim); }
.chart .xhair { stroke: var(--text-dim); stroke-width: 1; }
.chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.chart-legend span::before {
  content: ""; display: inline-block; width: 14px; height: 0; margin-right: 6px;
  border-top: 2px solid var(--series); vertical-align: middle;
}
.chart-legend span.ref::before { border-top: 2px dashed var(--ref); }
.sub-h { font-size: 12px; color: var(--text-dim); margin: 10px 0 4px; }

/* --- Tabelas --- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--text-dim); font-size: 11px;
  padding: 6px 8px; border-bottom: 1px solid var(--border);
}
.tbl td { padding: 6px 8px; border-bottom: 1px solid rgba(42, 49, 66, 0.5); font-family: var(--mono); }
.tbl td.txt { font-family: inherit; }
.tbl .num { text-align: right; }

/* --- Matriz --- */
.matrix-wrap { overflow-x: auto; }
.matrix { border-collapse: separate; border-spacing: 3px; font-size: 12px; min-width: 560px; }
.matrix th { font-size: 11px; color: var(--text-dim); font-weight: 600; padding: 4px 6px; text-align: center; }
.matrix th.rowh { text-align: right; white-space: nowrap; }
.matrix td {
  background: var(--bg-3);
  border-radius: 6px;
  padding: 6px 8px;
  min-width: 96px;
  vertical-align: top;
  border: 1px solid transparent;
}
.matrix td.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.matrix td.thin { opacity: 0.45; }
.mcell { display: flex; flex-direction: column; gap: 3px; }
.mbar { display: flex; height: 8px; gap: 2px; }
.mbar span { display: block; height: 100%; border-radius: 2px; }
.mnum { font-family: var(--mono); font-size: 11px; display: flex; justify-content: space-between; gap: 6px; }
.mnum .u { color: var(--up); }
.mnum .d { color: var(--down); }
.mn { color: var(--text-dim); font-size: 10px; font-family: var(--mono); }
.matrix-legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-dim); margin-top: 8px; flex-wrap: wrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }

/* --- Abas EUA --- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  background: var(--bg-2); color: var(--text-dim); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 170px;
}
.tabs button .tl { font-weight: 600; color: var(--text); }
.tabs button .ts { font-size: 11px; font-family: var(--mono); }
.tabs button[aria-selected="true"] { border-color: var(--accent); background: #16233a; }

/* --- Contexto EUA --- */
.ctx { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ctx .tile { background: var(--bg-3); border-radius: 8px; padding: 8px 10px; }
.ctx .tile .k { font-size: 11px; color: var(--text-dim); }
.ctx .tile .v { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.ctx .tile .c { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.ctx .tile .note { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.method p { font-size: 12px; color: var(--text-dim); margin: 4px 0; }
.method strong { color: var(--text); }

.recent { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 6px; }
.recent span {
  width: 14px; height: 14px; border-radius: 3px; display: inline-block;
  background: var(--bg-3); border: 1px solid var(--border);
}
.recent span.hit { background: var(--up); border-color: var(--up); }
.recent span.miss { background: transparent; border-color: var(--down); }

.tt {
  position: fixed; pointer-events: none; z-index: 50;
  background: #0f131c; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; font-size: 12px; font-family: var(--mono);
  box-shadow: 0 6px 18px rgba(0,0,0,.4); max-width: 280px;
}
.tt b { font-family: system-ui, sans-serif; }

@media (max-width: 900px) {
  .card.half { grid-column: 1 / -1; }
  .prob-row { grid-template-columns: 60px 1fr 100px; }
}

main.term > * { min-width: 0; }
@media (max-width: 900px) {
  main.term { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; }
  main.term > * { grid-column: 1 / -1 !important; }
  #generated { display: none; }
  header { flex-wrap: wrap; }
  .rung { grid-template-columns: 90px 1fr 60px; }
}
@media (max-width: 900px) {
  .card { overflow-x: auto; }
  .tbl th, .tbl td { padding: 5px 4px; }
}
