:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c232d;
  --panel-3: #222b37;
  --border: #262d38;
  --border-lite: #2f3846;
  --text: #e6eaf0;
  --muted: #7d8794;
  --gold: #f0b90b;
  --gold-2: #f8d33a;
  --gold-soft: rgba(240, 185, 11, 0.12);
  --up: #0ecb81;
  --up-soft: rgba(14, 203, 129, 0.12);
  --down: #f6465d;
  --down-soft: rgba(246, 70, 93, 0.12);
  --accent: #4ea8ff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --sh-1: 0 1px 3px rgba(0,0,0,.35);
  --sh-2: 0 6px 20px rgba(0,0,0,.4);
  --sh-3: 0 16px 44px rgba(0,0,0,.55);
  --edge-hi: inset 0 1px 0 rgba(255,255,255,.04);
}

* { box-sizing: border-box; }
::selection { background: rgba(240,185,11,.28); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c3540; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4655; }

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; height: 100%;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { background-image: radial-gradient(1100px 500px at 75% -10%, rgba(240,185,11,.05), transparent 60%),
                        radial-gradient(900px 500px at -10% 10%, rgba(14,203,129,.04), transparent 55%);
  background-attachment: fixed; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid rgba(240,185,11,.55); outline-offset: 1px; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.num { font-family: var(--mono); text-align: right; }

/* Toolbar */
#toolbar {
  height: 56px; background: rgba(22,27,34,.85); backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
  position: sticky; top: 0; z-index: 40; box-shadow: var(--sh-1);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16.5px; color: var(--text); letter-spacing: .02em; }
.brand em { font-style: normal; margin-left: 2px;
  background: linear-gradient(120deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#main-menu { display: flex; gap: 3px; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
#main-menu a {
  padding: 6px 13px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 12.5px;
  transition: all .15s ease;
}
#main-menu a:hover { color: var(--text); text-decoration: none; background: var(--panel-2); }
#main-menu a.active { color: #0b0e11; background: linear-gradient(135deg, var(--gold-2), var(--gold)); box-shadow: 0 2px 10px rgba(240,185,11,.35); }

.tb-balance {
  font-family: var(--mono); font-weight: 700; font-size: 12.5px;
  padding: 5px 12px; border-radius: 8px; background: var(--up-soft); color: var(--up);
  border: 1px solid rgba(14,203,129,.3); box-shadow: inset 0 1px 0 rgba(14,203,129,.1);
}
.tb-btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all .15s ease;
}
.tb-btn:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }
.conn { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--up); }
.conn .dot, .sb-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); display: inline-block; }
.clock { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.clock b { color: var(--text); }

/* Main container */
#app-main { min-height: calc(100vh - 80px); padding: 12px; }

/* Panels & Cards */
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.015), transparent 40px), var(--panel);
  border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--sh-1), var(--edge-hi);
}
.panel-head {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(255,255,255,.012);
}
.panel-head h2 { margin: 0; font-size: 13.5px; font-weight: 700; letter-spacing: .01em; }
.panel-body { padding: 16px; }

/* Buttons */
.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border-lite);
  padding: 7px 15px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12.5px;
  transition: all .15s ease; box-shadow: var(--edge-hi);
}
.btn:hover { border-color: var(--muted); background: var(--panel-3); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #0b0e11; border-color: transparent;
  box-shadow: 0 3px 12px rgba(240,185,11,.28); }
.btn.gold:hover { filter: brightness(1.07); box-shadow: 0 4px 16px rgba(240,185,11,.4); }
.btn.green { background: linear-gradient(135deg, #12d98e, var(--up)); color: #0b0e11; border-color: transparent;
  box-shadow: 0 3px 12px rgba(14,203,129,.28); }
.btn.green:hover { filter: brightness(1.07); box-shadow: 0 4px 16px rgba(14,203,129,.4); }
.btn.red { background: linear-gradient(135deg, #ff5d73, var(--down)); color: #fff; border-color: transparent;
  box-shadow: 0 3px 12px rgba(246,70,93,.28); }
.btn.red:hover { filter: brightness(1.07); }
.btn.sm { padding: 4px 10px; font-size: 11.5px; border-radius: 6px; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.badge.win, .badge.up { background: var(--up-soft); color: var(--up); border: 1px solid rgba(14,203,129,.25); }
.badge.loss, .badge.down { background: var(--down-soft); color: var(--down); border: 1px solid rgba(246,70,93,.25); }
.badge.gold { background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(240,185,11,.28); }
.badge.muted { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left; color: var(--muted); font-weight: 700; padding: 9px 12px;
  border-bottom: 1px solid var(--border); font-size: 10.5px;
  letter-spacing: .08em; text-transform: uppercase;
}
.tbl th.num { text-align: right; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid rgba(38,45,56,.6); }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover td { background: rgba(240,185,11,.03); }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* Markets Overview */
.hero-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); gap: 14px; margin-bottom: 14px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi {
  position: relative; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--sh-1), var(--edge-hi);
  overflow: hidden; transition: transform .15s ease, border-color .15s ease;
}
.kpi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(240,185,11,.55), transparent); }
.kpi:hover { transform: translateY(-2px); border-color: var(--border-lite); box-shadow: var(--sh-2); }
.kpi .k { font-size: 10.5px; color: var(--muted); margin-bottom: 6px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.kpi .v { font-family: var(--mono); font-size: 19px; font-weight: 800; letter-spacing: -.01em; }

/* Trading Workspace (Binance-style 3-column + bottom) */
.trade-layout {
  display: grid;
  grid-template-columns: 230px minmax(0,1fr) 240px 290px;
  grid-template-rows: auto 460px 240px;
  gap: 8px;
}
.pair-bar {
  grid-column: 1 / -1; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 10px 16px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  box-shadow: var(--sh-1), var(--edge-hi);
}
.pair-bar .sym-title { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px; letter-spacing: .01em; }
.pair-bar .px-main { font-family: var(--mono); font-size: 19px; font-weight: 800; }
.pair-bar .stat { display: flex; flex-direction: column; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.pair-bar .stat span { color: var(--muted); }
.pair-bar .stat b { font-family: var(--mono); font-size: 12.5px; margin-top: 3px; text-transform: none; letter-spacing: 0; }

.pairs-list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--sh-1), var(--edge-hi); }
.pairs-search { padding: 9px; border-bottom: 1px solid var(--border); }
.pairs-search input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 7px 10px; font-size: 12px; transition: border-color .15s;
}
.pairs-search input:focus { border-color: var(--gold); outline: none; }
.pairs-scroll { overflow-y: auto; flex: 1; }
.pair-row {
  display: flex; justify-content: space-between; align-items: center; padding: 7px 11px;
  cursor: pointer; border-bottom: 1px solid rgba(38,45,56,.4); font-size: 12px;
  border-left: 2px solid transparent; transition: all .12s;
}
.pair-row:hover { background: var(--panel-2); }
.pair-row.active { background: var(--gold-soft); border-left-color: var(--gold); }

