/* STEP 8 · iPhone desk. No neon, no glow, no double borders, no all-caps eyebrows. */
: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;
  --card-2: #2c2c2e;
  --green: #00d35a;
  --red: #ff453a;
  --orange: #ff9f0a;
  --cyan: #64d2ff;
  --blue: #0a84ff;
  --yellow: #ffd60a;
  --pink: #ff6b9a;
  --gutter: 16px;
  --tap: 44px;
  --nav-h: 52px;
  --tab-h: 52px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: 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); height: 100%; }
body {
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.3;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
.num, .odometer, .stat-val, .price-lg, .today, .row-value, .score-n {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

#app { height: 100dvh; height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
#main { flex: 1; overflow: hidden; position: relative; }

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-t) + 6px) var(--gutter) 8px;
  min-height: calc(var(--nav-h) + var(--safe-t));
  border-bottom: 0.5px solid transparent;
}
.nav-btn {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  color: var(--text);
  flex: 0 0 var(--tap);
  border-radius: 22px;
}
.nav-btn.avatar {
  background: var(--card-2);
  font-weight: 600;
  font-size: 16px;
}
.nav-title {
  flex: 1;
  text-align: left;
  font-size: 17px;
  font-weight: 600;
  min-height: var(--tap);
}
.nav-title .chevron { color: var(--tertiary); font-weight: 400; }
.nav-right { display: flex; gap: 0; }
.bell-dot {
  position: absolute;
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  margin: -18px 0 0 8px;
}

#search-bar {
  padding: 0 var(--gutter) 8px;
}
#search-input {
  width: 100%;
  height: var(--tap);
  border-radius: 12px;
  border: 0.5px solid var(--sep);
  background: var(--card);
  padding: 0 14px;
  outline: none;
}
#search-results {
  position: absolute;
  left: 0; right: 0;
  top: calc(var(--nav-h) + var(--safe-t) + 52px);
  bottom: calc(var(--tab-h) + var(--safe-b));
  background: var(--bg);
  z-index: 20;
  overflow-y: auto;
  padding: 0 var(--gutter);
}

.banner {
  margin: 0 var(--gutter) 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
  color: var(--red);
  font-size: 13px;
}

/* Screens */
.screen {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--gutter) calc(var(--tab-h) + var(--safe-b) + 20px);
}
.screen.overlay { position: absolute; inset: 0; background: var(--bg); z-index: 5; padding-bottom: calc(var(--tab-h) + var(--safe-b) + 20px); }
.screen[hidden], [hidden] { display: none !important; }

/* Tab bar */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(22, 22, 24, 0.82);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--sep);
  z-index: 10;
}
.tab {
  min-height: var(--tab-h);
  color: var(--tertiary);
  font-size: 10px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.tab.active { color: var(--blue); }
.tab::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  margin-bottom: 1px;
}
.tab[data-tab="home"]::before { border-radius: 5px 5px 2px 2px; }
.tab[data-tab="agents"]::before { border-radius: 50%; width: 10px; height: 10px; box-shadow: 8px 0 0 currentColor, -8px 0 0 currentColor; border: 0; background: currentColor; }
.tab[data-tab="activity"]::before { width: 16px; height: 16px; border-radius: 3px; }
.tab[data-tab="account"]::before { border-radius: 50%; }

/* Typography helpers */
.h-label { color: var(--secondary); font-size: 15px; font-weight: 600; }
.h-row { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
.h-row .link { color: var(--blue); font-size: 15px; min-height: var(--tap); display: inline-flex; align-items: center; }

/* Balance / PAPER */
.balance-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 6px; }
.odometer {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 66px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1;
  display: flex;
  height: 72px;
  overflow: hidden;
}
.odometer .digit-col { height: 72px; overflow: hidden; position: relative; }
.odometer .digit-strip { display: flex; flex-direction: column; }
.odometer .digit-strip span { height: 72px; line-height: 72px; display: block; }
.odometer .ch { line-height: 72px; height: 72px; }
.pill {
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, monospace;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin-top: 8px;
}
.pill-paper { background: var(--orange); color: #000; }
.pill-mult { background: rgba(0, 211, 90, 0.16); color: var(--green); }
.pill-stop { background: rgba(255, 69, 58, 0.16); color: var(--red); }
.pill-trail { background: rgba(0, 211, 90, 0.16); color: var(--green); }
.pill-shield { background: var(--card-2); color: var(--text); }

.meta-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; }
.today { font-size: 17px; font-weight: 600; }
.today.up { color: var(--green); }
.today.down { color: var(--red); }

