/* TraderMap analytics pages: layout + components (page scrolls normally; wide tables scroll inside their own container) */
html { background: var(--bg); color: var(--fg); font: 13px/1.45 var(--mono); color-scheme: dark; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
.bar { position: sticky; top: 0; flex-wrap: nowrap; row-gap: 4px; }
.bar nav { flex: 1 1 auto; min-width: 0; max-width: 100%; }
@media (max-width: 1250px) { .bar { flex-wrap: wrap; } .bar nav { order: 5; flex: 1 1 100%; } }
[hidden] { display: none !important; }

.page { flex: 1 0 auto; width: 100%; max-width: 1760px; margin: 0 auto; padding: 12px 14px 22px; display: flex; flex-direction: column; gap: 10px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 1.22rem; margin: 0; font-weight: 900; color: #fff; letter-spacing: -0.01em; }
.page-head p { margin: 3px 0 0; color: var(--dim); font-size: 0.76rem; max-width: 780px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar label { color: var(--dim); font-size: 0.72rem; display: inline-flex; align-items: center; gap: 5px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--panel); flex-wrap: nowrap; }
.seg button { font: inherit; font-size: 0.74rem; color: var(--dim); background: transparent; border: 0; border-right: 1px solid var(--line); padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: #fff; background: var(--panel-hover); }
.seg button[aria-pressed="true"] { background: var(--gold); color: #000; font-weight: 800; }
.input, .select { font: inherit; font-size: 0.76rem; background: #141622; color: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 5px 9px; outline: none; }
.input:focus, .select:focus { border-color: var(--gold); }
.input { min-width: 150px; }
.btn { font: inherit; font-size: 0.74rem; background: #141622; color: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 5px 10px; cursor: pointer; }
.btn:hover { border-color: var(--line-light); background: var(--panel-hover); }
input[type=range] { accent-color: var(--gold); vertical-align: middle; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; min-width: 0; }
.card .k { color: var(--dim); font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.05em; }
.card .v { font-size: 1.18rem; font-weight: 900; color: #fff; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s { font-size: 0.7rem; color: var(--dim); margin-top: 1px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.panel > .ph { padding: 7px 12px; border-bottom: 1px solid var(--line); background: #10121a; font-size: 0.71rem; font-weight: 800; color: var(--dim); text-transform: uppercase; letter-spacing: 0.04em; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border-radius: 6px 6px 0 0; }
.panel > .pb { padding: 10px 12px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 10px; align-items: start; }
.grid2.wide-left { grid-template-columns: minmax(0, 1fr) 380px; }
.chartbox { position: relative; width: 100%; height: 360px; }
.chartbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.tablewrap { overflow: auto; max-height: calc(100vh - 230px); min-height: 280px; -webkit-overflow-scrolling: touch; }
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.78rem; }
.dt th { position: sticky; top: 0; z-index: 2; background: #10121a; color: var(--dim); font-weight: 800; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; text-align: right; padding: 7px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.dt th:hover { color: #fff; }
.dt th.sorted::after { content: " ▼"; color: var(--gold); font-size: 0.6rem; }
.dt th.sorted.asc::after { content: " ▲"; }
.dt td { padding: 5px 10px; text-align: right; border-bottom: 1px solid #171924; white-space: nowrap; }
.dt th:first-child, .dt td:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.dt th:first-child { z-index: 3; background: #10121a; }
.dt tbody tr { cursor: pointer; }
.dt tbody tr:hover td { background: var(--panel-hover); }
.dt tbody tr.sel td { background: rgba(245, 158, 11, 0.09); }
.dt .sym { font-weight: 800; color: #fff; }
.dt canvas.sp { width: 80px; height: 22px; vertical-align: middle; }
.pos { color: #10b981; } .neg { color: #ef4444; }
.dim { color: var(--dim); }
.pill { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 0.68rem; font-weight: 800; }
.pill.g { background: rgba(16,185,129,0.15); color: #10b981; } .pill.r { background: rgba(239,68,68,0.15); color: #ef4444; } .pill.n { background: #1c1f2e; color: var(--dim); } .pill.y { background: rgba(245,158,11,0.15); color: var(--gold); }
.lsbar { display: inline-flex; width: 110px; height: 8px; border-radius: 4px; overflow: hidden; background: #1c1f2e; vertical-align: middle; }
.lsbar i { display: block; height: 100%; } .lsbar i:first-child { background: #10b981; } .lsbar i:last-child { background: #ef4444; }

.status { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--dim); font-size: 0.76rem; }
.status.err { border-color: rgba(239,68,68,0.5); color: #fca5a5; background: rgba(239,68,68,0.07); }
.status.ok { border-color: rgba(16,185,129,0.35); color: #6ee7b7; }
.note { color: var(--dim); font-size: 0.72rem; line-height: 1.55; }
.note b { color: #b4b9cc; }
.seo { color: var(--dim); font-size: 0.74rem; line-height: 1.6; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; }
.seo h2 { font-size: 0.86rem; color: #fff; margin: 0 0 6px; } .seo p { margin: 0 0 6px; }
.lnk-buy { color: var(--buy); font-weight: 800; } .lnk-gold { color: var(--gold); font-weight: 800; }

/* Heatmap page */
.hm-stage { position: relative; height: clamp(460px, calc(100vh - 330px), 900px); background: #07080c; border-radius: 0 0 6px 6px; overflow: hidden; }
.hm-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.hm-read { position: absolute; left: 10px; top: 8px; font-size: 0.72rem; color: #cfd3e4; background: rgba(9,10,15,0.78); border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; pointer-events: none; }
.hm-legend { display: flex; align-items: center; gap: 8px; font-size: 0.7rem; color: var(--dim); }
.hm-legend .ramp { flex: 1; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #1a0b3d, #3b1a8c 25%, #1f6fd0 45%, #17b6a4 65%, #7be04a 82%, #ffe600); }
.lvl { display: grid; grid-template-columns: 74px 1fr 56px; gap: 8px; align-items: center; padding: 3px 0; font-size: 0.74rem; cursor: pointer; }
.lvl:hover { background: var(--panel-hover); }
.lvl .bar2 { height: 8px; border-radius: 4px; background: #1c1f2e; overflow: hidden; } .lvl .bar2 i { display: block; height: 100%; }
.lvl.cur { color: var(--gold); font-weight: 800; border-top: 1px dashed #4a3a10; border-bottom: 1px dashed #4a3a10; margin: 3px 0; padding: 4px 0; }
.feed { max-height: 230px; overflow-y: auto; font-size: 0.72rem; }
.feed div { display: grid; grid-template-columns: 52px 46px 1fr 62px; gap: 6px; padding: 2px 0; border-bottom: 1px solid #171924; }

/* RSI tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; padding: 10px 12px; }
.tile { border-radius: 6px; padding: 8px 9px; border: 1px solid rgba(255,255,255,0.05); cursor: default; position: relative; min-height: 62px; }
.tile .s { font-weight: 900; color: #fff; font-size: 0.82rem; } .tile .r { font-size: 1.1rem; font-weight: 900; margin-top: 2px; } .tile .m { font-size: 0.64rem; opacity: 0.85; }

@media (max-width: 1100px) {
  .grid2, .grid2.wide-left { grid-template-columns: 1fr; }
  .tablewrap { max-height: 70vh; }
  .hm-stage { height: 62vh; }
}
@media (max-width: 700px) {
  .page { padding: 10px 8px 18px; }
  .bar { padding: 6px 8px; } .ref-links { margin-left: 0; }
  .chartbox { height: 280px; }
  .dt th, .dt td { padding: 5px 7px; }
}
.bar .lang-select { margin-left: auto; }

.bar { gap: 8px; }
.bar nav a { padding: 4px 7px; font-size: 0.74rem; }
.bar .ref-links { gap: 6px; }