.chart-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--sh-1), var(--edge-hi); }
.chart-tb {
  padding: 7px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.tf-btns { display: flex; gap: 3px; background: var(--bg); padding: 3px; border-radius: 7px; }
.tf-btns button {
  background: transparent; border: none; color: var(--muted); padding: 4px 9px;
  border-radius: 5px; cursor: pointer; font-size: 11.5px; font-weight: 700; transition: all .12s;
}
.tf-btns button.active { background: var(--panel-3); color: var(--gold); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
#chart-container { flex: 1; min-height: 0; }

.ob-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--sh-1), var(--edge-hi); }
.ob-head { padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 12px; display: flex; justify-content: space-between; }
.ob-list { flex: 1; overflow: hidden; font-family: var(--mono); font-size: 11.5px; padding: 4px 0; }
.ob-row {
  display: grid; grid-template-columns: 1fr 1fr; padding: 2px 10px; position: relative;
}
.ob-row .bar { position: absolute; top: 0; bottom: 0; right: 0; opacity: .14; pointer-events: none; }
.ob-row.ask .bar { background: var(--down); }
.ob-row.bid .bar { background: var(--up); }
.ob-mid {
  padding: 6px 10px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 14px; font-weight: 700; text-align: center;
}

.order-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; box-shadow: var(--sh-1), var(--edge-hi); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); padding: 4px; border-radius: 9px; }
.seg button { background: transparent; border: none; color: var(--muted); padding: 8px; border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 12.5px; transition: all .15s; }
.seg button.active.buy { background: linear-gradient(135deg, #12d98e, var(--up)); color: #0b0e11; box-shadow: 0 2px 10px rgba(14,203,129,.35); }
.seg button.active.sell { background: linear-gradient(135deg, #ff5d73, var(--down)); color: #fff; box-shadow: 0 2px 10px rgba(246,70,93,.35); }
.seg button.active.gold { background: var(--panel-3); color: var(--gold); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 10.5px; color: var(--muted); display: flex; justify-content: space-between; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.field input, .field select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-family: var(--mono); font-size: 13px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(240,185,11,.12); }
.pct-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pct-row button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 4px; padding: 4px; font-size: 11px; cursor: pointer; font-weight: 600;
}
.pct-row button:hover { border-color: var(--gold); color: var(--gold); }

.bottom-box {
  grid-column: 1 / -1; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--sh-1), var(--edge-hi);
}
.tabs-bar { display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--border); }
.tabs-bar button {
  background: transparent; border: none; color: var(--muted); padding: 7px 13px;
  cursor: pointer; font-weight: 700; font-size: 12px; border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent; letter-spacing: .03em; transition: all .12s;
}
.tabs-bar button:hover { color: var(--text); }
.tabs-bar button.active { color: var(--gold); border-bottom-color: var(--gold); }
.bottom-scroll { flex: 1; overflow: auto; }

/* AI Trading */
.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px,100%), 1fr)); gap: 12px; margin-bottom: 14px; }
.ai-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.ai-card h3 { margin: 0; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }

