:root {
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #182033;
  --border: #232c40;
  --border-strong: #2f3a52;
  --text: #e6eaf2;
  --text-2: #9aa4b8;
  --text-3: #6b7489;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --in: #2fbf71;
  --in-soft: rgba(47, 191, 113, 0.14);
  --out: #f2994a;
  --out-soft: rgba(242, 153, 74, 0.14);
  --danger: #ef5b5b;
  --danger-soft: rgba(239, 91, 91, 0.14);
  --warn: #f2c94c;
  --warn-soft: rgba(242, 201, 76, 0.14);
  --tron: #ff4d5e;
  --eth: #8c9eff;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; padding: 4px 8px 18px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #9b6bff); color: #fff; font-size: 14px;
}
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.sidebar-foot .email { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 6px; }

.main { min-width: 0; padding: 22px 28px 48px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.topbar h1 { font-size: 20px; margin: 0 auto 0 0; font-weight: 650; letter-spacing: -0.01em; }
.sync-info { font-size: 12.5px; color: var(--text-3); }

/* ---------- controles ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--text-3); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); padding: 6px 8px; }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn svg { width: 16px; height: 16px; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.input, select.input {
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 11px; min-width: 0; outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--text-3); }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; color: var(--text-2); cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-h h2 { font-size: 14px; margin: 0; font-weight: 600; }
.card-h .muted { font-size: 12.5px; }
.kpi .label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; }
.kpi .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.chart-box { position: relative; height: 260px; }

.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  background: var(--warn-soft); border: 1px solid rgba(242, 201, 76, 0.35); margin-bottom: 16px; font-size: 13.5px;
}
.banner.info { background: var(--accent-soft); border-color: rgba(91, 140, 255, 0.35); }
.banner.danger { background: var(--danger-soft); border-color: rgba(239, 91, 91, 0.4); }
.banner strong { display: block; margin-bottom: 2px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge.tron { background: rgba(255, 77, 94, 0.14); color: var(--tron); }
.badge.ethereum { background: rgba(140, 158, 255, 0.16); color: var(--eth); }
.badge.in { background: var(--in-soft); color: var(--in); }
.badge.out { background: var(--out-soft); color: var(--out); }
.badge.internal { background: var(--accent-soft); color: var(--accent); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3);
  font-weight: 600; padding: 9px 18px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 11px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
td.right, th.right { text-align: right; }
.amount-in { color: var(--in); }
.amount-out { color: var(--out); }
.cp { display: flex; flex-direction: column; gap: 1px; }
.cp .name { font-weight: 500; }
.empty { text-align: center; color: var(--text-3); padding: 36px 18px; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }

/* ---------- carteiras ---------- */
.wallets { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.wallet-card .head { display: flex; align-items: center; gap: 10px; }
.wallet-card .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-card .total { font-size: 22px; font-weight: 650; margin: 12px 0 2px; letter-spacing: -0.02em; }
.wallet-card .addr { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.wallet-card .bals { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 6px; }
.wallet-card .foot { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; }
.wallet-card .foot .actions { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 -8px; }
.wallet-card.paused { opacity: 0.6; }
.color-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }

.form-row { display: grid; grid-template-columns: 1fr 2fr auto auto; gap: 12px; align-items: end; }
.form-row.c3 { grid-template-columns: 1fr 2fr auto; }
.det { font-size: 12px; margin-top: 4px; min-height: 18px; }
.colors { display: flex; gap: 6px; }
.colors button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.colors button.on { border-color: var(--text); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px 0; font-size: 12.5px; color: var(--text-2); }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 50; background: var(--surface-2); border: 1px solid var(--border-strong);
  padding: 11px 16px; border-radius: var(--radius-sm); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); max-width: 380px;
}
.toast.err { border-color: rgba(239, 91, 91, 0.6); }

.icon-btn { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 2px; display: inline-flex; }
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 14px; height: 14px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { justify-content: center; padding-bottom: 8px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .qr { display: flex; justify-content: center; background: #fff; border-radius: var(--radius-sm); padding: 10px; width: fit-content; margin: 0 auto; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .half { grid-template-columns: minmax(0, 1fr); }
  .form-row, .form-row.c3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 2px; min-width: 0; }
  .brand { padding: 4px 8px; }
  .nav { display: flex; overflow-x: auto; width: 100%; min-width: 0; gap: 2px; scrollbar-width: none; }
  .nav a { padding: 7px 10px; font-size: 13px; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main { padding: 16px; }
  .kpi .value { font-size: 20px; }
  .card { padding: 14px; }
  .table-wrap { margin: 0 -14px -14px; }
  th, td { padding: 9px 12px; }
}