/* Chart */
.chart-wrap { position: relative; height: 200px; margin: 0 -4px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-empty {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 28px;
  color: var(--secondary); font-size: 13px;
  pointer-events: none;
}
.range-switch {
  display: flex; justify-content: space-between;
  margin: 8px 0 4px;
}
.range-switch button {
  min-width: 40px; min-height: var(--tap);
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.range-switch button.on { color: var(--green); }

/* Agent cards (home carousel) */
.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0;
  gap: 12px;
  margin: 0 -16px;
  padding: 0 16px 8px;
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }
.agent-card {
  flex: 0 0 calc(100vw - 32px);
  width: calc(100vw - 32px);
  aspect-ratio: 504 / 470;
  background: var(--card);
  border-radius: calc(42 * (100vw - 32px) / 504);
  padding: 18px 18px 16px;
  scroll-snap-align: start;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.agent-card h3 { margin: 0 0 6px; font-size: 20px; font-weight: 650; }
.agent-card .count { font-size: 15px; color: var(--secondary); margin-bottom: 10px; }
.agent-card.scanner h3 { color: var(--cyan); }
.agent-card.analyst h3 { color: var(--yellow); }
.agent-card.executor h3 { color: var(--green); }
.agent-card.risk h3 { color: var(--pink); }

.feed { display: flex; flex-direction: column; gap: 7px; font-size: 14px; overflow: hidden; }
.feed .kill { color: var(--tertiary); text-decoration: line-through; text-decoration-color: var(--red); }
.feed .kill .reason { color: var(--red); text-decoration: none; display: inline; margin-left: 6px; }
.feed .pass { color: var(--text); }
.feed .pass .to { color: var(--cyan); }

.layer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; flex: 1; }
.layer-strip {
  height: 8px; border-radius: 4px; background: var(--card-2);
}
.layer-strip.on { background: var(--green); }
.layer-strip.off { background: var(--red); }

.ring-wrap { display: flex; align-items: center; gap: 16px; flex: 1; }
.ring-wrap canvas { width: 120px; height: 120px; }
.ring-label { font-size: 15px; color: var(--secondary); }
.score-n { font-size: 28px; font-weight: 700; }

.exec-bar {
  height: 8px; border-radius: 4px; background: var(--card-2); overflow: hidden; margin: 8px 0;
}
.exec-bar > span { display: block; height: 100%; background: var(--green); width: 0; }
.exec-note { color: var(--secondary); font-size: 14px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.empty-card { color: var(--secondary); font-size: 15px; margin-top: 8px; }

/* Activity rows */
.act-row {
  display: flex; align-items: center;
  min-height: var(--tap);
  padding: 10px 0;
  border-bottom: 0.5px solid var(--sep);
  gap: 10px;
  text-align: left;
  width: 100%;
}
.act-row .mid { flex: 1; min-width: 0; }
.act-row .title { font-weight: 600; font-size: 15px; }
.act-row .sub { color: var(--secondary); font-size: 13px; margin-top: 2px; }
.row-value { font-weight: 600; font-size: 15px; text-align: right; }
.row-value.pos { color: var(--green); }
.row-value.neg { color: var(--red); }
.muted { color: var(--secondary); }

/* Agents tab */
.agent-panel {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin: 0 0 12px;
}
.agent-panel .head { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tertiary); }
.dot.running { background: var(--green); }
.dot.paused, .dot.stale { background: var(--orange); }
.dot.unknown { background: var(--tertiary); }
.switch {
  width: 51px; height: 31px; border-radius: 16px;
  background: var(--card-2);
  position: relative;
  flex: 0 0 51px;
  margin-left: auto;
}
.switch.on { background: var(--green); }
.switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px;
  background: #fff;
  border-radius: 50%;
}
.switch.on::after { left: 22px; }
.switch.locked, .switch[aria-disabled="true"] { opacity: 0.45; }
.dec-list { margin-top: 10px; }
.dec-row { display: flex; gap: 8px; padding: 8px 0; border-bottom: 0.5px solid var(--sep); font-size: 13px; }
.dec-row a { color: var(--blue); text-decoration: none; min-height: auto; }
.settings-link { color: var(--blue); min-height: var(--tap); display: inline-flex; align-items: center; }