/* Multi-Wallet */
.wallets-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.wallet-card {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, var(--panel-2), var(--panel) 60%);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--sh-1), var(--edge-hi); transition: transform .15s ease, box-shadow .15s ease;
}
.wallet-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--border-lite); }
.wallet-card::after { content: ''; position: absolute; top: -40%; right: -15%; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(240,185,11,.09), transparent 70%); pointer-events: none; }
.wallet-card .w-title { font-size: 10.5px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.wallet-card .w-val { font-family: var(--mono); font-size: 21px; font-weight: 800; margin: 7px 0; letter-spacing: -.01em; }
.asset-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; min-height: 22px; }
.asset-chip { background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(240,185,11,.3); padding: 2px 8px; border-radius: 10px; font-size: 10.5px; font-weight: 700; font-family: var(--mono); }
.iban-box { background: linear-gradient(135deg, #1a2230, #151a22 70%); border: 1px solid var(--border-lite); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--sh-1), var(--edge-hi); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 7px 12px; font-size: 12.5px; }
.kv .k { color: var(--muted); font-weight: 600; }
.kv .v { font-family: var(--mono); word-break: break-all; }

/* Auth Gate & Modal */
#auth-gate, #modal {
  position: fixed; inset: 0; background: rgba(9,12,16,.82); backdrop-filter: blur(10px) saturate(1.2);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.auth-card, .modal-card {
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 80px), var(--panel);
  border: 1px solid var(--border-lite);
  border-radius: 16px; padding: 26px; box-shadow: var(--sh-3), var(--edge-hi);
  max-height: calc(100dvh - 32px); overflow-y: auto;
  animation: modalIn .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: .02em; }
.auth-brand em { font-style: normal;
  background: linear-gradient(120deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.auth-quick {
  width: 100%; padding: 11px; border-radius: 9px; border: 1px solid rgba(240,185,11,.4);
  background: var(--gold-soft); color: var(--gold); font-weight: 700; cursor: pointer; margin-bottom: 12px;
  transition: all .15s;
}
.auth-quick:hover { background: rgba(240,185,11,.2); box-shadow: 0 0 18px rgba(240,185,11,.2); }
.auth-or { text-align: center; color: var(--muted); font-size: 11px; margin-bottom: 12px; letter-spacing: .1em; text-transform: uppercase; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; background: var(--bg); padding: 4px; border-radius: 9px; }
.auth-tabs button {
  padding: 9px; background: transparent; border: none; color: var(--muted);
  border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 12.5px; transition: all .15s;
}
.auth-tabs button.active { background: var(--panel-3); color: var(--gold); box-shadow: 0 1px 5px rgba(0,0,0,.4); }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-submit {
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #0b0e11; border: none; border-radius: 9px;
  padding: 11px; font-weight: 800; font-size: 13.5px; cursor: pointer; margin-top: 4px; letter-spacing: .03em;
  box-shadow: 0 4px 16px rgba(240,185,11,.3); transition: all .15s;
}
.auth-submit:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 22px rgba(240,185,11,.45); }
.auth-err { background: var(--down-soft); color: var(--down); border: 1px solid rgba(246,70,93,.3); padding: 9px 11px; border-radius: 8px; font-size: 12px; }
.auth-hint { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 6px; }

/* Status bar & ticker */
#status-bar {
  height: 30px; background: var(--panel); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
  font-size: 11px; gap: 14px;
}
.sb-left { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
#ticker-wrap { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
#ticker-track { display: inline-flex; gap: 22px; animation: tick 45s linear infinite; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Toasts */
#toasts { position: fixed; right: 16px; bottom: 42px; display: flex; flex-direction: column; gap: 9px; z-index: 200; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border-lite); border-left: 3px solid var(--gold);
  padding: 11px 16px; border-radius: 10px; font-size: 12.5px; font-weight: 600; box-shadow: var(--sh-2);
  transition: opacity .25s, transform .25s; animation: toastIn .25s cubic-bezier(.2,.9,.3,1.15);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.toast.success { border-left-color: var(--up); box-shadow: var(--sh-2), 0 0 16px rgba(14,203,129,.12); }
.toast.error { border-left-color: var(--down); box-shadow: var(--sh-2), 0 0 16px rgba(246,70,93,.12); }
.toast.out { opacity: 0; transform: translateX(24px); }

/* QR & Crypto Deposit */
.qr-box { text-align: center; padding: 12px; background: #fff; border-radius: 8px; width: 176px; margin: 10px auto; }
.qr-box img { display: block; width: 152px; height: 152px; margin: 0 auto; }

/* NAGA-style Markets sidebar */
.markets-layout { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 14px; align-items: start; }
.mk-side { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; position: sticky; top: 68px; box-shadow: var(--sh-1), var(--edge-hi); }
.mk-side-title { padding: 14px 16px; font-weight: 800; font-size: 13px; border-bottom: 1px solid var(--border); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mk-menu { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.mk-cat {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 11px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px;
  border-radius: 8px; transition: all .13s;
}
.mk-cat:hover { background: var(--panel-2); color: var(--text); }
.mk-cat.active { background: var(--gold-soft); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(240,185,11,.3); }
.mk-count { font-size: 10px; font-weight: 800; background: var(--panel-3); padding: 2px 7px; border-radius: 8px; font-family: var(--mono); }
.mk-cat.active .mk-count { background: rgba(240,185,11,.2); color: var(--gold); }

/* Asset-class chips inside pair pickers */
.pair-cats { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border); }
.pair-cats button {
  background: var(--bg); border: 1px solid var(--border); color: var(--muted);
  padding: 3px 8px; border-radius: 10px; font-size: 10.5px; font-weight: 700; cursor: pointer;
}
.pair-cats button.active { background: var(--gold-soft); border-color: rgba(240,185,11,.4); color: var(--gold); }

@media (max-width: 1100px) {
  .trade-layout { grid-template-columns: 1fr; grid-template-rows: auto; }
  #chart-container { height: 340px; }
  .wallets-grid, .kpi-row, .hero-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .wallets-grid, .kpi-row, .hero-grid { grid-template-columns: 1fr; }
  #main-menu { overflow-x: auto; }
}

/* ============ AI NEURAL ENGINE ============ */
.ai-hero { position: relative; overflow: hidden; background: radial-gradient(ellipse at 20% 50%, #14251d 0%, var(--panel) 60%); border-color: rgba(14,203,129,.25); }
#ai-neural { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.ai-hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 170px 1fr 220px; gap: 24px; align-items: center; padding: 22px 24px; }

.ai-core-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ai-orb { position: relative; width: 120px; height: 120px; }
.ai-orb.sm { width: 52px; height: 52px; }
.ai-orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; }
.ai-orb .ring.r1 { border-top-color: var(--up); border-right-color: rgba(14,203,129,.4); animation: orbSpin 3.2s linear infinite; }
.ai-orb .ring.r2 { inset: 10px; border-top-color: var(--gold); border-left-color: rgba(240,185,11,.35); animation: orbSpin 5.5s linear infinite reverse; }
.ai-orb .ring.r3 { inset: 20px; border-bottom-color: rgba(14,203,129,.6); animation: orbSpin 8s linear infinite; }
.ai-orb .orb-core { position: absolute; inset: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #57ffb0, var(--up) 45%, #064f31 100%);
  box-shadow: 0 0 24px rgba(14,203,129,.7), 0 0 60px rgba(14,203,129,.3), inset 0 0 14px rgba(0,0,0,.5); animation: orbPulse 2.4s ease-in-out infinite; }
.ai-orb.sm .orb-core { inset: 16px; }
@keyframes orbSpin { to { transform: rotate(360deg); } }
@keyframes orbPulse { 0%,100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.08); filter: brightness(1.35); } }
.ai-status { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; color: var(--up); display: flex; align-items: center; gap: 6px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 8px var(--up); animation: dotPulse 1.4s ease-in-out infinite; }
@keyframes dotPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }

.ai-title { font-size: 19px; font-weight: 800; letter-spacing: .06em; }
.ai-title span { color: var(--up); }
.ai-ver { font-size: 10px; font-weight: 600; font-family: var(--mono); color: var(--gold); border: 1px solid var(--gold-soft); background: var(--gold-soft); padding: 2px 7px; border-radius: 10px; margin-left: 8px; letter-spacing: 0; }
.ai-pnl { font-family: var(--mono); font-size: 34px; font-weight: 800; line-height: 1.1; text-shadow: 0 0 30px rgba(14,203,129,.25); }
.ai-pnl-lbl { font-size: 10px; letter-spacing: .18em; color: var(--muted); margin-bottom: 10px; }
.ai-stat-row { display: flex; gap: 18px; flex-wrap: wrap; }
.ai-stat { display: flex; flex-direction: column; }
.ai-stat b { font-family: var(--mono); font-size: 15px; }
.ai-stat span { font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

.ai-hero-scan { align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 8px; border-left: 1px solid var(--border); padding-left: 22px; }
.scan-label { font-size: 10px; letter-spacing: .2em; color: var(--muted); font-family: var(--mono); }
.scan-bar { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.scan-fill { height: 100%; width: 40%; border-radius: 4px; background: linear-gradient(90deg, transparent, var(--up), var(--gold)); animation: scanMove 2.8s ease-in-out infinite; }
@keyframes scanMove { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.scan-note { font-family: var(--mono); font-size: 11px; color: var(--up); }

.ai-mid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,1fr); gap: 12px; margin-bottom: 12px; }

.ai-term-panel { display: flex; flex-direction: column; overflow: hidden; }
.term-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.tdot { width: 10px; height: 10px; border-radius: 50%; }
.tdot.red { background: #ff5f57; } .tdot.yel { background: #febc2e; } .tdot.grn { background: #28c840; }
.term-title { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 8px; }
.ai-term { flex: 1; min-height: 300px; max-height: 340px; overflow-y: auto; padding: 12px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.75;
  background: #0a0f0d; position: relative; }
.ai-term::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(14,203,129,.02) 2px 4px); }
.ai-term .tl { color: #6fdc9f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-term .tl.hl { color: var(--text); }
.ai-term .tt { color: #3d6b52; margin-right: 6px; }
.ai-term b { color: #a9f0c6; }
.ai-term .up { color: var(--up); } .ai-term .down { color: var(--down); }

.ai-deploy { display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; }
.ai-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.ai-card-top { display: flex; gap: 10px; align-items: flex-start; }
.ai-glyph { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 19px; background: linear-gradient(145deg, rgba(14,203,129,.18), rgba(240,185,11,.12)); border: 1px solid rgba(14,203,129,.3); color: var(--up); }
.ai-card-top > div:nth-child(2) { flex: 1; min-width: 0; }
.ai-card-ctl { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 8px; margin-top: 10px; }
.ai-card-ctl select, .ai-card-ctl input { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 7px 9px; font-size: 12px; width: 100%; }

.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px,100%), 1fr)); gap: 12px; }
.bot-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; position: relative; overflow: hidden; }
.bot-card.running { border-color: rgba(14,203,129,.35); }
.bot-card.running::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--up), transparent); }
.bot-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.bot-radar { position: relative; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; background: radial-gradient(circle, rgba(14,203,129,.08) 0%, transparent 70%); border: 1px solid rgba(14,203,129,.3); overflow: hidden; }
.radar-sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(14,203,129,.55), transparent 70deg, transparent); animation: orbSpin 2.6s linear infinite; }
.radar-blip { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px var(--gold); animation: dotPulse 1.8s ease-in-out infinite; }
.radar-blip.b1 { top: 30%; left: 60%; } .radar-blip.b2 { top: 62%; left: 34%; animation-delay: .9s; }
.conf-gauge { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%;
  background: conic-gradient(var(--up) calc(var(--p) * 1%), rgba(255,255,255,.07) 0); display: flex; align-items: center; justify-content: center; }
