/* Codenira — OKX seconds trading terminal (demo) · dark trading style */
:root {
  --bg: #0a0d12;
  --panel: #11161d;
  --panel-2: #161d26;
  --border: #222b36;
  --text: #e8eef4;
  --muted: #8296a9;
  --green: #00c48c;
  --red: #ff5468;
  --blue: #3d9bff;
  --gold: #ffb02e;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; overflow: hidden;
}
.hidden { display: none !important; }
.green { color: var(--green) !important; }
.red { color: var(--red) !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 22px; padding: 0 16px;
  background: linear-gradient(180deg, #121924, #10161f); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; }
.logo-dot {
  width: 26px; height: 26px; border-radius: 8px; position: relative; flex: none;
  background: linear-gradient(135deg, #3d9bff, #00c48c);
}
.logo-dot::after {
  content: 'C'; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: 15px; font-weight: 800; color: #fff;
}
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: .5px; }
.tag-demo {
  font-size: 11px; color: var(--gold); border: 1px solid rgba(255, 176, 46, .45);
  padding: 2px 8px; border-radius: 20px;
}
.brand-sub { color: var(--muted); font-size: 12px; }
.conn-status { display: flex; align-items: center; gap: 7px; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.conn-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #5b6b7b; flex: none; }
.conn-status.ok .dot { background: var(--green); box-shadow: 0 0 8px rgba(0, 196, 140, .9); animation: pulse 2s infinite; }
.conn-status.warn .dot { background: var(--gold); }
.conn-status.bad .dot { background: var(--red); }
.conn-status.connecting .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.wallet { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.bal label { color: var(--muted); font-size: 12px; margin-right: 6px; }
.bal strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.bal .unit { color: var(--muted); font-size: 12px; margin-left: 4px; }

/* ---------- 通用按钮 ---------- */
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px;
}
.btn-ghost:hover { color: var(--text); border-color: #3a4655; }
.btn-primary {
  background: linear-gradient(135deg, #3d9bff, #1f6fe0); border: none; color: #fff;
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}

/* ---------- 布局 ---------- */
.layout {
  display: grid; grid-template-columns: 250px 1fr 332px; gap: 10px; padding: 10px;
  height: calc(100vh - 56px - var(--bnavH));
}
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.panel-head h3 { font-size: 14px; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- 币种列表 ---------- */
.search { padding: 0 12px 8px; }
.search input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none;
}
.search input:focus { border-color: var(--blue); }
.coin-list { overflow-y: auto; flex: 1; padding: 2px 6px 8px; }
.coin-row { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px; cursor: pointer; }
.coin-row:hover { background: var(--panel-2); }
.coin-row.active {
  background: linear-gradient(90deg, rgba(61, 155, 255, .14), transparent);
  box-shadow: inset 2px 0 0 var(--blue);
}
.coin-ava {
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none;
  position: relative; overflow: hidden;
}
.coin-name { flex: 1; min-width: 0; }
.coin-name b { font-size: 13.5px; }
.coin-name span { color: var(--muted); font-size: 11px; margin-left: 2px; }
.coin-price { text-align: right; }
.coin-price .cp { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.coin-price .cc { display: block; font-size: 11px; }

/* ---------- 中间行情区 ---------- */
.center-panel { min-width: 0; }
.symbol-head {
  display: flex; align-items: center; gap: 20px; padding: 14px 16px 8px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.sym-title { display: flex; align-items: center; gap: 10px; }
.sym-avatar {
  width: 38px; height: 38px; border-radius: 10px; color: #fff; font-weight: 800;
  font-size: 17px; display: flex; align-items: center; justify-content: center; flex: none;
  position: relative; overflow: hidden;
}
.coin-ava i, .sym-avatar i, .mini-ava i { font-style: normal; }
.coin-ava img, .sym-avatar img, .mini-ava img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.mini-ava {
  width: 15px; height: 15px; border-radius: 50%; color: #fff; font-weight: 700; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; vertical-align: -3px; margin-right: 4px;
}
.sym-name { font-size: 16px; font-weight: 700; }
.sym-sub { color: var(--muted); font-size: 11.5px; }
.sym-price .big-price { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.big-price.up { color: var(--green); }
.big-price.down { color: var(--red); }
.big-price.flash-up { animation: fUp .45s ease; }
.big-price.flash-down { animation: fDn .45s ease; }
@keyframes fUp { 0% { text-shadow: 0 0 18px rgba(0, 196, 140, .85); } }
@keyframes fDn { 0% { text-shadow: 0 0 18px rgba(255, 84, 104, .85); } }
.big-change { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sym-stats { display: flex; gap: 18px; margin-left: auto; }
.sym-stats label { display: block; color: var(--muted); font-size: 11px; }
.sym-stats span { font-size: 13px; font-variant-numeric: tabular-nums; }

.chart-wrap { flex: 1; position: relative; min-height: 220px; margin: 8px; }
#chart { width: 100%; height: 100%; display: block; }
.chart-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.tf-bar { display: flex; gap: 4px; padding: 8px 14px 0; }
.tf-chip {
  background: transparent; border: none; color: var(--muted); padding: 4px 10px;
  border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.tf-chip:hover { color: var(--text); }
.tf-chip.active { color: var(--blue); background: rgba(61, 155, 255, .12); }
.ohlc-info {
  position: absolute; top: 6px; left: 12px; z-index: 2; color: var(--muted);
  font-size: 11px; font-variant-numeric: tabular-nums; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 96px);
}
.statsbar { display: flex; gap: 28px; padding: 10px 16px 12px; border-top: 1px solid var(--border); }
.statsbar label { color: var(--muted); font-size: 11.5px; display: block; margin-bottom: 2px; }
.statsbar span { font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- 右侧下单区 ---------- */
.right-panel { overflow-y: auto; }
.ticket { padding: 2px 14px 12px; }
.sec-label { color: var(--muted); font-size: 12px; margin: 10px 0 7px; }
.durations { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.dur-chip {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 7px 4px; cursor: pointer; text-align: center;
}
.dur-chip b { display: block; font-size: 13.5px; }
.dur-chip span { color: var(--muted); font-size: 10.5px; }
.dur-chip:hover { border-color: #3a4655; }
.dur-chip.active { border-color: var(--blue); background: rgba(61, 155, 255, .12); }
.dur-chip.active span { color: var(--blue); }

.directions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dir-btn {
  border-radius: 10px; padding: 10px 8px; cursor: pointer; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); text-align: center; font-size: 14.5px; font-weight: 700;
}
.dir-btn .arr { font-size: 12px; margin-right: 4px; }
.dir-btn .dir-sub { font-weight: 400; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.dir-btn.up.active { background: linear-gradient(135deg, rgba(0, 196, 140, .22), rgba(0, 196, 140, .08)); border-color: var(--green); color: var(--green); }
.dir-btn.up.active .dir-sub { color: rgba(0, 196, 140, .8); }
.dir-btn.down.active { background: linear-gradient(135deg, rgba(255, 84, 104, .22), rgba(255, 84, 104, .08)); border-color: var(--red); color: var(--red); }
.dir-btn.down.active .dir-sub { color: rgba(255, 84, 104, .8); }

.amount-row { display: flex; gap: 6px; }
.amount-row button {
  width: 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font-size: 16px; cursor: pointer; flex: none;
}
.amount-row input {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 15px; font-weight: 600; outline: none; text-align: center;
}
.amount-row input:focus { border-color: var(--blue); }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
.quick-amts { display: flex; gap: 6px; margin-top: 7px; }
.quick-amts button {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 7px; padding: 5px 0; font-size: 12px; cursor: pointer;
}
.quick-amts button:hover { color: var(--text); border-color: #3a4655; }

.payout-preview {
  display: flex; gap: 10px; margin-top: 12px; background: var(--panel-2);
  border: 1px dashed var(--border); border-radius: 9px; padding: 9px 10px;
}
.payout-preview > div { flex: 1; min-width: 0; }
.payout-preview label { display: block; color: var(--muted); font-size: 10.5px; margin-bottom: 2px; }
.payout-preview span { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.submit-btn {
  width: 100%; margin-top: 12px; padding: 12px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 800; color: #fff; cursor: pointer; transition: transform .06s;
}
.submit-btn.up { background: linear-gradient(135deg, #00c48c, #00996e); box-shadow: 0 6px 18px rgba(0, 196, 140, .25); }
.submit-btn.down { background: linear-gradient(135deg, #ff5468, #d63a4d); box-shadow: 0 6px 18px rgba(255, 84, 104, .25); }
.submit-btn:active { transform: scale(.985); }
.risk-note { margin-top: 9px; color: var(--muted); font-size: 10.5px; text-align: center; }

/* ---------- 持仓 / 历史 ---------- */
.positions { border-top: 1px solid var(--border); }
.tabs { display: flex; }
.tab {
  flex: 1; background: transparent; border: none; color: var(--muted); padding: 10px;
  font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--blue); }
.order-list { padding: 8px 10px 12px; max-height: 340px; overflow-y: auto; }
.empty { color: var(--muted); text-align: center; padding: 22px 0; font-size: 12.5px; }

.order-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px;
  background: var(--panel-2);
}
.oc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.oc-dir { font-weight: 700; font-size: 12.5px; }
.order-card.up .oc-dir { color: var(--green); }
.order-card.down .oc-dir { color: var(--red); }
.oc-sym { color: var(--text); font-size: 12.5px; font-weight: 600; }
.oc-cd { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; color: var(--gold); }
.oc-mid { display: flex; gap: 10px; }
.oc-mid > div { flex: 1; min-width: 0; }
.oc-mid label { display: block; color: var(--muted); font-size: 10px; }
.oc-mid span { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.oc-bar { height: 4px; background: #0d1117; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.oc-bar i { display: block; height: 100%; border-radius: 3px; transition: width .2s linear; background: linear-gradient(90deg, var(--blue), #7ac8ff); }
.order-card.leading .oc-bar i { background: linear-gradient(90deg, var(--green), #5fe6bf); }
.order-card.losing .oc-bar i { background: linear-gradient(90deg, var(--red), #ff8f9c); }

.his-card { border-bottom: 1px solid rgba(34, 43, 54, .6); padding: 8px 4px; font-size: 12px; }
.hc-line1 { display: flex; align-items: center; gap: 7px; }
.hc-dir { font-size: 11px; }
.hc-dir.up { color: var(--green); }
.hc-dir.down { color: var(--red); }
.hc-sym { font-weight: 700; }
.hc-dur, .hc-amt { color: var(--muted); }
.hc-res { margin-left: auto; font-weight: 800; }
.hc-res.win { color: var(--green); }
.hc-res.lose { color: var(--red); }
.hc-res.tie { color: var(--muted); }
.hc-line2 {
  display: flex; justify-content: space-between; color: var(--muted);
  font-size: 10.5px; margin-top: 3px; font-variant-numeric: tabular-nums;
}

/* ---------- 提示 / 弹窗 ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast {
  background: #182029; border: 1px solid var(--border); border-left: 3px solid var(--blue);
  color: var(--text); padding: 10px 14px; border-radius: 9px; font-size: 13px; max-width: 340px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); animation: tin .25s ease;
}
.toast.win { border-left-color: var(--green); }
.toast.lose { border-left-color: var(--red); }
.toast.info { border-left-color: var(--gold); }
.toast.out { opacity: 0; transform: translateX(12px); transition: all .3s; }
@keyframes tin { from { opacity: 0; transform: translateX(16px); } }

.modal {
  position: fixed; inset: 0; background: rgba(4, 7, 10, .6); display: flex;
  align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px);
}
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; width: 320px; }
.modal-box h4 { font-size: 15px; margin-bottom: 8px; }
.modal-box p { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #243040; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Bottom tab bar ---------- */
:root { --bnavH: 58px; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--bnavH) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; justify-content: center;
  background: rgba(13, 18, 25, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}
.tab-item {
  flex: 0 1 190px; width: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 6px 0 5px;
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 10.5px; font-weight: 600;
}
.tab-item svg { width: 21px; height: 21px; }
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--blue); }

/* ---------- Sub views (History / Assets / Account) ---------- */
.view { display: none; }
.view.active { display: block; }
#viewTrade.active { display: grid; }
.view.page { height: calc(100vh - 56px - var(--bnavH)); overflow-y: auto; padding: 18px 20px 24px; }
.page-inner { max-width: 880px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.panel-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.demo-strip { margin-top: 12px; color: var(--muted); font-size: 11.5px; }
.demo-strip.center { text-align: center; margin-top: 10px; }

/* Filters */
.filters { display: flex; gap: 7px; margin-bottom: 12px; }
.chip {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  padding: 6px 16px; border-radius: 20px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.chip:hover { color: var(--text); }
.chip.active { color: var(--text); border-color: var(--blue); background: rgba(61, 155, 255, .12); }

/* Settlement records */
.settle-head, .settle-row {
  display: grid; grid-template-columns: 84px 1.2fr 100px 90px 1.4fr 76px 96px;
  gap: 8px; align-items: center; font-variant-numeric: tabular-nums;
}
.settle-head { color: var(--muted); font-size: 11px; padding: 2px 8px 10px; }
.settle-row { padding: 10px 8px; border-top: 1px solid rgba(34, 43, 54, .6); font-size: 12.5px; }
.sr-dir.up, .sr-res.win, .sr-pnl.win { color: var(--green); }
.sr-dir.down, .sr-res.lose, .sr-pnl.lose { color: var(--red); }
.sr-res.tie, .sr-pnl.tie { color: var(--muted); }
.sr-sym { display: flex; align-items: center; min-width: 0; }
.sr-px { color: var(--muted); }

/* Assets */
.asset-hero .big-eq { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.eq-grid { display: flex; gap: 28px; margin-top: 10px; flex-wrap: wrap; }
.eq-grid label { display: block; font-size: 11.5px; margin-bottom: 3px; }
.eq-grid span { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.asset-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.act-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 16px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.act-btn:hover { border-color: #3a4655; }
.act-btn.primary { background: linear-gradient(135deg, #3d9bff, #1f6fe0); border: none; color: #fff; }
.acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.acc-name { font-size: 13px; font-weight: 700; }
.acc-bal { margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.acc-bal b { font-size: 22px; font-weight: 800; }
.acc-sub { color: var(--muted); font-size: 11.5px; margin-bottom: 12px; }
.acc-btns { display: flex; gap: 8px; }
.mini-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 13px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.mini-btn:hover { border-color: #3a4655; }
.mini-btn.warn { color: var(--gold); border-color: rgba(255, 176, 46, .45); }
.tx-panel { margin-top: 12px; }
.tx-row { display: flex; align-items: center; gap: 11px; padding: 10px 2px; border-top: 1px solid rgba(34, 43, 54, .6); font-size: 12.5px; }
.tx-ico {
  width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.tx-ico.in { color: var(--green); }
.tx-ico.out { color: var(--red); }
.tx-ico.move { color: var(--blue); }
.tx-main { flex: 1; min-width: 0; }
.tx-title { font-weight: 600; }
.tx-sub { color: var(--muted); font-size: 11px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-right { text-align: right; flex: none; }
.tx-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-amt.plus { color: var(--green); }
.tx-amt.minus { color: var(--red); }
.tx-time { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* Account */
.profile-card { display: flex; align-items: center; gap: 16px; }
.pf-avatar {
  width: 64px; height: 64px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 28px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.pf-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.demo-badge {
  font-size: 10px; color: var(--gold); border: 1px solid rgba(255, 176, 46, .45);
  padding: 1px 7px; border-radius: 12px; font-weight: 700;
}
.pf-uid { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin: 4px 0 2px; }
.uid-copy {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; cursor: pointer; font-size: 11px; padding: 1px 6px;
}
.uid-copy:hover { color: var(--text); border-color: #3a4655; }
.menu-row {
  display: flex; align-items: center; gap: 11px; padding: 12px 2px;
  border-top: 1px solid rgba(34, 43, 54, .6); font-size: 13.5px; cursor: pointer;
}
.menu-row:first-of-type { border-top: none; }
.menu-row:hover .mr-label { color: var(--blue); }
.mr-ico {
  width: 30px; height: 30px; border-radius: 8px; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none;
}
.mr-label { font-weight: 600; }
.chev { font-style: normal; color: #5b6b7b; margin-left: 6px; }
.menu-row .chev { margin-left: auto; font-size: 16px; }
.vip-badge {
  font-size: 10.5px; color: #2b1d00; background: linear-gradient(135deg, #ffd77a, #ffb02e);
  padding: 2px 9px; border-radius: 12px; font-weight: 800;
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.stat label { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.set-card { margin-top: 12px; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 2px; border-top: 1px solid rgba(34, 43, 54, .6); font-size: 13px;
}
.set-row .muted { font-size: 12.5px; }

/* Modal forms */
.modal-box { width: 340px; }
.modal-box.receive-box { width: 300px; }
.seg { display: flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 3px; margin-top: 4px; }
.seg button {
  flex: 1; border: none; background: transparent; color: var(--muted); padding: 7px 4px;
  border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.seg button.active { background: var(--blue); color: #fff; }
.f-label { color: var(--muted); font-size: 12px; margin: 12px 0 6px; }
.f-input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 10px; font-size: 13.5px; outline: none;
}
.f-input:focus { border-color: var(--blue); }
select.f-input { appearance: none; }
.qr-wrap { display: flex; justify-content: center; padding: 10px; background: #fff; border-radius: 10px; margin: 4px auto 0; width: 180px; height: 180px; }
.qr-wrap svg, .qr-wrap img, .qr-wrap canvas { width: 160px; height: 160px; display: block; }
.addr-line {
  margin-top: 10px; background: var(--panel-2); border: 1px dashed var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 11px; word-break: break-all; text-align: center; font-variant-numeric: tabular-nums;
}
.modal .amount-row { margin-top: 2px; }
.modal .amount-row input { text-align: left; }
.modal .amount-row input, .modal .amount-row .btn-ghost { min-height: 40px; }
.modal .amount-row .btn-ghost {
  width: auto; min-width: 64px; padding: 8px 12px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
  line-height: 1.4; white-space: nowrap;
}
#modalTransfer .modal-box, #modalWithdraw .modal-box { width: min(340px, calc(100vw - 32px)); }

/* ---------- Security & preferences extras ---------- */
.mr-val { margin-left: auto; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mr-val.dim { color: var(--muted); }
.mr-val.ok { color: var(--green); }
.mr-val.code { color: var(--gold); font-weight: 700; letter-spacing: .5px; }
.eq-conv { color: var(--muted); font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; min-height: 15px; }
.fa-p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 6px 0 2px; }
.pwd-strength { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.ps-track { flex: 1; height: 4px; border-radius: 3px; background: #0d1117; overflow: hidden; display: block; }
.ps-track i { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .2s, background .2s; }
.qr-wrap.small { width: 156px; height: 156px; padding: 8px; }
.qr-wrap.small svg { width: 140px; height: 140px; }
.opt-list { max-height: 320px; overflow-y: auto; margin-top: 4px; }
.opt-row { display: flex; align-items: center; gap: 10px; padding: 11px 6px; border-top: 1px solid rgba(34, 43, 54, .6); cursor: pointer; font-size: 13.5px; }
.opt-row:first-child { border-top: none; }
.opt-row:hover { background: var(--panel-2); }
.opt-row .or-sub { color: var(--muted); font-size: 11px; margin-left: 6px; flex: 1; text-align: right; }
.or-def { color: var(--blue); font-size: 10.5px; font-weight: 700; margin-left: 4px; }
.opt-row .or-check { color: var(--blue); font-weight: 800; visibility: hidden; }
.opt-row.sel .or-check { visibility: visible; }

/* Light theme */
body.light { --bg: #eef1f5; --panel: #ffffff; --panel-2: #f2f4f7; --border: #e2e7ee; --text: #1a212b; --muted: #617082; }
body.light .topbar { background: #ffffff; }
body.light .bottomnav { background: rgba(255, 255, 255, .97); }
body.light .toast { background: #ffffff; }
body.light .oc-bar { background: #e7ebf1; }
body.light .ps-track { background: #e7ebf1; }
body.light .logo-dot { background: linear-gradient(135deg, #1f6fe0, #00996e); }

/* ---------- Trading modes ---------- */
.mode-tabs { display: flex; gap: 4px; padding: 10px 14px 0; align-items: center; }
.mode-tab {
  background: transparent; border: none; color: var(--muted); padding: 7px 13px;
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 700;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--blue); }
.fee-link { margin-left: auto; background: transparent; border: none; color: var(--blue); cursor: pointer; font-size: 12px; font-weight: 700; }
.durations.lev { grid-template-columns: repeat(3, 1fr); }
.funding-strip { margin-top: 10px; background: var(--panel-2); border: 1px dashed var(--border); border-radius: 8px; padding: 7px 10px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.btn-primary.wide { width: 100%; margin-top: 10px; padding: 10px; }
.limit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.lev-chip { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 7px 4px; cursor: pointer; text-align: center; font-weight: 700; font-size: 13px; }
.lev-chip.active { border-color: var(--blue); background: rgba(61, 155, 255, .12); color: var(--blue); }
.oc-liq { color: var(--gold); font-size: 10.5px; }
.oc-side.long { color: var(--green); }
.oc-side.short { color: var(--red); }

/* Fee schedule table */
.modal-box.fee-box { width: 420px; }
.fee-tbl { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; max-height: 240px; overflow-y: auto; }
.ft-head, .ft-row { display: grid; grid-template-columns: 64px 1.4fr 90px 90px; gap: 6px; padding: 7px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.ft-head { color: var(--muted); font-size: 10.5px; background: var(--panel-2); position: sticky; top: 0; }
.ft-row { border-top: 1px solid rgba(34, 43, 54, .55); }
.ft-row.me { background: rgba(0, 196, 140, .1); }
body.light .ft-head { background: var(--panel-2); }
body.light .ft-row { border-top-color: rgba(0, 0, 0, .07); }

/* ---------- Announcement bar ---------- */
.notice-bar {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, rgba(61, 155, 255, .16), rgba(0, 196, 140, .12));
  border-bottom: 1px solid var(--border); color: var(--text);
  padding: 7px 16px; font-size: 12.5px;
}
.notice-bar button { margin-left: auto; background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 12px; }

/* ---------- Support chat widget ---------- */
.chat-fab {
  position: fixed; right: 16px; bottom: calc(var(--bnavH) + 14px + env(safe-area-inset-bottom, 0px));
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer; z-index: 60;
  background: linear-gradient(135deg, #1f6fe0, #3d9bff); color: #fff; font-size: 20px;
  box-shadow: 0 8px 22px rgba(31, 111, 224, .45);
}
.cf-ico { line-height: 1; }
.cf-badge {
  position: absolute; top: -3px; right: -3px; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 800; border-radius: 10px; padding: 1px 6px; min-width: 18px;
}
.chat-panel {
  position: fixed; right: 16px; bottom: calc(var(--bnavH) + 14px + env(safe-area-inset-bottom, 0px));
  width: 320px; height: 430px; max-height: calc(100vh - var(--bnavH) - 90px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; z-index: 61; overflow: hidden;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .5);
}
.cp-head {
  display: flex; align-items: center; padding: 12px 14px;
  background: linear-gradient(135deg, #1f6fe0, #3d9bff); color: #fff;
}
.cp-head .cp-sub { display: block; font-size: 10.5px; opacity: .85; }
.cp-head button { margin-left: auto; background: transparent; border: none; color: #fff; cursor: pointer; font-size: 13px; }
.cp-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cp-sys { align-self: center; color: var(--muted); font-size: 11px; background: var(--panel-2); padding: 5px 12px; border-radius: 12px; }
.cp-b { max-width: 80%; padding: 7px 11px; border-radius: 12px; font-size: 12.5px; line-height: 1.45; word-break: break-word; }
.cp-b.user { align-self: flex-end; background: linear-gradient(135deg, #1f6fe0, #3d9bff); color: #fff; border-bottom-right-radius: 4px; }
.cp-b.agent { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.cp-b .cp-time { display: block; font-size: 9.5px; opacity: .6; margin-top: 2px; }
.cp-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.cp-input input {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 8px 11px; font-size: 12.5px; outline: none;
}
.cp-input input:focus { border-color: var(--blue); }
.cp-input button {
  background: linear-gradient(135deg, #1f6fe0, #3d9bff); border: none; color: #fff;
  border-radius: 9px; padding: 0 14px; cursor: pointer; font-size: 12.5px; font-weight: 700;
}
body.light .chat-panel { box-shadow: 0 16px 44px rgba(0, 0, 0, .18); }

/* Receive network tabs */
.net-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.net-tab {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 6px 0; cursor: pointer; font-size: 12px; font-weight: 700;
}
.net-tab.active { color: var(--blue); border-color: var(--blue); background: rgba(61, 155, 255, .12); }

/* ---------- User chip & auth ---------- */
.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip .uc-ava {
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.user-chip .uc-name { font-weight: 700; font-size: 12.5px; }
.user-chip .uc-uid { color: var(--muted); font-size: 11px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.auth-tabs button {
  flex: 1; background: transparent; border: none; color: var(--muted); padding: 8px;
  border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 13px;
}
.auth-tabs button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--blue); }
.auth-err { color: var(--red); font-size: 12px; margin-top: 10px; text-align: center; }
.cp-b .b-agent { display: block; font-size: 10px; opacity: .75; margin-bottom: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1150px) {
  body { overflow: auto; padding-bottom: calc(var(--bnavH) + env(safe-area-inset-bottom, 0px)); }
  .layout { grid-template-columns: 1fr; height: auto; }
  .center-panel { order: 1; min-height: 480px; }
  .coins-panel { order: 2; max-height: 300px; }
  .right-panel { order: 3; }
  .chart-wrap { min-height: 280px; }
  .order-list { max-height: none; }
  .sym-stats { margin-left: 0; }
  .view.page { height: auto; overflow: visible; padding-bottom: 20px; }
  .acc-grid { grid-template-columns: 1fr; }
  .settle-head { display: none; }
  .settle-row { grid-template-columns: 1fr 1fr auto; }
  .sr-px { grid-column: 1 / -1; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .brand-sub, .tag-demo { display: none; }
  .conn-status { display: none; }
  .bal label { display: none; }
  .bal strong { font-size: 15px; }
  .view.page { padding: 12px 10px 20px; }
  .asset-hero .big-eq { font-size: 24px; }
  .eq-grid { gap: 18px; }
  .tab-item span { font-size: 10px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
.testnet-notice{padding:10px 18px;background:#3d2d08;color:#ffe099;text-align:center;font-size:12px;border-bottom:1px solid #765919}.nile-help{padding:12px 0;font-size:12px;overflow-wrap:anywhere}.nile-help input{display:block;width:100%;margin:10px 0;padding:10px;background:transparent;color:inherit;border:1px solid #566274;border-radius:6px}.nile-help a{color:#76b4ff}.nile-help button{margin:6px 0}#nileWithdrawals{padding:12px;font-size:12px;overflow-wrap:anywhere}.nile-help p{line-height:1.6}.tag-demo{white-space:nowrap}.modal{overflow-y:auto}.modal-card,.modal-box{max-height:90vh;overflow-y:auto}
