:root { color-scheme: dark;
  --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, "SF Pro Display", system-ui, sans-serif;
  --textf: -apple-system, "SF Pro Text", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --top: env(safe-area-inset-top, 0px); --bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.3 var(--textf);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

.screen { min-height: 100vh; padding: calc(var(--top) + 6px) 16px calc(var(--bot) + 96px); }
.screen.push { position: fixed; inset: 0; overflow-y: auto; background: var(--bg); z-index: 20;
  padding-bottom: calc(var(--bot) + 110px); }
.offline + main .screen { padding-top: calc(var(--top) + 44px); }

/* error row */
.offline { position: fixed; top: var(--top); left: 0; right: 0; z-index: 50; background: #3a0d0b; color: var(--red);
  font-size: 13px; font-weight: 600; text-align: center; padding: 10px 16px; }

/* navbar */
.nav { display: flex; align-items: center; gap: 10px; height: 52px; }
.nav .grow { flex: 1; }
.avatar { width: 34px; height: 34px; border-radius: 17px; background: var(--card2); display: grid; place-items: center;
  font-weight: 600; font-size: 14px; min-width: 44px; min-height: 44px; background-clip: content-box; padding: 5px; }
.title-btn { font-weight: 600; font-size: 17px; min-height: 44px; display: flex; align-items: center; gap: 4px; }
.title-btn i { color: var(--sec); font-style: normal; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; position: relative; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--text); stroke-width: 2; }
.dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 4px; background: var(--green); }
.back { min-height: 44px; display: inline-flex; align-items: center; color: var(--blue); font-size: 17px; gap: 2px; }

/* balance */
.balance-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 4px; }
.balance { font: 600 66px/1 var(--display); letter-spacing: -1.5px; display: flex; overflow: hidden; height: 70px; }
.balance .sym { margin-right: 2px; }
.digit { display: inline-block; height: 70px; overflow: hidden; position: relative; }
.digit .strip { display: flex; flex-direction: column; transition: transform 600ms cubic-bezier(.2,.8,.2,1); }
.digit .strip span { height: 70px; line-height: 70px; }
.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; margin-top: 12px; }
.pill.mult { background: rgba(0,211,90,0.16); color: var(--green); }
.sub-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; font-size: 17px; font-weight: 500; }
.up { color: var(--green); } .down { color: var(--red); } .muted { color: var(--sec); } .faint { color: var(--ter); }

.chart { width: 100%; height: 240px; display: block; margin-top: 8px; }
.ranges { display: flex; justify-content: space-between; margin: 10px 0 22px; }
.ranges button { min-width: 44px; min-height: 36px; border-radius: 18px; font-size: 14px; font-weight: 600; color: var(--sec); }
.ranges button.on { background: var(--card2); color: var(--text); }

.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-h h2 { font: 600 22px var(--display); margin: 0; }
.section-h button, .section-h a { color: var(--blue); font-size: 17px; min-height: 44px; }

/* agent carousel + cards */
.carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px;
  scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.acard { flex: 0 0 calc(100vw - 32px); max-width: 504px; aspect-ratio: 504 / 470; background: var(--card);
  scroll-snap-align: center; padding: 20px;
  border-radius: calc(min(100vw - 32px, 504px) * 42 / 504); display: flex; flex-direction: column; overflow: hidden; }
.acard .head { display: flex; align-items: center; gap: 8px; }
.acard .head b { font: 600 20px var(--display); }
.acard .head .state { margin-left: auto; font-size: 13px; color: var(--sec); display: flex; align-items: center; gap: 6px; }
.sdot { width: 8px; height: 8px; border-radius: 4px; background: var(--green); }
.sdot.off { background: var(--ter); } .sdot.dead { background: var(--red); }
.acard .big { font: 600 40px/1.1 var(--display); margin: 10px 0 2px; }
.acard .meta { color: var(--sec); font-size: 15px; }
.acard .body { flex: 1; min-height: 0; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.feed-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 6px 0; border-bottom: 0.5px solid var(--sep); }
.feed-row:last-child { border-bottom: 0; }
.feed-row.kill .n { color: var(--ter); text-decoration: line-through; text-decoration-color: var(--red); }
.feed-row .r { color: var(--red); white-space: nowrap; }
.feed-row .pass { color: var(--cyan); white-space: nowrap; }
.strips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.strip8 { height: 34px; border-radius: 8px; background: var(--card2); font-size: 11px; color: var(--sec);
  display: flex; align-items: flex-end; padding: 5px 7px; }
.strip8.ok { background: rgba(0,211,90,0.18); color: var(--green); }
.strip8.bad { background: rgba(255,69,58,0.2); color: var(--red); }
.ring { width: 150px; height: 150px; align-self: center; }
.bar { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); width: 0; }
.tpills { display: flex; gap: 8px; flex-wrap: wrap; }
.tpill { font: 600 13px var(--mono); padding: 5px 10px; border-radius: 12px; }
.tpill.red { background: rgba(255,69,58,0.16); color: var(--red); }
.tpill.green { background: rgba(0,211,90,0.16); color: var(--green); }

/* rows */
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 0; border-bottom: 0.5px solid var(--sep); width: 100%; text-align: left; }
.row .ic { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 15px; }
.ic.bought { background: rgba(10,132,255,0.18); color: var(--blue); }
.ic.sold { background: rgba(0,211,90,0.18); color: var(--green); }
.ic.stopped { background: rgba(255,69,58,0.18); color: var(--red); }
.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: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .v { text-align: right; font-weight: 600; }
.row .v small { display: block; font-weight: 500; font-size: 14px; color: var(--sec); }
.empty { color: var(--sec); text-align: center; padding: 40px 0; }

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