.cg-inner { width: 34px; height: 34px; border-radius: 50%; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.cg-inner b { font-family: var(--mono); font-size: 10px; color: var(--up); }
.cg-inner span { font-size: 7px; color: var(--muted); letter-spacing: .1em; }
.bot-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.bot-stats > div { display: flex; flex-direction: column; }
.bot-stats span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.bot-stats b { font-family: var(--mono); font-size: 12.5px; }
.bot-wrbar { height: 4px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.bot-wrbar .fill { height: 100%; background: linear-gradient(90deg, var(--up), var(--gold)); border-radius: 3px; transition: width .6s; }
.bot-foot { display: flex; align-items: center; justify-content: space-between; }
.bot-empty { grid-column: 1/-1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 30px; color: var(--muted); text-align: center; }

@media (max-width: 1000px) {
  .ai-hero-inner { grid-template-columns: 1fr; text-align: center; }
  .ai-core-wrap { margin: 0 auto; }
  .ai-hero-scan { border-left: 0; padding-left: 0; }
  .ai-mid { grid-template-columns: 1fr; }
  .ai-stat-row { justify-content: center; }
}

/* ============ Global polish ============ */
#app-main > .panel { animation: viewIn .28s ease; }
#app-main > .trade-layout, #app-main > .markets-layout, #app-main > .hero-grid,
#app-main > .kpi-row, #app-main > .ai-hero, #app-main > .ai-mid { animation: viewIn .28s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#app-main { padding: 14px 16px; }
#app-main > * + * { margin-top: 0; }
.panel + .panel, .grid-2 + .panel, .panel + .grid-2 { margin-top: 14px; }

.ob-mid { background: rgba(255,255,255,.015); font-size: 15px; letter-spacing: .01em; }
.ob-row { transition: background .1s; }
.ob-row:hover { background: rgba(255,255,255,.03); }

/* Inputs inside order box + pct buttons */
.pct-row button { border-radius: 6px; transition: all .12s; }
.pct-row button:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }

/* Wallet action buttons row */
.wallet-card .btn { margin-right: 4px; }

/* Rounded remaining 8px surfaces */
.ai-card, .pairs-list .pair-cats button { border-radius: 8px; }

/* Slightly tighten trade grid gutters */
.trade-layout { gap: 10px; }

/* Language flags */
.lang-toggle { display: inline-flex; gap: 3px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.lang-flag { background: transparent; border: 1px solid transparent; padding: 3px 6px; border-radius: 6px; cursor: pointer; opacity: .5; transition: all .15s; display: inline-flex; align-items: center; }
.lang-flag:hover { opacity: .9; }
.lang-flag.on { opacity: 1; background: var(--gold-soft); border-color: rgba(240,185,11,.35); }

/* ===== Profile & KYC ===== */
.prof-hero { display: flex; align-items: center; gap: 20px; padding: 22px 24px; flex-wrap: wrap; }
.prof-avatar {
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #0d1117;
  background: linear-gradient(135deg, var(--gold), #ffdf8e);
  box-shadow: 0 0 0 3px rgba(240,185,11,.18), 0 8px 24px rgba(240,185,11,.22);
}
.prof-id { flex: 1; min-width: 220px; }
.prof-id h2 { margin: 0 0 6px; font-size: 21px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prof-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.prof-meta span::before { content: '·'; margin-right: 8px; color: var(--gold); }
.prof-meta span:first-child::before { content: ''; margin: 0; }
.prof-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.prof-stats > div { display: flex; flex-direction: column; gap: 3px; }
.prof-stats span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.prof-stats b { font-size: 17px; font-family: var(--mono); }
.prof-cols { display: grid; grid-template-columns: 1.25fr .95fr; gap: 14px; align-items: start; }
.prof-cols > div { display: flex; flex-direction: column; gap: 14px; }

.kyc-banner {
  display: flex; gap: 14px; align-items: flex-start; padding: 15px 18px;
  border-radius: 12px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel)); margin-top: 14px;
}
.kyc-banner-ico { font-size: 22px; line-height: 1; margin-top: 2px; }
.kyc-banner b { font-size: 14px; }
.kyc-banner p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.kyc-banner.pending { border-color: rgba(240,185,11,.45); background: linear-gradient(180deg, rgba(240,185,11,.10), var(--panel)); }
.kyc-banner.ok { border-color: rgba(46,189,133,.45); background: linear-gradient(180deg, rgba(46,189,133,.10), var(--panel)); }
.kyc-banner.rejected { border-color: rgba(246,70,93,.45); background: linear-gradient(180deg, rgba(246,70,93,.10), var(--panel)); }

.kyc-steps { display: flex; align-items: center; gap: 8px; padding: 20px 18px; }
.kyc-step { display: flex; align-items: center; gap: 10px; }
.kyc-dot {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; border: 2px solid var(--border); color: var(--muted);
  background: var(--panel2); transition: .2s;
}
.kyc-step.done .kyc-dot { border-color: var(--up); color: var(--up); background: rgba(46,189,133,.12); }
.kyc-step.active .kyc-dot { border-color: var(--gold); color: var(--gold); background: rgba(240,185,11,.12); box-shadow: 0 0 12px rgba(240,185,11,.25); }
.kyc-step-lbl { display: flex; flex-direction: column; }
.kyc-step-lbl b { font-size: 11.5px; }
.kyc-step-lbl span { font-size: 10.5px; color: var(--muted); }
.kyc-link { flex: 1; height: 2px; background: var(--border); min-width: 24px; }
.kyc-link.done { background: var(--up); }

.kyc-form { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.fr2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kyc-done-grid { padding: 10px 18px 16px; display: flex; flex-direction: column; }
.kyc-done-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.kyc-done-row:last-child { border-bottom: 0; }
.kyc-done-row span { color: var(--muted); }
.kyc-done-row b { text-align: right; font-weight: 600; }

.kyc-feat { padding: 8px 18px 14px; display: flex; flex-direction: column; }
.kyc-feat-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.kyc-feat-row:last-child { border-bottom: 0; }
.kyc-feat-row span:first-child { width: 16px; text-align: center; }
.kyc-feat-row.on { color: var(--text); }
.kyc-feat-row.on span:first-child { color: var(--up); font-weight: 700; }
.kyc-feat-row em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--muted); }
.kyc-feat-row.on em { color: var(--up); }

@media (max-width: 920px) {
  .prof-cols { grid-template-columns: 1fr; }
  .prof-hero { flex-direction: column; align-items: flex-start; }
  .prof-stats { gap: 18px; }
  .fr2 { grid-template-columns: 1fr; }
  .kyc-steps { flex-direction: column; align-items: flex-start; gap: 14px; }
  .kyc-link { display: none; }
}

/* ===== Account Packages ===== */
.pkg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 16px 18px 18px; }
.pkg-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 18px; border-radius: 14px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.pkg-card:hover { transform: translateY(-3px); border-color: var(--pkg); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.pkg-card.is-active { border-color: var(--pkg); box-shadow: 0 0 0 1px var(--pkg), 0 10px 30px rgba(0,0,0,.3); }
.pkg-card.gold.is-active, .pkg-card.gold:hover { box-shadow: 0 0 24px rgba(240,185,11,.18), 0 10px 30px rgba(0,0,0,.3); }
.pkg-ribbon {
  position: absolute; top: 12px; right: 12px; padding: 3px 10px; border-radius: 20px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .1em;
  background: var(--up); color: #0d1117;
}
.pkg-ribbon.pending { background: var(--gold); }
.pkg-head h3 { margin: 0; font-size: 10px; font-weight: 600; letter-spacing: .18em; color: var(--muted); }
.pkg-name { font-size: 24px; font-weight: 800; letter-spacing: .02em; color: var(--pkg); text-transform: uppercase; }
.pkg-cap { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--border); }
.pkg-cap span { font-size: 11px; color: var(--muted); }
.pkg-cap b { font-size: 18px; font-family: var(--mono); color: var(--pkg); }
.pkg-tag { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); min-height: 55px; }
.pkg-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pkg-nums > div { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.2); }
.pkg-nums span { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pkg-nums b { font-size: 15px; font-family: var(--mono); }
.pkg-nums b.up { color: var(--up); }
.pkg-feats { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.pkg-feats li { position: relative; padding-left: 20px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.pkg-feats li::before { content: '✓'; position: absolute; left: 0; color: var(--pkg); font-weight: 700; }
.pkg-foot { padding-top: 4px; }
.pkg-foot .btn { width: 100%; }
.pkg-state { display: block; text-align: center; padding: 8px; border-radius: 8px; font-size: 12.5px; font-weight: 700; }
.pkg-state.active { color: var(--up); background: rgba(46,189,133,.1); border: 1px solid rgba(46,189,133,.3); }
.pkg-state.pending { color: var(--gold); background: rgba(240,185,11,.1); border: 1px solid rgba(240,185,11,.3); }
@media (max-width: 1100px) { .pkg-grid { grid-template-columns: 1fr; } }
.kyc-cta { margin-left: auto; flex-shrink: 0; align-self: center; }

/* ===== KYC modal & doc upload ===== */
.kyc-mform { display: flex; flex-direction: column; gap: 12px; }
.kyc-start-in { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 24px; text-align: center; }
.kyc-start-ico { font-size: 34px; }
.kyc-start-in b { font-size: 15.5px; }
.kyc-start-in p { margin: 0 0 6px; font-size: 12.5px; line-height: 1.55; max-width: 340px; }
.kyc-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 20px 14px; border: 1.5px dashed var(--border-lite); border-radius: 10px; cursor: pointer;
  background: rgba(0,0,0,.18); transition: .18s; text-align: center; }
.kyc-drop:hover { border-color: var(--gold); background: rgba(240,185,11,.05); }
.kyc-drop.has-file { border-style: solid; border-color: var(--up); }
.kyc-drop-ico { font-size: 24px; }
.kyc-drop-txt { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.kyc-prev { max-width: 100%; max-height: 140px; border-radius: 8px; border: 1px solid var(--border); }

/* ===== Arbitrage Engine ===== */
.arb-locked { display: flex; justify-content: center; padding-top: 40px; }
.arb-lock-card { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  max-width: 560px; padding: 44px 40px; border-radius: 18px; border: 1px solid rgba(240,185,11,.3);
  background: radial-gradient(420px 200px at 50% 0%, rgba(240,185,11,.09), transparent 70%), var(--panel);
  box-shadow: 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.05); }
.arb-lock-ico { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(240,185,11,.1); border: 1px solid rgba(240,185,11,.35); box-shadow: 0 0 30px rgba(240,185,11,.15); }
.arb-lock-card h2 { margin: 4px 0 0; font-size: 24px; }
.arb-lock-feats { display: flex; gap: 30px; margin: 8px 0 10px; }
.arb-lock-feats > div { display: flex; flex-direction: column; gap: 2px; }
.arb-lock-feats b { font-family: var(--mono); font-size: 19px; color: var(--gold); }
.arb-lock-feats span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

.arb-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.arb-live { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .14em; color: var(--up); padding: 4px 10px; border-radius: 14px;
  background: rgba(14,203,129,.1); border: 1px solid rgba(14,203,129,.3); }

.arb-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.15fr); gap: 14px; align-items: start; margin-top: 14px; }
.arb-ctl { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.arb-scanbar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.06); overflow: hidden; position: relative; }
.arb-scanfill { position: absolute; inset: 0; width: 30%; border-radius: 4px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: arbscan 2.2s ease-in-out infinite; }
@keyframes arbscan { 0% { left: -30%; } 100% { left: 100%; } }

