:root {
  --background: #04050a; --slip: #020308;
  --surface-0: #080b13; --surface-1: #0a0d15; --surface-2: #0c1019; --surface-3: #11151f;
  --foreground: #e7ebf2; --foreground-secondary: #828b9e; --foreground-tertiary: #4c5466;
  --border: #161a25; --border-strong: #20262f;
  --accent: #3b7bf0; --accent-bright: #5a93ff; --accent-muted: #3b7bf01a; --accent-line: #3b7bf059;
  --yes: #29b07a; --yes-secondary: #3ecf94; --yes-bg: #29b07a1a; --yes-line: #29b07a59;
  --no: #e2495c; --no-secondary: #f06a7b; --no-bg: #e2495c1a; --no-line: #e2495c59;
  --warning: #f0a742; --warning-bg: #f0a7421a; --warning-line: #f0a74259;
  --radius-xs: 3px; --radius-sm: 4px; --radius-lg: 6px; --radius-modal: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--background); color: var(--foreground); font: 400 14px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.micro { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--foreground-tertiary); }
.muted { color: var(--foreground-secondary); }
.accent { color: var(--accent-bright); }
.up { color: var(--yes-secondary); } .down { color: var(--no-secondary); }
.warn { color: var(--warning); }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }

.nav { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: var(--surface-0); border-bottom: 1px solid var(--border); }
.nav-left, .nav-right { display: flex; align-items: center; gap: 12px; }
.wordmark { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.tag { color: var(--foreground-tertiary); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--foreground-tertiary); }
.dot.live { background: var(--yes); } .dot.down-state { background: var(--warning); }
.nav-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.nav-stat-v { font-size: 14px; font-weight: 600; }
.btn { border-radius: var(--radius-lg); padding: 9px 14px; font-size: 13px; font-weight: 600; transition: .15s; }
.btn-ghost { background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--foreground); }
.btn-ghost:hover { border-color: var(--accent-line); }
.btn-accent { background: var(--accent); color: #fff; width: 100%; padding: 13px; }
.btn-plain { color: var(--foreground-tertiary); width: 100%; padding: 8px; font-size: 12px; }
.btn-buy { background: var(--yes); color: var(--background); width: 100%; padding: 13px; font-size: 14px; font-weight: 700; }
.btn-sell { background: var(--no); color: #fff; width: 100%; padding: 13px; font-size: 14px; font-weight: 700; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.badge { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 9px 12px; border-radius: var(--radius-lg); }
.badge-warn { background: var(--warning-bg); border: 1px solid var(--warning-line); color: var(--warning); }
.badge-ok { background: var(--yes-bg); border: 1px solid var(--yes-line); color: var(--yes-secondary); }

.arbbar { height: 36px; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--slip); border-bottom: 1px solid var(--border); font-size: 12px; overflow: hidden; white-space: nowrap; }
.arb-tag { color: var(--warning); flex: none; }
.arb-body { flex: 1; overflow: hidden; text-overflow: ellipsis; color: var(--foreground-secondary); }
.arb-body .hit { color: var(--yes-secondary); font-weight: 600; margin-right: 26px; }
.arb-coh { color: var(--foreground-secondary); flex: none; }

.grid {
  height: calc(100vh - 92px); display: grid; gap: 10px; padding: 10px;
  grid-template-columns: 330px minmax(0, 1fr) 300px 322px;
  grid-template-rows: minmax(0, 1fr) 66px 336px;
  grid-template-areas:
    "qs   chart book ticket"
    "qs   micro book ticket"
    "acct blot  tape ticket";
}
.col-qs { grid-area: qs; } .col-acct { grid-area: acct; }
.col-chart { grid-area: chart; } .col-micro { grid-area: micro; } .col-blot { grid-area: blot; }
.col-book { grid-area: book; } .col-tape { grid-area: tape; } .col-ticket { grid-area: ticket; }
.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.col-ticket { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.panel-h { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--foreground-tertiary); margin-bottom: 10px; flex: none; }
.sub-h { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--foreground-tertiary); margin: 12px 0 6px; flex: none; }
.scroll { overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll::-webkit-scrollbar, .col-ticket::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-thumb, .col-ticket::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.empty { color: var(--foreground-tertiary); font-size: 12px; padding: 14px 4px; }
.divider { height: 1px; background: var(--border); margin: 16px 0 12px; flex: none; }

.input { width: 100%; background: var(--surface-0); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; color: var(--foreground); font-size: 12px; flex: none; margin-bottom: 8px; }
.input:focus { outline: none; border-color: var(--accent-line); }
.input::placeholder { color: var(--foreground-tertiary); }
.qgroup { margin-bottom: 14px; }
.qhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px 2px; }
.qname { font-size: 12px; font-weight: 700; color: var(--foreground-secondary); }
.qsum { font-family: var(--mono); font-size: 10px; font-weight: 700; flex: none; }
.orow { display: block; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; border-left: 2px solid transparent; }
.orow:hover { background: var(--surface-3); }
.orow.is-on { background: var(--accent-muted); border-left-color: var(--accent); }
.orow-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.oname { font-size: 12px; font-weight: 500; color: var(--foreground-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow.is-on .oname { color: var(--foreground); font-weight: 600; }
.opx { font-family: var(--mono); font-size: 12px; font-weight: 700; flex: none; }
.obar { height: 3px; background: var(--surface-3); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.obar-fill { height: 100%; background: var(--yes); border-radius: 2px; transition: width .3s; }
.otag { font-family: var(--mono); font-size: 9px; color: var(--foreground-tertiary); margin-top: 3px; }

.kv { display: flex; flex-direction: column; gap: 6px; flex: none; }
.kv div { display: flex; justify-content: space-between; font-size: 11px; }
.kv .k { color: var(--foreground-secondary); }
.kv .v { font-family: var(--mono); font-weight: 600; }
.payout-line { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 10px; }
.payout-v { font-size: 15px; font-weight: 700; color: var(--accent-bright); }
.imb { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; flex: none; margin-top: 6px; }
.imb-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.note { font-size: 10px; color: var(--foreground-tertiary); text-align: center; margin-top: 8px; flex: none; }
.note.left { text-align: left; }

.chart-h { flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.chart-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.sym { font-size: 17px; font-weight: 700; color: var(--foreground); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.px { font-size: 20px; font-weight: 700; }
.seg { display: flex; background: var(--surface-0); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { padding: 4px 10px; font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--foreground-secondary); }
.seg button.is-on { background: var(--accent-muted); color: var(--accent-bright); }
.q-context { font-size: 11px; color: var(--foreground-tertiary); margin-bottom: 6px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chart { flex: 1; width: 100%; min-height: 0; }

.col-micro { flex-direction: row; align-items: center; gap: 8px; padding: 10px 14px; }
.mstat { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mstat-v { font-size: 15px; font-weight: 600; white-space: nowrap; }

.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 8px; flex: none; align-items: center; }
.tabs button { font-size: 12px; font-weight: 600; color: var(--foreground-tertiary); padding-bottom: 6px; margin-bottom: -9px; border-bottom: 2px solid transparent; }
.tabs button.is-on { color: var(--foreground); border-bottom-color: var(--accent); }
.tabs-sm { gap: 14px; margin-top: 12px; }
.tab-right { margin-left: auto; color: var(--no-secondary) !important; font-size: 11px !important; }
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
th { text-align: right; font-size: 9px; font-weight: 600; letter-spacing: .04em; color: var(--foreground-tertiary); padding: 4px 6px; position: sticky; top: 0; background: var(--surface-1); }
th:first-child, td:first-child { text-align: left; }
td { text-align: right; padding: 6px; border-top: 1px solid var(--border); color: var(--foreground-secondary); white-space: nowrap; }
td.k { color: var(--foreground); font-weight: 600; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.mini { padding: 3px 8px; border-radius: var(--radius-xs); background: var(--surface-3); border: 1px solid var(--border-strong); font-size: 10px; font-weight: 600; color: var(--foreground-secondary); }
.mini:hover { border-color: var(--no-line); color: var(--no-secondary); }

.row-h { display: flex; justify-content: space-between; font-size: 9px; font-weight: 600; letter-spacing: .04em; color: var(--foreground-tertiary); padding: 6px 4px; flex: none; }
.book-side { flex: none; }
.brow { position: relative; display: flex; justify-content: space-between; padding: 2px 4px; font-family: var(--mono); font-size: 11px; cursor: pointer; }
.brow:hover { background: var(--surface-3); }
.bar { position: absolute; right: 0; top: 0; bottom: 0; border-radius: 2px; }
.brow > span { position: relative; z-index: 1; }
.brow .p { width: 78px; font-weight: 500; }
.brow .s, .brow .t { flex: 1; text-align: right; color: var(--foreground-secondary); }
.ask .p { color: var(--no-secondary); } .bid .p { color: var(--yes-secondary); }
.book-mid { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 4px; border-block: 1px solid var(--border); margin: 4px 0; flex: none; }
.mid { font-size: 15px; font-weight: 700; }
.arb-box { border-radius: var(--radius-lg); padding: 10px 12px; margin-top: 12px; flex: none; background: var(--surface-3); border: 1px solid var(--border-strong); }
.arb-box.hit { background: var(--yes-bg); border-color: var(--yes-line); }
.arb-detail { font-size: 11px; color: var(--foreground-secondary); margin-top: 4px; }
.arb-verdict { font-size: 13px; font-weight: 700; margin-top: 4px; }
.impact { display: flex; flex-direction: column; gap: 3px; font-family: var(--mono); font-size: 10px; flex: none; }
.impact div { display: flex; justify-content: space-between; color: var(--foreground-secondary); }

.trow { display: flex; justify-content: space-between; padding: 2px 4px; font-family: var(--mono); font-size: 11px; }
.trow .s { color: var(--foreground-secondary); } .trow .t { color: var(--foreground-tertiary); }

.side-toggle { display: flex; gap: 8px; flex: none; }
.side-toggle button { flex: 1; padding: 8px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border-strong); display: flex; flex-direction: column; gap: 2px; align-items: center; }
.side-toggle .s-name { font-size: 13px; font-weight: 700; color: var(--foreground-secondary); }
.side-toggle .s-px { font-size: 13px; font-weight: 700; color: var(--foreground-tertiary); }
.side-toggle button.is-on.is-yes { background: var(--yes); border-color: var(--yes); }
.side-toggle button.is-on:not(.is-yes) { background: var(--no); border-color: var(--no); }
.side-toggle button.is-on .s-name, .side-toggle button.is-on .s-px { color: var(--background); }
.fld { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; flex: none; }
.fld-in { display: flex; align-items: center; background: var(--surface-0); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 10px; }
.fld-in:focus-within { border-color: var(--accent-line); }
.fld-in input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--foreground); padding: 9px 0; font-size: 14px; font-weight: 600; }
.fld-btn { font-size: 10px; font-weight: 700; color: var(--accent-bright); padding-left: 8px; white-space: nowrap; }
.payout-box { background: var(--accent-muted); border: 1px solid var(--accent-line); border-radius: var(--radius-lg); padding: 10px 12px; margin: 12px 0; flex: none; }
.payout-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.payout-big { font-size: 20px; font-weight: 700; }
.payout-ret { font-size: 15px; font-weight: 700; color: var(--yes-secondary); }
.payout-sub { font-size: 11px; color: var(--foreground-secondary); margin-top: 4px; }
.payout-sub.warn { color: var(--no-secondary); }

.coh { display: flex; flex-direction: column; gap: 5px; flex: none; }
.coh div { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--foreground-secondary); }
.coh .sum { border-top: 1px solid var(--border-strong); padding-top: 6px; margin-top: 3px; font-weight: 700; }
.coh-q { font-size: 11px; font-weight: 600; color: var(--foreground-secondary); margin-bottom: 8px; }
.coh-note { font-size: 10px; color: var(--foreground-tertiary); margin-top: 8px; line-height: 1.45; }

.toast-wrap { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--surface-2); border: 1px solid var(--border-strong); border-left-width: 3px; border-radius: var(--radius-lg); padding: 10px 14px; font-size: 12px; max-width: 340px; box-shadow: 0 8px 32px #0009; }
.toast.ok { border-left-color: var(--yes); } .toast.err { border-left-color: var(--no); } .toast.info { border-left-color: var(--accent); }
.modal { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-modal); padding: 28px; width: 460px; color: var(--foreground); box-shadow: 0 24px 64px #0009; }
.modal::backdrop { background: #04050ae6; }
.modal h2 { margin: 0 0 10px; font-size: 20px; }
.modal p { margin: 0 0 18px; font-size: 13px; color: var(--foreground-secondary); line-height: 1.5; }
.addr { background: var(--surface-0); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; }
.addr .mono { font-size: 12px; word-break: break-all; }
.points { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.points li::before { margin-right: 8px; }
.points .yes { color: var(--yes-secondary); } .points .yes::before { content: "✓"; }
.points .warn { color: var(--warning); } .points .warn::before { content: "!"; }
.modal-status { min-height: 16px; margin-bottom: 10px; color: var(--foreground-secondary); }
@media (max-width: 1560px) { .grid { grid-template-columns: 280px minmax(0,1fr) 260px 300px; } }