/* Auditor */
.back-row { display: flex; align-items: center; gap: 8px; min-height: var(--tap); margin: 0 0 8px; }
.back-row button { min-width: var(--tap); min-height: var(--tap); text-align: left; font-size: 17px; color: var(--blue); }
.discs { position: relative; height: 220px; margin: 8px 0 16px; }
.disc {
  position: absolute; left: 50%;
  width: 88px; height: 88px;
  margin-left: -44px;
  border-radius: 50%;
  background: var(--card-2);
  display: grid; place-items: center;
  font-size: 13px; color: var(--tertiary);
  border: 0.5px solid var(--sep);
}
.disc.ok { background: #0a3d22; color: var(--green); border-color: var(--green); }
.disc.bad { background: #3d1010; color: var(--red); border-color: var(--red); }
.beam {
  position: absolute; left: 50%; width: 4px; height: 28px;
  margin-left: -2px;
  background: var(--cyan);
  border-radius: 2px;
  z-index: 2;
  opacity: 0;
}
.layer-rows { display: flex; flex-direction: column; }
.layer-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 0.5px solid var(--sep); font-size: 14px; }
.layer-row .val { color: var(--secondary); text-align: right; font-variant-numeric: tabular-nums; }
.verdict { margin: 16px 0; }
.verdict .big { font-size: 20px; font-weight: 650; }
.verdict .sub { color: var(--secondary); margin-top: 4px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; min-height: var(--tap); gap: 12px; }
.btn-fomo {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: var(--tap);
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  margin-top: 16px;
  text-decoration: none;
}

/* Coin */
.price-lg {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 44px; font-weight: 700; letter-spacing: -0.8px; margin: 6px 0 0;
}
.chg { font-weight: 600; margin: 4px 0 12px; }
.chg.up { color: var(--green); }
.chg.down { color: var(--red); }
.subline { color: var(--secondary); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 16px 0; }
.stat-k { color: var(--secondary); font-size: 13px; }
.stat-val { font-size: 16px; font-weight: 600; margin-top: 2px; }
.pos-card, .exit-card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.pos-card h4, .exit-card h4 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.exit-line { display: flex; justify-content: space-between; padding: 6px 0; color: var(--secondary); }
.exit-line span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }

/* Account */
.mode-switch { display: flex; background: var(--card); border-radius: 10px; padding: 3px; margin: 8px 0 14px; }
.mode-switch span {
  flex: 1; min-height: 38px; display: grid; place-items: center;
  border-radius: 8px; color: var(--secondary); font-weight: 600;
}
.mode-switch span.on { background: var(--card-2); color: var(--text); }
.field { margin: 0 0 14px; }
.field label { display: block; color: var(--secondary); font-size: 13px; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; min-height: var(--tap);
  background: var(--card);
  border: 0.5px solid var(--sep);
  border-radius: 10px;
  padding: 0 12px;
}
.field input:disabled, .field select:disabled, .mode-switch { opacity: 1; }
.row-link {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--tap);
  border-bottom: 0.5px solid var(--sep);
  text-decoration: none; color: inherit;
  width: 100%;
  text-align: left;
}
.row-link .go { color: var(--tertiary); }
.note { color: var(--secondary); font-size: 13px; margin: 8px 0 16px; }
.group { margin: 18px 0 8px; }
.group h3 { margin: 0 0 8px; font-size: 15px; font-weight: 650; }
.setting { padding: 10px 0; border-bottom: 0.5px solid var(--sep); }
.setting .lab { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 6px; }
.setting input[type="range"] { width: 100%; accent-color: var(--blue); height: 24px; }
.setting .pair { display: flex; gap: 8px; align-items: center; }
.setting .pair input[type="number"], .setting .pair input[type="text"] {
  width: 110px; min-height: 36px; background: var(--card); border: 0.5px solid var(--sep);
  border-radius: 8px; padding: 0 8px; font-variant-numeric: tabular-nums;
}
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  background: var(--card-2); color: var(--text);
  padding: 10px 16px; border-radius: 10px; z-index: 30; font-size: 14px;
}

/* Loading skeletons */
.skel {
  background: var(--card);
  border-radius: 10px;
  opacity: 0.7;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.skel.line { height: 16px; margin: 10px 0; }
.skel.hero { height: 72px; margin: 8px 0 16px; }
.skel.chart { height: 200px; margin: 8px 0; }
.skel.card { height: 280px; border-radius: 28px; }

#app.loading .live { visibility: hidden; }

.setup {
  padding-top: 48px;
  text-align: left;
}
.setup h1 { font-size: 28px; margin: 0 0 12px; }
.setup p { color: var(--secondary); font-size: 16px; line-height: 1.45; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .skel { opacity: 0.7; }
}
