/* trade everything: night theme (shared with the paper demo in app/; this copy evolves for the real exchange). */
:root {
  --bg: #0a0d10; --panel: #0f1316; --panel2: #161b20; --line: #1d242a; --line-soft: #161c21;
  --ink: #e9eef1; --ink2: #a4afb7; --muted: #7f8c95;
  --up: #2ebd85; --down: #f0616d; --warn: #e3ac45; --accent: #2ebd85;
  --cta: #2ebd85; --cta-ink: #04130c; --wash: rgba(46,189,133,.10); --wash-down: rgba(240,97,109,.10);
  --grid: rgba(231,236,239,.06);
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --mono: Inter, system-ui, -apple-system, sans-serif; /* numbers use Inter with tabular figures */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); font: 13px/1.4 var(--sans); font-feature-settings: 'cv11' 1, 'ss01' 1; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--ink); }
.mono, .num, td, .v { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); } .warn { color: var(--warn); }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; height: 46px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.logo { font: 600 16px var(--sans); letter-spacing: -.03em; white-space: nowrap; }
.logo b { color: var(--accent); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 20px; height: 100%; }
.nav a { position: relative; height: 100%; display: flex; align-items: center; color: var(--muted); font-weight: 500; transition: color .15s; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); }
.nav a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.more { position: relative; }
.more-menu { display: none; position: absolute; top: 40px; left: -8px; min-width: 160px; padding: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.more-menu a { display: block; height: auto; padding: 8px 10px; border-radius: 6px; }
.more-menu a:hover { background: var(--panel); }
.more:hover .more-menu, .more:focus-within .more-menu { display: block; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; font-weight: 500; color: var(--ink2); }
.top-right button { background: none; border: 0; font-weight: 500; color: var(--ink2); }
.top-right button:hover { color: var(--ink); }
.pill { white-space: nowrap; padding: 5px 11px; border: 0; border-radius: 999px; background: var(--panel2); }
.demo-pill { color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.menu-btn { display: none; }

/* results tape (recent closes), like Papertrade's ticker */
.tape { display: flex; align-items: center; gap: 10px; height: 28px; padding: 0 16px; overflow: hidden; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--bg); }
.tape .lbl { font: 500 11px var(--sans); color: var(--muted); margin-right: 2px; }
#tape-items { display: flex; gap: 18px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.tape .tchip { flex: 0 0 auto; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; font: 500 11.5px var(--mono); font-variant-numeric: tabular-nums; }

.tape .tchip b { font-family: var(--sans); color: var(--ink2); font-weight: 600; }
.tape .demo-note { margin-left: auto; color: var(--muted); font-size: 11px; }

/* cards and key/value rows */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 8px; font: 600 12.5px var(--sans); color: var(--ink); }
.kv { display: grid; grid-template-columns: 1fr auto; row-gap: 6px; column-gap: 12px; padding: 4px 14px 14px; font-size: 12.5px; color: var(--ink2); }
.kv .v { font-family: var(--mono); color: var(--ink); text-align: right; }
.big { font: 600 26px var(--mono); padding: 0 14px 12px; }
.page { padding: 10px; display: grid; gap: 10px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* tabs and tables */
.tabs { display: flex; align-items: center; gap: 20px; padding: 0 16px; border-bottom: 1px solid var(--line); min-height: 38px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 0; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .spacer { margin-left: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; font: 500 11px var(--sans); color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
td.t { font-family: var(--sans); font-weight: 600; }
tr:hover td { background: rgba(255,255,255,.015); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.tag { display: inline-block; padding: 2px 7px; border-radius: 999px; font: 600 10.5px var(--sans); }
.tag.l { background: rgba(47,191,134,.15); color: var(--up); } .tag.s { background: rgba(239,91,91,.13); color: var(--down); }
.tag.n { background: var(--panel2); color: var(--ink2); }

/* controls */
.btn { padding: 6px 11px; border: 0; border-radius: 7px; background: var(--panel2); font-weight: 500; font-size: 12px; color: var(--ink2); transition: color .15s, background .15s; }
.btn:hover { color: var(--ink); background: #1d242a; }
.btn.primary { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.btn.danger { color: var(--down); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; background: var(--panel2); border-radius: 10px; }
.seg button { background: none; border: 0; border-radius: 7px; padding: 8px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.seg button.on { background: #232b31; color: var(--ink); }
.seg button.long.on { background: var(--up); color: var(--cta-ink); } .seg button.short.on { background: var(--down); color: #fff; }
.field { display: flex; gap: 6px; }
.input { width: 100%; padding: 9px 11px; border: 1px solid transparent; border-radius: 8px; background: var(--panel2); text-align: right; font: 500 13px var(--mono); font-variant-numeric: tabular-nums; transition: border-color .15s; }
.input:focus { outline: none; border-color: #3a464e; }
.lbl { display: flex; justify-content: space-between; font: 500 11.5px var(--sans); color: var(--muted); margin-bottom: 6px; }
.cta { width: 100%; padding: 13px; border: 0; border-radius: 10px; background: var(--cta); color: var(--cta-ink); font-weight: 600; font-size: 14px; transition: filter .15s, transform .05s; }
.cta:hover:not(:disabled) { filter: brightness(1.08); } .cta:active:not(:disabled) { transform: translateY(1px); }
.cta.short { background: var(--down); color: #fff; }
.cta:disabled { opacity: .5; cursor: not-allowed; }
.meter { height: 4px; border-radius: 2px; background: var(--panel2); position: relative; overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; background: var(--up); border-radius: 3px; }
.meter.hot i { background: var(--warn); } .meter.full i { background: var(--down); }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.range-chip { padding: 4px 9px; border-radius: 6px; background: none; border: 0; font-weight: 500; font-size: 12px; color: var(--muted); transition: color .15s, background .15s; }
.range-chip:hover { color: var(--ink); }
.range-chip.on { background: var(--panel2); color: var(--ink); }
.live { color: var(--accent); font: 700 10px var(--sans); letter-spacing: .08em; }

/* toasts */
.toasts { position: fixed; right: 14px; bottom: 14px; display: grid; gap: 8px; z-index: 50; }
.toast { min-width: 240px; max-width: 360px; padding: 11px 14px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 12.5px; }
.toast.err { border-color: var(--down); } .toast.ok { border-color: var(--up); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-bg.open { display: flex; }
.modal { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.modal h3 { font-size: 15px; }

@media (max-width: 900px) {
  .top { gap: 12px; }
  .nav { display: none; position: absolute; top: 48px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; height: auto; background: var(--panel); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 16px; height: auto; }
  .nav a.on::after { display: none; }
  .more-menu { display: block; position: static; border: 0; box-shadow: none; background: none; padding: 0 0 0 10px; }
  .menu-btn { display: block; background: none; border: 0; font-size: 18px; color: var(--ink2); }
  .top-right { gap: 12px; }
  .top-right .hide-sm { display: none; }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .tape .demo-note { display: none; }
}

/* ---- real exchange additions: wallet, trading key, banners, modals ---- */
.wallet-btn { padding: 6px 12px; border: 0; border-radius: 999px; background: var(--cta) !important; color: var(--cta-ink) !important; font-weight: 600 !important; white-space: nowrap; }
.wallet-btn.on { background: var(--panel2) !important; color: var(--ink) !important; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.bal-pill { cursor: pointer; color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.live-dot.on { background: var(--accent); }
.banner { padding: 7px 16px; font-size: 12px; color: var(--ink2); border-bottom: 1px solid var(--line); background: var(--panel); }
.banner b { color: var(--ink); }
.banner.stage { display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 5px 12px; background: rgba(227,172,69,.12); border-bottom-color: rgba(227,172,69,.35); color: var(--ink2); font-size: 11.5px; }
.banner.stage > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.test-tag { flex: 0 0 auto; padding: 1px 6px; border-radius: 4px; background: var(--warn); color: #1a1204; font: 700 9.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.test-badge { margin-left: 6px; padding: 2px 6px; border-radius: 4px; background: var(--warn); color: #1a1204; font: 700 9.5px var(--sans); letter-spacing: .08em; vertical-align: 2px; }
.banner.stage b { color: var(--warn); }
.banner.warn { background: rgba(240,97,109,.10); color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.modal { position: relative; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide { max-width: 460px; }
.modal-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 20px; line-height: 1; color: var(--muted); padding: 2px 6px; }
.modal-x:hover { color: var(--ink); }
.modal h3 { padding-right: 24px; }
.modal .note { font-size: 11.5px; color: var(--ink2); line-height: 1.5; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); }
.modal .note.warn { border-color: rgba(227,172,69,.35); }
.modal .fine { font-size: 11px; line-height: 1.5; color: var(--muted); }
.modal .fine a, .modal .note a { text-decoration: underline; text-underline-offset: 2px; }
.small { font-size: 12px; line-height: 1.5; }
.wlist { display: grid; gap: 6px; }
.wopt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); font-weight: 600; text-align: left; }
.wopt:hover { border-color: #3a464e; }
.wopt img, .wfallback { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.wfallback { display: inline-flex; align-items: center; justify-content: center; background: var(--panel); color: var(--ink2); }
.steps { list-style: none; display: grid; gap: 8px; counter-reset: st; }
.steps li { position: relative; padding: 9px 11px 9px 40px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--muted); counter-increment: st; }
.steps li::before { content: counter(st); position: absolute; left: 11px; top: 9px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--panel2); color: var(--ink2); font: 600 11px var(--sans); }
.steps li b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.steps li.doing { border-color: var(--warn); } .steps li.doing::before { background: var(--warn); color: #1a1406; }
.steps li.done { border-color: rgba(46,189,133,.4); } .steps li.done::before { content: "✓"; background: var(--up); color: var(--cta-ink); }
.steps li.failed { border-color: var(--down); }
.acct-row { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 10px; background: var(--panel2); }
.acct-row .mono { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.kv.flat { padding: 0; }
.keybox { display: grid; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
.keybox .kh { display: flex; align-items: center; justify-content: space-between; }
.kbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.kpill { padding: 2px 8px; border-radius: 999px; font: 600 10.5px var(--sans); background: var(--panel2); color: var(--ink2); }
.kpill.ready { background: var(--wash); color: var(--up); } .kpill.expiring, .kpill.locked, .kpill.pending { background: rgba(227,172,69,.12); color: var(--warn); }
.escape summary { cursor: pointer; font-size: 12px; color: var(--ink2); }
.escape[open] { display: grid; gap: 8px; }
.seg.mini button { padding: 5px 8px; font-size: 12px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); }
.input.left, .sel-l { text-align: left; font-family: var(--sans); }
select.input { appearance: auto; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
a.btn { display: inline-flex; align-items: center; }
:focus-visible { outline: 2px solid rgba(46,189,133,.6); outline-offset: 2px; }
[hidden] { display: none !important; }
.table-wrap { position: relative; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 900px) { .top-right .bal-pill { display: none; } .tape .demo-note { display: none; } }
#dp-body, .dp-status { display: grid; gap: 10px; }
.dp-status:empty { display: none; }
.modal > * { min-width: 0; }
.modal { overflow-x: hidden; }
.modal .field { flex-wrap: wrap; }
.modal .field .input { flex: 1 1 140px; }
@media (max-width: 480px) { .banner.stage .hide-xs { display: none; } }
