/* Volume Monitor - shared site layout + reusable components (loaded after app.css).
   Uses app.css variables only (--bg --panel --panel2 --hover --line --line2 --text --muted --dim
   --up --up-bg --down --down-bg --warn --conf ...), so dark/light themes just work.

   Layout (base.html):  .top > .brand(.brand-name) + .sitenav(a[aria-current=page]) + .actions
                        .footnav in the footer
   Page heading:        <section class="pagehead"><h1>..</h1><p class="lede">..</p><p class="meta">..</p></section>
   Page body:           <main class="page"> .. </main>  (16px gutters on phones, 20px on desktop, max 1400px)
                        .grid2 = two columns >= 1000px (use .span2 to span both), .section h2 = section title
   KPI cards:           .stat-grid > .stat > .stat-label + .stat-value + .stat-sub (+ .split > i.l / i.s bar)
                        .tag (small pill), .tag.warn for "partial" etc.
   Panels:              .panel > .panel-h(h2 + .muted note) + content   (card with header row)
   Data tables:         .tablescroll > table.dtable  (sticky header, th/td.r = right-aligned numbers,
                        td.up / td.down colors, th[data-sort] clickable, .coinlink for /coin/<BASE> links)
   Segmented control:   app.css .fgroup.seg > button.tg ; active = .on or aria-pressed="true"
   Chart container:     .chart (relative; put an <svg> inside) + .chart-tip tooltip + .legend > .key.l/.key.s
   History chart:       {% include "partials/series_chart.html" with metric="oi" base=base title=".." %} -> .panel.sc
                        (several series in one chart: layers='[...]' -> .sc-legend; wide="1" -> .sc-wide in .sc-grid)
   Referral CTAs:       {% include "partials/signup_cta.html" with venue="bybit"|"hyperliquid" page="<id>" %} -> .su card;
                        .su-row = cards side by side, .su-strip = titled strip (.su-strip-h), .card.su-card = stacked list,
                        .su-mini = tiny inline "sign up" link (table rows). Footer disclosure: .disclose
   Misc:                .hide-sm (hidden <= 640px), .note (small muted paragraph), .num (tabular mono numbers), .faq from app.css
*/

/* ---- header / nav ---- */
.brand { text-decoration: none; color: var(--text); border-radius: 8px; }
.brand:focus-visible, .sitenav a:focus-visible { outline: 2px solid var(--conf); outline-offset: 2px; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.top { gap: 10px 16px; }
.sitenav { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; }
.sitenav a {
  display: inline-flex; align-items: center; height: 32px; padding: 0 11px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.sitenav a:hover { color: var(--text); background: var(--hover); }
.sitenav a[aria-current="page"] { color: var(--text); background: var(--panel2); box-shadow: inset 0 -2px 0 var(--up); }
.footnav { line-height: 1.9; }
.footnav a { text-decoration: none; }
.footnav a:hover { text-decoration: underline; }

/* ---- page heading ---- */
.pagehead { padding: 18px 20px 6px; max-width: 1400px; }
.pagehead h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 6px; font-weight: 700; }
.lede { margin: 0; max-width: 78ch; color: var(--muted); font-size: 14px; }
.lede b, .lede strong { color: var(--text); font-weight: 600; }
.pagehead .meta { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pagehead .meta b { color: var(--text); font-weight: 500; }

/* ---- page body ---- */
.page { padding: 12px 20px 8px; max-width: 1400px; display: grid; gap: 16px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .grid2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } .span2 { grid-column: 1 / -1; } }
.stack { display: grid; gap: 16px; min-width: 0; }
.section h2, .panel-h h2 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -.005em; }
.note { font-size: 12px; color: var(--muted); margin: 6px 2px 0; }
.note b { color: var(--text); font-weight: 600; }
.num { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; }
.tag {
  display: inline-block; padding: 0 6px; border-radius: 5px; font: 600 10.5px/17px Inter, sans-serif; letter-spacing: .02em;
  color: var(--muted); background: var(--panel2); border: 1px solid var(--line2); white-space: nowrap; vertical-align: middle;
}
.tag.warn { color: var(--warn); border-color: rgba(245, 165, 36, .4); background: transparent; }

/* ---- panel (card with header) ---- */
.panel { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; padding: 12px 14px 10px; }
.panel-h .muted { font-size: 12px; }
.panel-b { padding: 0 14px 14px; }

