:root {
  --bg: #07090d;
  --panel: #0e1218;
  --panel-2: #121821;
  --line: #1c2430;
  --line-2: #263142;
  --text: #e6edf6;
  --muted: #8593a6;
  --dim: #5b6778;
  --accent: #5eead4;
  --accent-2: #22d3ee;
  --up: #22c55e;
  --down: #f43f5e;
  --warn: #f59e0b;
  --violet: #a78bfa;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); }
body { min-height: 100vh; background:
  radial-gradient(1200px 500px at 10% -10%, rgba(34, 211, 238, .07), transparent 60%),
  radial-gradient(900px 400px at 100% 0%, rgba(167, 139, 250, .06), transparent 60%), var(--bg); }
button, input, select { font: inherit; color: inherit; }
.num, td.n, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); } .warn { color: var(--warn); }

/* ---------- topo ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  background: rgba(7, 9, 13, .82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .28em; font-size: 15px; }
.brand svg { width: 26px; height: 26px; }
.brand small { font-weight: 500; letter-spacing: .12em; color: var(--muted); font-size: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px;
  font-weight: 700; letter-spacing: .06em; border: 1px solid var(--line-2); background: var(--panel-2); white-space: nowrap; }
.pill.live { color: #fecaca; border-color: rgba(244, 63, 94, .5); background: rgba(244, 63, 94, .12); }
.pill.paper { color: #bae6fd; border-color: rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .08); }
.pill.ok { color: #bbf7d0; border-color: rgba(34, 197, 94, .45); background: rgba(34, 197, 94, .1); }
.pill.halt { color: #fde68a; border-color: rgba(245, 158, 11, .5); background: rgba(245, 158, 11, .12); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 0 rgba(94, 234, 212, .6); }
.dot.on { background: var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, .55); } 70% { box-shadow: 0 0 0 8px rgba(94, 234, 212, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); } }
.spacer { flex: 1; }
.meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; }
.btn { border: 1px solid var(--line-2); background: var(--panel-2); padding: 7px 12px; border-radius: 9px; cursor: pointer;
  font-weight: 600; transition: .15s; }
.btn:hover { border-color: var(--accent); }
.btn.danger { border-color: rgba(244, 63, 94, .55); color: #fecdd3; background: rgba(244, 63, 94, .1); }
.btn.danger:hover { background: rgba(244, 63, 94, .22); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 8px; font-size: 11px; border-radius: 7px; }

/* ---------- layout ---------- */
main { padding: 16px 18px 40px; display: grid; gap: 14px; max-width: 1800px; margin: 0 auto; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.kpi .v { font: 700 21px/1.2 var(--mono); margin-top: 4px; }
.kpi .s { color: var(--muted); font-size: 11.5px; margin-top: 2px; font-family: var(--mono); }
.grid-a { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(320px, 1fr); gap: 14px; }
.grid-b { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.card > header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 44px; }
.card > header h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.card > header .spacer { flex: 1; }
.card .body { padding: 12px 14px; }
.scroll { overflow: auto; }

/* ---------- gráfico ---------- */
.chartbox { height: 470px; position: relative; }
.chartbox.small { height: 240px; }
.legend { position: absolute; left: 12px; top: 8px; z-index: 3; font: 12px var(--mono); color: var(--muted); pointer-events: none; }
.legend b { color: var(--text); font-size: 14px; margin-right: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 4px 9px; cursor: pointer; color: var(--muted); font-size: 12px; }
.seg button.on { background: var(--line-2); color: var(--text); }
select.sym { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 8px; font-weight: 700; }

/* ---------- posições ---------- */
.pos { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel-2); cursor: pointer; }
.pos:hover { border-color: var(--line-2); }
.pos .row { display: flex; align-items: center; gap: 8px; }
.pos .sym { font-weight: 800; }
.side { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 5px; letter-spacing: .06em; }
.side.LONG { background: rgba(34, 197, 94, .15); color: var(--up); }
.side.SHORT { background: rgba(244, 63, 94, .15); color: var(--down); }
.pos .pnl { margin-left: auto; font: 700 15px var(--mono); }
.pos .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.pos .grid b { display: block; color: var(--text); font: 600 12px var(--mono); }
.rbar { position: relative; height: 6px; border-radius: 3px; background: var(--line); margin-top: 9px; overflow: hidden; }
.rbar i { position: absolute; top: 0; bottom: 0; }
.rbar .zero { left: 25%; width: 1px; background: var(--muted); }
.empty { color: var(--dim); text-align: center; padding: 26px 8px; }