.opp-sel { background: rgba(240,185,11,.07); }
.opp-exec { animation: oppflash 1.4s ease; }
@keyframes oppflash { 0% { background: rgba(14,203,129,.35); } 100% { background: transparent; } }
tr[data-sel] { cursor: pointer; }
tr[data-sel]:hover { background: rgba(240,185,11,.06); }

.arb-mx-head { display: flex; justify-content: space-between; align-items: baseline; padding: 13px 16px 10px; border-bottom: 1px solid var(--border); }
.arb-mx-head b { font-size: 14px; }
.arb-mx-head span { font-size: 10.5px; }
.arb-mx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 14px; max-height: 420px; overflow-y: auto; }
.arb-ex { padding: 9px 10px; border-radius: 9px; border: 1px solid var(--border); background: rgba(0,0,0,.18);
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; transition: border-color .2s; }
.ex-n { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.ex-p { grid-column: 1 / -1; font-size: 13px; font-weight: 700; }
.ex-d { font-size: 10px; }
.ex-l { font-size: 9px; color: var(--muted); text-align: right; }
.arb-ex.ex-lo { border-color: rgba(14,203,129,.6); background: rgba(14,203,129,.08); box-shadow: 0 0 14px rgba(14,203,129,.12); }
.arb-ex.ex-lo .ex-n::after { content: ' BUY'; color: var(--up); font-size: 8.5px; }
.arb-ex.ex-hi { border-color: rgba(246,70,93,.6); background: rgba(246,70,93,.08); box-shadow: 0 0 14px rgba(246,70,93,.12); }
.arb-ex.ex-hi .ex-n::after { content: ' SELL'; color: var(--down); font-size: 8.5px; }
.mono { font-family: var(--mono); }

@media (max-width: 1100px) {
  .arb-layout { grid-template-columns: 1fr; }
  .arb-mx-grid { grid-template-columns: repeat(2, 1fr); }
}

.arb-kpis { grid-template-columns: repeat(5, 1fr); gap: 10px; }
.arb-kpis .kpi { padding: 10px 13px; border-radius: 10px; }
.arb-kpis .kpi .k { font-size: 9px; margin-bottom: 4px; }
.arb-kpis .kpi .v { font-size: 16px; }
@media (max-width: 1100px) { .arb-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .arb-kpis { grid-template-columns: repeat(2, 1fr); } }
.arb-cap-note { font-size: 11.5px; font-weight: 600; padding: 7px 10px; border-radius: 8px; background: rgba(0,0,0,.2); border: 1px solid var(--border); text-align: center; }

/* arbitrage capital lock */
.arb-lockbox { border: 1px solid rgba(240,185,11,.35); border-radius: 12px; padding: 14px 16px;
  background: linear-gradient(160deg, rgba(240,185,11,.08), transparent 60%), var(--panel-2); }
.arb-lockrow { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 12.5px; }
.arb-lockrow span { color: var(--muted); }
.arb-lockrow b { font-family: var(--mono); font-size: 13px; }
.arb-lockprog { height: 6px; border-radius: 6px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 10px; }
#arb-lockfill { height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, var(--gold-2), var(--gold)); transition: width .6s ease; }

/* staking */
.stk-apy { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--up); }
.stk-apy.hot { color: var(--gold); }
.stk-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  background: linear-gradient(160deg, rgba(14,203,129,.05), transparent 55%), var(--panel-2);
  display: flex; flex-direction: column; gap: 8px; }
