:root {
  --bg0: #050709;
  --bg1: #0b101c;
  --panel: #0d1424;
  --border: #3c5578;
  --green: #2ecc71;
  --red: #e74c3c;
  --gray: #7c8aa5;
  --gold: #f1c40f;
  --blue: #3498db;
  --white: #eaf0fb;
  --mono: Consolas, "Cascadia Mono", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 100%);
  color: var(--white);
  font-family: var(--sans);
  font-size: 14px;
  min-width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 7, 9, 0.85);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--gold);
  line-height: 1.1;
}

.brand .quant { color: var(--white); font-weight: 600; }

.tagline { font-size: 12px; color: var(--gray); margin-top: 2px; }

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

.source-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 4px;
  padding: 3px 8px;
}

select, .btn {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--white);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
}

.btn:hover, select:hover { border-color: var(--gray); }
.btn:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.panels {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  overflow-x: auto;
  width: max-content;
  min-width: 100%;
}

.panel {
  width: 343px;
  flex: none;
  background: var(--panel);
  border: 1px solid var(--border);
  outline: 1px solid var(--border);
  outline-offset: 2px;
  padding: 8px 14px 12px;
}

.panel-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }

.panel-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.4px;
}

.status { font-size: 11px; font-weight: 700; }
.status.online { color: var(--green); }
.status.offline { color: var(--gray); }

.asset { font-size: 11px; color: var(--white); text-align: right; }

.divider { border-top: 1px solid var(--border); margin: 7px 0; }

.poss-card {
  border: 1px solid var(--white);
  outline: 1px solid var(--white);
  outline-offset: 1px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(234, 240, 251, 0.08);
  margin: 4px 0 6px;
}

.poss-card .lbl { font-size: 12px; color: var(--white); }

.poss-card .val { font-size: 17px; font-weight: 800; color: var(--white); }

.poss-card.buy  { border-color: var(--green); outline-color: var(--green); background: rgba(46, 204, 113, 0.14); }
.poss-card.sell { border-color: var(--red); outline-color: var(--red); background: rgba(231, 76, 60, 0.14); }
.poss-card.wait { border-color: var(--white); outline-color: var(--white); background: rgba(234, 240, 251, 0.06); }

.poss-card.pulse { animation: pulse 0.9s ease-out; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(241, 196, 15, 0.55); }
  100% { box-shadow: 0 0 0 22px rgba(241, 196, 15, 0); }
}

.section-title { font-size: 12px; color: var(--white); margin: 4px 0; }

.tech-row { display: flex; align-items: center; justify-content: space-between; margin: 3px 0; font-size: 12px; }

.tech-row .name { color: var(--white); }
.tech-row .tri { font-weight: 700; min-width: 46px; text-align: center; }
.tech-row .cls { font-weight: 700; text-align: right; }
.green { color: var(--green); }
.red { color: var(--red); }
.neutral { color: var(--white); }
.gray { color: var(--gray); }

.row2 { display: flex; align-items: center; justify-content: space-between; margin: 4px 0; font-size: 12px; }
.row2 .name { color: var(--white); }
.row2 .val { font-weight: 700; text-align: right; }

.termo-blocks { letter-spacing: 0; white-space: nowrap; font-size: 12px; font-weight: 700; }

.targets { display: flex; justify-content: space-around; text-align: center; margin: 2px 0 4px; }
.targets .col { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.targets .col .head { color: var(--white); font-weight: 600; }

.mkt-data { font-size: 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin: 2px 0 6px; }
.mkt-data .left { color: var(--white); }
.mkt-data .right { text-align: right; color: var(--white); }

.spark { width: 100%; height: 56px; display: block; margin: 4px 0 2px; }

.bottom-card {
  border: 1px solid var(--white);
  outline: 1px solid var(--white);
  outline-offset: 1px;
  padding: 8px 12px 10px;
  margin-top: 4px;
  background: rgba(234, 240, 251, 0.06);
}

.bottom-card.buy  { border-color: var(--green); outline-color: var(--green); background: rgba(46, 204, 113, 0.12); }
.bottom-card.sell { border-color: var(--red); outline-color: var(--red); background: rgba(231, 76, 60, 0.12); }
.bottom-card.wait { border-color: var(--white); outline-color: var(--white); }

.prob-head { font-size: 11px; color: var(--white); }

.prob-line { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.prob-dir { font-size: 17px; font-weight: 800; color: var(--white); }
.prob-num { font-size: 26px; font-weight: 800; color: var(--white); line-height: 1; }

.metric { display: flex; align-items: center; justify-content: space-between; margin: 3px 0; font-size: 12px; }
.metric .name { color: var(--white); }
.metric .val { font-weight: 700; text-align: right; }

.blocks { display: flex; gap: 4px; margin-top: 5px; }
.block { width: 12px; height: 12px; background: var(--white); }
.block.fill { background: var(--white); }
.block.hatch {
  background:
    repeating-linear-gradient(90deg, var(--white) 0 2px, transparent 2px 6px);
  border: 1px solid var(--white);
}

.footbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--white);
  position: sticky;
  bottom: 0;
  background: rgba(5, 7, 9, 0.9);
}

.muted { color: var(--gray); }

.mkt-open { color: var(--green); }
.mkt-closed { color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  .poss-card.pulse { animation: none; }
}

/*--- Autenticação (login / admin) ---*/

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  outline: 1px solid var(--border);
  outline-offset: 2px;
  padding: 28px 26px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
}

.auth-title .quant { color: var(--white); }

.auth-sub {
  font-size: 12px;
  color: var(--gray);
  text-align: center;
  margin: 4px 0 18px;
}

.auth-label {
  display: block;
  font-size: 12px;
  color: var(--white);
  margin: 10px 0 4px;
}

.auth-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--white);
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 9px 12px;
}

.auth-input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.auth-btn {
  width: 100%;
  margin-top: 18px;
  font-size: 14px;
  font-weight: 700;
  padding: 10px;
  background: var(--gold);
  color: #1a1400;
  border: none;
}

.auth-btn:hover { background: #ffd633; }

.auth-msg {
  font-size: 12px;
  text-align: center;
  margin-top: 12px;
  min-height: 16px;
  color: var(--gray);
}

.auth-msg.err { color: var(--red); }
.auth-msg.ok { color: var(--green); }

.auth-foot {
  font-size: 11px;
  color: var(--gray);
  text-align: center;
  margin-top: 10px;
}

/*--- Painel admin ---*/

.admin-panel { min-height: 100vh; }

.admin-section {
  margin: 18px auto;
  max-width: 860px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.admin-section h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 12px;
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-form .auth-input { width: auto; flex: 1 1 160px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--white);
}

.admin-table th { color: var(--gray); font-size: 11px; text-transform: uppercase; }

.admin-actions { white-space: nowrap; }

.btn.danger { color: var(--red); border-color: var(--red); }

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 7, 9, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-card {
  max-width: 400px;
  text-align: center;
  padding: 30px;
  border: 1px solid var(--red);
  background: var(--panel);
}

.lock-card h2 { color: var(--red); margin-bottom: 8px; font-size: 18px; }

.lock-card p { color: var(--white); font-size: 13px; margin-bottom: 14px; }

.btn-logout { color: var(--gray); }
