:root {
  color-scheme: dark;
  --bg: #000; --text: #fff; --sec: rgba(235,235,245,.6); --ter: rgba(235,235,245,.3);
  --sep: rgba(84,84,88,.55); --card: #1c1c1e; --card2: #2c2c2e;
  --green: #00d35a; --red: #ff453a; --orange: #ff9f0a; --cyan: #64d2ff; --blue: #0a84ff;
  --yellow: #ffd60a; --pink: #ff6b9a;
  --display: -apple-system-headline, "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --textf: "SF Pro Text", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --cardw: calc(100vw - 32px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); }
body { font: 17px/1.3 var(--textf); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 84px); overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; min-height: 44px; min-width: 44px; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--sec); font-weight: 400; }
.grow { flex: 1; }

/* offline row */
.offline { position: sticky; top: env(safe-area-inset-top); z-index: 30; background: var(--bg); color: var(--red);
  font-size: 13px; padding: 8px 16px; border-bottom: .5px solid var(--sep); }

/* navbar */
.navbar { display: flex; align-items: center; padding: 4px 8px 0 16px; gap: 4px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--card2); position: relative; margin-right: 4px; }
.avatar::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--green); opacity: .9; }
.navtitle { font: 600 17px var(--textf); padding: 0 4px; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; position: relative; }
.iconbtn svg, .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn .dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* balance */
.balance-row { display: flex; align-items: flex-start; gap: 10px; padding: 18px 16px 0; }
.odometer { font: 700 clamp(66px, 19vw, 100px)/1 var(--display); letter-spacing: -.03em; display: flex; overflow: hidden; height: 1em; }
.odometer .d { display: inline-block; height: 1em; overflow: hidden; }
.odometer .col { display: flex; flex-direction: column; transition: transform 600ms cubic-bezier(.16,1,.3,1); }
.odometer .col span { height: 1em; }
.paper-pill { background: var(--orange); color: #000; font: 600 13px var(--textf); padding: 4px 10px; border-radius: 999px; margin-top: 8px; }
.today-row { display: flex; align-items: center; gap: 8px; padding: 10px 16px 0; }
.today { font-size: 17px; }
.up { color: var(--green); } .down { color: var(--red); }
.multi { background: var(--green); color: #000; font: 600 13px var(--textf); padding: 3px 9px; border-radius: 999px; }
.multi.neg { background: var(--red); }

/* chart */
.chart-wrap { position: relative; margin-top: 18px; height: 240px; }
#lineChart { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; left: 0; right: 0; top: 46%; text-align: center; color: var(--sec); font-size: 15px; }
.ranges { display: flex; justify-content: space-between; padding: 6px 16px 0; }
.ranges button { font: 600 13px var(--textf); color: var(--sec); border-radius: 8px; padding: 0 10px; }
.ranges button.on { color: #000; background: var(--green); min-height: 30px; align-self: center; }

/* sections */
.section { display: flex; align-items: center; justify-content: space-between; font: 700 22px var(--display); padding: 28px 16px 10px; }
.seeall { color: var(--green); font: 400 17px var(--textf); }
.large { font: 700 34px var(--display); padding: 12px 16px 12px; }

/* agent carousel */
.carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 16px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.acard { flex: 0 0 var(--cardw); width: var(--cardw); aspect-ratio: 504 / 470; border-radius: calc(var(--cardw) * 42 / 504);
  background: var(--card); scroll-snap-align: center; padding: 22px; display: flex; flex-direction: column; overflow: hidden; }
.acard h3 { font: 600 17px var(--textf); display: flex; align-items: center; gap: 8px; }
.acard h3 i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.acard .big { font: 700 44px/1.05 var(--display); margin-top: 10px; letter-spacing: -.02em; }
.acard .sub { color: var(--sec); font-size: 15px; margin-top: 4px; }
.acard .fill { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; min-height: 0; }
.feed { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 15px; overflow: hidden; }
.feed li { display: flex; justify-content: space-between; gap: 10px; white-space: nowrap; }
.feed li .n { overflow: hidden; text-overflow: ellipsis; }
.feed li.kill { color: var(--ter); }
.feed li.kill .n { text-decoration: line-through; text-decoration-color: var(--red); }
.feed li.kill .r { color: var(--red); }
.strips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.strips b { height: 10px; border-radius: 5px; background: var(--card2); transition: background 150ms; }
.strips b.ok { background: var(--green); } .strips b.no { background: var(--red); }
.ring { width: 46%; aspect-ratio: 1; align-self: center; }
.bar { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width 120ms linear; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.mpill { font: 500 13px var(--mono); padding: 5px 10px; border-radius: 999px; background: var(--card2); }
.mpill.red { color: var(--red); } .mpill.green { color: var(--green); }

/* lists */
.list { padding: 0 16px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; border-bottom: .5px solid var(--sep); width: 100%; text-align: left; }
.row:last-child { border-bottom: 0; }
.row .ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 40px; font: 600 15px var(--textf); color: #000; }
.row .t { flex: 1; min-width: 0; }
.row .t div:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t div:last-child { color: var(--sec); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .v { text-align: right; font-size: 15px; max-width: 42%; }
.empty { color: var(--sec); padding: 24px 0; text-align: center; }
.more { display: block; margin: 12px auto; color: var(--green); }

/* agents tab */
.agentbox { background: var(--card); border-radius: 22px; margin: 0 16px 14px; padding: 6px 16px 10px; }
.agentbox header { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.agentbox header h3 { font: 600 20px var(--display); flex: 1; }
.status { width: 10px; height: 10px; border-radius: 50%; background: var(--ter); }
.status.on { background: var(--green); }
.agentbox .meta { color: var(--sec); font-size: 15px; display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; }
.dec { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; font-size: 14px; padding: 9px 0; border-top: .5px solid var(--sep); align-items: baseline; }
.dec a { color: var(--text); text-decoration: none; font-weight: 600; }
.dec .tm { color: var(--ter); }
.dec .rs { color: var(--sec); text-align: right; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbtn { color: var(--blue); font-size: 15px; }

/* switch */
.switch { position: relative; width: 51px; height: 31px; flex: 0 0 51px; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--card2); transition: background 200ms; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform 200ms; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:disabled + i { opacity: .4; }

/* pushed screens */
.screen { position: fixed; inset: 0; background: var(--bg); z-index: 20; overflow-y: auto;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 96px); animation: push 280ms cubic-bezier(.2,.8,.2,1); }
@keyframes push { from { transform: translateX(30%); opacity: 0; } to { transform: none; opacity: 1; } }
.backbar { display: flex; align-items: center; gap: 6px; padding: 4px 8px; }
.back { color: var(--green); font-size: 17px; padding: 0 8px; }
.coinhead { padding: 6px 16px 0; }
.coinhead h1 { font: 700 28px var(--display); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip { font: 600 13px var(--textf); padding: 4px 9px; border-radius: 999px; background: var(--card2); color: var(--green); }
.price { font: 700 clamp(48px, 14vw, 66px)/1.05 var(--display); padding: 14px 16px 0; letter-spacing: -.02em; }
.candles { height: 280px; margin-top: 12px; }
.candles canvas { width: 100%; height: 100%; display: block; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--sep); margin: 16px; border-radius: 16px; overflow: hidden; }
.stats div { background: var(--card); padding: 12px 14px; }
.stats small { color: var(--sec); font-size: 13px; display: block; }
.stats b { font: 600 17px var(--textf); }
.card { background: var(--card); border-radius: 18px; margin: 0 16px 14px; padding: 14px 16px; }
.card h4 { font: 600 17px var(--textf); margin-bottom: 8px; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; }
.kv span:first-child { color: var(--sec); }
.cta { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 25;
  display: block; text-align: center; min-height: 54px; line-height: 54px; border-radius: 27px; background: var(--green);
  color: #000; font: 600 17px var(--textf); text-decoration: none; }
.cta.sell { background: var(--red); color: #fff; }

/* auditor screen */
.discs { position: relative; width: 220px; margin: 18px auto 8px; height: 252px; }
.disc { position: absolute; left: 0; right: 0; height: 40px; border-radius: 50%; background: var(--card2);
  border: 1px solid rgba(255,255,255,.08); transition: background 150ms; display: grid; place-items: center; font: 600 15px var(--textf); }
.disc.ok { background: var(--green); color: #000; } .disc.no { background: var(--red); }
.disc.skip { opacity: .35; }
.beam { position: absolute; left: -18px; right: -18px; height: 3px; border-radius: 2px; background: var(--cyan);
  box-shadow: 0 0 0 1px rgba(100,210,255,.25); transition: top 350ms linear; }
.verdict { text-align: center; padding: 6px 16px 14px; }
.verdict b { font: 700 22px var(--display); display: block; }
.verdict span { color: var(--sec); }
.layers .kv b { font-weight: 500; }
.layers .kv.no b { color: var(--red); } .layers .kv.skip b { color: var(--ter); }

/* account */
.group { background: var(--card); border-radius: 14px; margin: 0 16px 22px; overflow: hidden; }
.group h3 { font: 400 13px var(--textf); color: var(--sec); padding: 0 16px 6px; margin: 0 0 0 0; background: var(--bg); }
.glabel { color: var(--sec); font-size: 13px; padding: 0 32px 6px; }
.grow-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-bottom: .5px solid var(--sep); }
.grow-row:last-child { border-bottom: 0; }
.grow-row > span:first-child { flex: 1; }
.grow-row a { color: var(--blue); text-decoration: none; }
.setting { padding: 10px 16px; border-bottom: .5px solid var(--sep); }
.setting:last-child { border-bottom: 0; }
.setting .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.setting label { font-size: 15px; }
.setting input[type=number], .setting input[type=text], .setting select {
  width: 112px; background: var(--card2); color: var(--text); border: 0; border-radius: 8px; padding: 8px 10px;
  font: 500 15px var(--mono); text-align: right; min-height: 36px; }
.setting input[type=text] { width: 150px; }
.setting input[type=range] { width: 100%; margin-top: 8px; accent-color: var(--green); pointer-events: none; opacity: .35; }
.setting.editing input[type=range] { pointer-events: auto; opacity: 1; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 92px); z-index: 45;
  background: var(--card2); border-radius: 14px; padding: 6px 6px 6px 16px; display: flex; align-items: center; gap: 10px;
  font-size: 15px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast span { flex: 1; }
.toast button { color: var(--green); font-weight: 600; padding: 0 12px; }
.setting .err { color: var(--red); font-size: 13px; margin-top: 4px; }
.seg { display: flex; background: var(--card2); border-radius: 9px; padding: 2px; }
.seg button { flex: 1; min-height: 32px; border-radius: 7px; font: 600 13px var(--textf); color: var(--sec); }
.seg button.on { background: #636366; color: #fff; }
.note { color: var(--sec); font-size: 13px; padding: 6px 32px 18px; }
.warn { color: var(--orange); }

/* search */
.search-bar { display: flex; gap: 8px; padding: 8px 16px; align-items: center; }
.search-bar input { flex: 1; background: var(--card2); border: 0; border-radius: 10px; color: var(--text); padding: 10px 12px; font: 17px var(--textf); min-height: 40px; }
.textbtn { color: var(--green); }

/* sheet */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: flex; align-items: flex-end; }
.sheet .panel { background: var(--card); width: 100%; border-radius: 16px 16px 0 0; padding: 20px 16px calc(env(safe-area-inset-bottom) + 16px); }
.sheet h3 { font: 600 20px var(--display); margin-bottom: 6px; }
.sheet p { color: var(--sec); font-size: 15px; margin-bottom: 14px; }
.sheet input { width: 100%; background: var(--card2); border: 0; border-radius: 10px; color: var(--text); padding: 12px; font: 17px var(--mono); margin-bottom: 12px; }
.sheet .btns { display: flex; gap: 10px; }
.sheet .btns button { flex: 1; border-radius: 12px; background: var(--card2); min-height: 50px; font-weight: 600; }
.sheet .btns button.go { background: var(--green); color: #000; }
.sheet .btns button.danger { background: var(--red); color: #fff; }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; padding: 6px 0 calc(env(safe-area-inset-bottom) + 2px);
  background: rgba(22,22,24,.78); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font: 500 10px var(--textf); color: var(--ter); }
.tabbar button.on { color: var(--green); }

/* loading */
.skel { background: var(--card); border-radius: 14px; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .5; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .odometer .col, .beam, .disc, .bar i, .switch i, .switch i::after { transition: none !important; }
  .skel, .screen { animation: none !important; }
}