.stk-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.stk-card-mid { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; flex-wrap: wrap; }
.stk-prog { height: 5px; border-radius: 5px; background: rgba(255,255,255,.07); overflow: hidden; }
.stk-prog > div { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--up), #34d399); transition: width .6s ease; }
.stk-card-act { display: flex; justify-content: flex-end; }

/* swap / convert */
.sw-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); gap: 14px; align-items: start; }
.sw-card { border-color: rgba(240,185,11,.3); }
.sw-row { display: flex; gap: 14px; align-items: flex-end; }
.sw-side { flex: 0 0 150px; }
.sw-side label, .sw-amt label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.sw-amt { flex: 1; }
.sw-sel { width: 100%; }
.sw-flip { display: flex; justify-content: center; margin: 10px 0; }
.sw-flip .btn { border-radius: 50%; width: 38px; height: 38px; font-size: 16px; padding: 0; }
.sw-recv { padding: 10px 12px; border: 1px dashed var(--border-lite); border-radius: 9px;
  font-family: var(--mono); font-size: 15px; background: var(--panel-2); min-height: 42px;
  display: flex; align-items: center; }
.sw-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11.5px;
  margin: 12px 0; padding: 9px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.sw-prog { height: 5px; border-radius: 5px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 10px; }
.sw-prog > div, #sw-progfill, #ss-progfill { height: 100%; width: 0%; border-radius: 5px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold)); transition: width .2s linear; }
@media (max-width: 900px) { .sw-layout, .arb-layout { grid-template-columns: 1fr; } }

