/* Volume Monitor */
:root, :root[data-theme="dark"] {
  --bg: #0b0e13; --panel: #11151c; --panel2: #171c25; --hover: #1a2029; --line: #222a35; --line2: #2c3542;
  --text: #e7eaf0; --muted: #8b94a5; --dim: #5d6778;
  --up: #1fcf8a; --up-bg: rgba(31, 207, 138, .12); --down: #f2495a; --down-bg: rgba(242, 73, 90, .12);
  --warn: #f5a524; --conf: #b394ff; --conf-bg: rgba(179, 148, 255, .14); --star: #ffc53d;
  --teal: #4fe0bf;   /* venue colours (--v-<name>) come from the registry: base.html #vm-venue-css */
  --flash: rgba(179, 148, 255, .22); --watch-bg: rgba(255, 197, 61, .07); --conf-row: rgba(179, 148, 255, .07);
  --shadow: 0 1px 0 rgba(255,255,255,.02), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6f9; --panel: #ffffff; --panel2: #f7f8fa; --hover: #f1f4f8; --line: #e4e7ec; --line2: #d6dbe3;
  --text: #121826; --muted: #5a6475; --dim: #8b94a3;
  --up: #089e63; --up-bg: rgba(8, 158, 99, .10); --down: #d92d43; --down-bg: rgba(217, 45, 67, .09);
  --warn: #c77800; --conf: #6d3fe0; --conf-bg: rgba(109, 63, 224, .10); --star: #d99a00;
  --teal: #0f9e80;
  --flash: rgba(109, 63, 224, .14); --watch-bg: rgba(217, 154, 0, .08); --conf-row: rgba(109, 63, 224, .05);
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--up); } .down { color: var(--down); }
[hidden] { display: none !important; }
.mono, .feed td { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace; }

/* ---- header ---- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 30px; height: 30px; flex: none; }
.logo rect { fill: var(--panel2); stroke: var(--line2); }
.logo path { fill: var(--up); }
h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; font-weight: 700; }
.sub { font-size: 12px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line2); border-radius: 8px; background: var(--panel2); cursor: pointer;
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.on { border-color: var(--up); color: var(--up); background: var(--up-bg); }
.btn.off { color: var(--muted); }
.btn.attn { border-color: var(--warn); color: var(--warn); animation: pulse 2s ease-in-out infinite; }
.btn.sm { height: 28px; font-size: 12px; padding: 0 10px; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.icon svg { width: 16px; height: 16px; fill: currentColor; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px rgba(245,165,36,.18); } }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-right: 4px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.live.ok i { background: var(--up); box-shadow: 0 0 0 3px var(--up-bg); }
.live.bad i { background: var(--down); }
.live.demo i { background: var(--conf); }

/* ---- status strip ---- */
.status {
  display: flex; gap: 6px 14px; flex-wrap: wrap; padding: 7px 20px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.status.quiet { padding: 0; border: 0; }   /* no strip yet: the live region stays in the page, 0 px tall */
.st-list { display: contents; }
.st { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.st i { width: 7px; height: 7px; border-radius: 50%; background: var(--up); }
.st.amber i { background: var(--warn); } .st.red i { background: var(--down); }
.st b { color: var(--text); font-weight: 500; }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 16px; padding: 16px 20px; align-items: start; }
.feed-col { min-width: 0; }
.side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; }

