:root {
  --bg: #121418;
  --bg-2: #16191f;
  --card: #1c1f25;
  --card-2: #22262e;
  --lime: #c1ff72;
  --lime-2: #a8e85a;
  --text: #ffffff;
  --muted: #8a8d91;
  --red: #ff5c7a;
  --yellow: #f5b942;
  --green: #3ddc84;
  --line: rgba(255,255,255,.06);
  --shadow: 0 12px 40px rgba(0,0,0,.28);
  --r: 20px;
  --side: 88px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: Manrope, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: .01em;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

.app {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #0e1014;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 0 18px;
  z-index: 20;
}

.brand { display: grid; place-items: center; gap: 6px; margin-bottom: 18px; }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; box-shadow: 0 0 24px rgba(193,255,114,.25); }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--lime); color: #111;
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px;
  box-shadow: 0 0 24px rgba(193,255,114,.35);
}
.brand-text { font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.side-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-ico {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; color: var(--muted);
  position: relative; transition: .2s ease;
}
.nav-ico svg { width: 22px; height: 22px; }
.nav-ico:hover { background: var(--card); color: #fff; }
.nav-ico.is-active { background: var(--lime); color: #111; }
.nav-ico.logout { margin-top: auto; }
.badge-dot {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 99px;
  font-size: 9px; font-weight: 700; display: grid; place-items: center;
}

.main { padding: 22px 28px 40px; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; margin-bottom: 22px;
}
.search {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 999px; padding: 0 18px; height: 52px;
  border: 1px solid var(--line);
}
.search svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search input {
  flex: 1; background: none; border: 0; outline: none; color: #fff; font-size: 14px;
}
.btn-lime {
  background: var(--lime); color: #111; font-weight: 700;
  border: 0; border-radius: 999px; padding: 14px 22px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(193,255,114,.2);
}
.btn-lime:hover { filter: brightness(1.05); }
.btn-ghost {
  background: var(--card-2); color: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 12px 18px; cursor: pointer; font-weight: 600;
}
.profile { display: flex; align-items: center; gap: 12px; margin-left: 8px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(145deg, #3a4250, #1c222c);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  border: 2px solid #2c3340;
}
.profile strong { display: block; font-size: 14px; }
.profile small { color: var(--muted); font-size: 12px; }

.grid-dash {
  display: grid;
  grid-template-columns: 1.55fr .85fr;
  grid-template-rows: auto auto;
  gap: 18px;
}
.card {
  background: var(--card);
  border-radius: var(--r);
  padding: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card h3 { font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.space { justify-content: space-between; }
.grow { flex: 1; }

.balance-head .label { color: var(--muted); font-size: 13px; }
.balance-head .amt { font-size: 32px; font-weight: 800; letter-spacing: -.03em; }
.chip {
  font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 8px;
}
.chip.up { color: var(--green); background: rgba(61,220,132,.12); }
.chip.down { color: var(--red); background: rgba(255,92,122,.12); }

.seg {
  display: flex; background: #15181e; border-radius: 10px; padding: 4px; gap: 2px;
}
.seg button, .seg a {
  background: none; border: 0; color: var(--muted); padding: 6px 10px;
  border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 12px;
}
.seg button.is-on, .seg a.is-on { background: #2a2f38; color: #fff; }

.select {
  background: #15181e; border: 1px solid var(--line); color: #fff;
  border-radius: 10px; padding: 8px 10px; font-weight: 600;
}

.chart-box { height: 120px; position: relative; margin-top: 4px; }
#balanceChart { width: 100%; height: 120px !important; }

.promo {
  background: linear-gradient(180deg, #1e232c, #191d24);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  justify-content: center; min-height: 340px; gap: 14px;
}
.promo p { font-size: 22px; font-weight: 800; line-height: 1.25; max-width: 260px; }
.promo-art { width: 180px; height: 140px; }

.bottom-3 {
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px;
  grid-column: 1 / -1;
}

.tabs { display: flex; gap: 18px; margin-bottom: 14px; }
.tabs a, .tabs button {
  background: none; border: 0; color: var(--muted); font-weight: 700; cursor: pointer; font-size: 15px;
}
.tabs .on { color: #fff; position: relative; }
.tabs .on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 2px;
  background: var(--lime); border-radius: 2px;
}

.coin-row {
  display: grid; grid-template-columns: 36px 1fr auto auto; gap: 10px;
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.coin-row:last-child { border-bottom: 0; }
.coin-ico {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #111;
}
.coin-ico img { width: 100%; height: 100%; object-fit: cover; }
.coin-row .sym { font-weight: 800; font-size: 14px; }
.coin-row .px { font-weight: 700; }
.pct { font-weight: 700; font-size: 13px; min-width: 64px; text-align: right; }
.pct.up { color: var(--green); }
.pct.down { color: var(--red); }

.trade-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.trade-tabs button {
  flex: 1; border: 0; border-radius: 12px; padding: 10px; font-weight: 800; cursor: pointer;
  background: #15181e; color: var(--muted);
}
.trade-tabs button.on { background: var(--lime); color: #111; }
.field { margin-bottom: 12px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.field-box {
  display: flex; align-items: center; background: #15181e; border-radius: 14px;
  padding: 4px 4px 4px 14px; border: 1px solid var(--line);
}
.field-box input {
  flex: 1; background: none; border: 0; color: #fff; font-size: 18px; font-weight: 700; outline: none; min-width: 0;
  padding: 12px 0;
}
.field-box select {
  background: #22262e; color: #fff; border: 0; border-radius: 12px; padding: 12px 10px; font-weight: 800;
}

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { color: var(--muted); font-weight: 600; text-align: left; padding: 8px 6px; }
.table td { padding: 10px 6px; border-top: 1px solid var(--line); }
.pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.pill.ok { background: rgba(61,220,132,.15); color: var(--green); }
.pill.wait { background: rgba(245,185,66,.15); color: var(--yellow); }
.pill.no { background: rgba(255,92,122,.15); color: var(--red); }

.page-grid { display: grid; gap: 18px; }
.markets-table img { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; margin-right: 8px; }
.spark { width: 92px; height: 32px; }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(800px 400px at 10% 0%, rgba(193,255,114,.12), transparent),
    radial-gradient(600px 400px at 100% 100%, rgba(80,120,255,.12), transparent),
    var(--bg);
}
.auth-card { width: min(440px, 100%); }
.auth-card-wide { width: min(640px, 100%); }
.auth-card h1 { font-size: 28px; margin: 8px 0 6px; }
.reg-form { margin-top: 18px; }
.reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.reg-span { grid-column: 1 / -1; }
.reg-form .input { margin: 6px 0 12px; }
.reg-form select.input { appearance: none; }
.input {
  width: 100%; background: #15181e; border: 1px solid var(--line); color: #fff;
  border-radius: 14px; padding: 14px 16px; margin: 8px 0 14px; font-size: 14px;
  color-scheme: dark;
}
.alert { padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; font-size: 13px; }
.alert.err { background: rgba(255,92,122,.12); color: var(--red); }
.alert.ok { background: rgba(61,220,132,.12); color: var(--green); }

.chat-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 18px; min-height: 70vh; }
.chat-list { overflow: auto; max-height: 70vh; }
.chat-item {
  display: flex; gap: 10px; padding: 12px; border-radius: 14px; cursor: pointer;
}
.chat-item:hover, .chat-item.on { background: #15181e; }
.chat-pane { display: flex; flex-direction: column; min-height: 70vh; }
.msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 0 16px; }
.bubble {
  max-width: 70%; padding: 10px 14px; border-radius: 16px; line-height: 1.4; font-size: 14px;
}
.bubble.me { align-self: flex-end; background: var(--lime); color: #111; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: #15181e; border-bottom-left-radius: 4px; }
.chat-send { display: flex; gap: 10px; }
.chat-send input { flex: 1; }
.chat-item.has-unread { border-left: 3px solid var(--lime); background: rgba(193,255,114,.08); }
.chat-item.has-unread .chat-preview { color: #fff; font-weight: 600; }
.chat-list.flash-new { animation: chatFlash .6s ease; }
@keyframes chatFlash { 0%,100%{ box-shadow:none } 50%{ box-shadow:0 0 0 2px rgba(193,255,114,.5) } }
.chat-preview { font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-select { cursor: pointer; }

.kyc-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.step { background: #15181e; border-radius: 14px; padding: 14px; }
.step b { display: block; margin-bottom: 4px; }

.admin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.danger { background: var(--red); color: #fff; }

.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 999px; }
.asset-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.asset-row:last-child { border-bottom: 0; }
.asset-bal { text-align: right; min-width: 110px; }
.asset-actions { display: flex; gap: 8px; justify-content: flex-end; }
.asset-actions .btn-lime,
.asset-actions .btn-ghost,
.modal .btn-lime,
.modal .btn-ghost {
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease, filter .18s ease;
}
.asset-actions .btn-lime:hover,
.modal .btn-lime:hover {
  background: #dcffa0;
  filter: none;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 28px rgba(193,255,114,.4);
}
.asset-actions .btn-ghost:hover,
.modal .btn-ghost:hover {
  background: #2c3340;
  border-color: var(--lime);
  color: var(--lime);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 22px rgba(0,0,0,.35);
}
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal-bg[hidden] { display: none !important; }
.modal { width: min(420px, 100%); }
.qr-wrap {
  background: #15181e; border-radius: 16px; padding: 16px;
  display: grid; place-items: center; margin-bottom: 12px;
}
.qr-wrap img { width: 220px; height: 220px; border-radius: 12px; }
.addr-box {
  background: #15181e; border-radius: 12px; padding: 12px 14px;
  word-break: break-all; font-size: 13px; font-weight: 600;
}

@media (max-width: 1100px) {
  .grid-dash, .bottom-3, .chat-wrap, .admin-actions { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; height: auto; flex-direction: row; width: 100%; padding: 10px; gap: 8px; }
  .side-nav { flex-direction: row; overflow: auto; }
  .brand-text, .profile small { display: none; }
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex: 1 1 100%; }
  .asset-row { grid-template-columns: 40px 1fr; }
  .asset-bal { text-align: left; grid-column: 2; }
  .asset-actions { grid-column: 1 / -1; }
  .reg-grid { grid-template-columns: 1fr; }
}