/* ---- KPI cards ---- */
.stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; } }
.stat { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.stat-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-value { font: 700 22px/1.25 Inter, sans-serif; letter-spacing: -.02em; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.stat-sub { display: flex; justify-content: space-between; gap: 4px 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.stat-sub .num { font-size: 11.5px; }
.split { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); margin: 0 0 7px; }
.split i { display: block; height: 100%; min-width: 0; }
.split i.l { background: var(--down); }
.split i.s { background: var(--up); }

/* ---- data tables ---- */
.tablescroll { overflow: auto; max-width: 100%; overscroll-behavior-x: contain; border-top: 1px solid var(--line); }
.tablescroll.tall { max-height: 560px; }
.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; white-space: nowrap; }
.dtable th {
  position: sticky; top: 0; z-index: 2; background: var(--panel2); color: var(--muted); text-align: left;
  font: 600 11px/1.2 Inter, sans-serif; text-transform: uppercase; letter-spacing: .04em; padding: 9px 8px; border-bottom: 1px solid var(--line);
}
.dtable td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover td { background: var(--hover); }
.dtable th:first-child, .dtable td:first-child { padding-left: 14px; }
.dtable th:last-child, .dtable td:last-child { padding-right: 14px; }
.dtable .r { text-align: right; }
.dtable td.up { color: var(--up); } .dtable td.down { color: var(--down); }
.dtable td.z { color: var(--dim); }
.dtable th.grp { text-align: center; border-bottom: 0; padding-bottom: 2px; }
/* two-row headers: add .grouped so the whole thead sticks instead of each th */
.dtable.grouped thead { position: sticky; top: 0; z-index: 3; }
.dtable.grouped th { position: static; }
.dtable.grouped th.sticky { position: sticky; left: 0; }
.dtable th[rowspan] { vertical-align: bottom; }
.dtable th[data-sort] { cursor: pointer; user-select: none; }
.dtable th[data-sort]:hover { color: var(--text); }
.dtable th[aria-sort] { color: var(--text); }
.dtable th[aria-sort="descending"]::after { content: " \2193"; }
.dtable th[aria-sort="ascending"]::after { content: " \2191"; }
.dtable td.sticky, .dtable th.sticky { position: sticky; left: 0; z-index: 1; background: var(--panel); box-shadow: 1px 0 0 var(--line); }
.dtable th.sticky { z-index: 3; background: var(--panel2); }
.dtable tbody tr:hover td.sticky { background: var(--hover); }
.dtable tr.new td { animation: flash 2.4s ease-out; }
.coinlink { font-family: Inter, sans-serif; font-weight: 700; font-size: 13px; text-decoration: none; letter-spacing: -.01em; }
.coinlink:hover { text-decoration: underline; text-decoration-color: var(--dim); }
.dtable .rank { color: var(--dim); font-size: 11px; display: inline-block; min-width: 18px; }
.empty-row td { text-align: center; color: var(--muted); padding: 28px 12px; font-family: Inter, sans-serif; white-space: normal; }

/* ---- segmented control (extends app.css .fgroup/.tg) ---- */
.tg[aria-pressed="true"] { color: var(--text); background: var(--panel2); box-shadow: inset 0 -2px 0 var(--muted); }

/* ---- chart ---- */
.chart { position: relative; width: 100%; min-height: 200px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--dim); font: 500 10.5px Inter, sans-serif; }
.chart .untracked { fill: var(--panel2); }
.chart .bar-l { fill: var(--down); }
.chart .bar-s { fill: var(--up); }
.chart .hl { fill: var(--text); opacity: .06; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: 8px 10px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line2); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: 12px;
}
.chart-tip .t { color: var(--muted); margin-bottom: 4px; }
.chart-tip .row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip .row b { font-family: "JetBrains Mono", monospace; font-weight: 500; }
.legend { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--muted); }
.key.l::before { background: var(--down); }
.key.s::before { background: var(--up); }
.key.u::before { background: var(--panel2); border: 1px solid var(--line2); }

