:root {
  --bg: #0f1420;
  --panel: #171f31;
  --panel-2: #1d2740;
  --border: #2a3854;
  --text: #e6ecf7;
  --muted: #8b98b3;
  --green: #2ecc71;
  --red: #e74c3c;
  --amber: #f1c40f;
  --accent: #4a8cff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  row-gap: 10px;
  padding: 14px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar .spacer { flex: 1; }
.topbar .muted { color: var(--muted); font-size: 13px; }
.bot-toggle { display: flex; align-items: center; gap: 8px; }
button.small { padding: 6px 12px; font-size: 13px; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 20px; display: grid; gap: 20px; }

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar .spacer { flex-basis: 100%; height: 0; }
  .container { padding: 0 14px; margin: 16px auto; gap: 14px; }
  .card { padding: 16px; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  min-width: 0;
}
.card h2 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
/* filtros (selects) dentro do titulo do card: inline ao lado do texto,
   nao 100% de largura como os campos de formulario */
.card h2 select {
  width: auto;
  display: inline-block;
  padding: 6px 10px;
  font-size: 12px;
  margin-left: 8px;
  text-transform: none;
  letter-spacing: normal;
  vertical-align: middle;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 600; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.on { background: rgba(46, 204, 113, 0.15); color: var(--green); }
.badge.off { background: rgba(139, 152, 179, 0.15); color: var(--muted); }
.badge.warn { background: rgba(241, 196, 15, 0.15); color: var(--amber); }
.badge.danger { background: rgba(231, 76, 60, 0.15); color: var(--red); }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button.secondary { background: var(--panel-2); border: 1px solid var(--border); }
button.danger { background: var(--red); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

form.stack { display: grid; gap: 14px; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  font-family: inherit;
}
/* Autofill do Chrome/Edge forca um fundo claro proprio que ignora o background
   normal e quebra o tema escuro. O unico override que funciona e cobrir o fundo
   com um box-shadow interno + repintar a cor do texto. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--panel-2) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  border: 1px solid var(--border);
}
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
label.check input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.fields-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.buy { color: var(--green); font-weight: 600; }
td.sell { color: var(--red); font-weight: 600; }
td.hold { color: var(--muted); }
.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red); }

table details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  list-style: none;
}
table details summary::-webkit-details-marker { display: none; }
table details summary::before { content: "▸ "; }
table details[open] summary::before { content: "▾ "; }
table details .motivo-full {
  margin-top: 6px;
  color: var(--text);
  font-weight: 400;
  white-space: normal;
}

body.login-body {
  background:
    radial-gradient(600px 420px at 50% 8%, rgba(247, 147, 26, 0.16), transparent 65%),
    radial-gradient(900px 700px at 50% 100%, rgba(74, 140, 255, 0.10), transparent 60%),
    var(--bg);
}

.login-wrap { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100vh; overflow: hidden; padding: 24px; }

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 152, 179, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 152, 179, 0.07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 35%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 35%, #000 0%, transparent 72%);
  pointer-events: none;
}

.login-chart {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%; height: 38vh;
  min-height: 240px;
  opacity: 0.5;
  pointer-events: none;
}
.login-chart .candle-up rect { fill: rgba(46, 204, 113, 0.28); }
.login-chart .candle-up line { stroke: rgba(46, 204, 113, 0.28); }
.login-chart .candle-down rect { fill: rgba(231, 76, 60, 0.24); }
.login-chart .candle-down line { stroke: rgba(231, 76, 60, 0.24); }
.login-chart line { stroke-width: 1.4; }
.login-chart polyline.trend {
  fill: none;
  stroke: #f7931a;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(247, 147, 26, 0.55));
}

.login-ticker {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(29, 39, 64, 0.55);
  border: 1px solid var(--border);
  backdrop-filter: blur(3px);
  pointer-events: none;
  animation: ticker-float 6s ease-in-out infinite;
}
.login-ticker .dot { width: 7px; height: 7px; border-radius: 50%; }
.login-ticker.t-btc { top: 10%; left: 8%; }
.login-ticker.t-btc .dot { background: #f7931a; }
.login-ticker.t-eth { top: 16%; right: 9%; animation-delay: 1.2s; }
.login-ticker.t-eth .dot { background: #627eea; }
.login-ticker.t-bnb { bottom: 28%; left: 6%; animation-delay: 2.4s; }
.login-ticker.t-bnb .dot { background: #f3ba2f; }
.login-ticker.t-sol { bottom: 34%; right: 7%; animation-delay: 3.6s; }
.login-ticker.t-sol .dot { background: #9945ff; }
@media (max-width: 720px) { .login-ticker { display: none; } }

.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6);
  animation: live-pulse 2s ease-out infinite;
}

@keyframes ticker-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.login-card {
  position: relative;
  width: 380px;
  max-width: 100%;
  text-align: center;
  padding: 32px 28px 28px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(29, 39, 64, 0.92), rgba(23, 31, 49, 0.92));
  border: 1px solid rgba(247, 147, 26, 0.22);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(74, 140, 255, 0.05) inset;
  backdrop-filter: blur(6px);
}
.login-card .stack { text-align: left; }

.btc-badge {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 50%;
  filter: drop-shadow(0 0 18px rgba(247, 147, 26, 0.45));
  animation: btc-float 4.5s ease-in-out infinite;
}
.btc-badge svg { width: 100%; height: 100%; }

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  background: linear-gradient(90deg, #ffd08a, #f7931a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-tagline {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.login-card p.sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

@keyframes btc-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
  .btc-badge, .login-ticker, .live-dot { animation: none; }
}
.error { background: rgba(231, 76, 60, 0.12); color: var(--red); border: 1px solid rgba(231, 76, 60, 0.4); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.notice { background: rgba(46, 204, 113, 0.12); color: var(--green); border: 1px solid rgba(46, 204, 113, 0.4); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.warn-box { background: rgba(241, 196, 15, 0.1); color: var(--amber); border: 1px solid rgba(241, 196, 15, 0.35); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.scroll { max-height: 340px; overflow-y: auto; overflow-x: auto; }
.table-scroll { overflow-x: auto; }

.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  font-size: 14px;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 20px; min-width: 0; }

.vote-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--border); }
.vote-badge .v-up { color: var(--green); }
.vote-badge .v-down { color: var(--red); }
.vote-badge .v-neutral { color: var(--muted); }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

.help-text { font-size: 14px; line-height: 1.6; color: var(--text); }
.help-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.help-item:last-child { border-bottom: 0; }
.help-item h3 { font-size: 15px; margin-bottom: 8px; }
.help-item p { font-size: 13px; line-height: 1.6; color: var(--text); margin-bottom: 6px; }
.help-item p.up { color: var(--green); }
.help-item p.down { color: var(--red); }
.help-item p.muted-note { color: var(--muted); font-style: italic; }
.help-item code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