/* big titles */
h1.big { font: 700 34px var(--display); margin: 8px 0 14px; }

/* agents tab */
.fcard { background: var(--card); border-radius: 20px; padding: 16px; margin-bottom: 14px; }
.fcard .head { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.fcard .head b { font: 600 20px var(--display); }
.fcard .head .cnt { color: var(--sec); font-size: 15px; }
.fcard .head .sp { flex: 1; }
.dec { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; font-size: 14px; padding: 8px 0; border-top: 0.5px solid var(--sep); align-items: baseline; }
.dec .tm { color: var(--ter); }
.dec .rs { color: var(--sec); text-align: right; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { color: var(--blue); min-height: 44px; display: inline-flex; align-items: center; }

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

/* account */
.group { background: var(--card); border-radius: 12px; margin-bottom: 22px; overflow: hidden; }
.group .gh { color: var(--sec); font-size: 13px; padding: 0 16px; margin: 0 0 6px; }
.cell { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px; border-bottom: 0.5px solid var(--sep); width: 100%; text-align: left; }
.cell:last-child { border-bottom: 0; }
.cell .l { flex: 1; } .cell .rv { color: var(--sec); }
.cell .chev { color: var(--ter); }
.seg { display: flex; background: var(--card2); border-radius: 9px; padding: 2px; }
.seg button { min-width: 70px; min-height: 32px; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--sec); }
.seg button.on { background: #636366; color: #fff; }
.setting { padding: 10px 16px; border-bottom: 0.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, .field {
  width: 110px; background: var(--card2); color: var(--text); border: 0; border-radius: 8px; padding: 8px 10px;
  font: 15px var(--textf); text-align: right; font-variant-numeric: tabular-nums; min-height: 36px; }
.setting input[type=range] { width: 100%; accent-color: var(--green); min-height: 32px; }
.group-title { font: 600 20px var(--display); margin: 26px 0 10px; }
.note { color: var(--sec); font-size: 13px; padding: 0 4px 10px; }
.cmd { display: flex; gap: 8px; padding: 10px 16px; }
.cmd input { flex: 1; text-align: left; width: auto; }
.reply { padding: 0 16px 12px; font-size: 14px; white-space: pre-wrap; color: var(--sec); }
.reply a { display: inline-block; margin: 6px 6px 0 0; }

/* auditor screen */
.discs { position: relative; height: 260px; margin: 18px auto 10px; width: 220px; }
.disc { position: absolute; left: 10px; right: 10px; height: 26px; border-radius: 50%; background: var(--card2);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.35); display: grid; place-items: center; font-size: 13px; font-weight: 700; transition: background .15s; }
.disc.ok { background: #0b4f2a; color: var(--green); }
.disc.bad { background: #5a1713; color: var(--red); }
.disc.grey { opacity: .45; }
.beam { position: absolute; left: -6px; right: -6px; height: 26px; border-radius: 50%; border: 2px solid var(--cyan);
  box-shadow: 0 0 0 1px rgba(100,210,255,.25); transition: top 350ms ease-in-out; pointer-events: none; }
.lrow { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 12px 0; border-bottom: 0.5px solid var(--sep); font-size: 15px; }
.lrow .ck { font-weight: 700; } .lrow .val { color: var(--sec); text-align: right; }
.verdict { margin: 18px 0 8px; } .verdict b { font: 600 22px var(--display); display: block; }

/* coin */
.coin-h { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.coin-h h1 { font: 700 28px var(--display); margin: 0; }
.chip { font-size: 13px; font-weight: 600; padding: 4px 9px; border-radius: 10px; background: rgba(0,211,90,.16); color: var(--green); }
.price { font: 600 44px/1.1 var(--display); margin-top: 10px; }
.candles { width: 100%; height: 280px; display: block; margin: 12px 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--sep); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.stats div { background: var(--card); padding: 12px 14px; }
.stats small { display: block; color: var(--sec); font-size: 13px; }
.stats b { font-size: 17px; font-weight: 600; }
.exitcard { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; }
.exitcard .ln { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; }

.cta { position: fixed; left: 16px; right: 16px; bottom: calc(var(--bot) + 16px); z-index: 30; min-height: 54px;
  border-radius: 27px; background: var(--green); color: #000; font-weight: 700; font-size: 17px; display: grid; place-items: center; }
.cta.sell { background: var(--red); color: #fff; }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around;
  padding: 6px 0 calc(var(--bot) + 4px); background: rgba(22,22,24,0.72); backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%); border-top: 0.5px solid var(--sep); }
.tabbar button { flex: 1; min-height: 49px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: #8e8e93; }
.tabbar svg { width: 26px; height: 26px; fill: #8e8e93; stroke: #8e8e93; }
.tabbar button.on { color: var(--text); } .tabbar button.on svg { fill: var(--text); stroke: var(--text); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bot) + 96px); z-index: 60; background: var(--card2);
  padding: 10px 16px; border-radius: 20px; font-size: 15px; max-width: calc(100vw - 32px); }
.searchbox { width: 100%; background: var(--card); border: 0; border-radius: 10px; color: var(--text); font: 17px var(--textf); padding: 10px 12px; min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  .digit .strip, .beam, .sw i, .sw i::after, .disc { transition: none !important; }
  .sk { animation: none; }
}

a.cell { color: var(--text); }
.verdict span { font-size: 15px; }
