:root {
  --bg: #0b0e13;
  --panel: #0f131a;
  --panel2: #141922;
  --line: #1e2430;
  --text: #d8dee8;
  --muted: #6b7482;
  --green: #2ebd85;
  --red: #e5484d;
  --accent: #ff7a3c;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: grid; grid-template-rows: 48px 56px 1fr 150px; overflow: hidden;
}
a, button { color: inherit; }

/* nav */
.nav { display: flex; align-items: center; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.logo { color: var(--accent); flex: none; }
.mkt .coin-mark { color: var(--accent); vertical-align: -3px; margin-right: 5px; }
.mkt .caret { color: var(--muted); font-size: 11px; margin-left: 3px; }
.spacer { flex: 1; }
.connect { background: var(--green); color: #04140d; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }

/* market bar */
.market-bar { display: flex; align-items: center; gap: 26px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.mkt .coin { font-weight: 700; font-size: 15px; }
.stat { display: flex; flex-direction: column; }
.stat label { color: var(--muted); font-size: 11px; }
.stat span { font-size: 13px; font-weight: 600; }
.stat .price { font-size: 15px; }
.up { color: var(--green); } .down { color: var(--red); }

/* terminal grid */
.terminal { display: grid; grid-template-columns: 1fr 300px 280px; min-height: 0; }
.chart-col { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-width: 0; }
.chart-toolbar { display: flex; align-items: center; gap: 16px; padding: 7px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.chart-toolbar .tf { color: var(--text); font-weight: 600; }
.chart-toolbar .tool { cursor: pointer; }
.ohlc { font-size: 11.5px; margin-left: auto; }
#chart { flex: 1; min-height: 0; }

/* order book */
.book-col { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.book-tabs { display: flex; gap: 18px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.btab { color: var(--muted); font-weight: 600; cursor: pointer; }
.btab.active { color: var(--text); border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.book { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.book-head, .row { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 2px 12px; font-variant-numeric: tabular-nums; }
.book-head { color: var(--muted); font-size: 11px; padding: 6px 12px; }
.book-head span:not(:first-child), .row span:not(:first-child) { text-align: right; }
.rows { overflow: hidden; }
.rows.asks { display: flex; flex-direction: column-reverse; }
.row { position: relative; font-size: 12px; cursor: default; }
.row .bar { position: absolute; top: 0; right: 0; bottom: 0; opacity: .13; }
.row.ask .price { color: var(--red); } .row.ask .bar { background: var(--red); }
.row.bid .price { color: var(--green); } .row.bid .bar { background: var(--green); }
.row span { position: relative; z-index: 1; }
.spread-row { display: flex; justify-content: space-between; padding: 6px 12px; color: var(--muted); font-size: 11.5px; border-block: 1px solid var(--line); }

/* trade panel */
.trade-col { padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.side-tabs { display: flex; gap: 6px; }
.side { flex: 1; padding: 9px; border: 0; border-radius: 8px; background: var(--panel2); color: var(--muted); font-weight: 700; cursor: pointer; }
.side.buy.active { background: var(--green); color: #04140d; }
.side.sell.active { background: var(--red); color: #1a0505; }
.ord-tabs { display: flex; gap: 16px; color: var(--muted); }
.otab { cursor: pointer; font-weight: 600; }
.otab.active { color: var(--text); }
.avail, .slip { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.avail span:last-child, .slip span:last-child { color: var(--text); }
.amt { display: flex; flex-direction: column; gap: 5px; }
.amt > span { color: var(--muted); font-size: 12px; }
.amt-in { display: flex; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.amt-in input { flex: 1; background: none; border: 0; color: var(--text); font-size: 15px; padding: 10px 0; outline: none; }
.amt-in em { color: var(--muted); font-style: normal; font-size: 12px; }
.slider { width: 100%; accent-color: var(--accent); }
.pct-val { text-align: right; color: var(--muted); font-size: 12px; margin-top: -4px; }
.cta { background: var(--green); color: #04140d; border: 0; border-radius: 9px; padding: 12px; font-weight: 700; cursor: pointer; }
.side-sell-active .cta { background: var(--red); color: #1a0505; }
.portfolio { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.portfolio label { color: var(--muted); font-size: 12px; }
.pv { font-size: 20px; font-weight: 800; margin: 4px 0 10px; }
.pv-actions { display: flex; gap: 6px; }
.pv-actions button { flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px; cursor: pointer; font-size: 12px; }

/* bottom */
.bottom { border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.btabs { display: flex; gap: 18px; padding: 10px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.bt { color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 600; }
.bt.active { color: var(--text); }
.empty { color: var(--muted); padding: 26px; text-align: center; }

/* deposit modal */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: 380px; max-width: 92vw; }
.modal-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.dep-dest { background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; margin: 10px 0; color: var(--muted); font-size: 12px; }
.dep-dest code { color: var(--text); word-break: break-all; }
.dep-msg { font-size: 12.5px; margin: 8px 2px; color: var(--accent); min-height: 16px; }
.muted { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.muted b { color: var(--text); }
.small { font-size: 11px; }
.field { display: block; margin: 10px 0; font-size: 12px; color: var(--muted); }
.field span { display: block; margin-bottom: 5px; }
.field input { width: 100%; box-sizing: border-box; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; color: var(--text); font-size: 14px; outline: none; }
.field input:focus { border-color: var(--accent); }
.fee-line { display: flex; justify-content: space-between; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; margin: 12px 0; font-size: 13px; color: var(--muted); }
.fee-line b { color: var(--accent); font-size: 16px; }
.fee-line em { color: var(--green); font-style: normal; font-size: 11px; }
.wd-recv { margin: 8px 2px; font-size: 13px; color: var(--muted); }
.wd-recv b { color: var(--text); }
.wd-min { margin: 6px 2px 2px; font-size: 11px; color: var(--muted); }
