:root {
  --bg: #000;
  --text: #fff;
  --secondary: rgba(235, 235, 245, 0.6);
  --tertiary: 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;
  --purple: #bf5af2;
  --gutter: 16px;
  --nav-h: 56px;
  --tab-h: 49px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --font: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  font-size: 15px; line-height: 1.3;
  min-height: 100%;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
img { display: block; max-width: 100%; }
.tabular, .num, .odo, .pill, .value, .pct, .mul {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* banner */
.banner {
  position: sticky; top: 0; z-index: 40;
  background: #3a1210; color: var(--red);
  padding: 8px var(--gutter);
  padding-top: calc(8px + var(--safe-top));
  font-size: 13px; line-height: 1.35;
}
.banner[hidden] { display: none; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--nav-h) + var(--safe-top));
  padding: var(--safe-top) var(--gutter) 0;
  background: rgba(0,0,0,0.86);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
}
.nav.under-banner { top: auto; }
.hit {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card2); color: var(--text);
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.brand {
  flex: 1; min-width: 0;
  font-size: 17px; font-weight: 600;
  color: var(--text);
  text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand span { color: var(--tertiary); font-weight: 500; padding-left: 2px; }
.nav-title {
  flex: 1; min-width: 0;
  font-size: 17px; font-weight: 600;
  text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ico { width: 22px; height: 22px; stroke: var(--text); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bell-wrap { position: relative; }
.bell-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 1.5px solid var(--bg);
}
.search-field {
  flex: 1; min-width: 0;
  height: 36px; border-radius: 10px;
  background: var(--card2); border: 0;
  padding: 0 12px; color: var(--text);
  outline: none;
}
.search-field::placeholder { color: var(--tertiary); }

/* main */
.main {
  padding: 8px 0 calc(var(--tab-h) + var(--safe-bot) + 16px);
  min-height: 100dvh;
}
.gutter { padding-left: var(--gutter); padding-right: var(--gutter); }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--secondary); }
.dim { color: var(--tertiary); }
.sep { height: 0.5px; background: var(--sep); margin: 0 var(--gutter); }

/* typography helpers */
.h-label { font-size: 13px; color: var(--secondary); font-weight: 500; }
.h-section {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 18px var(--gutter) 10px;
  font-size: 20px; font-weight: 700;
}
.h-section a, .h-section button.link {
  font-size: 15px; font-weight: 500; color: var(--blue);
  min-height: 44px; display: inline-flex; align-items: center;
}

/* PAPER pill */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; letter-spacing: 0;
  height: 22px; padding: 0 8px; border-radius: 11px;
  background: var(--card2); color: var(--secondary);
  text-transform: none;
}
.pill.paper { background: rgba(255, 159, 10, 0.18); color: var(--orange); }
.pill.green { background: rgba(0, 211, 90, 0.16); color: var(--green); }
.pill.red { background: rgba(255, 69, 58, 0.16); color: var(--red); }
.pill.blue { background: rgba(10, 132, 255, 0.16); color: var(--blue); }
.pill.cyan { background: rgba(100, 210, 255, 0.16); color: var(--cyan); }
.pill.yellow { background: rgba(255, 214, 10, 0.16); color: var(--yellow); }
.pill.purple { background: rgba(191, 90, 242, 0.16); color: var(--purple); }
.pill.pink { background: rgba(255, 107, 154, 0.16); color: var(--pink); }
.pill.strike { color: var(--tertiary); text-decoration: line-through; text-decoration-color: var(--red); }

/* balance */
.balance-block { padding: 8px var(--gutter) 4px; }
.balance-row { display: flex; align-items: flex-start; gap: 10px; }
.odo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 72px;
  line-height: 0.95;
  letter-spacing: -2px;
  display: flex; align-items: flex-start;
  min-width: 0;
}
.odo .ch {
  display: inline-block; height: 72px; overflow: hidden; position: relative;
}
.odo .reel {
  display: flex; flex-direction: column;
  will-change: transform;
  transition: transform 600ms ease-out;
}
.odo .reel span {
  display: block; height: 72px; line-height: 72px;
}
.meta-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-height: 28px; }
.pct { font-size: 15px; font-weight: 600; }
.pct.up { color: var(--green); }
.pct.down { color: var(--red); }
.mul {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 600;
  color: var(--green);
  background: rgba(0, 211, 90, 0.14);
  height: 24px; padding: 0 8px; border-radius: 12px;
  display: inline-flex; align-items: center;
}

/* chart */
.chart-wrap { padding: 8px 0 0; }
.chart-wrap canvas { width: 100%; height: 160px; display: block; }
.ranges {
  display: flex; gap: 4px; padding: 8px var(--gutter) 4px;
}
.ranges button {
  flex: 1; min-height: 36px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--secondary);
}
.ranges button.on { background: var(--card2); color: var(--text); }