/* ---- confluence bar ---- */
.confbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 10px;
  border: 1px solid var(--conf-bg); background: linear-gradient(90deg, var(--conf-bg), transparent 70%);
  border-radius: 10px; overflow: hidden;
}
.confbar-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--conf); white-space: nowrap; }
.confbar-items { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.confbar-items::-webkit-scrollbar { display: none; }
.cb {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-size: 12px;
}
.cb b { font-weight: 700; }
.cb .n { color: var(--conf); font-weight: 600; }
.cb:hover { border-color: var(--conf); }

/* ---- filters ---- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.fgroup { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: var(--panel); }
.fgroup .tg { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.fgroup .tg:last-child { border-right: 0; }
.tg {
  height: 30px; padding: 0 10px; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px;
  color: var(--dim); cursor: pointer; font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.tg:hover { color: var(--text); }
/* --vc = the venue's colour, set on .v-<venue> and .chip.<venue> by base.html #vm-venue-css */
.tg.on { color: var(--text); background: var(--panel2); box-shadow: inset 0 -2px 0 var(--vc, var(--muted)); }
.tg.up.on { color: var(--up); box-shadow: inset 0 -2px 0 var(--up); }
.tg.down.on { color: var(--down); box-shadow: inset 0 -2px 0 var(--down); }
.tg.conf.on { color: var(--conf); border-color: var(--conf); background: var(--conf-bg); box-shadow: none; }
.tg.star.on { color: var(--star); border-color: var(--star); box-shadow: none; }
.fsel { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.fsel select, .search {
  height: 30px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); padding: 0 8px; font-size: 12.5px;
}
.search { width: 110px; text-transform: uppercase; }
.search::placeholder { text-transform: none; color: var(--dim); }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; padding: 0 4px; }
.ftoggle, .feed td .tm { display: none; }
.feed-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin: 2px 2px 6px; flex-wrap: wrap; }
#count { color: var(--text); font-weight: 500; }

/* ---- feed table ---- */
.tablewrap {
  position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow);
  overflow: auto; max-height: calc(100vh - 200px); min-height: 280px; overscroll-behavior: contain;
}
.feed { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; white-space: nowrap; }
.feed th {
  position: sticky; top: 0; z-index: 2; background: var(--panel2); color: var(--muted); font: 600 11px/1 Inter, sans-serif;
  text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line);
}
.feed td { padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.feed .r { text-align: right; }
.feed tbody tr { transition: background-color .6s; }
.feed tbody tr:hover td { background-color: var(--hover); }
.feed td.c-time, .feed th.c-time { padding-left: 10px; }
.feed td.c-time { color: var(--muted); }
.feed td.c-time .age { display: block; font-size: 10.5px; color: var(--dim); }
.feed td.c-time .lat { display: block; max-width: 9em; white-space: normal; font-size: 10px; line-height: 1.25; color: var(--dim); }
.feed td.c-coin { position: sticky; left: 0; z-index: 1; background-color: var(--panel); }
.feed th.c-coin { position: sticky; left: 0; z-index: 3; }
.feed tr.lv2 td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.feed tr.lv3 td:first-child { box-shadow: inset 3px 0 0 var(--down); }
.feed tr.cf td:first-child { box-shadow: inset 3px 0 0 var(--conf); }
.feed td { background-image: linear-gradient(var(--tint, transparent), var(--tint, transparent)); }
.feed tr.cf { --tint: var(--conf-row); }
.feed tr.w { --tint: var(--watch-bg); }
.feed tr.cf.w { --tint: var(--conf-row); }
.feed tr.new td { animation: flash 2.4s ease-out; }
.feed tr.upd td.o { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 25% { background-color: var(--flash); } 100% { background-color: transparent; } }

.coin, .cm { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.cm { margin-left: 5px; }
.coin b { font-family: Inter, sans-serif; font-weight: 700; font-size: 13.5px; letter-spacing: -.01em; cursor: pointer; }
.coin b:hover { text-decoration: underline; text-decoration-color: var(--dim); }
.stb { background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--dim); font-size: 14px; line-height: 1; }
.stb:hover { color: var(--star); }
.stb.on { color: var(--star); }
/* <span class="chip binance">: venue colour via --vc; a chip without a venue inherits its colour */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 5px; font: 600 10.5px/16px Inter, sans-serif;
  border: 1px solid currentColor; letter-spacing: .02em; white-space: nowrap; color: var(--vc);
}
.chip .m { color: var(--muted); font-weight: 500; }
.chip.cfc { background: var(--conf-bg); border-color: transparent; }
.cfwrap { display: flex; flex-wrap: wrap; gap: 3px 4px; align-items: center; min-width: 150px; max-width: 190px; white-space: normal; }
.cfn { color: var(--conf); font: 700 11px Inter, sans-serif; margin-right: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 6px; border-radius: 5px;
  font: 700 10.5px/16px Inter, sans-serif; letter-spacing: .04em; background: var(--panel2); color: var(--muted); border: 1px solid var(--line2);
}
.badge.liq { color: var(--warn); border-color: rgba(245,165,36,.4); }
.badge.funding { color: var(--teal); }
.badge.trade { color: var(--conf); border-color: var(--conf-bg); }
.pips { display: inline-flex; gap: 2px; }
.pips i { width: 3px; height: 9px; border-radius: 1px; background: var(--line2); }
.pips i.on { background: var(--muted); }
.lv2 .pips i.on { background: var(--warn); }
.lv3 .pips i.on { background: var(--down); }
.sub2 { font: 500 10.5px Inter, sans-serif; color: var(--muted); margin-left: 4px; }

