/* Volume Monitor */
:root, :root[data-theme="dark"] {
  --bg: #0b0e13; --panel: #11151c; --panel2: #171c25; --hover: #1a2029; --line: #222a35; --line2: #2c3542;
  --text: #e7eaf0; --muted: #8b94a5; --dim: #8893a4;
  --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: #606c7d;
  --up: #067a4d; --up-bg: rgba(8, 158, 99, .10); --down: #c4263b; --down-bg: rgba(217, 45, 67, .09);
  --warn: #995b00; --conf: #6d3fe0; --conf-bg: rgba(109, 63, 224, .10); --star: #d99a00;
  --teal: #087b63;
  --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: var(--fs-body, 1rem)/1.5 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: var(--fs-xs); }
.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-block: 12px; 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: var(--fs-h2); margin: 0; letter-spacing: -.01em; font-weight: 700; }
.sub { font-size: var(--fs-xs); color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--ctl-h); padding: .25rem .75rem;
  border: 1px solid var(--line2); border-radius: 8px; background: var(--panel2); cursor: pointer;
  font-size: .875rem; 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 { min-height: var(--ctl-h-sm); font-size: var(--fs-xs); padding: .125rem .625rem; }
.btn.icon { width: var(--ctl-h); 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 {
  padding-block: 7px; font-size: var(--fs-xs); color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--bg);
  position: relative; overflow-x: auto;
}
/* Phones: one readable, scrollable row, including before the first response and during reconnects. From 900px the
   row wraps instead (T-459: at 1920 the last venues were cut off behind the hidden scrollbar). */
.st-list { display: flex; gap: 4px 14px; width: max-content; min-height: 1.45em; }
@media (min-width: 56.25rem) {
  .status { overflow-x: visible; }
  .st-list { flex-wrap: wrap; width: auto; }
}
.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-block: 16px; 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 { position: relative; display: flex; gap: 6px; min-width: 0; overflow-x: auto; padding: 3px; }
.confbar-empty { padding: 3px 0; border: 1px solid transparent; font-size: 12px; white-space: nowrap; }
.cb {
  position: relative;
  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;
  flex-shrink: 0;
}
.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 {
  min-height: var(--ctl-h-sm); padding: .125rem .625rem; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px;
  color: var(--dim); cursor: pointer; font-size: var(--fs-sm); 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 {
  min-height: var(--ctl-h-sm); border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); padding: .125rem .5rem; font-size: var(--fs-sm);
}
.search { width: 110px; text-transform: uppercase; }
.search::placeholder { text-transform: none; color: var(--dim); opacity: 1; }
.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 {
  container: signals / inline-size;
  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: var(--fs-table); 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; }
