: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, "SF Pro Display", BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --textf: -apple-system, "SF Pro Text", BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--textf);
  font-size: 17px; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
body { min-height: 100vh; overflow-x: hidden; }
.num, .tab-num { font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input { font: inherit; color: var(--text); }

.view { display: none; padding: calc(var(--top) + 8px) 16px calc(var(--bottom) + 96px); }
.view.on { display: block; }
.overlay { position: fixed; inset: 0; background: var(--bg); z-index: 40; overflow-y: auto; display: none;
  padding: calc(var(--top) + 8px) 16px calc(var(--bottom) + 32px); }
.overlay.on { display: block; }

/* error row */
#err { display: none; position: sticky; top: 0; z-index: 30; margin: 0 -16px; padding: 10px 16px;
  color: var(--red); font-size: 13px; background: #000; border-bottom: 0.5px solid var(--sep); }
#err.on { display: block; }

/* navbar */
.navbar { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 8px; }
.avatar { width: 44px; height: 44px; display: grid; place-items: center; }
.avatar span { width: 32px; height: 32px; border-radius: 50%; background: var(--card2); display: grid;
  place-items: center; font-weight: 600; font-size: 15px; }
.brand { flex: 1; font-weight: 600; font-size: 17px; min-height: 44px; display: flex; align-items: center; }
.brand small { color: var(--ter); margin-left: 4px; font-weight: 400; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; position: relative; }
.icon-btn svg { width: 22px; height: 22px; stroke: var(--text); fill: none; stroke-width: 1.8; }
.dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: none; }
.dot.on { display: block; }
.back { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; color: var(--blue); font-size: 17px; }

/* balance */
.bal-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.odo { font-family: var(--display); font-weight: 600; font-size: 66px; line-height: 1; letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums; display: inline-flex; overflow: hidden; height: 1.08em; }
.odo .d { display: inline-block; height: 1.08em; overflow: hidden; }
.odo .strip { display: flex; flex-direction: column; transition: transform 600ms ease-out; }
.odo .strip span { height: 1.08em; line-height: 1.08em; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.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 { margin-top: 6px; font-size: 17px; font-variant-numeric: tabular-nums; display: flex; gap: 8px; align-items: center; }
.up { color: var(--green); } .down { color: var(--red); } .muted { color: var(--sec); } .faint { color: var(--ter); }

/* charts */
.chart-wrap { position: relative; margin: 16px -16px 0; height: 240px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: var(--sec); font-size: 15px; }
.chart-empty.on { display: flex; }
.ranges { display: flex; justify-content: space-between; margin: 8px 0 0; }
.ranges button { min-width: 44px; min-height: 44px; font-size: 13px; font-weight: 600; color: var(--sec); border-radius: 8px; }
.ranges button.on { color: var(--green); }

/* sections */
.sec-head { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 12px; min-height: 44px; }
.sec-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.sec-head a, .sec-head button { color: var(--green); 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; 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);
  border-radius: calc(42 * min(100vw - 32px, 504px) / 504); padding: 20px; scroll-snap-align: center;
  display: flex; flex-direction: column; overflow: hidden; position: relative; }
.acard .top { display: flex; justify-content: space-between; align-items: flex-start; }
.acard .who { font-size: 15px; color: var(--sec); display: flex; align-items: center; gap: 8px; }
.acard .who i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.acard .big { font-family: var(--display); font-size: 34px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.acard .body { flex: 1; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden; }
.feed-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 6px 0;
  border-bottom: 0.5px solid var(--sep); font-variant-numeric: tabular-nums; }
