/* BTC Intel Terminal — full-viewport workspace. Uses the site's tokens (app.css); the layout
   changes columns, panel placement and type size with the viewport instead of scaling:
     ≥ 3000 px      8 columns × 3 rows, everything on one screen (ultrawide)
     2200–2999 px   6 columns × 4 rows (2560 × 1440)
     1600–2199 px   5 columns × 4 rows (1920 × 1080)
     1280–1599 px   4 columns, page scrolls (laptops)
     768–1279 px    2 columns by priority (tablets)
     < 768 px       1 column by priority; low-priority panels start collapsed (phones)
   On the fixed-height layouts every panel scrolls inside itself, so nothing is cut off. */

body.term { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans);
  font-size: clamp(11.5px, 0.22vw + 8.4px, 15px); --tbar: 44px; --gap: clamp(4px, 0.35vw, 10px); }
body.term a { color: var(--orange-ink); }

/* ── top bar ── */
.t-bar { position: sticky; top: 0; z-index: 5; height: var(--tbar); box-sizing: border-box; display: flex; align-items: center; gap: clamp(10px, 1.2vw, 24px);
  padding: 0 var(--gap) 0 calc(var(--gap) + 4px); background: var(--bg); border-bottom: 1px solid var(--line); }
.t-brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; flex: none; }
.t-logo { display: block; height: 31px; width: auto; }
.t-name { font: 600 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--orange-ink); border: 1px solid var(--orange-line); border-radius: 3px; padding: 4px 6px; }
.t-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.t-nav a { color: var(--muted) !important; font-size: 12.5px; padding: 6px 9px; border-radius: 4px; white-space: nowrap; text-decoration: none !important; }
.t-nav a:hover { color: var(--text) !important; background: var(--card); }
.t-nav a[aria-current='page'] { color: var(--text) !important; background: var(--card2); box-shadow: inset 0 -2px 0 var(--orange); }
.t-stat { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.t-stat i.fd { margin-right: 5px; }
.t-clock { color: var(--text2); font-family: var(--mono); }
.t-bar .icon-btn { flex: none; }

/* ── grid ── */
.t-grid { display: grid; gap: var(--gap); padding: var(--gap); box-sizing: border-box; width: 100%; }
body.term main { padding-bottom: var(--gap); }
.t-loading { grid-column: 1 / -1; color: var(--muted); padding: 40px; text-align: center; }

/* ── panel ── */
.tp { padding: 0; scroll-margin-top: 0; background: var(--card); border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.tp-h { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); min-height: 28px; box-sizing: border-box; flex: none; }
.tp-tog { all: unset; display: flex; align-items: center; flex: none; max-width: 70%; cursor: default; }
.tp-h h2 { margin: 0; font: 600 10.5px/1.2 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.tp-at { font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-b { padding: 8px 10px; overflow: auto; min-height: 0; flex: 1 1 auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.t-empty { color: var(--muted); margin: 6px 0; }
.t-k { display: block; font: 600 9.5px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin: 0 0 3px; }
.t-foot { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

/* five-step scale: a quiet chip / dot */
.t-chip { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line2); color: var(--text2); white-space: nowrap; }
.t-chip.sup, .t-chip.con { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); }
.t-chip.cau, .t-chip.adv { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.sd { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--line2); }
.sd.sup { background: var(--up); } .sd.con { background: color-mix(in srgb, var(--up) 55%, transparent); }
.sd.cau { background: color-mix(in srgb, var(--down) 60%, transparent); } .sd.adv { background: var(--down); }
.sd.neu { background: var(--muted); } .sd.ctx { background: transparent; border: 1px solid var(--line2); box-sizing: border-box; }

/* reading rows */
.t-rows, .t-doms, .t-forces, .t-list, .t-chg, .t-news, .t-moves { list-style: none; margin: 0; padding: 0; }
.t-rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto 7px; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--line); }
.t-rows li:last-child { border-bottom: 0; }
.rn { color: var(--text2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv { font-family: var(--mono); font-size: 0.92em; color: var(--text); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30ch; }
.dim { color: var(--dim); }
.up { color: var(--up); } .down { color: var(--down); }

/* price */
.t-price { display: flex; align-items: baseline; gap: 10px; }
.t-big { font: 500 clamp(28px, 2.2vw, 52px)/1.05 var(--mono); letter-spacing: -0.02em; }
.t-pc { font: 500 10.5px var(--mono); color: var(--muted); border: 1px solid var(--line2); border-radius: 3px; padding: 0 4px; margin-left: 6px; cursor: help; vertical-align: 1px; }
.t-mvs { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 10px; }
.t-mv { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--mono); font-size: 0.95em; }
.t-mv b { font-weight: 600; } .t-mv small { color: var(--dim); }
.t-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px 14px; margin: 0; }
.t-kv dt { font: 600 9.5px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.t-kv dd { margin: 1px 0 0; font-family: var(--mono); font-size: 0.95em; white-space: nowrap; }
.t-kv dd small { color: var(--dim); font-family: var(--sans); }
.t-kv2 { margin: 10px 0; }
.t-kv2 dd { font-family: var(--sans); }
.t-live { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.t-live::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); margin-right: 5px; vertical-align: 1px; }
.t-live.on::before { background: var(--up); } .t-live.stale::before { background: var(--down); }

/* market read */
.t-post { display: flex; gap: 22px; align-items: flex-end; }
.t-state { font-size: clamp(20px, 1.5vw, 32px); font-weight: 600; letter-spacing: -0.01em; }
.t-state.sup, .t-state.con { color: var(--up); } .t-state.cau, .t-state.adv { color: var(--down); }
.t-grade { font: 500 clamp(20px, 1.5vw, 32px)/1 var(--mono); }
.t-grade small { font-size: 0.5em; color: var(--dim); }
.t-df { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.t-df ul { list-style: none; margin: 0; padding: 0; }
.t-df li { padding: 2px 0; line-height: 1.35; }
.t-df li b { font-weight: 500; color: var(--text); }

/* domains & forces: centered bars, neutral colors */
.t-doms li, .t-forces li { display: grid; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.t-doms li { grid-template-columns: minmax(70px, 1fr) minmax(60px, 1.2fr) auto; }
.t-forces li { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(50px, 0.8fr); }
.t-forces li.off { opacity: 0.5; }
.t-forces .rl { color: var(--muted); font-size: 0.92em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-bar2 { position: relative; display: block; height: 6px; background: var(--card2); border-radius: 3px; }
.t-bar2::before { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line2); }
.t-bar2 i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.t-bar2 i.p { background: color-mix(in srgb, var(--up) 75%, transparent); } .t-bar2 i.n { background: color-mix(in srgb, var(--down) 75%, transparent); }

/* changes */
.t-chg li { padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
.t-chg li .t-k { display: inline; margin-right: 6px; }
.t-chg p { margin: 2px 0 0; color: var(--text2); line-height: 1.4; }
.t-list { margin-bottom: 8px; } .t-list li { padding: 2px 0 2px 10px; position: relative; color: var(--text2); line-height: 1.4; }
.t-list li::before { content: '·'; position: absolute; left: 0; color: var(--dim); }
.tp-b > .t-k { margin-top: 10px; }
.t-cyc { margin: 0 0 6px; } .t-cyc .t-k { display: inline; margin-right: 6px; }
.t-pmh { margin-top: 10px !important; }

/* ETF bars */
.t-etf { margin-bottom: 8px; }
.t-etf svg { display: block; width: 100%; height: 40px; }
.t-etf rect.p { fill: color-mix(in srgb, var(--up) 80%, transparent); } .t-etf rect.n { fill: color-mix(in srgb, var(--down) 80%, transparent); }
.t-etf line { stroke: var(--line2); stroke-width: 1; }

/* news & moves */
.t-news li, .t-moves li { display: grid; gap: 4px 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line); }
.t-news li { grid-template-columns: auto minmax(0, 1fr); }
.t-news .t-src { margin-left: 4px; }
.t-news a { color: var(--text) !important; text-decoration: none; line-height: 1.35; }
.t-news a:hover { text-decoration: underline; }
.t-time { font-size: 10.5px; color: var(--dim); white-space: nowrap; font-family: var(--mono); }
.t-src { font-size: 10.5px; color: var(--muted); white-space: nowrap; } .t-src.t1 { color: var(--text2); font-weight: 600; }
.t-moves li { grid-template-columns: auto minmax(0, 1fr) auto; }
.t-moves .rv small { color: var(--dim); }

/* chart: the site's chart card inside a panel */
.tp-chart .tp-b { display: flex; flex-direction: column; padding: 6px 8px 4px; }
.tp-chart .picard { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; }
.tp-chart .pi-head { margin: 0 0 4px; }
.tp-chart .pc-ovs { margin: 0 0 4px; }
.tp-chart .pi-chart { flex: 1 1 0; min-height: 0; overflow: hidden; }
.tp-chart .pc-status, .tp-chart .pi-src { margin: 3px 0 0; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.tp-chart .pc-status:hover, .tp-chart .pi-src:hover { white-space: normal; }

/* tables, segments, small bars and sparklines used by the panels */
.t-tab { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.t-tab th { text-align: left; font: 600 9.5px/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); padding: 3px 6px 4px 0; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.t-tab td { padding: 3px 6px 3px 0; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--text2); }
.t-tab .r { text-align: right; } .t-tab td.r { font-family: var(--mono); }
.t-tab tr.tot td { border-top: 1px solid var(--line2); color: var(--text); }
.t-tab td.up { color: var(--up); } .t-tab td.down { color: var(--down); }
.t-seg { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
.t-seg button { font: 500 11px var(--sans); color: var(--muted); background: var(--card2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; cursor: pointer; }
.t-seg button small { font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; margin-right: 2px; }
.t-seg button[aria-pressed='true'] { color: var(--text); border-color: var(--orange-line); background: var(--orange-dim); }
.t-dvc { width: 64px; }
.t-dv { position: relative; display: block; width: 60px; height: 8px; margin-left: auto; }
.t-dv::before { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line2); }
.t-dv i { position: absolute; top: 1px; height: 6px; border-radius: 2px; }
.t-dv i.p { left: 50%; background: var(--up); } .t-dv i.n { right: 50%; background: var(--down); }
.t-spark { display: block; width: 100%; height: 30px; } .t-spark polyline { fill: none; stroke: var(--orange-ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.t-act li { grid-template-columns: minmax(0, 1fr) 70px auto; }
.t-act .t-spark { height: 16px; width: 70px; }
.t-bars { display: block; width: 100%; height: 40px; margin: 2px 0 8px; }
.t-bars rect.p { fill: color-mix(in srgb, var(--up) 80%, transparent); } .t-bars rect.n { fill: color-mix(in srgb, var(--down) 80%, transparent); }
.t-bars line { stroke: var(--line2); stroke-width: 1; }
.t-etfh { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.t-etfh .t-k { margin: 0; }
.t-hb { display: block; height: 5px; background: var(--card2); border-radius: 3px; overflow: hidden; }
.t-hb i { display: block; height: 100%; background: color-mix(in srgb, var(--orange) 70%, transparent); border-radius: 3px; }
.t-pools { list-style: none; margin: 0; padding: 0; }
.t-pools li { display: grid; grid-template-columns: minmax(70px, 1fr) minmax(40px, 1.2fr) 46px; gap: 8px; align-items: center; padding: 2px 0; }
.t-shc { display: flex; align-items: center; justify-content: flex-end; gap: 6px; } .t-shc .t-hb { width: 50px; }
.t-ep { margin-top: 2px; height: 6px; }
.t-sub { margin-top: 10px !important; }
.t-rows small { color: var(--dim); font-family: var(--sans); }
.t-rows li { grid-template-columns: minmax(0, 1fr) auto; }
.t-rows li:has(.sd) { grid-template-columns: minmax(0, 1fr) auto 7px; }
.t-rows li.t-act-row { grid-template-columns: minmax(0, 1fr) 70px auto; }
.t-chg { margin-top: 10px; }

/* ── layouts ── */
/* phones: one column in priority order */
.t-grid { grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'px' 'read' 'dom' 'chart' 'news' 'pm' 'etf' 'moves' 'fees' 'mining' 'act' 'supply' 'dist'; }
@media (max-width: 767px) {
  .t-stat { display: none; }
  .t-bar { height: auto; flex-wrap: wrap; gap: 4px 10px; padding-top: 6px; padding-bottom: 4px; }
  .t-bar .icon-btn { margin-left: auto; }
  .t-nav { order: 5; width: 100%; }
  .tp-tog { cursor: pointer; flex: 1; }
  .tp-tog::after { content: '▾'; margin-left: 6px; color: var(--dim); font-size: 11px; }
  .tp.closed .tp-tog::after { content: '▸'; }
  .tp.closed .tp-b { display: none; }
  .tp.closed .tp-h { border-bottom: 0; }
  .tp-chart .pi-chart { min-height: 240px; }
  .tp-news .tp-b, .tp-moves .tp-b, .tp-etf .tp-b { max-height: 60vh; }
  .t-news li { grid-template-columns: minmax(0, 1fr); }
  .tp-etf .t-tab th:nth-child(3), .tp-etf .t-tab td:nth-child(3) { display: none; }
}
/* tablets: two columns */
@media (min-width: 768px) {
  .t-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(220px, auto);
    grid-template-areas: 'px read' 'chart chart' 'dom news' 'pm etf' 'moves etf' 'fees mining' 'act supply' 'dist dist'; }
  .tp-chart { min-height: 440px; }
  .tp-news, .tp-etf, .tp-moves, .tp-act { max-height: 520px; }
}
/* laptops: four columns, the page scrolls */
@media (min-width: 1280px) {
  .t-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(260px, 36vh);
    grid-template-areas: 'px chart chart read' 'dom chart chart news' 'pm etf etf news' 'moves fees mining mining' 'act supply dist dist'; }
  .tp-chart, .tp-news, .tp-etf, .tp-moves, .tp-act { min-height: 0; max-height: none; }
}
/* desktop and up: the workspace fills the window exactly; panels scroll inside */
@media (min-width: 1600px) and (min-height: 760px) {
  .t-grid { height: calc(100vh - var(--tbar)); grid-auto-rows: unset; }
}
@media (min-width: 1600px) {
  .t-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr));
    grid-template-areas: 'px chart chart chart read' 'dom chart chart chart news' 'pm etf etf moves news' 'fees mining act supply dist'; }
}
@media (min-width: 1600px) and (max-height: 759px) { .t-grid { grid-template-rows: repeat(4, minmax(240px, auto)); } }
@media (min-width: 2200px) {
  .t-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr));
    grid-template-areas: 'px chart chart chart read news' 'dom chart chart chart pm news' 'etf etf moves fees mining act' 'etf etf moves supply mining dist'; }
}
@media (min-width: 3000px) {
  .t-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
    grid-template-areas: 'px chart chart chart read pm etf news' 'dom chart chart chart moves pm etf news' 'fees mining mining act supply dist dist news'; }
}
@media (min-width: 2200px) and (max-height: 900px) { .t-grid { height: auto; grid-template-rows: repeat(4, minmax(240px, auto)); } }
/* the ETF table drops its ≈ BTC column whenever its panel is narrow, whatever the layout */
.tp-etf .tp-b { container-type: inline-size; }
@container (max-width: 470px) { .tp-etf .t-tab th:nth-child(3), .tp-etf .t-tab td:nth-child(3) { display: none; } }

/* small company icon over a lettered badge (treasuries) */
.t-logo-b { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; border-radius: 3px; background: var(--card2); border: 1px solid var(--line2); font: 700 7px/1 var(--sans); color: var(--muted); overflow: hidden; }
.t-logo-b img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 1px; }