/* Keep metadata readable through the composited flash and row tint. */
.feed tr.new :is(.age, .lat, .stb, .o.pending, .o.na),
.feed tr.upd td.o:is(.pending, .na) { color: var(--text); }
@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-block: 8px; }
.faq h2 { font-size: var(--fs-h2); margin: 8px 0 12px; }
.faq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 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: .9375rem; }
.faq p { margin: 8px 0 2px; color: var(--muted); font-size: .875rem; }
.faq p b { color: var(--text); font-weight: 600; }
.foot { padding-top: 20px; padding-bottom: 32px; border-top: 1px solid var(--line); margin-top: 20px; font-size: .875rem; display: grid; grid-template-columns: minmax(0, 1fr); 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-block: 10px; }
  .sub { display: none; }
  .actions { gap: 6px; }
  .btn { min-height: var(--ctl-h-sm); padding: .125rem .625rem; font-size: var(--fs-xs); }
  .btn.icon { width: var(--ctl-h-sm); }
  .live span { display: none; }
  .status { padding-block: 6px; gap: 4px 10px; }
  .layout { padding-block: 12px; 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; }
  /* Keep every measurement, with the five essential signal fields first. The desktop
     table remains scrollable; phone rows wrap rather than losing later columns. */
  .feed, .feed tbody { display: block; white-space: normal; }
  .feed thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .feed tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px; gap: 8px; border-bottom: 1px solid var(--line); background-image: linear-gradient(var(--tint, transparent), var(--tint, transparent)); }
  .feed td { display: block; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; text-align: start; background-image: none; }
  .feed td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font: 500 .6875rem/1.4 Inter, sans-serif; margin-bottom: 2px; }
  .feed td.c-coin { position: static; grid-column: 1 / -1; grid-row: 1; box-shadow: none; background-color: transparent; }
  .feed td:nth-child(4) { grid-column: 1; grid-row: 2; }
  .feed td:nth-child(5) { grid-column: 2; grid-row: 2; }
  .feed td:nth-child(6) { grid-column: 3; grid-row: 2; }
  .feed td.c-time { grid-column: 2 / -1; grid-row: 3; }
  .feed td:nth-child(3) { grid-column: 1; grid-row: 3; }
  .feed td:nth-child(7) { grid-column: 1; grid-row: 4; }
  .feed td:nth-child(8) { grid-column: 2; grid-row: 4; }
  .feed td:nth-child(10) { grid-column: 3; grid-row: 4; }
  .feed td:nth-child(9) { grid-column: 1 / -1; }
  .feed td:last-child { grid-column: 1 / -1; }
  .feed .coin { display: flex; }
  .feed .coin b { min-width: 0; font-size: .875rem; }
  .feed .cm { display: flex; flex-wrap: wrap; margin: 4px 0 0; }
  .feed :is(.chip, .badge, .dir, .bs) { flex-wrap: wrap; white-space: normal; }
  .feed .cfwrap { min-width: 0; max-width: none; }
  .feed .sub2 { display: block; margin-left: 0; }
  .feed .stb, .feed .trade { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
  .feed tr:is(.lv2, .lv3, .cf) td:first-child { box-shadow: none; }
  .filters .fgroup { flex-wrap: wrap; min-width: 0; max-width: 100%; }
  .filters .tg, .modebar .tg { white-space: normal; overflow-wrap: anywhere; }
  .modebar .fgroup.mode { flex-wrap: wrap; max-width: 100%; }
  .hot li { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .hot .net { grid-column: 2 / -1; }
  .hot .nm, .wl { overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
  .confbar { flex-wrap: wrap; }
  .confbar-items { flex: 1 1 100%; }
  .feed-meta .muted { display: none; }
  /* T-460: phones can't show page notifications (Android Chrome's `new Notification` throws; iOS needs a home-screen
     app), and the button pushed the home header to 3 rows (127px, sticky). Zoomed desktops (hover) keep it. */
  @media (hover: none) { #btn-notify { display: none; } }
  .tablewrap { max-height: 72vh; }
  .faq-grid { grid-template-columns: minmax(0, 1fr); }
}
.feed tr.w .coin b { color: var(--star); }
/* A rem breakpoint also responds to enlarged text: measurements keep their units
   together rather than splitting a large number across a very narrow column. */
@container signals (max-width: 24rem) {
  .feed tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feed td:nth-child(6) { grid-column: 2; grid-row: 3; }
  .feed td.c-time { grid-column: 1 / -1; grid-row: 4; }
  .feed td:nth-child(7) { grid-column: 1; grid-row: 5; }
  .feed td:nth-child(8) { grid-column: 2; grid-row: 5; }
  .feed td:nth-child(10) { grid-column: 1; grid-row: 6; }
}
.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; }
#mode-hint { width: 32ch; max-width: 100%; min-height: 1.45em; flex-shrink: 0; }

.qv .sub2 { display: block; margin-left: 0; }
.orc { display: block; margin-left: 0; color: var(--muted); text-decoration: none; white-space: nowrap; }
.orc:hover { text-decoration: underline; }

/* ---- 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; }
}

/* ---- home (T-459) ---- */
/* Scanner title + note as one block, so the .page grid gap doesn't open between them. */
.scan-head .note { margin-top: 4px; }
/* "Right now" heatmap tile: views.heat_thumb's mini profile, longs red left of the price line, shorts green right. */
.heat-thumb { display: block; height: 1.75rem; margin-top: 6px; }
.heat-thumb svg { display: block; width: 100%; height: 100%; }
.heat-thumb path { fill: none; stroke-width: 1.4; }
.heat-thumb .l { stroke: var(--down); } .heat-thumb .s { stroke: var(--up); }
.heat-thumb .m { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; opacity: .6; }
.now-fg.k-xfear .stat-value, .now-fg.k-fear .stat-value { color: var(--down); }
.now-fg.k-xgreed .stat-value, .now-fg.k-greed .stat-value { color: var(--up); }
/* "How it works": closed questions in a prose-width column, two columns on wide screens. */
.howto .faq-grid { grid-template-columns: minmax(0, 1fr); max-width: var(--wrap-text); }
@media (min-width: 82.5rem) { .howto .faq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: calc(2 * var(--wrap-text) + 10px); } }
.howto details[open] { border-color: var(--line2); }
/* "?" beside the alert-mode switch: modes, levels, confluence and LIQ/FUND/TRADE rows, anchored to the mode bar. */
.modebar { position: relative; }
.mode-help summary {
  list-style: none; display: grid; place-items: center; width: var(--ctl-h-sm); height: var(--ctl-h-sm); border-radius: 50%;
  border: 1px solid var(--line2); color: var(--muted); font-weight: 700; cursor: pointer; user-select: none;
}
.mode-help summary::-webkit-details-marker { display: none; }
.mode-help summary:hover, .mode-help[open] summary { color: var(--text); border-color: var(--muted); }
.mode-help-p {
  position: absolute; z-index: 15; top: calc(100% + 6px); left: 0; width: min(36rem, 100%); max-height: 70vh; overflow: auto;
  padding: 2px 14px; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow);
  font-size: var(--fs-xs); color: var(--muted);
}
.mode-help-p p { margin: 8px 0; }
.mode-help-p b { color: var(--text); font-weight: 600; }