.feed-row:last-child { border-bottom: 0; }
.feed-row.kill { color: var(--ter); }
.feed-row.kill .n { text-decoration: line-through; text-decoration-color: var(--red); }
.feed-row .r { color: var(--red); white-space: nowrap; }
.feed-row.pass .r { color: var(--cyan); }
.strips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.strips div { height: 28px; border-radius: 8px; background: var(--card2); transition: background 150ms; }
.strips div.ok { background: var(--green); } .strips div.red { background: var(--red); }
.strips div.scan { background: var(--cyan); }
.ring { width: 140px; height: 140px; 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; transition: width 300ms linear; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.card-foot { font-size: 14px; color: var(--sec); }

/* list rows */
.rows { background: var(--card); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; border-bottom: 0.5px solid var(--sep); }
.row:last-child { border-bottom: 0; }
.row .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 36px; font-size: 16px; }
.row .mid { flex: 1; min-width: 0; }
.row .t { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 13px; color: var(--sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .v { text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; white-space: nowrap; }
.row .v small { display: block; color: var(--sec); font-size: 13px; }
.empty { color: var(--sec); text-align: center; padding: 28px 16px; font-size: 15px; }

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

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

/* titles */
h1.title { font-size: 34px; font-weight: 700; letter-spacing: -0.4px; margin: 8px 0 16px; }

/* agents tab */
.agent-full { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 16px; }
.agent-full .hd { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.agent-full .hd b { flex: 1; font-size: 20px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.status-dot.paused { background: var(--orange); } .status-dot.down { background: var(--red); }
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--card2); position: relative; transition: background 200ms; flex: 0 0 51px; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; transition: transform 200ms; }
.switch.on { background: var(--green); } .switch.on::after { transform: translateX(20px); }
.switch.locked { opacity: 0.4; }
.switch-hit { min-width: 51px; min-height: 44px; display: flex; align-items: center; }
.dec { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; font-size: 13px; padding: 8px 0;
  border-top: 0.5px solid var(--sep); align-items: center; font-variant-numeric: tabular-nums; }
.dec .c { color: var(--blue); }
.small-link { color: var(--blue); font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }

/* coin */
.coin-head { display: flex; align-items: center; gap: 8px; }
.coin-head h1 { font-size: 28px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 13px;
  background: rgba(0,211,90,0.16); color: var(--green); font-size: 13px; font-weight: 600; }
.chip.red { background: rgba(255,69,58,0.16); color: var(--red); }
.big-price { font-family: var(--display); font-size: 48px; font-weight: 600; margin-top: 12px; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--sep); border-radius: 14px; overflow: hidden; margin-top: 16px; }
.stats div { background: var(--card); padding: 12px 16px; }
.stats small { display: block; color: var(--sec); font-size: 13px; }
.stats b { font-weight: 600; font-variant-numeric: tabular-nums; }
.card { background: var(--card); border-radius: 14px; padding: 16px; margin-top: 16px; }
.card h3 { margin: 0 0 8px; font-size: 15px; color: var(--sec); font-weight: 500; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; font-variant-numeric: tabular-nums; font-size: 15px; }
.cta { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; border-radius: 27px;
  background: var(--green); color: #000; font-weight: 700; font-size: 17px; margin-top: 20px; }
.cta.sell { background: var(--red); color: #fff; }
.cta.ghost { background: var(--card2); color: var(--text); }
.btn-row { display: flex; gap: 12px; } .btn-row .cta { flex: 1; }

/* auditor screen */
.discs { position: relative; margin: 20px auto 8px; width: 220px; height: 260px; }
.disc { position: absolute; left: 10px; right: 10px; height: 26px; border-radius: 50%; background: var(--card2);
  border: 0.5px solid var(--sep); transition: background 150ms; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: transparent; }
.disc.ok { background: var(--green); color: #000; } .disc.red { background: var(--red); color: #fff; }
.disc.nc { background: #3a3a3c; opacity: 0.5; }
.beam { position: absolute; left: -6px; right: -6px; height: 3px; border-radius: 2px; background: var(--cyan);
  transition: top 300ms ease-out; display: none; }
.beam.on { display: block; }
.layer-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; min-height: 44px;
  border-bottom: 0.5px solid var(--sep); font-size: 15px; }
.layer-row:last-child { border-bottom: 0; }
.layer-row .val { font-variant-numeric: tabular-nums; text-align: right; }
.layer-row.red .val { color: var(--red); } .layer-row.nc { color: var(--ter); }
.verdict { font-size: 22px; font-weight: 700; margin-top: 12px; }
.verdict.red { color: var(--red); } .verdict.ok { color: var(--green); }

/* account */
.seg { display: flex; background: var(--card2); border-radius: 10px; padding: 2px; }
.seg button { flex: 1; min-height: 40px; border-radius: 8px; font-weight: 600; font-size: 15px; color: var(--sec); }
.seg button.on { background: #636366; color: #fff; }
.field { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-bottom: 0.5px solid var(--sep); }
.field:last-child { border-bottom: 0; }
.field label { flex: 1; font-size: 16px; }
.field input[type=number], .field input[type=text] { width: 110px; text-align: right; background: transparent; border: 0;
  font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 15px; min-height: 44px; outline: none; color: var(--text); }
.setting { padding: 10px 16px; border-bottom: 0.5px solid var(--sep); }
.setting:last-child { border-bottom: 0; }
.setting .l { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.setting .l span { font-size: 15px; }
.setting input[type=number], .setting input[type=text] { width: 100px; text-align: right; background: var(--card2); border: 0; border-radius: 8px;
  padding: 0 8px; min-height: 36px; font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; outline: none; }
.setting input[type=range] { width: 100%; margin: 10px 0 2px; accent-color: var(--green); min-height: 28px; }
.setting .err { color: var(--red); font-size: 13px; margin-top: 4px; }
.group-title { margin: 24px 0 8px; font-size: 13px; color: var(--sec); padding-left: 16px; }
.cmd { display: flex; gap: 8px; }
.cmd input { flex: 1; background: var(--card2); border: 0; border-radius: 12px; padding: 0 14px; min-height: 44px; outline: none; }
.cmd button { min-width: 64px; min-height: 44px; border-radius: 12px; background: var(--green); color: #000; font-weight: 700; }
.reply { white-space: pre-wrap; font-size: 15px; margin-top: 12px; color: var(--text); }
.reply a { display: inline-flex; align-items: center; min-height: 44px; color: var(--green); margin-right: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 90px); transform: translateX(-50%); background: var(--card2);
  padding: 10px 16px; border-radius: 12px; font-size: 15px; z-index: 60; display: none; }
.toast.on { display: block; }
.searchbar { display: flex; gap: 8px; align-items: center; }
.searchbar input { flex: 1; background: var(--card2); border: 0; border-radius: 10px; padding: 0 12px; min-height: 40px; outline: none; }

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