:root {
  --bg: #0b0e14;
  --panel: #131722;
  --panel-2: #1a2032;
  --border: #232a3b;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #2f81f7;
  --green: #26a69a;
  --red: #ef5350;
  --gold: #f7b32b;
  --radius: 12px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

/* ---------- Auth page ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(47,129,247,.15), transparent),
    radial-gradient(600px 300px at 10% 110%, rgba(38,166,154,.1), transparent),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo .logo-icon { font-size: 34px; }
.auth-logo h1 { font-size: 22px; margin-top: 6px; letter-spacing: .5px; }
.auth-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tabs { display: flex; gap: 6px; background: var(--bg); padding: 5px; border-radius: 10px; margin-bottom: 20px; }
.tabs button {
  flex: 1; padding: 9px; border: none; background: transparent;
  color: var(--muted); border-radius: 7px; font-weight: 600; font-size: 13px;
}
.tabs button.on { background: var(--accent); color: #fff; }
.field { margin-bottom: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: none;
  padding: 11px 18px; border-radius: 9px; font-weight: 600; font-size: 14px;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn.full { width: 100%; }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--red); }
.btn.green { background: var(--green); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.msg { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; display: none; }
.msg.error { display: block; background: rgba(239,83,80,.12); color: #ff8a87; border: 1px solid rgba(239,83,80,.3); }
.msg.ok { display: block; background: rgba(38,166,154,.12); color: #6fd8cd; border: 1px solid rgba(38,166,154,.3); }
.lang-select { position: absolute; top: 18px; right: 18px; width: auto; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; height: 100vh; overflow: hidden; }
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 12px;
  overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 16px; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 500; font-size: 13.5px;
  border: none; background: transparent; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.on { background: rgba(47,129,247,.14); color: var(--accent); }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 14px 12px 6px; opacity: .7; }
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar .burger { display: none; background: none; border: none; color: var(--text); font-size: 20px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); width: 36px; height: 36px; border-radius: 50%; font-size: 15px;
}
.icon-btn .dot {
  position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff;
  font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--green));
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 13px;
}
.user-chip small { color: var(--muted); display: block; font-size: 11px; }
.view { flex: 1; overflow-y: auto; padding: 22px; }
.page-title { font-size: 19px; margin-bottom: 18px; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.card h3 { font-size: 13.5px; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.right { margin-left: auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid rgba(35,42,59,.55); white-space: nowrap; }
tr:hover td { background: rgba(26,32,50,.45); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
}
.badge.green { background: rgba(38,166,154,.15); color: var(--green); }
.badge.red { background: rgba(239,83,80,.15); color: var(--red); }
.badge.blue { background: rgba(47,129,247,.15); color: var(--accent); }
.badge.gray { background: rgba(139,147,167,.15); color: var(--muted); }
.badge.gold { background: rgba(247,179,43,.15); color: var(--gold); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,8,14,.72);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 18px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; padding: 24px;
}
.modal h2 { font-size: 17px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 9px; min-width: 260px; max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: slideIn .25s ease;
  font-size: 13px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast b { display: block; margin-bottom: 2px; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Bell dropdown ---------- */
.bell-drop {
  position: absolute; top: 48px; right: 0; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5); z-index: 60; display: none;
}
.bell-drop.open { display: block; }
.notif-item { padding: 12px 14px; border-bottom: 1px solid rgba(35,42,59,.6); font-size: 13px; }
.notif-item.unread { background: rgba(47,129,247,.07); }
.notif-item b { font-size: 13px; }
.notif-item p { color: var(--muted); margin-top: 3px; font-size: 12.5px; }
.notif-item time { font-size: 11px; color: var(--muted); }

/* ---------- Chat IA ---------- */
.chat-box { display: flex; flex-direction: column; height: 380px; }
.chat-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.bubble { max-width: 82%; padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.bubble.ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- PIX ---------- */
.pix-qr { display: flex; justify-content: center; margin: 14px 0; }
.pix-qr img { border-radius: 10px; background: #fff; padding: 8px; width: 230px; height: 230px; }
.payload-box {
  background: var(--bg); border: 1px dashed var(--border); border-radius: 8px;
  padding: 10px; font-family: monospace; font-size: 11px; word-break: break-all;
  color: var(--muted); max-height: 90px; overflow-y: auto;
}

/* ---------- Sentiment gauge ---------- */
.gauge-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid rgba(35,42,59,.5); }
.gauge-row:last-child { border-bottom: none; }
.gauge-sym { width: 74px; font-weight: 700; font-size: 13px; }
.gauge-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--panel-2); position: relative; overflow: hidden; }
.gauge-fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.gauge-score { width: 52px; text-align: right; font-size: 12.5px; font-weight: 600; }

.price-tile { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(35,42,59,.5); }
.price-tile:last-child { border-bottom: none; }
.price-val { font-weight: 700; font-variant-numeric: tabular-nums; }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 13px; }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chart-box { width: 100%; min-height: 260px; }

/* ---------- Tutorial ---------- */
.tutorial-list { display: flex; flex-direction: column; gap: 14px; max-width: 860px; margin-top: 14px; }
.tut-step { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; }
.tut-num {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, var(--gold), #d98f12); color: #14141f;
}
.tut-body h3 { margin: 0 0 6px; font-size: 15px; }
.tut-body p { margin: 0 0 10px; line-height: 1.65; color: var(--muted, #9aa0b4); }
.tut-warn {
  max-width: 860px; margin-top: 16px; padding: 14px 18px;
  border-left: 3px solid var(--gold); color: var(--muted, #9aa0b4);
  font-size: 13px; line-height: 1.6;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -250px; top: 0; bottom: 0; width: 240px; z-index: 90;
    transition: left .25s ease;
  }
  .sidebar.open { left: 0; box-shadow: 12px 0 30px rgba(0,0,0,.5); }
  .topbar .burger { display: block; }
  .view { padding: 14px; }
  .user-chip div { display: none; }
}

/* ---------- Scrollbars ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: #2b3349 transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #333c55, #262e42);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #f7b32b, #d99a1f);
  border-color: var(--bg);
}
::-webkit-scrollbar-corner { background: transparent; }
