:root {
  --bg: #0d1015; --panel: #151a21; --panel2: #1b2129; --line: #262d37; --line2: #313946;
  --text: #e5e8ee; --muted: #8a94a4; --faint: #5d6777;
  --up: #34c178; --down: #ee5d5d; --accent: #5d9cf5; --warn: #eea53a; --crit: #ee5d5d;
  --s: #34c178; --m: #5d9cf5; --ctx: #6b7584;
  --up-bg: rgba(52,193,120,.12); --down-bg: rgba(238,93,93,.12); --warn-bg: rgba(238,165,58,.13); --acc-bg: rgba(93,156,245,.12);
  --radius: 10px; --gap: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7; --panel: #ffffff; --panel2: #f7f8fa; --line: #e2e5ea; --line2: #d3d8df;
    --text: #151a22; --muted: #5b6676; --faint: #8b95a4;
    --up: #128a4b; --down: #cf3a32; --accent: #2563d4; --warn: #b8700c; --crit: #cf3a32;
    --s: #128a4b; --m: #2563d4; --ctx: #8b95a4;
    --up-bg: rgba(18,138,75,.09); --down-bg: rgba(207,58,50,.08); --warn-bg: rgba(184,112,12,.1); --acc-bg: rgba(37,99,212,.08);
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; } h2 { font-size: 15px; } h3 { font-size: 13px; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }
.small { font-size: 12px; } .tiny { font-size: 11px; }
button { font: inherit; color: inherit; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; max-width: 1320px; margin: 0 auto; }
.brand { font-weight: 700; letter-spacing: -.02em; font-size: 15px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand svg { width: 20px; height: 20px; }
.brand:hover { text-decoration: none; }
.spacer { flex: 1; }
.user { color: var(--muted); font-size: 12px; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; font-size: 12px; }
.linkbtn:hover { color: var(--text); }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 0 12px; max-width: 1320px; margin: 0 auto; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a { color: var(--muted); padding: 9px 11px 10px; white-space: nowrap; border-bottom: 2px solid transparent; font-weight: 500; }
nav.tabs a:hover { color: var(--text); text-decoration: none; }
nav.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
nav.tabs .badge { margin-left: 5px; }
main { max-width: 1320px; margin: 0 auto; padding: 18px 16px 60px; }
.pagehead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pagehead .sub { color: var(--muted); font-size: 13px; }

/* ---------- panels ---------- */
.grid { display: grid; gap: var(--gap); align-content: start; align-items: start; }
.grid.g2.stretch, .grid.g3.stretch { align-items: stretch; }
.mini { display: flex; flex-direction: column; }
.mini a { display: flex; gap: 8px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); color: var(--text); }
.mini a:first-child { border-top: 0; }
.mini a:hover { text-decoration: none; color: var(--accent); }
.mini .r { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 980px) { .g2, .g3, .g-main { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.panel > .ph { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.panel > .ph .sub { color: var(--muted); font-size: 12px; }
.panel > .ph .right { margin-left: auto; }
.about { color: var(--muted); font-size: 12.5px; margin: -4px 0 10px; }
.empty { color: var(--muted); padding: 10px 0; font-size: 13px; }
.note { background: var(--panel2); border: 1px dashed var(--line2); border-radius: 8px; padding: 10px 12px; color: var(--muted); font-size: 12.5px; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-bg); color: var(--text); }
.note.crit { border: 1px solid var(--crit); background: var(--down-bg); color: var(--text); }
.sentence { font-size: 15px; line-height: 1.55; margin: 0 0 2px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.stat .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .x { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.hero { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--acc-bg); }
.stat.hero .v { font-size: 28px; }
.stats .stat.hero { grid-column: span 2; }
@media (max-width: 420px) { .stats .stat.hero { grid-column: 1 / -1; } }

/* ---------- pills / tier badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 500;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.pill.up { color: var(--up); background: var(--up-bg); border-color: transparent; }
.pill.down { color: var(--down); background: var(--down-bg); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.pill.acc { color: var(--accent); background: var(--acc-bg); border-color: transparent; }
.pill.stage { font-weight: 600; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--crit); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 17px; }
.tier { display: inline-flex; align-items: center; justify-content: center; font: 600 10.5px/1 var(--sans); border-radius: 4px; padding: 3px 5px; letter-spacing: .02em; cursor: help; white-space: nowrap; }
.tier.S { background: var(--s); color: #fff; } .tier.M { background: var(--m); color: #fff; }
.tier.ctx { background: transparent; color: var(--ctx); border: 1px solid var(--line2); }
.tier.ctx.untested { border-style: dashed; }
.ctxlabel { color: var(--ctx); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; margin-left: 4px; }

/* ---------- regime ---------- */
.regime { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .regime { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.regime .r { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.regime .r .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; align-items: center; }
.regime .r .v { font-weight: 600; margin-top: 3px; }
.regime .r.ctx .v { color: var(--muted); font-weight: 500; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel2); }

/* ---------- metrics list ---------- */
.fam { margin-bottom: 4px; }
.fam.ctxfam { opacity: .86; }
.metric { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: start; }
.metric:first-of-type { border-top: 0; }
.metric .l { font-weight: 500; }
.metric .e { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin-top: -2px; }
.metric .val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.metric.ctx .l, .metric.ctx .val { color: var(--muted); font-weight: 500; }

/* ---------- coins grid ---------- */
.coins { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 420px) { .coins { grid-template-columns: 1fr 1fr; } .coin .px { font-size: 15px; } main { padding: 14px 12px 50px; } .panel { padding: 12px; } .tablewrap { margin: 0 -12px; padding: 0 12px; } }
.coin { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--text); display: block; }
.coin:hover { border-color: var(--line2); text-decoration: none; background: var(--panel2); }
.coin .row1 { display: flex; justify-content: space-between; align-items: baseline; }
.coin .sym { font-weight: 700; }
.coin .px { font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 600; margin: 3px 0 5px; }
.coin .meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }

/* ---------- calls ---------- */
.call { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.call.long { border-left: 3px solid var(--up); } .call.short { border-left: 3px solid var(--down); } .call.no_trade { border-left: 3px solid var(--ctx); }
.call .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.call .head .title { font-weight: 700; font-size: 15px; }
.call .head .when { margin-left: auto; color: var(--muted); font-size: 12px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 14px; margin: 12px 0; }
.kv .k { color: var(--muted); font-size: 11.5px; } .kv .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.kv .x { color: var(--muted); font-size: 11.5px; }
.ladder { display: grid; max-width: 640px; grid-template-columns: auto 1fr auto auto; gap: 4px 12px; font-variant-numeric: tabular-nums; margin: 8px 0; font-size: 13px; }
.ladder .lab { color: var(--muted); }
.ladder .tg { color: var(--up); } .ladder .st { color: var(--down); }
details { margin-top: 8px; }
details > summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; } details[open] > summary::before { content: "▾ "; }
pre.calltext { white-space: pre-wrap; word-break: break-word; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font: 12.5px/1.5 var(--mono); margin: 8px 0 0; }
ul.reasons { margin: 6px 0 0; padding-left: 18px; } ul.reasons li { margin: 2px 0; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .cols2 { grid-template-columns: 1fr; } }

/* feedback */
.fb { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.fbrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.fbrow .lab { color: var(--muted); font-size: 12px; min-width: 64px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--panel2); border: 0; border-left: 1px solid var(--line2); padding: 6px 11px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:hover:not(.on) { color: var(--text); }
input[type=text], input[type=password], textarea { width: 100%; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; color: var(--text); font: inherit; }
textarea { min-height: 54px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; border-color: transparent; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line2); }
.fbhist { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.fbhist div { padding: 3px 0; }

/* filters */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- alerts feed ---------- */
.feed { display: flex; flex-direction: column; }
.al { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.al:first-child { border-top: 0; }
.al .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--accent); }
.al.warn .dot { background: var(--warn); } .al.critical .dot { background: var(--crit); }
.al .t { font-weight: 500; } .al .b { color: var(--muted); font-size: 12.5px; word-break: break-word; }
.al .w { color: var(--faint); font-size: 11.5px; white-space: nowrap; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--faint); font: 10.5px var(--sans); font-variant-numeric: tabular-nums; }
.chart .tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line2); border-radius: 7px; padding: 6px 8px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.25); white-space: nowrap; z-index: 5; display: none; font-variant-numeric: tabular-nums; }
.chart .tip .tt { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.chart .tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend .sw { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.rangesel { display: inline-flex; }
.chartpanel .about { margin-bottom: 6px; }

/* ---------- login ---------- */
.loginwrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.loginbox { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.loginbox h1 { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.loginbox label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 5px; }
.loginbox .btn { width: 100%; margin-top: 18px; padding: 10px; }
.loginbox .err { color: var(--down); font-size: 13px; margin-top: 12px; min-height: 18px; }

.loading { color: var(--muted); padding: 30px 0; text-align: center; }
.err-box { color: var(--down); background: var(--down-bg); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.sep { height: 1px; background: var(--line); margin: 12px 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.legendtiers { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
footer { color: var(--faint); font-size: 11.5px; text-align: center; padding: 10px 16px 30px; }

/* scanner and the Telegram bar */
.pill.tg { font-size: 10.5px; padding: 0 7px; color: var(--accent); background: var(--acc-bg); border-color: transparent; vertical-align: 1px; }
.checks { display: grid; gap: 4px; }
.chk { display: grid; grid-template-columns: 18px minmax(150px, 220px) 1fr; gap: 8px; align-items: baseline; font-size: 13px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.chk:last-child { border-bottom: 0; }
.chk .ic { font-weight: 700; text-align: center; }
.chk.ok .ic { color: var(--up); }
.chk.no .ic { color: var(--down); }
.chk .d { color: var(--muted); font-size: 12.5px; }
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13px; line-height: 1.5; }
ol.steps b { color: var(--text); }
.cands { display: grid; }
.cand { padding: 9px 0; border-bottom: 1px solid var(--line); }
.cand:last-child { border-bottom: 0; }
.cand .row1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; }
.cand details { margin-top: 4px; }
.cand summary { cursor: pointer; color: var(--muted); }
.cand .log { display: grid; gap: 3px; font-size: 12.5px; margin-top: 6px; color: var(--muted); }
.cand .log b { color: var(--text); font-weight: 600; }
@media (max-width: 560px) {
  .chk { grid-template-columns: 18px 1fr; }
  .chk .d { grid-column: 2; }
}