/* live screen card */
.live-card {
  margin: 12px var(--gutter) 0;
  background: var(--card);
  border-radius: 22px;
  overflow: hidden;
}
.live-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
}
.live-frame img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 180ms linear;
}
.live-frame img.show { opacity: 1; }
.live-tag {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff; font-size: 12px; font-weight: 500;
  height: 24px; padding: 0 8px; border-radius: 12px;
  max-width: calc(100% - 140px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.live-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: #8e8e93; flex-shrink: 0; }
.live-tag .dot.hot { background: var(--red); }
.live-lane {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  font-size: 12px; font-weight: 600;
  height: 24px; padding: 0 8px; border-radius: 12px;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center;
  max-width: 46%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.live-order {
  padding: 12px 14px 14px;
  display: flex; align-items: center; gap: 10px;
  min-height: 48px;
}
.live-order .t { flex: 1; min-width: 0; font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks { display: flex; gap: 6px; flex-shrink: 0; }
.check {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--card2); color: var(--tertiary);
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.check.on { background: rgba(0,211,90,0.2); color: var(--green); }
.check.off { background: rgba(255,69,58,0.2); color: var(--red); }

/* bot carousel */
.carousel {
  display: flex; gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--gutter) 8px;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.bot-card {
  flex: 0 0 78%;
  max-width: 300px;
  scroll-snap-align: start;
  background: var(--card);
  border-radius: 18px;
  padding: 14px 14px 16px;
  min-height: 132px;
  text-align: left;
}
.bot-card .top { display: flex; align-items: center; gap: 8px; }
.bot-card .name { font-size: 16px; font-weight: 650; flex: 1; }
.bot-card .stat { font-size: 13px; color: var(--secondary); }
.bot-card .body { margin-top: 10px; font-size: 14px; color: var(--secondary); }
.feed-line { font-size: 13px; margin-top: 6px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-line.kill { color: var(--tertiary); text-decoration: line-through; text-decoration-color: var(--red); }
.feed-line.pass { color: var(--secondary); }
.layer-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 10px 0 8px;
}
.layer-strip {
  height: 6px; border-radius: 3px; background: var(--card2);
}
.layer-strip.ok { background: var(--green); }
.layer-strip.bad { background: var(--red); }
.score-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.ring {
  width: 44px; height: 44px; flex-shrink: 0;
}
.bar {
  height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; margin-top: 8px;
}
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 3px; }

/* activity rows */
.act {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px var(--gutter);
  min-height: 64px;
  width: 100%;
  text-align: left;
  border-bottom: 0.5px solid var(--sep);
}
.act .mid { flex: 1; min-width: 0; }
.act .title, .act .sub { display: block; }
.act .title { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act .sub { font-size: 13px; color: var(--secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act .right { text-align: right; flex-shrink: 0; font-size: 15px; font-weight: 600; max-width: 42%; }
.act .right .v { font-variant-numeric: tabular-nums; }
.act .right .s { display: block; font-size: 12px; font-weight: 500; color: var(--secondary); margin-top: 2px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.empty {
  padding: 40px var(--gutter);
  text-align: center;
  color: var(--secondary);
  font-size: 16px;
}

/* bots tab */
.bot-full {
  margin: 10px var(--gutter) 14px;
  background: var(--card);
  border-radius: 18px;
  padding: 14px;
}
.bot-full .head { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tertiary); flex-shrink: 0; }
.status-dot.on { background: var(--green); }
.status-dot.off { background: var(--red); }
.switch {
  width: 51px; height: 31px; border-radius: 16px;
  background: var(--card2); position: relative;
  flex-shrink: 0;
  opacity: 0.9;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
}
.switch.on { background: var(--green); }
.switch.on::after { left: 22px; }
.switch.locked { opacity: 0.4; }
.dec-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0;
  min-height: 44px;
  border-top: 0.5px solid var(--sep);
  font-size: 14px;
}
.dec-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note {
  margin: 8px var(--gutter) 0;
  font-size: 13px; color: var(--secondary);
  background: var(--card);
  border-radius: 12px;
  padding: 10px 12px;
}

/* audit */
.audit-hero { text-align: center; padding: 8px var(--gutter) 4px; }
.audit-hero .sym { font-size: 22px; font-weight: 700; }
.discs {
  display: flex; justify-content: center; gap: 8px;
  padding: 16px var(--gutter) 8px;
}
.disc {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--tertiary);
  position: relative;
}
.disc.ok { background: rgba(0,211,90,0.18); color: var(--green); }
.disc.bad { background: rgba(255,69,58,0.18); color: var(--red); }
.disc .beam {
  position: absolute; inset: -3px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--cyan);
  animation: beam 1.1s ease-in-out;
}
@keyframes beam { 0% { opacity: 0; transform: scale(0.7); } 40% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.15); } }
.layer-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px var(--gutter);
  min-height: 48px;
  border-bottom: 0.5px solid var(--sep);
}
.layer-row .nm { flex: 1; min-width: 0; }
.layer-row .nm .k { font-size: 15px; font-weight: 600; }
.layer-row .nm .v { font-size: 13px; color: var(--secondary); margin-top: 1px; }
.social-row {
  margin: 14px var(--gutter) 0;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px; color: var(--secondary);
}

