/* 30/11: Exchange tab, trading-terminal layout (ex.js). Built on qbitinfo.org's tokens, so both themes work. */
body.on-ex .wrap, body.on-ex .topbar .inner { max-width: 1520px; }   /* header lines up with the terminal */
body.on-ex .wrap { padding-top: 12px; }
#tab-exchange { display: flex; flex-direction: column; gap: 8px; --ex-r: 10px; --ex-fs: 12.5px; }
/* 30/11 (user: text not crisp): numbers use the UI face with tabular digits instead of the thin mono;
   wallet addresses and keys keep a mono face so l/1 and 0/O stay apart */
#tab-exchange, .ex-wpop { --ex-mono: "Geist Mono", ui-monospace, Consolas, monospace; --font-mono: var(--font-ui); font-variant-numeric: tabular-nums; }
#tab-exchange.hidden { display: none; }
/* private beta: the nav tab shows only on browsers that signed in; visitors on /exchange see the gate */
html:not(.qx-member) #tabs .tab.ex-private { display: none; }
#tab-exchange:not(.ex-gated) .ex-gate, #tab-exchange.ex-gated .ex-term, #tab-exchange.ex-gated .ex-banner { display: none; }
/* first answer from the server still pending: a small spinner instead of a view that may be the wrong one */
#tab-exchange.ex-loading .ex-term, #tab-exchange.ex-loading .ex-gate, #tab-exchange.ex-loading .ex-banner { display: none; }
#tab-exchange.ex-loading::after { content: ""; display: block; width: 26px; height: 26px; margin: 120px auto; border-radius: 50%;
  border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: exd-spin .7s linear infinite; }