.dir { font: 700 11px Inter, sans-serif; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; }
.dir.buy { color: var(--up); background: var(--up-bg); }
.dir.sell { color: var(--down); background: var(--down-bg); }
.dir.mixed { color: var(--muted); background: var(--panel2); }
.qv { font-weight: 600; }
.x { font-weight: 600; }
.x.hi { color: var(--warn); } .x.hot { color: var(--down); }
.bs { display: inline-flex; align-items: center; gap: 6px; }
.bs .bar { width: 28px; height: 4px; border-radius: 2px; background: var(--down); opacity: .85; overflow: hidden; }
.bs .bar i { display: block; height: 100%; background: var(--up); }
.o.pending { color: var(--dim); }
.o.na { color: var(--dim); }
.trade {
  display: inline-block; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line2); text-decoration: none;
  font: 600 11.5px Inter, sans-serif; color: var(--text); background: var(--panel2);
}
.trade:hover { border-color: var(--muted); }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty b { color: var(--text); display: block; margin-bottom: 4px; font-size: 14px; }
.nfa { font-size: 11.5px; color: var(--dim); margin: 8px 2px 0; }

/* ---- side ---- */
.card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.card h2 { font-size: 13px; margin: 0; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }
.hot { list-style: none; margin: 0; padding: 0; counter-reset: h; }
.hot li {
  display: grid; grid-template-columns: 18px 1fr auto auto; gap: 8px; align-items: center; padding: 5px 6px; margin: 0 -6px;
  border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.hot li:hover, .hot li.sel { background: var(--hover); }
.hot li::before { counter-increment: h; content: counter(h); color: var(--dim); font-size: 11px; text-align: right; }
.hot .nm { font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
.hot .hb { display: inline-block; height: 4px; border-radius: 2px; background: var(--muted); opacity: .45; margin-right: 6px; vertical-align: middle; }
.hot .h { font-family: "JetBrains Mono", monospace; color: var(--muted); font-size: 11.5px; }
.hot .net { font-family: "JetBrains Mono", monospace; font-size: 11.5px; min-width: 62px; text-align: right; }
.watchlist { display: flex; flex-wrap: wrap; gap: 6px; }
.wl { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 999px; border: 1px solid var(--line2); font-size: 12px; font-weight: 600; }
.wl span { cursor: pointer; }
.wl button { background: none; border: 0; color: var(--dim); cursor: pointer; padding: 0 4px; font-size: 13px; }
.wl button:hover { color: var(--down); }
.cta {
  display: block; text-decoration: none; padding: 14px; border-radius: 10px; border: 1px dashed var(--line2);
  background: linear-gradient(135deg, rgba(42, 171, 238, .12), transparent 70%);
}
.cta:hover { border-color: #2aabee; }
.cta-t { display: block; font-weight: 700; font-size: 13.5px; }
.cta-s { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.row-btns { display: flex; gap: 8px; margin-top: 10px; }

/* ---- faq / footer ---- */
.faq { padding: 8px 20px 8px; max-width: 1400px; }
.faq h2 { font-size: 16px; margin: 8px 0 12px; }
.faq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; align-items: start; }
.faq details { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 10px 14px; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.faq p { margin: 8px 0 2px; color: var(--muted); font-size: 13px; }
.faq p b { color: var(--text); font-weight: 600; }
.foot { padding: 20px 20px 32px; border-top: 1px solid var(--line); margin-top: 20px; font-size: 13px; display: grid; gap: 8px; color: var(--muted); }
.foot a { color: var(--text); }
.addr {
  font-family: "JetBrains Mono", monospace; font-size: 12px; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 6px; padding: 3px 8px; cursor: pointer; word-break: break-all; text-align: left; max-width: 100%;
}
.addr:hover { border-color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20; background: var(--text); color: var(--bg);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; box-shadow: 0 8px 30px rgba(0,0,0,.3);
}

/* ---- responsive ---- */
@media (max-width: 1320px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  .sub { display: none; }
  .actions { gap: 6px; }
  .btn { height: 30px; padding: 0 10px; font-size: 12px; }
  .live span { display: none; }
  .status { padding: 6px 16px; gap: 4px 10px; }
  .layout { padding: 12px 16px; gap: 12px; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .filters { gap: 6px; }
  .search { flex: 1 1 90px; }
  .ftoggle { display: inline-flex; margin-bottom: 8px; }
  .filters { display: none; }
  .filters.open { display: flex; }
  .feed .c-time { display: none; }
  .feed td .tm { display: inline; font-size: 10.5px; color: var(--dim); }
  .cm { display: flex; margin: 2px 0 0 22px; gap: 6px; }
  .feed td.c-coin { padding-top: 5px; padding-bottom: 5px; }
  .feed tr.lv2 td.c-coin { box-shadow: inset 3px 0 0 var(--warn), 1px 0 0 var(--line); }
  .feed tr.lv3 td.c-coin { box-shadow: inset 3px 0 0 var(--down), 1px 0 0 var(--line); }
  .feed tr.cf td.c-coin { box-shadow: inset 3px 0 0 var(--conf), 1px 0 0 var(--line); }
  .feed td.c-coin, .feed th.c-coin { padding-left: 10px; box-shadow: 1px 0 0 var(--line); }
  .feed-meta .muted { display: none; }
  .tablewrap { max-height: 72vh; }
  .feed td.c-time .age { display: none; }
  .faq, .foot { padding-left: 16px; padding-right: 16px; }
  .faq-grid { grid-template-columns: minmax(0, 1fr); }
}
.feed tr.w .coin b { color: var(--star); }
.hot li.none { display: block; cursor: default; } .hot li.none::before { content: none; }

/* Alert mode switch: always visible, above the filters. */
.modebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.modebar .fgroup.mode .tg { padding-left: 14px; padding-right: 14px; font-weight: 600; }

.qv .sub2 { display: block; margin-left: 0; }

/* ---- accessibility (T-161) ---- */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.sr-pref { display: flex; margin-top: 10px; }
.tg:focus-visible, .btn:focus-visible, .cb:focus-visible, .stb:focus-visible, .linkbtn:focus-visible, .trade:focus-visible,
[data-coin]:focus-visible, .wl button:focus-visible, .cta:focus-visible, .fsel select:focus-visible, .search:focus-visible,
.check input:focus-visible {
  outline: 2px solid var(--conf); outline-offset: 2px;
}
.fgroup .tg:focus-visible { outline-offset: -2px; }   /* .fgroup clips its children (overflow: hidden) */
@media (prefers-reduced-motion: reduce) {
  .feed tr.new td, .feed tr.upd td.o, .btn.attn { animation: none; }
  .feed tbody tr { transition: none; }
}