/* ---- series chart (partials/series_chart.html + series_chart.js); the plot height is set inline ---- */
.sc-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.sc .panel-h .sc-note { margin-right: auto; }
.sc .tg { height: 28px; font-size: 12px; }
.sc .tg[aria-disabled="true"] { opacity: .45; cursor: default; }
.sc-box { position: relative; margin: 0 8px 0 14px; }
.sc-plot { position: absolute; inset: 0; }
.sc-box .chart-empty { z-index: 2; }
.sc-box .chart-empty[hidden], .sc-tip[hidden] { display: none; }
.sc-tip { left: 0; top: 0; z-index: 3; }
.sc-legend {
  position: absolute; top: 4px; left: 6px; right: 70px; z-index: 1; display: flex; flex-wrap: wrap; gap: 2px 12px;
  font-size: 11px; line-height: 16px; color: var(--muted); pointer-events: none;
}
.sc-legend[hidden] { display: none; }
.sc-legend .k { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sc-legend .k i { width: 12px; height: 3px; border-radius: 2px; }
.sc-legend .k i.sign { height: 8px; width: 8px; background: linear-gradient(90deg, var(--up) 50%, var(--down) 50%); }
.sc-legend .k.off { opacity: .6; }
.sc-grid > .sc-wide { grid-column: 1 / -1; }
.sc-credit { margin: 4px 14px 10px; font-size: 11px; color: var(--dim); text-align: right; }
.sc-credit a { color: var(--muted); }
.sc-gapkey { float: left; color: var(--muted); }
.sc-gapkey[hidden] { display: none; }
.sc-gapkey i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; background: var(--dim); opacity: .3; border-radius: 2px; }
.sc-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .sc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .sc-box { margin: 0 4px 0 10px; } .sc-credit { margin: 4px 12px 8px; } .sc-grid { gap: 12px; } }

/* ---- referral sign-up CTAs (partials/signup_cta.html) ---- */
.su {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 10px 14px; min-width: 0;
}
.su p { margin: 0; }
.su-main { flex: 1 1 260px; min-width: 0; }
.su-t { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; }
.su-t .chip { font-size: 10.5px; line-height: 16px; padding: 0 6px; }
.su .su-s { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.su-s b { color: var(--text); font-weight: 600; font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 11.5px; }
.su-act { flex: 0 1 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.su-btn, .su-code {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 7px; white-space: nowrap;
  font: 600 12px Inter, sans-serif; text-decoration: none; cursor: pointer; color: var(--text);
  border: 1px solid var(--line2); background: var(--panel2);
}
.su-btn:hover, .su-code:hover { border-color: var(--muted); }
.su-btn:focus-visible, .su-code:focus-visible, .su-mini:focus-visible { outline: 2px solid var(--conf); outline-offset: 2px; }
.su-bybit .su-btn { box-shadow: inset 0 -2px 0 var(--bybit); }
.su-hyperliquid .su-btn { box-shadow: inset 0 -2px 0 var(--hyperliquid); }
.su-code { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-weight: 500; border-style: dashed; background: transparent; }
.su-code svg { width: 13px; height: 13px; fill: var(--muted); }
.su .su-geo { flex: 1 1 100%; margin-top: -2px; font-size: 11px; color: var(--dim); }
/* layouts */
.su-row { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .su-row { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; } }
.su-strip { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px 14px 14px; box-shadow: var(--shadow); }
.su-strip-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin: 0 0 10px; }
.su-strip-h h2 { font-size: 14px; font-weight: 600; margin: 0; }
.su-strip-h span { font-size: 12px; color: var(--muted); }
.su-strip .su { background: var(--bg); }
.su-card .su { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 10px 0 0; margin-top: 10px; background: none; }
.su-card .card-h + .su { border-top: 0; padding-top: 0; margin-top: 0; }
/* tiny inline link next to a Trade button */
.su-mini { font: 500 11px Inter, sans-serif; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 2px; margin: 0 6px 0 3px; white-space: nowrap; }
.su-mini:hover { color: var(--text); text-decoration-color: var(--muted); }
.disclose { font-size: 12px; }

/* ---- phones ---- */
@media (max-width: 760px) {
  .sitenav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 12px; }
  .sitenav::-webkit-scrollbar { display: none; }
  .sitenav a { height: 30px; padding: 0 9px; font-size: 13px; }
}
@media (max-width: 640px) {
  .sitenav { margin: 0 -16px; padding: 0 8px; }
  .sitenav a { padding: 0 8px; }
  .pagehead { padding: 14px 16px 4px; }
  .pagehead h1 { font-size: 21px; }
  .lede { font-size: 13.5px; }
  .page { padding: 10px 16px 4px; gap: 12px; }
  .stat { padding: 10px 12px; }
  .stat-value { font-size: 19px; }
  .panel-h { padding: 10px 12px 8px; }
  .panel-b { padding: 0 12px 12px; }
  .tablescroll.tall { max-height: 65vh; }
  .hide-sm { display: none; }
  .su { padding: 10px 12px; }
  .su-strip { padding: 10px 12px 12px; }
  .su-strip-h span { display: none; }
  .dtable th:first-child, .dtable td:first-child { padding-left: 12px; }
  .dtable th:last-child, .dtable td:last-child { padding-right: 12px; }
}