/* Measured Sheets v1 canonical roles. Aliases activate only with the shell marker.
   Keep the incumbent root palette above until the shared shell is integrated. */
:root, :root[data-theme="dark"] {
  --sc-canvas: #101b2c; --sc-work: #142238; --sc-support: #1c2e48; --sc-raised: #223955;
  --sc-rule: #39516b; --sc-boundary: #a2b8d2; --sc-text: #edf3fb; --sc-muted: #c0cede;
  --sc-action: #b4cbff; --sc-selected: #254f99; --sc-up: #70deb5; --sc-down: #ffb2bc;
  --sc-warn: #f7cf80; --sc-focus: #bed2ff; --sc-warning: var(--sc-warn);
  --sc-overlay-shadow: 0 8px 28px rgba(0,0,0,.24);
  --sc-page: 1.75rem; --sc-section: 1.375rem; --sc-subsection: 1.125rem;
  --sc-body: 1rem; --sc-measure: .875rem; --sc-meta: .8125rem;
  --sc-space-1: 4px; --sc-space-2: 8px; --sc-space-3: 12px; --sc-space-4: 20px; --sc-space-5: 32px;
}
:root[data-theme="light"] {
  --sc-canvas: #edf2f8; --sc-work: #ffffff; --sc-support: #e2ebf6; --sc-raised: #d6e3f5;
  --sc-rule: #9bacbf; --sc-boundary: #697e99; --sc-text: #182c47; --sc-muted: #4a607a;
  --sc-action: #244eaa; --sc-selected: #dce7ff; --sc-up: #126c50; --sc-down: #ad2944;
  --sc-warn: #805716; --sc-focus: #244eaa;
  --sc-overlay-shadow: 0 8px 28px rgba(24,44,71,.14);
}
body[data-sc-ui="measured-sheets"] {
  --bg: var(--sc-canvas); --panel: var(--sc-work); --panel2: var(--sc-support); --hover: var(--sc-raised);
  --line: var(--sc-rule); --line2: var(--sc-boundary); --text: var(--sc-text);
  --muted: var(--sc-muted); --dim: var(--sc-muted); --conf: var(--sc-action);
  --up: var(--sc-up); --down: var(--sc-down); --warn: var(--sc-warn); --teal: var(--sc-up); --star: var(--sc-warn);
  /* Opaque contextual fields keep semantic foregrounds measurable on every row. */
  --up-bg: var(--sc-support); --down-bg: var(--sc-support); --conf-bg: var(--sc-support);
  --flash: var(--sc-support); --watch-bg: var(--sc-support); --conf-row: var(--sc-support); --shadow: none;
  --fs-2xs: var(--sc-meta); --fs-xs: var(--sc-meta); --fs-sm: var(--sc-measure);
  --fs-table: var(--sc-measure); --fs-body: var(--sc-body); --fs-h3: var(--sc-subsection);
  --fs-h2: var(--sc-section); --fs-h1: var(--sc-page); --fs-stat: var(--sc-section);
  --ctl-h: 2.25rem; --ctl-h-sm: 2.25rem;
  --wrap: 90rem; --wrap-wide: 105rem; --wrap-text: 72ch; --gutter: 32px;
  font-size: var(--sc-body); line-height: 1.5;
  background: var(--sc-canvas); color: var(--sc-text); caret-color: var(--sc-action);
  accent-color: var(--sc-action);
}
body[data-sc-ui="measured-sheets"] ::selection { background: var(--sc-selected); color: var(--sc-text); }
body[data-sc-ui="measured-sheets"] :where(a) { text-underline-offset: .2em; }
body[data-sc-ui="measured-sheets"] :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--sc-focus); outline-offset: 3px; scroll-margin-block: 6rem 1rem;
}
body[data-sc-ui="measured-sheets"] :where(input, textarea)::placeholder { color: var(--sc-muted); opacity: 1; }
@media (max-width: 40rem) {
  body[data-sc-ui="measured-sheets"] { --gutter: 16px; --ctl-h: 2.75rem; --ctl-h-sm: 2.75rem; }
}
@media (pointer: coarse) {
  body[data-sc-ui="measured-sheets"] { --ctl-h: 2.75rem; --ctl-h-sm: 2.75rem; }
}
