.otc-reference {
  color-scheme: light;
  --bg: #f3f3fd;
  --panel: #fff;
  --well: #f8f7fd;
  --line: #dfdcf0;
  --text: #252042;
  --muted: #625d7a;
  --mint: #5030bd;
  --rose: #a92240;
  --error: #a92240;
  --buy: #08714c;
  background: radial-gradient(ellipse at 90% 0, #efe3ff, transparent 42%), var(--bg);
}
.otc-reference .site-header { border-color: #e4def2; background: #fff; }
.otc-reference .brand-mark { border-color: #d9cdfd; color: #5931c7; background: #f5efff; }
.otc-reference .site-nav a:hover { color: #5030bd; background: #f5efff; }
.otc-reference .site-nav a[aria-current] { color: #4b28ba; background: #eee8ff; }
.otc-page { max-width: 1088px; padding-block: 10px 52px; }
.otc-reference :focus-visible { outline-color: #6a44de; }
.market-switch { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin: 0 0 12px; padding: 0; border: 0; background: transparent; }
.market-switch a { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); text-align: center; text-decoration: none; font-size: 15px; }
.market-switch a[aria-current] { border-color: #7148f0; box-shadow: inset 0 0 0 1px #7148f0; color: #5030bd; }
.market-switch small { color: var(--muted); font-size: 11px; }
.market-overview { margin-bottom: 7px; border: 1px solid #ddd0fc; border-radius: 18px; background: linear-gradient(125deg, #fff, #f9f3ff 79%, #f5efff); }
.market-head { justify-content: start; padding: 16px 18px 11px; background: transparent; }
.pair-identity h1 { font-size: clamp(22px, 3vw, 31px); letter-spacing: -.033em; }
.pair-identity .token-mark { width: 37px; height: 37px; }
.pair-identity .token-pair .token-mark + .token-mark { box-shadow: -2px 0 0 #fff; }
.market-meta { flex-wrap: wrap; }
.market-state { padding: 2px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--well); font-size: 12px; }
.market-state[data-state=pending] { border-color: #efd9a7; color: #78500b; background: #fff4d9; }
.market-state[data-state=ready] { border-color: #bbe6d4; color: #136746; background: #e8f9f0; }
.market-hint { margin: 0; padding: 0 15px 8px; color: var(--muted); font-size: 13px; }
.market-shortcuts button small { margin-inline-start: 3px; font-size: 11px; font-weight: 500; }
.market-shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 14px 13px; }
.otc-page .market-shortcuts button { border-color: #d9cafa; border-radius: 11px; background: #fff; color: #5030bd; font-weight: 720; }
.otc-page .market-shortcuts button:disabled { opacity: .7; }
.market-overview .market-metrics { border-color: #e8ddfa; background: #f9f6ff; }
.market-overview .market-metrics > div { padding: 8px 15px; }
.market-overview .market-metrics > div + div { border-color: #e8ddfa; }
.market-overview .market-metrics dd { font-size: clamp(13px, 1.6vw, 18px); }
.metric-ask dd { color: var(--buy); }
.market-overview .market-metrics[data-state=pending] { grid-template-columns: 1fr; border-bottom: 0; }
.market-overview .market-metrics[data-state=pending] > div { display: flex; align-items: center; gap: 10px; border: 0; }
.market-overview .market-metrics[data-state=pending] dd { margin: 0; }
.market-overview .market-metrics[data-state=pending] .metric-live { display: none; }
.market-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 53px; padding: 6px 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.market-tools { display: flex; gap: 7px; }
.otc-page .market-tools button { border-color: #d3c5fb; border-radius: 20px; background: #fff; color: #4a28b7; font-size: 14px; font-weight: 680; }
.market-toolbar .account-bar { min-width: 0; gap: 9px; padding: 0; background: transparent; }
.market-toolbar .account-bar p { color: var(--muted); font-size: 13px; }
.wallet-readout { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.market-toolbar .wallet-identity { color: var(--ink); font-weight: 650; }
.market-toolbar .account-bar a { font-size: 12px; white-space: nowrap; }
.market-toolbar #connect { white-space: nowrap; }
.otc-page .primary, .otc-reference dialog .primary { border-color: #5731c6; background: #5731c6; color: #fff; }
.otc-page .primary:hover:not(:disabled), .otc-reference dialog .primary:hover:not(:disabled) { background: #4922b4; }

.market-stack { display: grid; gap: 12px; min-width: 0; }
.market-stack > section, #pendingStatus, #tradeStatus { scroll-margin-block-start: 12px; }
.pending-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 12px; padding: 9px 15px; border: 1px solid #ead8ab; border-radius: 10px; color: #78500b; background: #fff8e7; font-size: 14px; }
.pending-status p { margin: 0; }
.pending-status .pending-guide { flex: 1 0 100%; margin-top: 5px; padding-top: 6px; border-top: 1px solid #ead8ab; font-weight: 640; }
.otc-panel { border-color: var(--line); border-radius: 17px; background: #fff; box-shadow: 0 6px 24px #4c337408; }
.book-summary { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.book-summary p { margin: 0; font-size: 13px; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; padding: 15px 18px 9px; }
.side-head h2 { margin: 0; font-size: 19px; }
.side-head > span { color: var(--muted); font-size: 13px; text-align: end; }
.book-side { padding-bottom: 10px; }
.book-side .book-empty { margin: 0; padding: 9px 18px 15px; color: var(--muted); font-size: 14px; }
.book-side .book-table { width: calc(100% - 36px); margin-inline: 18px; }
.book-table th, .book-table td { padding: 9px 10px; text-align: start; }
.book-table th { border: 0; background: #f7f5fb; }
.book-table th:first-child { border-radius: 7px 0 0 7px; }
.book-table th:last-child { border-radius: 0 7px 7px 0; }
.book-table tbody tr:hover { background: #faf8ff; }
.book-table .price, .bid-side .price { color: var(--text); }
.book-table .book-action { white-space: nowrap; }
.book-table .book-maker { color: var(--muted); font-size: 12px; }
.book-table .book-maker small { color: var(--text); font: 12px var(--mono); }
.otc-page .book-table button[data-direction=buy] { color: #fff; background: #08714c; border-color: #08714c; }
.otc-page .book-table button[data-direction=sell] { color: #fff; background: #b32842; border-color: #b32842; }
.book-side .more-book { border-top: 0; }
.book-side .more-book button { width: 100%; color: #5030bd; border-color: #d5c8fc; }
.lookup-results { padding: 0 17px 17px; }
.lookup-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.lookup-fields button { white-space: nowrap; }
.lookup-results h3 { margin: 15px 0 7px; font-size: 16px; }
.lookup-results > button { margin-top: 8px; }
.sweep-panel, .create-panel { max-width: none; }
.sweep-directions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.otc-page .sweep-directions button { font-weight: 700; background: #fff; }
.otc-page .sweep-directions button[data-side=buy] { border-color: #b2dfcc; color: #08714c; }
.otc-page .sweep-directions button[data-side=buy][aria-pressed=true] { border-color: #08714c; color: #fff; background: #08714c; }
.otc-page .sweep-directions button[data-side=sell] { border-color: #ebbec6; color: #a92240; }
.otc-page .sweep-directions button[data-side=sell][aria-pressed=true] { border-color: #b32842; color: #fff; background: #b32842; }
.quote-sheet .quote-paid { color: var(--text); font-weight: 650; }
.quote-sheet .quote-fee { color: #97470d; font-weight: 650; }
.quote-sheet .quote-net { color: var(--buy); font-size: clamp(18px, 4.8vw, 22px); font-weight: 780; }
.quote-sheet div:has(.emphasis) { border-color: var(--line); }
.quote-sheet div:has(.quote-net) { margin-top: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.quote-sheet div:has(.quote-net) dt { color: var(--text); font-weight: 700; }
.network-note { margin: 0; color: var(--muted); font-size: 13px; }
.network-note summary { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; color: var(--text); }
.network-note summary span { color: var(--mint); font-size: 16px; }
.network-note p { margin: 0 0 3px; }
.trade-form input::placeholder { color: #766e89; }
.notice { margin: 0; border-color: #b8e5d3; background: #edfbf3; color: #176949; }
.notice[data-error=true] { border-color: #e6b5c0; background: #fff0f3; color: var(--error); }
.trade-help { margin: 14px 0 0; border-radius: 12px; background: #fff; }
.trade-help summary { min-height: 48px; padding-inline: 16px; }
.trade-help dl { padding-inline: 16px; }
.trade-help .live-disclosure { display: block; margin-inline: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.live-disclosure code { overflow-wrap: anywhere; font: 13px/1.5 var(--mono); }
.otc-reference dialog { border-color: #d7caf3; box-shadow: 0 16px 70px #34245a39; }
.otc-reference dialog::backdrop { background: #20173681; }
.fill-units { margin: 0; padding: 0; border: 0; }
.fill-units legend { margin-bottom: 5px; padding: 0; color: var(--muted); font-size: 14px; }
.fill-units label { position: relative; flex: 1; text-align: center; cursor: pointer; }
.fill-units input[type=radio] { position: absolute; width: 1px; min-height: 0; height: 1px; opacity: 0; }
.fill-units label span { display: grid; place-items: center; min-height: 44px; border: 1px solid transparent; border-radius: 6px; }
.fill-units input:checked + span { border-color: #c9b5f8; background: #f0e8ff; color: #4b28ba; font-weight: 660; }
.fill-units input:focus-visible + span { outline: 2px solid #7148f0; outline-offset: 1px; }

@media (max-width: 680px) {
  .otc-reference .site-nav:has(.nav-icon) { border-color: var(--line); background: #fff; }
  .otc-page { padding-bottom: 20px; }
  .market-switch { gap: 6px; margin-bottom: 9px; }
  .market-switch a { flex-wrap: wrap; gap: 2px 5px; font-size: 14px; }
  .market-head { padding: 12px 12px 10px; }
  .market-hint { padding-inline: 11px; }
  .market-shortcuts { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 0 10px 10px; gap: 6px; }
  .market-shortcuts button { padding-inline: 5px; font-size: 14px; }
  .market-toolbar { flex-wrap: wrap; gap: 7px; padding-inline: 8px; }
  .market-toolbar .account-bar { flex-wrap: wrap; width: 100%; }
  .market-toolbar .wallet-readout { flex: 1 0 100%; text-align: start; }
  .market-toolbar #connect { flex: 1; }
  .side-head { padding-inline: 12px; }
  .side-head > span { font-size: 12px; }
  .book-side .book-empty { padding-inline: 12px; }
  .book-side .book-table { width: calc(100% - 24px); margin-inline: 12px; }
  .lookup-results { padding-inline: 12px; }
}
@media (max-width: 420px) {
  .lookup-fields { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .book-table tbody tr { padding: 9px 1px; }
  .book-table .price { grid-column: 1; grid-row: 1; }
  .book-table td:nth-child(3) { grid-column: 2; grid-row: 1; }
  .book-table td:nth-child(4) { grid-column: 1; grid-row: 2; }
  .book-table td:nth-child(5) { grid-column: 2; grid-row: 2; }
  .book-table .book-maker { grid-column: 1/-1; grid-row: 3; }
}
