:root {
  --bg: #0a0c16; --bg2: #0e1120; --card: #12152a; --card2: #181c35; --card3: #1f2442; --line: #252a4a; --line2: #2f355c;
  --text: #e9ebf8; --muted: #8f97bf; --faint: #5f6690;
  --accent: #8b7cf6; --accent2: #6f5ef0; --good: #34d399; --bad: #f87171; --warn: #fbbf24;
  --gold: #f5c542; --pink: #f472b6; --cyan: #22d3ee; --orange: #fb923c;
  --radius: 14px; --shadow: 0 10px 30px -12px #0008;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.5 Inter, system-ui, "Segoe UI", Roboto, sans-serif; }
body { background: radial-gradient(1200px 600px at 80% -10%, #1b1840 0%, transparent 60%), var(--bg); min-height: 100vh; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 16px; margin: 0; }
a.link { color: var(--accent); text-decoration: none; font-size: 13px; white-space: nowrap; }
code { background: var(--card2); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); } .hint { color: var(--faint); font-size: 12.5px; margin: 6px 0 0; }
.sub { color: var(--muted); margin: 3px 0 0; font-size: 13.5px; }
.strong { font-weight: 700; }
.hidden { display: none !important; }
.center { text-align: center; margin: 14px 0; }
.good-t { color: var(--good); } .bad-t { color: var(--bad); } .warn-t { color: var(--warn); }

/* ---------- controls ---------- */
button, select, input {
  font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; min-height: 38px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #8b7cf633; }
input { min-width: 0; flex: 1; }
input[type=number] { font-variant-numeric: tabular-nums; }
button { cursor: pointer; background: var(--accent2); border-color: transparent; font-weight: 600; transition: filter .15s, background .15s; }
button:hover { filter: brightness(1.12); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: linear-gradient(135deg, #a194ff, #7a67f5); color: #10102a; box-shadow: 0 6px 20px -8px #8b7cf6; }
button.good { background: var(--good); color: #062014; }
button.bad { background: var(--bad); color: #2a0b0b; }
button.ghost { background: var(--card2); border-color: var(--line); font-weight: 500; }
button.ghost:hover { background: var(--card3); }
button.small { min-height: 30px; padding: 3px 10px; font-size: 13px; }
button.wide { width: 100%; }
button.icon { min-width: 40px; padding: 6px; font-size: 18px; }
label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
label.check input { flex: none; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--card3); border: 1px solid var(--line2); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #c9cbe0; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent2); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch.big { width: 52px; height: 30px; } .switch.big span::after { width: 24px; height: 24px; } .switch.big input:checked + span::after { transform: translateX(22px); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; background: #0c0f1dcc; border-right: 1px solid var(--line); backdrop-filter: blur(8px); z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 10px; }
.logo { font-size: 26px; width: 40px; height: 40px; display: grid; place-items: center; background: linear-gradient(135deg, #2b2560, #171a33); border-radius: 12px; border: 1px solid var(--line2); }
.brand-name { font-weight: 800; font-size: 16px; } .brand-sub { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav .grp { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 12px 10px 4px; }
.nav button { display: flex; gap: 10px; align-items: center; background: transparent; color: var(--muted); font-weight: 500; text-align: left; padding: 8px 10px; min-height: 36px; }
.nav button .ic { width: 20px; text-align: center; opacity: .9; }
.nav button:hover { background: var(--card); color: var(--text); filter: none; }
.nav button.active { background: linear-gradient(90deg, #8b7cf62e, #8b7cf60d); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { display: flex; flex-direction: column; gap: 8px; }
.bot-pill { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); flex: none; }
.bot-pill.on .pulse { background: var(--good); box-shadow: 0 0 0 0 #34d39988; animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px #34d39900; } 100% { box-shadow: 0 0 0 0 #34d39900; } }
.mini-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.mini-dot.on { background: var(--good); }
.mobile-top { display: none; }
.scrim { display: none; }
.main-wrap { min-width: 0; }
main { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; }

/* ---------- page / cards ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: flex-end; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-head > div:first-child { flex: 1 1 380px; }
.controls, .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row { margin-top: 8px; } .row.between { justify-content: space-between; margin-top: 0; }
.card { background: linear-gradient(180deg, var(--card), #10132600); background-color: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 14px; box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px 14px; }
.card-head + .card-body { border-top: 1px solid var(--line); }
.card-body { padding: 16px 20px; }
.card-body.tight { padding: 6px 12px; }
.card .row-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.card .row-item:first-child { border-top: 0; }
.row-item .lbl { font-weight: 600; } .row-item .desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid-2 > .card { margin-top: 14px; }
.grid-2.wide-left { grid-template-columns: 1.5fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.note { background: #3a2f12; color: var(--gold); border: 1px solid #5a4818; border-radius: 12px; padding: 10px 14px; margin: 8px 0; white-space: pre-wrap; }
.note.err { background: #3a1616; color: var(--bad); border-color: #5c2222; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c, var(--accent)); opacity: .9; }
.stat .t { font-size: 11px; font-weight: 700; letter-spacing: .07em; color: var(--muted); text-transform: uppercase; }
.stat .v { font-size: 25px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); }
.bar { height: 9px; background: var(--card3); border-radius: 6px; overflow: hidden; margin: 8px 0 2px; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); width: 0; transition: width .5s; border-radius: 6px; }
.bar.good > div { background: linear-gradient(90deg, #10b981, var(--good)); }
.bar.thin { height: 6px; margin: 4px 0; }

canvas.chart { width: 100%; height: 340px; display: block; }
canvas.chart.small { height: 170px; }
.tooltip { position: fixed; z-index: 80; background: #05060ee8; border: 1px solid var(--line2); border-radius: 10px; padding: 7px 11px; font-size: 12.5px; white-space: pre; pointer-events: none; box-shadow: var(--shadow); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line2); padding: 10px 18px; border-radius: 12px; z-index: 90; max-width: 90vw; box-shadow: var(--shadow); }
.toast.err { border-color: var(--bad); color: var(--bad); }
.logbox { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; height: 72vh; overflow: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; margin: 0; }
.logbox .gem { color: var(--pink); } .logbox .err { color: #ff7675; } .logbox .ok { color: #55efc4; } .logbox .upg { color: var(--cyan); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 12px 7px 0; vertical-align: top; border-top: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; font-weight: 600; border-top: 0; }
.table-wrap { overflow-x: auto; }
.stat-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; margin: 6px 0; }
.stat-row .info { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: -4px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border-radius: 9px; background: transparent; color: var(--muted); font-weight: 500; min-height: 32px; padding: 5px 12px; }
.seg button.active { background: var(--card3); color: #fff; box-shadow: 0 1px 0 #ffffff10 inset; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 6px 14px; font-weight: 500; min-height: 34px; }
.chip b { color: var(--text); font-weight: 700; font-size: 12px; background: var(--card3); border-radius: 99px; padding: 0 7px; }
.chip.active { background: #8b7cf622; border-color: var(--accent); color: #fff; }

/* ---------- activity ---------- */
.day { color: var(--faint); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 14px 8px 6px; }
.act { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 9px 8px; border-radius: 10px; }
.act:hover { background: var(--card2); }
.act .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--card3); font-size: 16px; }
.act .ttl { font-weight: 600; } .act .det { color: var(--muted); font-size: 12.5px; word-break: break-word; }
.act .tm { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.act.ok .ico { background: #34d39922; } .act.warn .ico { background: #fbbf2422; } .act.err .ico { background: #f8717122; }
.act.err .ttl { color: #fca5a5; } .act.warn .ttl { color: #fde68a; }
.empty { color: var(--muted); padding: 18px 8px; text-align: center; }

/* ---------- upgrades ---------- */
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.preset { text-align: left; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font-weight: 500; color: var(--text); }
.preset .pt { font-weight: 800; font-size: 15px; }
.preset .pd { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.preset.active { border-color: var(--accent); background: linear-gradient(135deg, #8b7cf62a, #8b7cf60a); box-shadow: 0 0 0 3px #8b7cf622; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.field { display: flex; flex-direction: column; align-items: stretch; gap: 6px; color: var(--text); font-weight: 600; font-size: 13px; }
.field input { flex: none; }
.field small { color: var(--faint); font-weight: 400; font-size: 12px; }
.upg-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.upg-cols .card { margin-top: 14px; }
.upg-row { display: grid; grid-template-columns: 20px 1fr 64px; gap: 8px; align-items: center; padding: 5px 0; }
.upg-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; flex: none; }
.upg-row .nm { font-size: 13.5px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.upg-row .nm span.n { line-height: 1.25; }
.upg-row select { min-height: 30px; padding: 3px 6px; font-size: 13px; }
.upg-row.off .nm { color: var(--faint); }
.upg-row.locked .nm span.n { text-decoration: line-through; text-decoration-color: #ffffff30; }
.tag { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--card3); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.tag.lock { color: #fca5a5; background: #f8717118; }
.tag.cnt { color: var(--good); background: #34d39918; }
.st { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line2); flex: none; vertical-align: middle; }
.st-buy { background: #3b82f6; box-shadow: 0 0 6px #3b82f6; } .st-poor { background: #334a7a; } .st-max { background: var(--gold); } .st-absent { background: #f8717166; }
.saved { color: var(--good); font-size: 12.5px; opacity: 0; transition: opacity .3s; }
.saved.show { opacity: 1; }

/* ---------- profile ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.kpi .ki { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: var(--card3); flex: none; }
.kpi .kv { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .kl { font-size: 11.5px; color: var(--muted); }
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.mod { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card2); position: relative; overflow: hidden; }
.mod::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--rc, var(--accent)); }
.mod .ms { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.mod .mn { font-weight: 700; margin: 2px 0; } .mod .mr { font-size: 12.5px; color: var(--rc, var(--muted)); }
.ws-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 5px 0; font-size: 13px; }
.ws-item .bar { grid-column: 1 / -1; margin: 2px 0 0; }
.ws-item.locked { color: var(--faint); }
.ws-item .lv { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 80px; gap: 10px; align-items: center; margin: 7px 0; font-size: 13px; }
.hbar .bar { margin: 0; height: 10px; }
.hbar .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--card2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 11px; font-size: 12.5px; }
.pill b { color: var(--accent); font-weight: 700; }
.sankey-wrap { overflow-x: auto; overflow-y: hidden; }
.sankey { display: block; min-width: 520px; width: 100%; height: auto; }
.sankey text { fill: var(--text); font-size: 12px; font-weight: 600; }
.sankey text.v { fill: var(--muted); font-weight: 500; font-size: 11px; }
.sankey text { pointer-events: none; }
.big-total { font-size: 15px; } .big-total b { font-size: 18px; }

/* ---------- remote ---------- */
.remote { display: grid; grid-template-columns: minmax(250px, 320px) minmax(250px, 400px) minmax(0, 1fr); gap: 18px; align-items: start; }
.remote .card:first-child { margin-top: 0; }
.feed-card { position: sticky; top: 16px; }
.feed { max-height: calc(100vh - 150px); overflow-y: auto; padding: 4px 8px; }
.feed .act { grid-template-columns: 30px 1fr auto; gap: 10px; padding: 8px 6px; }
.feed .act .ico { width: 30px; height: 30px; }
.feed .day { padding: 10px 6px 4px; }
.screen-wrap { position: relative; background: #000; border-radius: 18px; overflow: hidden; border: 1px solid var(--line2); line-height: 0; min-height: 200px; display: flex; justify-content: center; box-shadow: var(--shadow); }
#screen { max-width: 100%; max-height: 80vh; width: auto; height: auto; display: block; touch-action: none; user-select: none; -webkit-user-drag: none; cursor: crosshair; }
.screen-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); line-height: 1.4; pointer-events: none; white-space: pre-wrap; }
.ripple { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; border: 3px solid var(--accent); pointer-events: none; animation: rip .5s ease-out forwards; }
@keyframes rip { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.phone-keys { display: flex; gap: 6px; margin-top: 10px; }
.phone-keys button { flex: 1; background: var(--card2); border: 1px solid var(--line); font-size: 18px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.shots a { color: var(--muted); font-size: 11px; text-decoration: none; }
.shots img { width: 100%; border-radius: 8px; display: block; border: 1px solid var(--line); }
.dev-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dev { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.dev .dn { font-weight: 700; } .dev .ds { color: var(--muted); font: 12px ui-monospace, Consolas, monospace; }

/* ---------- icons ---------- */
.ico { flex: none; vertical-align: middle; }
button[data-icon] { display: inline-flex; align-items: center; gap: 7px; }
button.icon[data-icon] { justify-content: center; }
.phone-keys button { display: flex; align-items: center; justify-content: center; }
.small { font-size: 12.5px; }
.side-title { font-weight: 700; margin: 16px 0 2px; }
.logo { color: var(--accent); }
.nav button .ic { display: inline-grid; place-items: center; }
.seg.wrap { margin-bottom: 14px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg.wrap button.active { box-shadow: inset 0 -2px 0 var(--c, var(--accent)); }

/* ---------- dashboard ---------- */
.live { display: grid; grid-template-columns: minmax(240px, 330px) 1fr; gap: 14px; margin-bottom: 14px; }
.live-main { background: linear-gradient(160deg, #1b1a3e, #12152a 70%); border: 1px solid var(--line2); border-radius: var(--radius); padding: 20px 22px; position: relative; overflow: hidden; }
.live-main::after { content: ""; position: absolute; width: 240px; height: 240px; right: -80px; top: -90px; background: radial-gradient(circle, #8b7cf644, transparent 70%); pointer-events: none; }
.live-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.live-wave { font-size: 52px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.live-sub { color: var(--faint); font-size: 12.5px; }
.live-fc { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.live .cards { align-content: start; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 0; }
.strip-item { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-right: 1px solid var(--line); }
.strip-item:last-child { border-right: 0; }
.strip-item .si { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); flex: none; }
.strip-item .sv { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.strip-item .sl { font-size: 11.5px; color: var(--muted); }
.ex-nums { display: flex; flex-wrap: wrap; gap: 28px; margin: 0 0 12px; }
.num-block .nl { font-size: 12px; color: var(--muted); }
.num-block .nv { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
canvas.chart { cursor: crosshair; }
.cur-table th.r, .cur-table td.r { text-align: right; padding-right: 18px; }
.cur-table td { vertical-align: middle; padding-top: 11px; padding-bottom: 11px; }
.cur-table tbody tr { animation: rowIn .5s ease both; animation-delay: calc(var(--i) * 60ms); }
.cur-table tbody tr:hover { background: var(--card2); }
.cdot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 10px; }
.spark { display: block; }
.spark-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s ease forwards .15s; }
.spark-fill { opacity: 0; animation: fadeIn .8s ease forwards .6s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.tier-head, .tier-row { display: grid; grid-template-columns: 56px 1fr 74px 74px; gap: 12px; align-items: center; }
.tier-head { color: var(--faint); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px; }
.tier-head .r, .tier-row .r { text-align: right; font-variant-numeric: tabular-nums; }
.tier-row { padding: 7px 6px; border-radius: 10px; font-size: 13.5px; }
.tier-row:hover { background: var(--card2); }
.tier-row .tn { font-weight: 700; }
.tbar { position: relative; height: 18px; background: var(--card3); border-radius: 6px; overflow: hidden; }
.tbar.thin { height: 5px; margin-top: 4px; border-radius: 3px; }
.tfill { height: 100%; width: 0; background: linear-gradient(90deg, #6f5ef0, #a78bfa); border-radius: inherit; transition: width .9s cubic-bezier(.2,.8,.2,1); transition-delay: var(--d, 0ms); }
.tfill.coins { background: linear-gradient(90deg, #b8861b, #e8b23a); }
.tbar .tv { position: absolute; left: 8px; top: 0; line-height: 18px; font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000a; }
.hl { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 9px 8px; border-radius: 10px; animation: rowIn .5s ease both; animation-delay: calc(var(--i) * 45ms); }
.hl:hover { background: var(--card2); }
.hl .hi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--card3); color: var(--accent); }
.hl-record .hi { background: #e8b23a22; color: #e8b23a; } .hl-day .hi { background: #46c2a822; color: #46c2a8; } .hl-bot .hi { background: #5aa9e622; color: #5aa9e6; }
.hl .ttl { font-weight: 600; } .hl .det { color: var(--muted); font-size: 12.5px; } .hl .tm { color: var(--faint); font-size: 12px; white-space: nowrap; }
.heat-stats { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.heat-stats b { color: var(--text); margin-left: 4px; }
.heatmap { overflow-x: auto; }
.hm-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; min-width: 620px; }
.hm-months { display: grid; gap: 3px; min-width: 620px; height: 18px; color: var(--faint); font-size: 11.5px; }
.hm { aspect-ratio: 1; border-radius: 3px; background: var(--card3); min-width: 9px; }
.hm-grid .hm:not(.none) { animation: cellIn .45s ease both; animation-delay: calc(var(--i) * 16ms); }
.hm.none { background: transparent; }
.hm.l1 { background: #3b3a78; } .hm.l2 { background: #5b4fc4; } .hm.l3 { background: #7c6cf0; } .hm.l4 { background: #b4a9ff; }
.hm-grid .hm:hover { outline: 1.5px solid #fff; outline-offset: 1px; }
.hm-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 10px; color: var(--faint); font-size: 11.5px; }
.hm-legend .hm { width: 12px; aspect-ratio: 1; min-width: 0; }
@keyframes cellIn { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }

/* ---------- sankey animation + hover trace ---------- */
.sankey .lnk { fill-opacity: .26; transition: fill-opacity .2s; animation: linkIn 1s ease both; animation-delay: calc(var(--c) * .22s); }
.sankey .node { animation: nodeIn .6s ease both; animation-delay: calc(var(--c) * .22s); transition: opacity .2s; }
.sankey .node rect:first-child { transform-box: fill-box; transform-origin: center; }
@keyframes linkIn { from { clip-path: inset(0 100% 0 0); opacity: 0; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes nodeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sankey.hl .lnk { fill-opacity: .05; }
.sankey.hl .lnk.on { fill-opacity: .6; }
.sankey.hl .node { opacity: .28; }
.sankey.hl .node.on { opacity: 1; }
.sankey .node { cursor: pointer; }
.sankey .lnk { cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .sankey .lnk, .sankey .node, .spark-line, .spark-fill, .hm-grid .hm, .cur-table tbody tr, .hl { animation: none !important; }
  .spark-line { stroke-dashoffset: 0; } .spark-fill { opacity: 1; } .tfill { transition: none; }
}

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--card); border: 1px solid var(--line); padding: 30px; border-radius: 18px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.login-card .brand { justify-content: center; font-size: 26px; font-weight: 800; }
.brand.big { font-size: 28px; font-weight: 800; text-align: center; justify-content: center; }
.err { color: var(--bad); min-height: 1.2em; }

@media (max-width: 1350px) {
  .upg-cols { grid-template-columns: 1fr 1fr; }
  .remote { grid-template-columns: minmax(240px, 300px) minmax(240px, 400px); }
  .remote .side-col { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .grid-2.wide-left { grid-template-columns: 1fr; }
  .live { grid-template-columns: 1fr; }
  .remote { grid-template-columns: minmax(240px, 300px) 1fr; }
  .remote .side-col { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; transform: translateX(-105%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: #0008; z-index: 25; }
  .mobile-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; position: sticky; top: 0; z-index: 20; background: #0c0f1dee; border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
  .mobile-top .brand-name { flex: 1; }
  main { padding: 16px 12px 50px; }
  .remote, .grid-2, .grid-2.even, .grid-3, .split, .presets, .form-grid, .upg-cols { grid-template-columns: 1fr; }
  .feed { max-height: 320px; }
  .feed-card { position: static; }
  .stat-row { grid-template-columns: 110px 1fr 56px; }
  .hbar { grid-template-columns: 100px 1fr 64px; }
  h1 { font-size: 22px; }
}
.sankey .node.expandable { cursor: pointer; }
.sankey .chev { pointer-events: none; }