/* self-custody recovery phrase */
.phrase-box { margin-top: 12px; padding: 12px; border-radius: 10px;
  border: 1px dashed rgba(240,185,11,.35); background: rgba(0,0,0,.25); }
.phrase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.phr-w { font-family: var(--mono); font-size: 12px; padding: 6px 8px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--border); display: flex; gap: 7px; align-items: baseline; }
.phr-w i { font-style: normal; font-size: 9.5px; color: var(--muted); }
.phr-masked { color: var(--muted); letter-spacing: .15em; justify-content: center; }

/* ==================== MOBILE RESPONSIVE ==================== */
.menu-toggle { display: none; font-size: 16px; line-height: 1; padding: 7px 11px; }

@media (max-width: 1024px) {
  #toolbar { height: auto; flex-wrap: wrap; padding: 8px 12px; row-gap: 8px; position: sticky; }
  .tb-left { flex-wrap: nowrap; gap: 10px; flex: 1; min-width: 0; }
  .tb-right { gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  #main-menu { order: 3; flex: 1 1 100%; display: none; flex-direction: column; gap: 3px; }
  #toolbar.menu-open #main-menu { display: flex; }
  #main-menu a { white-space: normal; padding: 11px 14px; font-size: 13.5px; }
  .clock { display: none; }
  .markets-layout { grid-template-columns: 1fr; }
  .mk-side { position: static; }
  .mk-side .mk-menu { display: flex; overflow-x: auto; scrollbar-width: none; }
  .mk-side .mk-menu::-webkit-scrollbar { display: none; }
  .mk-side .mk-cat { white-space: nowrap; flex-shrink: 0; }
  .hero-grid { grid-template-columns: 1fr; }
  .fr2 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  #app-main { padding: 8px; }
  .view-wrap { padding: 4px 0 40px; }
  #tb-user { display: none; }
  .conn { display: none; }
  .tb-right { gap: 6px; }
  .tb-left { flex: 0 0 auto; }
  .tb-btn { padding: 6px 9px; }
  .lang-toggle { margin-right: 0; }
  .brand span { font-size: 14.5px; }
  .wallets-grid, .kpi-row, .hero-grid { grid-template-columns: 1fr 1fr; }
  .kpi .v { font-size: 16px; }
  .phrase-grid { grid-template-columns: repeat(2, 1fr); }
  .sw-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .sw-side { flex: 1; }
  .sw-flip { margin: 4px 0; }
  .panel-head { flex-wrap: wrap; gap: 6px; }
  .arb-mx-grid { grid-template-columns: repeat(2, 1fr); }
  .arb-lock-feats { gap: 18px; flex-wrap: wrap; }
  .stk-card-top, .stk-card-mid { flex-direction: column; align-items: flex-start; gap: 4px; }
  .prof-stats { flex-wrap: wrap; gap: 14px; }
  .modal-card { padding: 18px; }
  #toasts { left: 12px; right: 12px; bottom: 16px; }
  .toast { width: 100%; }
  .kyc-mform .fr2, .kyc-mgrid { grid-template-columns: 1fr; }
  .tbl { font-size: 11.5px; }
  .tbl th, .tbl td { padding: 7px 9px; white-space: nowrap; }
  .btn { padding: 8px 12px; }
  .seg button { padding: 10px; font-size: 12px; }
  #chart-container { height: 300px; }
  .auth-card { padding: 20px; }
  .ai-hero-inner { padding: 18px; }
  .pkg-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .wallets-grid, .kpi-row { grid-template-columns: 1fr; }
  .arb-kpis { grid-template-columns: repeat(2, 1fr); }
  .arb-mx-grid { grid-template-columns: 1fr; }
  #main-menu a { padding: 7px 11px; font-size: 12px; }
  .tb-balance { font-size: 11px; padding: 4px 8px; }
  .phr-w { font-size: 11px; }
  .kpi-row { gap: 8px; }
  .iban-box .kv { grid-template-columns: 90px 1fr; font-size: 12px; }
  h2 { font-size: 15px; }
  .arb-top h2 { font-size: 17px; flex-wrap: wrap; }
}

@media (max-width: 720px) {
  #status-bar { padding: 0 10px; gap: 8px; }
  .sb-left { gap: 8px; }
  .sb-left .sb-item:nth-child(2), #sb-updated { display: none; }
}
@media (max-width: 480px) {
  .sb-left .sb-item:nth-child(1) { display: none; }
  .sb-right .sb-item { font-size: 10px; }
}

/* grid children must not force tracks wider than viewport */
.panel, .markets-layout > *, .trade-layout > *, .hero-grid > *, .ai-mid > *,
.arb-layout > *, .sw-layout > *, .wallets-grid > *, .kpi-row > * { min-width: 0; }

/* ---------- pro terminal polish (spot & futures) ---------- */
.pair-bar { padding: 12px 18px; gap: 28px; }
.pair-bar .sym-title { font-size: 19px; }
.pair-bar .px-main { font-size: 22px; }
.pair-bar .stat b { font-size: 13px; }

.ob-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ob-cols {
  display: grid; grid-template-columns: 1.1fr 1fr .9fr; padding: 4px 10px;
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 700;
}
.ob-cols span:nth-child(n+2), .ob-row span:nth-child(n+2) { text-align: right; }
.ob-row { grid-template-columns: 1.1fr 1fr .9fr; padding: 2.5px 10px; }
.ob-row .num { color: var(--muted); font-size: 11px; }
.ob-mid { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 10px; }
.ob-mid .spread { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }

.order-box .kv { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted); }
.order-box .kv b { color: var(--text); font-family: var(--mono); font-weight: 700; font-size: 12.5px; }
.order-box .btn-submit { padding: 12px; font-size: 14px; font-weight: 800; letter-spacing: .02em; border-radius: 10px; }
.lev-quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.lev-quick button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 4px 0; font-size: 10.5px; font-weight: 700; cursor: pointer; transition: all .12s;
}
.lev-quick button:hover { border-color: var(--gold); color: var(--gold); }
.lev-quick button.active { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }

