:root {
  --bg: #0a0e17;
  --bg-2: #0f1520;
  --panel: #121a28;
  --panel-2: #16202f;
  --line: #1e2a3d;
  --text: #e6edf6;
  --muted: #8697ad;
  --accent: #4f8cff;
  --green: #2fd48b;
  --amber: #ffb020;
  --red: #ff4d5e;
  --red-soft: rgba(255, 77, 94, 0.12);
  --green-soft: rgba(47, 212, 139, 0.12);
  --amber-soft: rgba(255, 176, 32, 0.12);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(79, 140, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(47, 212, 139, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.5px;
  color: #06111f;
  background: linear-gradient(135deg, #6fb1ff, #4f8cff);
  box-shadow: 0 6px 16px rgba(79, 140, 255, 0.35);
}

.brand-text h1 { margin: 0; font-size: 20px; font-weight: 700; }
.ticker { color: var(--muted); font-weight: 500; }

.net {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.net strong { color: var(--text); }
.net .sep { opacity: 0.4; }
.net-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 212, 139, 0.18);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.phase {
  padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 11.5px;
}
.phase-accum { color: var(--green); background: var(--green-soft); }
.phase-rug { color: var(--red); background: var(--red-soft); }

.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.live-price {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 14px; border-right: 1px solid var(--line); margin-right: 2px;
}
.live-price-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.live-price-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.live-price-change { font-size: 12px; font-weight: 700; }
.live-price-change.up { color: var(--green); }
.live-price-change.down { color: var(--red); }

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s ease;
  color: #fff;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.3); }
.btn-ico { margin-right: 4px; }

.btn-danger {
  background: linear-gradient(135deg, #ff6b78, #ff2d42);
  box-shadow: 0 8px 22px rgba(255, 45, 66, 0.35);
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }

.btn-ghost {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); }

/* ---------- KPIs ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 16px 0;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font-size: 24px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-tag {
  font-size: 11px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 999px;
}

.chart-wrap { position: relative; width: 100%; height: 240px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }

/* ---------- Signals ---------- */
.card-signals .signals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.signal {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; border-radius: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.signal-badge {
  flex-shrink: 0;
  font-size: 11px; font-weight: 800;
  padding: 4px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.4px;
  min-width: 74px; text-align: center;
}
.badge-ok { color: var(--green); background: var(--green-soft); }
.badge-warn { color: var(--amber); background: var(--amber-soft); }
.badge-crit { color: var(--red); background: var(--red-soft); }
.signal.crit { border-color: rgba(255, 77, 94, 0.4); background: rgba(255, 77, 94, 0.06); }
.signal-body { flex: 1; }
.signal-title { font-weight: 700; font-size: 14px; }
.signal-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

.risk-badge { font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.risk-low { color: var(--green); background: var(--green-soft); }
.risk-med { color: var(--amber); background: var(--amber-soft); }
.risk-high { color: var(--red); background: var(--red-soft); }

/* ---------- Transactions ---------- */
.tx-scroll { max-height: 300px; overflow-y: auto; border-radius: 10px; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tx-table th {
  position: sticky; top: 0;
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 8px 10px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tx-table th.num, .tx-table td.num { text-align: right; }
.tx-table td { padding: 9px 10px; border-bottom: 1px solid rgba(30, 42, 61, 0.6); font-variant-numeric: tabular-nums; }
.tx-table tr:last-child td { border-bottom: none; }
.wallet { font-family: ui-monospace, "SF Mono", Consolas, monospace; color: #c6d4e6; }
.tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}
.tag-buy { color: var(--green); background: var(--green-soft); }
.tag-sell { color: var(--amber); background: var(--amber-soft); }
.tag-liq { color: var(--red); background: var(--red-soft); }
.tx-new { animation: rowIn 0.5s ease; }
@keyframes rowIn { from { background: rgba(79,140,255,0.16); } to { background: transparent; } }

/* ---------- Footer ---------- */
.footer { margin-top: 18px; text-align: center; }
.disclaimer {
  font-size: 12px; color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  padding: 8px 14px; border-radius: 999px;
  display: inline-block;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .app { padding: 12px; }
  .topbar { padding: 14px; }
  .topbar-actions { width: 100%; }
  .btn { flex: 1; }
  .live-price { border-right: none; align-items: flex-start; padding-left: 0; }
  .brand-text h1 { font-size: 17px; }
  .kpi-value { font-size: 20px; }
}