/* coin */
.coin-head { padding: 4px var(--gutter) 8px; }
.coin-sub { font-size: 13px; color: var(--secondary); margin-top: 4px; }
.coin-price {
  font-family: var(--font-display);
  font-size: 44px; font-weight: 700; letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  margin-top: 10px;
}
.stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; padding: 12px var(--gutter);
}
.stat-box { background: var(--card); border-radius: 12px; padding: 10px; }
.stat-box .k { font-size: 12px; color: var(--secondary); }
.stat-box .v { font-size: 15px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.pos-box {
  margin: 4px var(--gutter) 12px;
  background: var(--card); border-radius: 14px; padding: 12px 14px;
  font-size: 15px;
}
.actions {
  display: flex; gap: 10px;
  padding: 4px var(--gutter) 20px;
}
.actions a, .actions button.btn {
  flex: 1; min-height: 48px;
  border-radius: 14px;
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.btn-blue { background: var(--blue); color: #fff; }
.btn-card { background: var(--card2); color: var(--text); }
.btn[disabled], a.btn[aria-disabled="true"] { opacity: 0.45; }

/* account */
.acct-block { padding: 8px var(--gutter) 4px; }
.mode-row { display: flex; gap: 8px; margin: 8px 0 12px; }
.mode-row button {
  flex: 1; min-height: 44px; border-radius: 12px;
  background: var(--card); font-weight: 600;
}
.mode-row button.on { background: var(--card2); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22); }
.acct-link, .acct-row {
  display: flex; align-items: center;
  min-height: 48px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--sep);
  width: 100%; text-align: left; font-size: 16px;
}
.acct-link .chev { color: var(--tertiary); margin-left: auto; }
.group-title {
  padding: 18px 0 6px;
  font-size: 13px; font-weight: 600; color: var(--secondary);
}
.set-row { padding: 8px 0 10px; border-bottom: 0.5px solid var(--sep); }
.set-row .lab { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.set-row .lab .val { font-variant-numeric: tabular-nums; color: var(--secondary); }
.set-row input[type=range] {
  width: 100%; margin: 8px 0 0; accent-color: var(--blue);
  pointer-events: none;
  opacity: 0.85;
}
.set-row input[type=text], .set-row input[type=number] {
  width: 88px; height: 32px; border-radius: 8px;
  background: var(--card2); border: 0; padding: 0 8px;
  text-align: right; font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  padding-bottom: var(--safe-bot);
  background: rgba(22, 22, 24, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}
.tabbar button {
  flex: 1; min-height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--tertiary);
  font-size: 10px; font-weight: 500;
}
.tabbar button.on { color: var(--blue); }
.tabbar .ticon { width: 24px; height: 24px; }

/* overlays / sheets */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 430px;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 12px 16px calc(16px + var(--safe-bot));
}
.sheet h2 { font-size: 18px; margin: 6px 0 12px; font-weight: 700; }
.sheet .choice {
  width: 100%; min-height: 48px;
  border-radius: 12px;
  background: var(--card2);
  margin: 0 0 8px;
  font-size: 16px; font-weight: 600;
}
.sheet .choice.on { outline: 1px solid var(--blue); }
.full-screen {
  position: fixed; inset: 0; z-index: 60; background: #000;
  display: flex; flex-direction: column;
}
.full-screen .fs-bar {
  display: flex; align-items: center; gap: 8px;
  padding: calc(6px + var(--safe-top)) 8px 6px;
}
.full-screen .stage {
  flex: 1; overflow: auto; touch-action: pinch-zoom;
  display: flex; align-items: center; justify-content: center;
}
.full-screen .stage img { width: 100%; height: auto; }
.search-list { padding: 8px 0 20px; max-height: 70vh; overflow: auto; }

/* loading skeletons */
.skel {
  background: var(--card);
  border-radius: 10px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.skel-balance { height: 72px; margin: 8px var(--gutter); }
.skel-chart { height: 180px; margin: 8px var(--gutter); border-radius: 12px; }
.skel-card { height: 132px; margin: 0 0 0 0; }

.missing {
  padding: calc(80px + var(--safe-top)) var(--gutter);
  color: var(--secondary); text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