.bottom-box .tbl thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.bottom-box .tbl tbody tr { transition: background .1s; }
.bottom-box .tbl tbody tr:hover { background: rgba(255,255,255,.025); }
.empty-state { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- support chat widget (client & broker) ---------- */
#sup-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 900;
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #f0b90b, #d19a00); color: #0b0e11;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(240,185,11,.35), 0 4px 12px rgba(0,0,0,.4);
  transition: transform .15s, box-shadow .15s;
}
#sup-fab:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(240,185,11,.45), 0 6px 14px rgba(0,0,0,.4); }
#sup-fab.hidden { display: none; }
#sup-dot {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  background: #f6465d; color: #fff; border-radius: 9px; font-size: 10.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid #0b0e13;
}
#sup-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 901;
  width: 340px; height: 460px; max-height: calc(100vh - 44px);
  background: var(--panel, #161b22); border: 1px solid var(--border, #262d38); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
#sup-panel.hidden { display: none; }
.sup-head {
  padding: 12px 14px; border-bottom: 1px solid var(--border, #262d38);
  font-weight: 800; font-size: 13px; display: flex; align-items: center; gap: 8px;
  background: rgba(240,185,11,.06);
}
.sup-head #sup-close {
  margin-left: auto; background: transparent; border: none; color: var(--muted, #8b93a3);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.sup-head #sup-close:hover { color: var(--text, #e6e9ef); }
.sup-live { width: 8px; height: 8px; border-radius: 50%; background: var(--up, #0ecb81); box-shadow: 0 0 8px var(--up, #0ecb81); animation: supPulse 1.6s infinite; }
@keyframes supPulse { 50% { opacity: .4; } }
.sup-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sup-empty { color: var(--muted, #8b93a3); font-size: 12px; text-align: center; padding: 26px 12px; line-height: 1.6; }
.sup-row { display: flex; }
.sup-row.me { justify-content: flex-end; }
.sup-bubble {
  max-width: 82%; padding: 8px 11px; border-radius: 12px; font-size: 12.5px; line-height: 1.5;
  background: var(--panel-2, #1c222c); color: var(--text, #e6e9ef); border: 1px solid var(--border, #262d38);
  word-break: break-word; white-space: pre-wrap;
}
.sup-row.me .sup-bubble { background: rgba(240,185,11,.14); border-color: rgba(240,185,11,.35); }
.sup-who { display: block; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gold, #f0b90b); margin-bottom: 3px; }
.sup-row.me .sup-who { color: var(--muted, #8b93a3); }
.sup-time { display: block; font-size: 9.5px; color: var(--muted, #8b93a3); margin-top: 4px; text-align: right; font-family: var(--mono, monospace); }
.sup-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border, #262d38); }
.sup-input input {
  flex: 1; background: var(--bg, #0b0e13); border: 1px solid var(--border, #262d38); color: var(--text, #e6e9ef);
  border-radius: 10px; padding: 9px 12px; font-size: 12.5px; outline: none; min-width: 0;
}
.sup-input input:focus { border-color: var(--gold, #f0b90b); }
.sup-input button {
  background: linear-gradient(135deg, #f0b90b, #d19a00); color: #0b0e11; border: none; border-radius: 10px;
  width: 42px; cursor: pointer; font-size: 15px; font-weight: 800;
}

/* ---------- professional deposit flow ---------- */
.dp-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.dp-mcard {
  display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px;
  color: var(--text); transition: border-color .15s, background .15s; font-family: inherit;
}
.dp-mcard:hover { border-color: var(--border-lite); }
.dp-mcard.on { border-color: var(--gold); background: rgba(240,185,11,.08); box-shadow: 0 0 0 1px rgba(240,185,11,.35) inset; }
.dp-mico { font-size: 19px; line-height: 1; }
.dp-mcard b { font-size: 12.5px; display: block; }
.dp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.dp-chips button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 5px 11px; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: all .12s;
}
.dp-chips button:hover { border-color: var(--gold); color: var(--gold); }
.dp-chips button.on { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.dp-bank { background: linear-gradient(135deg, #1a2230, #151a22 70%); border: 1px solid var(--border-lite); border-radius: 12px; overflow: hidden; }
.dp-bank-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: rgba(240,185,11,.05); }
.dp-bank-head b { font-size: 13px; }
.dp-bank-row {
  display: grid; grid-template-columns: 78px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid rgba(38,45,56,.5); font-size: 12.5px;
}
.dp-bank-row:last-child { border-bottom: none; }
.dp-bank-row > span:first-child { color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.dp-bank-row .mono { font-family: var(--mono); word-break: break-all; }
.dp-bank-row.ref { background: rgba(240,185,11,.06); }
.dp-copy {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 4px 10px; font-size: 11px; font-weight: 700; cursor: pointer; transition: all .12s;
}
.dp-copy:hover { border-color: var(--gold); color: var(--gold); }
.dp-steps { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dp-step { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: #b6bdc9; line-height: 1.5; }
.dp-step .n {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; background: rgba(240,185,11,.14);
  color: var(--gold); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.dp-warn { font-size: 11.5px; color: #c9d1d9; background: rgba(246,70,93,.07); border: 1px solid rgba(246,70,93,.3); border-radius: 9px; padding: 9px 12px; line-height: 1.5; }
.dp-err { font-size: 12px; color: #f6465d; background: rgba(246,70,93,.08); border: 1px solid rgba(246,70,93,.35); border-radius: 9px; padding: 8px 12px; margin-top: 10px; }
.dp-refbox { background: rgba(240,185,11,.08); border: 1px solid rgba(240,185,11,.4); border-radius: 12px; padding: 14px; text-align: center; margin-bottom: 12px; }
