:root {
  --bg: #000; --text: #fff; --sec: rgba(235,235,245,0.6); --ter: rgba(235,235,245,0.3);
  --sep: rgba(84,84,88,0.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", SFMono-Regular, Menlo, monospace;
  --cardw: calc(100vw - 32px);
  --tabh: calc(50px + env(safe-area-inset-bottom));
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.35 var(--textf); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top); padding-bottom: calc(var(--tabh) + 16px); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
main { min-height: 60vh; }

/* error row */
.err { position: sticky; top: env(safe-area-inset-top); z-index: 30; background: var(--card); color: var(--red);
  font-size: 13px; padding: 10px 16px; border-bottom: 1px solid var(--sep); }

/* navbar */
.nav { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 16px; min-height: 52px; }
.nav .title { flex: 1; font-weight: 600; font-size: 17px; display: flex; align-items: center; gap: 4px; min-height: 44px; }
.nav .title .chev { color: var(--ter); font-weight: 400; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; position: relative; border-radius: 22px; }
.icon-btn svg { width: 22px; height: 22px; fill: var(--text); }
.avatar { width: 32px; height: 32px; border-radius: 16px; background: var(--card2); display: grid; place-items: center;
  font-weight: 600; font-size: 14px; color: var(--sec); }
.dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 4px; background: var(--green); }
.back { display: flex; align-items: center; gap: 2px; color: var(--blue); min-height: 44px; min-width: 44px; font-size: 17px; }

/* balance */
.hero { padding: 4px 16px 0; }
.balance-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.balance { font-family: var(--display); font-size: clamp(56px, 18vw, 80px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; display: inline-flex; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 13px; font-weight: 600; }
.pill.paper { background: var(--orange); color: #000; }
.pill.mult { background: rgba(0,211,90,0.16); color: var(--green); }
.pill.mono { font-family: var(--mono); font-weight: 500; font-size: 12px; }
.pill.red { background: rgba(255,69,58,0.16); color: var(--red); }
.pill.green { background: rgba(0,211,90,0.16); color: var(--green); }
.today { font-size: 17px; font-weight: 500; margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.up { color: var(--green); } .down { color: var(--red); } .muted { color: var(--sec); } .ter { color: var(--ter); }

/* odometer */
.odo { display: inline-flex; overflow: hidden; }
.odo .d { display: inline-block; height: 1.05em; overflow: hidden; position: relative; }
.odo .col { display: flex; flex-direction: column; transition: transform 600ms cubic-bezier(.16,1,.3,1); }
.odo .col span { height: 1.05em; display: block; text-align: center; }
.odo .s { display: inline-block; }

/* chart */
.chart-wrap { position: relative; margin-top: 12px; }
.chart-wrap canvas { display: block; width: 100%; height: 240px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--sec); font-size: 15px; }
.ranges { display: flex; justify-content: space-between; padding: 8px 16px 0; }
.ranges button { min-width: 44px; min-height: 44px; border-radius: 22px; font-size: 13px; font-weight: 600; color: var(--sec); }
.ranges button.on { color: var(--green); background: rgba(0,211,90,0.14); }

/* sections */
.section-h { display: flex; justify-content: space-between; align-items: center; padding: 24px 16px 10px; }
.section-h h2 { margin: 0; font-size: 22px; font-weight: 700; }
.section-h a, .section-h span { color: var(--sec); font-size: 15px; min-height: 44px; display: flex; align-items: center; }

/* agent cards */
.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); padding: 20px; scroll-snap-align: center; display: flex; flex-direction: column; overflow: hidden; }
.acard .ah { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.acard .ah i { width: 8px; height: 8px; border-radius: 4px; display: inline-block; }
.acard .ah .st { margin-left: auto; color: var(--sec); font-weight: 500; font-size: 13px; }
.acard .big { font-family: var(--display); font-size: 40px; font-weight: 600; margin: 10px 0 6px; letter-spacing: -0.01em; }
.acard .sub { color: var(--sec); font-size: 14px; }
.feed { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.feed .r { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 5px 0; border-top: 1px solid var(--sep); }
.feed .r .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .r.kill .n { color: var(--ter); text-decoration: line-through; text-decoration-color: var(--red); }
.feed .r.kill .why { color: var(--red); white-space: nowrap; }
.feed .r.pass .why { color: var(--cyan); white-space: nowrap; }
.strips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.strips b { height: 10px; border-radius: 5px; background: var(--card2); }
.strips b.ok { background: var(--green); } .strips b.no { background: var(--red); } .strips b.run { background: var(--cyan); }
.ring { width: 120px; height: 120px; margin: 4px 0; }
.bar { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; margin: 10px 0 6px; }
.bar > i { display: block; height: 100%; background: var(--green); width: 0; transition: width 1.2s linear; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* lists */
.list { margin: 0 16px; background: var(--card); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; border-top: 1px solid var(--sep); }
.row:first-child { border-top: 0; }
.row .ic { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; flex: none; font-size: 15px; font-weight: 700; }
.row .ic.bought { background: rgba(10,132,255,0.18); color: var(--blue); }
.row .ic.sold { background: rgba(0,211,90,0.16); color: var(--green); }
.row .ic.stopped { background: rgba(255,69,58,0.16); color: var(--red); }
.row .ic.rejected { background: var(--card2); color: var(--sec); }
.row .mid { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--sec); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .v { text-align: right; font-size: 15px; font-weight: 500; white-space: nowrap; }
.row .chev { color: var(--ter); }
.empty { color: var(--sec); text-align: center; padding: 32px 16px; }
.more { display: block; margin: 12px auto; min-height: 44px; padding: 0 20px; color: var(--blue); }

/* agents tab */
.fcard { margin: 0 16px 12px; background: var(--card); border-radius: 18px; padding: 16px; }
.fcard .h { display: flex; align-items: center; gap: 10px; }
.fcard .h .nm { font-size: 20px; font-weight: 700; }
.fcard .h .cnt { color: var(--sec); font-size: 14px; }
.sdot { width: 10px; height: 10px; border-radius: 5px; background: var(--green); }
.sdot.off { background: var(--ter); }
.switch { margin-left: auto; width: 51px; height: 31px; border-radius: 16px; background: var(--card2); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 14px; background: #fff; transition: transform .2s; }
.switch.on { background: var(--green); } .switch.on::after { transform: translateX(20px); }
.switch.locked { opacity: .4; }
.switch-hit { min-width: 51px; min-height: 44px; display: grid; place-items: center; margin-left: auto; }
.dec { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; font-size: 13px; padding: 8px 0; border-top: 1px solid var(--sep); align-items: center; min-height: 44px; }
.dec .c { font-weight: 600; } .dec .why { color: var(--sec); text-align: right; }
.link { color: var(--blue); min-height: 44px; display: inline-flex; align-items: center; }

/* coin */
.coin-h { padding: 0 16px; }
.coin-h .nm { font-size: 28px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--card2); font-size: 13px; font-weight: 600; }
.chip.ok { color: var(--green); } .chip.no { color: var(--red); }
.price { font-family: var(--display); font-size: 48px; font-weight: 600; margin-top: 8px; letter-spacing: -0.01em; }
.candles { display: block; width: 100%; height: 260px; margin-top: 8px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--sep); margin: 16px; border-radius: 14px; overflow: hidden; }
.stats div { background: var(--card); padding: 12px 14px; }
.stats .k { color: var(--sec); font-size: 13px; } .stats .vv { font-size: 17px; font-weight: 600; margin-top: 2px; }
.card { margin: 0 16px 12px; background: var(--card); border-radius: 14px; padding: 16px; }
.card .ln { display: flex; justify-content: space-between; padding: 6px 0; min-height: 32px; align-items: center; }
.cta { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabh) + 12px); height: 54px; border-radius: 27px;
  font-size: 17px; font-weight: 700; display: grid; place-items: center; z-index: 15; }