/* ---------- tabelas ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); cursor: default; white-space: nowrap; }
th[data-k] { cursor: pointer; } th[data-k]:hover { color: var(--text); }
td { padding: 7px 10px; border-bottom: 1px solid rgba(28, 36, 48, .6); white-space: nowrap; }
td.n, th.n { text-align: right; }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(94, 234, 212, .04); }
.tag { font-size: 10.5px; padding: 2px 7px; border-radius: 5px; font-weight: 700; }
.tag.ALTA { color: var(--up); background: rgba(34, 197, 94, .12); }
.tag.BAIXA { color: var(--down); background: rgba(244, 63, 94, .12); }
.tag.LATERAL { color: var(--muted); background: var(--line); }
.score { display: inline-block; width: 64px; height: 6px; background: var(--line); border-radius: 3px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.score i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* ---------- feed / console ---------- */
.feed { max-height: 330px; }
.sig { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; padding: 8px 14px; border-bottom: 1px solid rgba(28, 36, 48, .6); }
.sig .why { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.sig.taken { box-shadow: inset 3px 0 0 var(--accent); background: rgba(94, 234, 212, .04); }
.console { font: 11.5px/1.55 var(--mono); max-height: 330px; padding: 8px 14px; }
.console div { white-space: pre-wrap; word-break: break-word; }
.console .WARNING { color: var(--warn); } .console .ERROR, .console .CRITICAL { color: var(--down); }
.console .t { color: var(--dim); margin-right: 8px; }
.tabs { display: inline-flex; gap: 4px; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 4px 8px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; }
.tabs button.on { color: var(--text); background: var(--line); }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); }
.modal.on { display: flex; }
.modal .box { width: min(440px, 92vw); background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 20px; }
.modal h4 { margin: 0 0 6px; font-size: 16px; }
.modal p { color: var(--muted); margin: 0 0 14px; }
.modal input { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); font-family: var(--mono); letter-spacing: .1em; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, 92vw); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 10px;
  white-space: pre-wrap; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.hunter { border-color: rgba(245, 158, 11, .28); }
.hunter > header h3 { color: #fcd34d; }
.hkpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.hkpis > div { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; }
.hkpis b { font-size: 16px; }
.budget { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.budget i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--warn), var(--down)); transition: width .4s; }
.book { font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 5px; letter-spacing: .06em; color: #fcd34d; background: rgba(245, 158, 11, .14); }
.noapi { color: var(--dim); text-decoration: line-through; }

.modal .box.wide { width: min(860px, 94vw); max-height: 92vh; overflow: auto; }
.acct-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.acct-head h4 { margin: 0; }
.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.acct-card { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 14px; }
.acct-card h5 { margin: 0 0 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.acct-card dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; margin: 0; font-size: 12.5px; }
.acct-card dt { color: var(--muted); } .acct-card dd { margin: 0; font-family: var(--mono); }
.acct-card label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.acct-card label input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--bg); font-family: var(--mono); text-transform: none; letter-spacing: 0; }
.acct-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.checklist { margin-top: 12px; } .checklist ol { margin: 0; padding-left: 18px; line-height: 1.7; }
.checklist code { background: var(--bg); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); }
.hint { color: var(--muted); font-size: 11.5px; margin: 8px 0 0; }
.acct-live { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 14px; border-radius: 12px; flex-wrap: wrap;
  border: 1px solid rgba(244, 63, 94, .35); background: rgba(244, 63, 94, .06); }
.acct-live > div { flex: 1; min-width: 220px; }
.modal input + input { margin-top: 8px; }

/* ---------- responsivo ---------- */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .grid-a, .grid-b { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  main { padding: 12px 12px 30px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; position: static; }
  .card > header { flex-wrap: wrap; }
  #chartInfo { display: none; }
  .meta { display: none; }
  .chartbox { height: 360px; }
  .brand small { display: none; }
  .hkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acct-grid { grid-template-columns: 1fr; }
}

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 28px; }
.login .brand { justify-content: center; margin-bottom: 6px; font-size: 20px; }
.login p { text-align: center; color: var(--muted); margin: 0 0 20px; }
.login label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 12px 0 5px; }
.login input { width: 100%; padding: 11px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); }
.login input:focus { outline: none; border-color: var(--accent); }
.login button { width: 100%; margin-top: 20px; padding: 11px; border-radius: 10px; border: 0; cursor: pointer; font-weight: 800; letter-spacing: .08em;
  color: #031312; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.login .err { color: var(--down); text-align: center; min-height: 18px; margin-top: 12px; }