.ex-gate, .ex-term { animation: ex-in .25s ease-out; }
@keyframes ex-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ex-gate, .ex-term, #tab-exchange.ex-loading::after { animation: none; } }
.ex-gate { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 64px 24px 72px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.ex-gcoin { width: 64px; height: 64px; }
.ex-gcoin svg { width: 100%; height: 100%; display: block; }
.ex-gtag { font: 700 11px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 999px; margin-top: 6px; }
.ex-gate h1 { margin: 0; font-size: 28px; font-weight: 750; letter-spacing: -.025em; }
.ex-gate p { margin: 0; max-width: 52ch; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.ex-gbtn { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 10px; }
.ex-gbtn .exd-go { padding: 0 22px; margin: 0; }
.ex-gbtn .ex-hb { height: 46px; padding: 0 22px; border-radius: 11px; font-size: 14px; }
#tab-exchange .up { color: var(--accent); }
#tab-exchange .dn { color: var(--down); }

.ex-note { display: flex; gap: 10px; align-items: baseline; font-size: 12px; color: var(--warn); background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent); border-radius: var(--ex-r); padding: 7px 12px; }
.ex-note b { text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.ex-note.hidden { display: none; }
.ex-note.demo { color: #fff; background: var(--down); border-color: transparent; font-weight: 500; }
.ex-note.demo a { color: #fff; font-weight: 700; }
.ex-banner { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: 12.5px;
  background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--ex-r); padding: 8px 12px; }
.ex-banner.hidden { display: none; }

/* ---------- terminal grid ---------- */
.ex-term { display: grid; gap: 6px;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  grid-template-areas: "top top top" "book chart trades" "book form trades" "mine mine mine"; }
.ex-top { grid-area: top; } .ex-book { grid-area: book; } .ex-chart { grid-area: chart; }
.ex-trades { grid-area: trades; } .ex-form { grid-area: form; } .ex-mine { grid-area: mine; }
.ex-p { background: var(--surface); border: 1px solid var(--line); border-radius: var(--ex-r); min-width: 0; position: relative; }
:root[data-theme="dark"] .ex-p { border-color: transparent; }
.ex-ph { display: flex; align-items: center; gap: 10px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); min-height: 40px; box-sizing: border-box; }
.ex-ph h2 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: -.005em; margin-right: auto; }

/* tabs: underline style, like a terminal */
.ex-tabs { display: flex; gap: 16px; align-items: center; }
.ex-tabs button { border: 0; background: none; padding: 3px 0 5px; font: 600 13px var(--font-ui); color: var(--ink-3); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.ex-tabs button:hover { color: var(--ink); }
.ex-tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.ex-tabs button:focus-visible, .ex-ivs button:focus-visible, .ex-bv:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.ex-ivs { display: flex; gap: 2px; margin-left: auto; }
.ex-ivs.hidden { display: none; }
.ex-ivs button { border: 0; background: none; padding: 4px 8px; border-radius: 6px; font: 500 12px var(--font-ui); color: var(--ink-3); cursor: pointer; }
.ex-ivs button:hover { color: var(--ink); }
.ex-ivs button.on { color: var(--ink); background: var(--surface-3); }

/* ---------- header strip ---------- */
.ex-top { display: flex; align-items: center; gap: 12px 26px; padding: 12px 20px; flex-wrap: wrap; min-height: 64px; box-sizing: border-box; }
/* 24h change as a tinted pill */
#ex-ch { align-self: flex-start; padding: 0 7px; margin-left: -7px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
#ex-ch.up { background: color-mix(in srgb, var(--accent) 13%, transparent); }
#ex-ch.dn { background: color-mix(in srgb, var(--down) 12%, transparent); }
.ex-pair { display: flex; align-items: center; gap: 9px; padding-right: 26px; border-right: 1px solid var(--line); }
.ex-coin { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.ex-pair h1 { margin: 0; font-size: 19px; font-weight: 750; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.ex-pair h1 span { color: var(--ink-3); font-weight: 600; }
.ex-lastbox { display: flex; align-items: baseline; gap: 6px; padding-right: 26px; border-right: 1px solid var(--line); }
.ex-lp { font-family: var(--font-mono); font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; border-radius: 4px; }
.ex-lp.flash { animation: ex-flash .9s ease-out; }
@keyframes ex-flash { 0% { background: color-mix(in srgb, currentColor 18%, transparent); } 100% { background: transparent; } }
.ex-lpu { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.ex-stats { display: flex; gap: 6px 30px; margin: 0; flex-wrap: wrap; align-items: flex-start; }
.ex-stats div { display: flex; flex-direction: column; gap: 4px; }
.ex-stats dt { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.ex-stats dd { margin: 0; font-family: var(--font-mono); font-size: 14.5px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-acct { margin-left: auto; display: none; gap: 8px; align-items: center; }   /* phones only: the header holds it on wider screens */
/* exchange account in the site header, in place of Connect */
.ex-hacct { display: none; align-items: center; gap: 8px; }
body.on-ex .ex-hacct { display: flex; }
/* Connect (Qbit Wallet) belongs to the Wallets tab only (user, 30/11); hidden until ex.js tags <body data-tab> */
body:not([data-tab="wallets"]) #cwbtn, body:not([data-tab="wallets"]) #cwpop { display: none !important; }
.ex-hb { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 600 12px var(--font-ui); cursor: pointer; white-space: nowrap; }
.ex-hb:hover { border-color: var(--ink-3); }
.ex-hb.fill { background: var(--ink); color: var(--bg); border-color: transparent; }
.ex-hb.fill:hover { opacity: .85; }
.ex-hb svg { width: 13px; height: 13px; flex: none; }
.ex-hb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ex-hb.ex-me span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.btn.ex-b { padding: 7px 12px; border-radius: 8px; }
.ex-b svg { width: 14px; height: 14px; flex: none; }
.ex-me span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- order book and trades lists ---------- */
.ex-bh, .ex-row { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 10px; padding: 0 12px 0 16px; }
/* column headers: the name in ink, the unit muted beside it, a rule under the row */
.ex-bh { font-size: 12px; font-weight: 600; color: var(--ink-2); padding-top: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); margin-bottom: 5px; letter-spacing: .005em; }
.ex-bh em { font-style: normal; font-weight: 500; font-size: 10.5px; color: var(--ink-3); margin-left: 4px; letter-spacing: .03em; }
.ex-bh span, .ex-row span { text-align: right; }
/* price on the left, amount and total on the right: the two headers never run into each other (user, 30/11) */
.ex-bh span:first-of-type, .ex-row span:first-of-type { text-align: left; }
.ex-row { position: relative; font-family: var(--font-mono); font-size: var(--ex-fs); font-weight: 500; line-height: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ex-row span { position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-row.buy .p { color: var(--accent); }
.ex-row.sell .p { color: var(--down); }
.ex-row[data-p] { cursor: pointer; }
.ex-row[data-p]:hover, .ex-row.hl { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.ex-dep { position: absolute; right: 0; top: 0; bottom: 0; pointer-events: none; }
.ex-row.buy .ex-dep { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.ex-row.sell .ex-dep { background: color-mix(in srgb, var(--down) 12%, transparent); }
/* your-order marker sits in the left gutter, so it never pushes the price out of line */
.ex-row .p { overflow: visible; }
.ex-own { position: absolute; left: -10px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: currentColor; }
.ex-mp0 { font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--ink-3); }
/* the book is exactly as tall as chart + form; each side scrolls to the levels that do not fit */
.ex-book { display: flex; flex-direction: column; }
.ex-asks { display: flex; flex-direction: column-reverse; flex: 1 1 0; min-height: 0; overflow-y: auto; }
.ex-asks > .ex-row { flex: none; }
.ex-bids { flex: 1 1 0; min-height: 0; overflow-y: auto; padding-bottom: 6px; }
.ex-asks, .ex-bids { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior: contain; }
.ex-asks::-webkit-scrollbar, .ex-bids::-webkit-scrollbar { width: 6px; }
.ex-asks::-webkit-scrollbar-thumb, .ex-bids::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.ex-asks.hidden, .ex-bids.hidden { display: none; }
.ex-mid { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 3px 0; }
.ex-mid b { font-family: var(--font-mono); font-size: 17px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.ex-arr { width: 15px; height: 15px; }
.ex-mid span { font-size: 11.5px; color: var(--ink-3); margin-left: auto; }
.ex-bvs { display: flex; gap: 4px; }
.ex-bv { width: 22px; height: 22px; border: 1px solid transparent; border-radius: 5px; background: none; padding: 4px; display: grid; gap: 2px; cursor: pointer; opacity: .55; }
.ex-bv.on, .ex-bv:hover { opacity: 1; border-color: var(--line-strong); }
.ex-bv i { display: block; height: 3px; border-radius: 1px; }
.ex-bv.both i:nth-child(1), .ex-bv.asks i { background: var(--down); }
.ex-bv.both i:nth-child(2) { background: var(--ink-3); }
.ex-bv.both i:nth-child(3), .ex-bv.bids i { background: var(--accent); }
.ex-sel { font: 12px var(--font-mono); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 4px; cursor: pointer; }
.ex-btip { position: absolute; left: calc(100% + 8px); z-index: 5; transform: translateY(-50%); display: grid; grid-template-columns: auto auto; gap: 3px 14px;
  padding: 9px 12px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 11.5px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .45); }
.ex-btip.hidden { display: none; }
.ex-btip span { opacity: .7; }
.ex-btip b { font-family: var(--font-mono); font-weight: 600; text-align: right; }
.ex-trades { display: flex; flex-direction: column; }
.ex-tl { flex: 1 1 0; min-height: 0; overflow-y: auto; padding-bottom: 6px; }
/* depth: the lower half of the trades panel */
.ex-dp { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.ex-dcv { position: relative; flex: 1 1 0; min-height: 120px; margin: 2px 4px 4px; }
.ex-dcv canvas { position: absolute; inset: 0; display: block; cursor: crosshair; }
.ex-row .t { color: var(--ink-3); }
.ex-row.new { animation: ex-new 1.4s ease-out; }
@keyframes ex-new { 0% { background: color-mix(in srgb, currentColor 22%, transparent); } 100% { background: transparent; } }
.ex-row.buy.new { color: var(--accent); } .ex-row.sell.new { color: var(--down); }
.ex-row.new span:not(.p) { color: var(--ink); }
.ex-row.new .t { color: var(--ink-3); }
.ex-none { font-size: 12px; color: var(--ink-3); padding: 14px 12px; text-align: center; }
.ex-none.big { padding: 40px 12px; font-size: 13px; }

/* ---------- chart ---------- */
.ex-chart { display: flex; flex-direction: column; }
.ex-leg { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 7px 12px 0; font-size: 11.5px; color: var(--ink-3); min-height: 18px; }
.ex-leg b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.ex-cv { position: relative; height: 340px; margin: 2px 4px 4px; }
.ex-rz { height: 9px; margin: -2px 0 1px; cursor: ns-resize; touch-action: none; display: flex; align-items: center; justify-content: center; }
.ex-rz::before { content: ""; width: 44px; height: 3px; border-radius: 2px; background: var(--line-strong); }
.ex-rz:hover::before { background: var(--ink-3); }
.ex-lw { position: absolute; inset: 0; } .ex-lw.hidden { display: none; }
.ex-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--ink-3); }
.ex-empty.hidden { display: none; }

/* ---------- order form ---------- */
.ex-form .ex-ph { border-bottom: 0; padding-bottom: 4px; }
.ex-feeh { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.ex-msw { display: none; }
.ex-fss { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 6px 14px 14px; }
.ex-fs { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ex-form[data-kind="market"] .ex-f.lim, .ex-form[data-kind="limit"] .ex-f.mkt { display: none; }
.ex-av { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.ex-av b { margin-left: auto; font-family: var(--font-mono); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.ex-ib { border: 0; background: none; padding: 0; width: 16px; height: 16px; color: var(--accent); cursor: pointer; display: grid; place-items: center; }
.ex-ib svg { width: 15px; height: 15px; }
.ex-f { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 11px; background: var(--surface-2);
  transition: border-color .12s; }
.ex-f:hover { border-color: var(--ink-3); }
.ex-f:focus-within { border-color: var(--accent); }
.ex-f span { font-size: 12px; color: var(--ink-3); flex: none; }
.ex-f input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font: 500 14px var(--font-mono);
  padding: 7px 0; text-align: right; font-variant-numeric: tabular-nums; }
.ex-f input:disabled { color: var(--ink-3); font-family: var(--font-ui); }
.ex-f i { font-style: normal; font-size: 12px; color: var(--ink-2); flex: none; min-width: 34px; text-align: right; }
/* percentage slider */
.ex-rg { position: relative; display: flex; align-items: center; gap: 10px; height: 22px; }
.ex-rg input { --v: 0%; flex: 1; appearance: none; -webkit-appearance: none; height: 4px; border-radius: 2px; margin: 0; cursor: pointer;
  background: linear-gradient(to right, var(--rg) var(--v), var(--surface-3) var(--v)); position: relative; z-index: 1; }
.ex-fs.buy .ex-rg input { --rg: var(--accent); } .ex-fs.sell .ex-rg input { --rg: var(--down); }
.ex-rg input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rg); cursor: grab; }
.ex-rg input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rg); cursor: grab; }
.ex-rg input:focus-visible { outline: 2px solid var(--rg); outline-offset: 4px; }
.ex-rgm { position: absolute; left: 0; right: 46px; top: 50%; transform: translateY(-50%); display: flex; justify-content: space-between; pointer-events: none; z-index: 2; }
.ex-rgm i { width: 6px; height: 6px; transform: rotate(45deg); background: var(--surface); border: 1.5px solid var(--line-strong); }
.ex-rg output { width: 36px; text-align: right; font: 11.5px var(--font-mono); color: var(--ink-3); }
.ex-est { font-size: 11.5px; color: var(--ink-3); min-height: 0; }
.ex-est:empty { display: none; }
.ex-go { border: 0; border-radius: 8px; padding: 11px; font: 650 14px var(--font-ui); color: #fff; cursor: pointer; transition: filter .12s; }
.ex-go.buy { background: var(--accent); }
.ex-go.sell { background: var(--down); }
:root[data-theme="dark"] .ex-go { color: #07110a; }
.ex-go:hover { filter: brightness(1.08); }
.ex-go:disabled { opacity: .55; cursor: wait; }
.ex-go:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ex-err { font-size: 12px; color: var(--down); }
.ex-err.ok { color: var(--ink-2); }
.exd-go.ghost { background: none; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong); margin-top: 8px; }
.ex-rg input:disabled { opacity: .45; cursor: not-allowed; }
.ex-err:empty { display: none; }

/* ---------- my activity ---------- */
.ex-mine .ex-ph { gap: 18px; }
.ex-mine .ex-tabs { overflow-x: auto; scrollbar-width: none; }
.ex-mine .ex-tabs::-webkit-scrollbar { display: none; }
#ex-cxall { margin-left: auto; font-size: 12.5px; }
.ex-tbl { overflow-x: auto; min-height: 120px; }
table.ex-t { width: 100%; border-collapse: collapse; min-width: 760px; }
.ex-t th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--ink-3); padding: 9px 12px; white-space: nowrap; }
.ex-t td { padding: 9px 12px; font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; white-space: nowrap; color: var(--ink); border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ex-t td:first-child { color: var(--ink-2); }
.ex-t .r { text-align: right; }
.ex-t tbody tr:hover td { background: var(--surface-2); }
.ex-sd { font-family: var(--font-ui); font-weight: 600; }
.ex-sd.buy { color: var(--accent); } .ex-sd.sell { color: var(--down); }
.ex-st { font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.ex-st.filled { background: var(--accent-soft); color: var(--accent); }
.ex-st.open { background: var(--warn-soft); color: var(--warn); }
.ex-as { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-ui); }
.ex-as i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 800 11px var(--font-ui); font-style: normal; color: #fff; background: var(--brand); }
.ex-as i.USDC { background: #2775ca; }
.ex-as small { color: var(--ink-3); font-size: 11.5px; }
.ex-acts { display: inline-flex; gap: 14px; }
.ex-link { border: 0; background: none; padding: 0; color: var(--accent); font: 600 12.5px var(--font-ui); cursor: pointer; }
.ex-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.ex-link.hidden { display: none; }
.ex-2fa { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 1px dashed var(--line-strong); background: transparent; border-radius: 8px;
  padding: 10px 12px; margin: 10px 12px 12px; color: var(--ink-2); font: 12px var(--font-ui); cursor: pointer; }
.ex-2fa svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.ex-2fa span { display: flex; flex-direction: column; gap: 2px; }
.ex-2fa b { color: var(--ink); font-size: 12.5px; }
.ex-2fa:hover { border-color: var(--accent); }

/* ---------- dialogs ---------- */
#exm { background: rgba(6, 14, 9, .58); backdrop-filter: blur(4px); }
#exm .ex-mbox { width: min(420px, 100%); padding: 26px 26px 24px; gap: 16px; border-radius: 18px; border-color: var(--line);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .55); margin-top: 7vh; }
#exm .ex-mbox.wide { width: min(480px, 100%); }
#exm .modal-x { top: 16px; right: 16px; width: 32px; height: 32px; border: 0; background: var(--surface-2); color: var(--ink-3); font-size: 13px; }
#exm .modal-x:hover { background: var(--surface-3); color: var(--ink); }
#exm-body { display: flex; flex-direction: column; gap: 14px; }
.exd-h { display: flex; gap: 14px; align-items: flex-start; padding-right: 36px; margin-bottom: 2px; }
.exd-h h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.exd-h p { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.exd-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.exd-ic svg { width: 20px; height: 20px; }
.exd-ic.warn { background: var(--warn-soft); color: var(--warn); }
.exd-ic.ok { background: var(--accent-soft); color: var(--accent); }
.exd-ic.big { width: 58px; height: 58px; border-radius: 18px; }
.exd-ic.big svg { width: 28px; height: 28px; }
.exd-st { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 6px 8px 2px; }
.exd-st h2 { margin: 6px 0 0; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.exd-st p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; max-width: 34ch; }
.exd-st b { color: var(--ink); }

/* fields */
.exd-f { display: flex; flex-direction: column; gap: 6px; }
.exd-l { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.exd-l em { font-style: normal; font-weight: 500; color: var(--ink-3); margin-left: 6px; }
.exd-i { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px 0 14px; border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--surface-2); transition: border-color .12s, box-shadow .12s; }
.exd-i:hover { border-color: var(--ink-3); }
.exd-i:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); background: var(--surface); }
.exd-i input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; color: var(--ink); font: 14.5px var(--font-ui); padding: 0; }
.exd-i input::placeholder { color: var(--ink-3); opacity: .75; }
#exw-a { font-family: var(--ex-mono); font-size: 13px; }
#exw-v { font-size: 14px; font-weight: 500; }
.exd-code { font-family: var(--ex-mono) !important; font-size: 20px !important; letter-spacing: .45em; font-variant-numeric: tabular-nums; }
.exd-eye { border: 0; background: none; color: var(--ink-3); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; flex: none; }
.exd-eye svg { width: 17px; height: 17px; }
.exd-eye:hover, .exd-eye.on { color: var(--accent); background: var(--surface-3); }
.exd-u { font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.exd-max { border: 0; background: var(--accent-soft); color: var(--accent); font: 700 12px var(--font-ui); padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.exd-max:hover { filter: brightness(.96); }
.exd-avl { font-size: 12px; color: var(--ink-3); }
.exd-avl b { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.exd-ph { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-3); }
.exd-ph span { display: inline-flex; align-items: center; gap: 5px; }
.exd-ph svg { width: 13px; height: 13px; opacity: .35; }
.exd-ph .ok { color: var(--accent); }
.exd-ph .ok svg { opacity: 1; }
.exd-ck { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.exd-ck input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--accent); flex: none; }

/* buttons, notes, links */
.exd-go { height: 46px; border: 0; border-radius: 11px; background: var(--accent); color: #fff; font: 650 14.5px var(--font-ui); cursor: pointer;
  transition: filter .12s; margin-top: 2px; }
:root[data-theme="dark"] .exd-go { color: #06110a; }
.exd-go:hover { filter: brightness(1.07); }
.exd-go:focus { outline: none; }
.exd-go:focus-visible { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.exd-go:disabled { cursor: wait; opacity: .7; }
.exd-go.busy { color: transparent; position: relative; }
.exd-go.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: exd-spin .7s linear infinite; }
@keyframes exd-spin { to { transform: rotate(360deg); } }
.exd-err { font-size: 12.5px; text-align: center; margin-top: -4px; }
.exd-alt { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; font-size: 12.5px; color: var(--ink-3); padding-top: 2px; }
.exd-note { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); color: var(--ink-2); }
.exd-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.exd-note.warn { background: var(--warn-soft); color: var(--warn); }
.exd-note.bad { background: color-mix(in srgb, var(--down) 10%, transparent); color: var(--down); }
.exd-note.ok { background: var(--accent-soft); color: var(--accent); }
.exd-note b { font-weight: 700; }
.exd-note a { color: inherit; font-weight: 700; }
.exd-small { margin: 0; font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* coin picker, address card, summary */
.exd-coins { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: -6px; }
.exd-cc { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 11px; border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; font-family: var(--font-ui); }
.exd-cc:hover { border-color: var(--ink-3); }
.exd-cc.on { border-color: var(--accent); background: var(--accent-soft); }
.exd-cc span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.exd-cc b { font-size: 14px; }
.exd-cc small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exd-coin { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 800 14px var(--font-ui); font-style: normal; color: #fff; background: var(--brand); }
.exd-coin.USDC { background: #2775ca; }
.exd-net { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-3); font: 600 12px var(--font-ui); color: var(--ink); }
.exd-addr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); }
.exd-addr.hidden { display: none; }
.exd-addr .ex-qr svg, .exd-2qr .ex-qr svg { width: 132px; height: 132px; background: #fff; border-radius: 10px; padding: 5px; display: block; }
.exd-addr .ex-qr, .exd-2qr .ex-qr { width: 132px; height: 132px; display: grid; place-items: center; }
.exd-ad, .exd-key { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.exd-ad small, .exd-key small { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.exd-ad code, .exd-key code { font-family: var(--ex-mono); font-size: 12.5px; line-height: 1.5; word-break: break-all; color: var(--ink); }
.exd-copy { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font: 600 12px var(--font-ui); padding: 6px 12px; border-radius: 8px; cursor: pointer; width: auto; height: auto; }
.exd-copy svg { width: 13px; height: 13px; display: none; }
.exd-copy.ok { border-color: var(--accent); color: var(--accent); }
.exd-copy.ok svg { display: block; }
.exd-load { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: exd-spin .7s linear infinite; }
.exd-kvs, .exd-sum { display: flex; flex-direction: column; gap: 8px; }
.exd-sum { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.exd-kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12.5px; color: var(--ink-3); }
.exd-kv b { font-family: var(--font-mono); font-weight: 600; color: var(--ink); text-align: right; }
.exd-kv.tot { padding-top: 8px; border-top: 1px dashed var(--line-strong); }
.exd-kv.tot b { font-size: 14px; }
.exd-kv b.dn { color: var(--down); }

/* Wallet menu (header dropdown on wide screens, dialog on phones) */
.ex-wpop { position: absolute; top: calc(100% + 10px); right: 44px; z-index: 60; width: 360px; padding: 16px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; gap: 4px; animation: ex-in .18s ease-out; }
.ex-wpop[hidden] { display: none; }
.ex-caret { width: 12px !important; height: 12px !important; margin-left: -2px; transition: transform .15s; }
#ex-wbtn[aria-expanded="true"] .ex-caret { transform: rotate(180deg); }
.exw-me { display: flex; gap: 12px; align-items: center; padding: 2px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.exw-me > div { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.exw-me b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exw-mail { font-size: 12px; color: var(--ink-3); margin-top: -3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exw-me .exd-av { width: 40px; height: 40px; font-size: 16px; }
.exw-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.exw-top { display: flex; flex-direction: column; gap: 3px; padding: 4px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.exw-top small { font-size: 11.5px; color: var(--ink-3); }
.exw-top b { font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.exw-top b span { font-family: var(--font-ui); font-size: 13px; color: var(--ink-3); font-weight: 600; }
.exw-c { display: grid; grid-template-columns: 30px auto minmax(0, 1fr); grid-template-areas: "ic n v" ". a a"; gap: 2px 10px; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid var(--line); }
.exw-ic { grid-area: ic; width: 30px; height: 30px; }
.exw-ic svg { width: 100%; height: 100%; display: block; }
.exw-n { grid-area: n; display: flex; flex-direction: column; min-width: 0; }
.exw-n b { font-size: 14px; } .exw-n small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.exw-v { grid-area: v; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.exw-v b { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.exw-v small { font-size: 11px; color: var(--ink-3); }
.exw-a { grid-area: a; display: flex; gap: 14px; justify-content: flex-end; padding-top: 4px; }
.exw-2fa { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 1px dashed var(--line-strong); background: transparent;
  border-radius: 10px; padding: 9px 11px; margin-top: 10px; color: var(--ink-2); font: 12px var(--font-ui); cursor: pointer; }
.exw-2fa svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.exw-2fa span { display: flex; flex-direction: column; gap: 2px; }
.exw-2fa b { color: var(--ink); font-size: 12.5px; }
.exw-2fa:hover { border-color: var(--accent); }
.exw-f { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.exw-f .exd-go, .exw-f .ex-hb { height: 38px; border-radius: 10px; margin: 0; justify-content: center; font-size: 12.5px; padding: 0 8px; }
.exw-f .ex-hb svg { width: 13px; height: 13px; }
.exw-in { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.exw-list { display: flex; flex-direction: column; margin: 14px -16px -16px; border-top: 1px solid var(--line); padding: 6px 0; }
.exw-in .exw-list { margin: 14px 0 0; border: 1px solid var(--line); border-radius: 12px; }
.exw-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 18px; text-align: left;
  font: 500 13px var(--font-ui); color: var(--ink); cursor: pointer; }
.exw-row:hover { background: var(--surface-2); }
.exw-row svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.exw-row em { margin-left: auto; font-style: normal; font: 600 12px var(--font-ui); }
.exw-row em.ok { color: var(--accent); } .exw-row em.warn { color: var(--warn); }
.ex-me .ex-caret { margin-left: 2px; }
#exm .ex-mbox.xwide { width: min(900px, 100%); }
.exd-xh { margin: 0 -26px -24px; border-top: 1px solid var(--line); max-height: 62vh; overflow: auto; }
.exd-xh table.ex-t { min-width: 700px; }
.exd-xh .ex-none.big, .exd-xh .exd-small { display: block; padding: 34px 26px; }

/* recent deposits in the deposit dialog */
.exd-hist { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.exd-hh { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-top: 10px; }
.exd-hh small { font-size: 11px; color: var(--ink-3); }
/* one line per deposit: amount, time, status, link to the transaction; a thin bar under the ones still confirming */
.exd-dep { display: grid; grid-template-columns: auto 1fr auto 16px; align-items: baseline; column-gap: 10px; row-gap: 7px; padding: 9px 2px; }
.exd-dep + .exd-dep { border-top: 1px solid var(--line); }
.exd-dep b { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.exd-dw { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exd-ds { font-size: 11.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.exd-ds.filled { color: var(--accent); }
.exd-ds.open { color: var(--warn); }
.exd-dep a { color: var(--ink-3); font-size: 13px; text-decoration: none; text-align: right; }
.exd-dep a:hover { color: var(--accent); }
.exd-dep .exd-bar { grid-column: 1 / -1; height: 3px; }
.exd-bar { display: block; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.exd-bar i { display: block; height: 100%; border-radius: 999px; background: var(--warn); transition: width .4s ease; }
.exd-bar.mini { display: inline-block; width: 60px; height: 4px; margin-left: 8px; vertical-align: middle; }
@media (prefers-reduced-motion: reduce) { .exd-bar i { transition: none; } }

/* 2FA steps */
.exd-steps { list-style: none; margin: 0; padding: 0; counter-reset: st; display: flex; flex-direction: column; gap: 14px; }
.exd-steps li { counter-increment: st; position: relative; padding-left: 38px; display: flex; flex-direction: column; gap: 4px; }
.exd-steps li::before { content: counter(st); position: absolute; left: 0; top: -1px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 700 12px var(--font-ui); }
.exd-steps li:not(:last-child)::after { content: ""; position: absolute; left: 11.5px; top: 28px; bottom: -12px; width: 1px; background: var(--line-strong); }
.exd-steps b { font-size: 13.5px; }
.exd-steps span { font-size: 12.5px; color: var(--ink-3); }
.exd-steps .exd-f { margin-top: 6px; }
.exd-2qr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; margin-top: 6px; padding: 12px; border-radius: 12px; background: var(--surface-2); }

/* account */
.exd-acc { display: flex; gap: 12px; align-items: center; padding-right: 36px; }
.exd-acc > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.exd-acc b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exd-av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); font: 700 18px var(--font-ui); flex: none; }
.exd-tag { align-self: flex-start; font: 600 11px var(--font-ui); padding: 2px 8px; border-radius: 999px; }
.exd-tag.ok { background: var(--accent-soft); color: var(--accent); }
.exd-tag.warn { background: var(--warn-soft); color: var(--warn); }
.exd-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.exd-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 0; color: var(--ink);
  font: 500 13.5px var(--font-ui); text-align: left; width: 100%; }
.exd-row + .exd-row { border-top: 1px solid var(--line); }
button.exd-row { cursor: pointer; }
button.exd-row:hover { background: var(--surface-2); }
.exd-ri { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.exd-ri svg { width: 16px; height: 16px; }
.exd-rl { flex: 1; }
.exd-rv { font: 600 12px var(--font-ui); color: var(--ink-3); }
.exd-rv.ok { color: var(--accent); } .exd-rv.warn { color: var(--warn); }
.exd-chev { width: 15px; height: 15px; color: var(--ink-3); }
.ex-qr { display: grid; place-items: center; }

@media (max-width: 480px) {
  #exm { padding: 0; place-items: end stretch; }
  #exm .ex-mbox, #exm .ex-mbox.wide { width: 100%; margin: 0; border-radius: 20px 20px 0 0; padding: 22px 18px 26px; max-height: 92vh; overflow-y: auto; }
  .exd-addr, .exd-2qr { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .exd-ad, .exd-key { align-items: center; }
  .exd-copy { align-self: center; }
}
@media (prefers-reduced-motion: reduce) { .exd-go.busy::after, .exd-load { animation: none; } .exd-i, .exd-go { transition: none; } }

/* ---------- responsive ---------- */
/* 01/12: on a short desktop screen (a 1410x843 laptop) the Buy and Sell buttons had slipped under the fold when the
   chart grew to 340px; a chart height the user dragged (inline style on the box) still wins */
@media (min-width: 1280px) and (max-height: 900px) { .ex-cv { height: 296px; } }
@media (max-width: 1279px) {
  .ex-term { grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "top top" "chart book" "form trades" "mine mine"; }
  .ex-asks, .ex-bids { flex: none; min-height: 0; overflow: visible; }
  .ex-tl { flex: none; max-height: 380px; }
  .ex-dp { flex: none; } .ex-dcv { flex: none; height: 220px; }
  .ex-btip { left: auto; right: calc(100% + 8px); }
}
@media (max-width: 859px) {
  .ex-term { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "chart" "form" "book" "trades" "mine"; }
  .ex-top { gap: 10px 18px; padding: 10px 12px; }
  .ex-pair, .ex-lastbox { border-right: 0; padding-right: 0; }
  .ex-stats { gap: 6px 16px; width: 100%; }
  .ex-acct { margin-left: 0; width: 100%; }
  .ex-acct .btn { flex: 1; justify-content: center; }
  .ex-me { flex: 0 1 auto !important; }
  .ex-cv { height: 300px; }
  .ex-msw { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 4px 14px 2px; background: var(--surface-3); border-radius: 8px; padding: 3px; }
  .ex-msw button { border: 0; border-radius: 6px; padding: 7px; font: 600 13px var(--font-ui); color: var(--ink-2); background: transparent; cursor: pointer; }
  .ex-msw button[data-ms="buy"].on { background: var(--accent); color: #fff; }
  .ex-msw button[data-ms="sell"].on { background: var(--down); color: #fff; }
  :root[data-theme="dark"] .ex-msw button.on { color: #07110a; }
  .ex-fss { grid-template-columns: 1fr; }
  .ex-form[data-ms="buy"] .ex-fs.sell, .ex-form[data-ms="sell"] .ex-fs.buy { display: none; }
  .ex-asks, .ex-bids { min-height: 0; }
  .ex-btip { display: none !important; }
  .ex-feeh { display: none; }
  /* tables: the site turns rows into label/value cards at this width, so they must not keep a desktop width */
  table.ex-t, .exd-xh table.ex-t { min-width: 0; }
  .ex-t td { white-space: normal; }
  /* things to tap need room for a finger */
  .ex-ib { width: 32px; height: 32px; margin: -8px -8px -8px 0; } .ex-ib svg { width: 18px; height: 18px; }
  .ex-row { line-height: 28px; }
  .ex-bvs { gap: 6px; } .ex-bv { width: 36px; height: 36px; padding: 10px; }
  .ex-sel { height: 36px; padding: 3px 6px; }
  /* 01/12: iOS zooms the whole page when a field under 16px gets the focus */
  .ex-f input, .exd-i input, .ex-sel { font-size: 16px; }
  .ex-tabs button { padding: 9px 0 10px; }
  .ex-ivs button { padding: 8px 10px; }
}
@media (max-width: 720px) { body.on-ex .ex-hacct { display: none; } .ex-acct { display: flex; } }
@media (prefers-reduced-motion: reduce) {
  .ex-lp.flash, .ex-row.new { animation: none; }
  .ex-go, .ex-f { transition: none; }
}

/* coin marks are SVG now (30/11): no letter, no background */
.ex-coin, .exd-coin, .ex-as i { background: none !important; color: inherit; overflow: hidden; }
.ex-coin svg, .exd-coin svg, .ex-as i svg { width: 100%; height: 100%; display: block; }