.cta.buy { background: var(--green); color: #000; } .cta.sell { background: var(--red); color: #fff; } .cta.neutral { background: #fff; color: #000; }
.pad-cta { height: 80px; }

/* auditor */
.discs { position: relative; height: 270px; margin: 8px auto 0; width: 220px; }
.disc { position: absolute; left: 0; right: 0; height: 44px; border-radius: 50%; background: var(--card2); border: 0;
  display: grid; place-items: center; transition: background 150ms; }
.disc span { font-size: 13px; font-weight: 700; color: var(--sec); }
.disc.ok { background: rgba(0,211,90,0.85); } .disc.ok span { color: #000; }
.disc.no { background: rgba(255,69,58,0.9); } .disc.no span { color: #fff; }
.disc.grey span { color: var(--ter); }
.beam { position: absolute; left: -12px; right: -12px; height: 3px; background: var(--cyan); border-radius: 2px; opacity: 0;
  transition: top 350ms linear, opacity 150ms; box-shadow: none; }
.vrow { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--sep); min-height: 44px; align-items: center; }
.vrow:first-child { border-top: 0; }
.vrow .k { display: flex; gap: 8px; align-items: center; }
.vrow .k b { width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; background: var(--card2); color: var(--ter); }
.vrow .k b.ok { background: var(--green); color: #000; } .vrow .k b.no { background: var(--red); color: #fff; }
.vrow .val { text-align: right; font-family: var(--mono); font-size: 13px; }
.verdict { padding: 16px; }
.verdict .h { font-size: 22px; font-weight: 700; }
.verdict .h.no { color: var(--red); } .verdict .h.ok { color: var(--green); }

/* account */
.seg { display: flex; margin: 0 16px; background: var(--card); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; min-height: 44px; border-radius: 8px; font-weight: 600; color: var(--sec); }
.seg button.on { background: var(--card2); color: var(--text); }
.field { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 16px; border-top: 1px solid var(--sep); }
.field:first-child { border-top: 0; }
.field label { flex: 1; }
.field input[type=number], .field input[type=text] { width: 110px; min-height: 36px; background: var(--card2); border: 0; border-radius: 8px;
  color: var(--text); font: 15px var(--mono); padding: 0 10px; text-align: right; }
.set { padding: 10px 16px; border-top: 1px solid var(--sep); }
.set:first-child { border-top: 0; }
.set .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; }
.set .top .nm { font-size: 14px; }
.set input[type=range] { width: 100%; height: 44px; accent-color: var(--green); margin: 0; }
.set input[type=number], .set input[type=text], .set select { width: 120px; min-height: 36px; background: var(--card2); border: 0; border-radius: 8px;
  color: var(--text); font: 14px var(--mono); padding: 0 10px; text-align: right; }
.group-h { padding: 22px 16px 8px; color: var(--sec); font-size: 13px; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 84px); transform: translateX(-50%); background: var(--card2);
  padding: 10px 16px; border-radius: 20px; font-size: 14px; z-index: 40; max-width: calc(100vw - 32px); }

/* search */
.search { display: flex; gap: 8px; padding: 6px 16px; }
.search input { flex: 1; min-height: 40px; background: var(--card); border: 0; border-radius: 10px; color: var(--text); font: 17px var(--textf); padding: 0 12px; }

/* tabbar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabh); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(18,18,18,0.72); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--sep); z-index: 20; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--ter); min-height: 44px; }
.tabbar a svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; }
.tabbar a.on { color: var(--text); }

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

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