:root {
  color-scheme: dark;
  --bg: #000000;
  --text: #ffffff;
  --secondary: rgba(235, 235, 245, 0.6);
  --tertiary: rgba(235, 235, 245, 0.3);
  --separator: 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;
  --tabbar: rgba(22, 22, 22, 0.72);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.num, .odometer, .value, .pill, .stat .v, .price-lg, .badge {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.display {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
}
.mono {
  font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
body { min-height: 100dvh; }
#app {
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
.navbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  min-height: 44px;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--card-2);
  border: 0;
  padding: 0;
  flex: 0 0 36px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  background: none;
  border: 0;
  color: var(--text);
  text-align: left;
  padding: 8px 0;
  min-height: 44px;
}
.brand span { color: var(--secondary); }
.icon-btn {
  width: 44px; height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  position: relative;
  font-size: 20px;
}
.dot {
  position: absolute;
  top: 10px; right: 10px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
}
.error-bar {
  margin: 0 16px 8px;
  color: var(--red);
  font-size: 13px;
  line-height: 1.35;
}
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 4px;
  min-height: 44px;
  gap: 8px;
}
.page-nav h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 17px;
  padding: 10px 0;
  min-height: 44px;
}
.nav-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nav-left h1 { font-size: 17px; font-weight: 600; }
.balance-wrap { padding: 4px 16px 8px; }
.balance-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.odometer {
  display: flex;
  align-items: flex-end;
  font-size: 66px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  min-height: 66px;
}
.odo-char { display: inline-block; height: 1em; overflow: hidden; }
.odo-char span { display: block; transition: transform 600ms ease-out; }
.badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 5px 8px;
}
.badge.paper { color: var(--orange); background: rgba(255, 159, 10, 0.14); }
.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--secondary);
  font-size: 17px;
}
.up, .subline.up { color: var(--green); }
.down, .subline.down { color: var(--red); }
.pill {
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(0, 211, 90, 0.14);
  color: var(--green);
  font-size: 15px;
  font-weight: 600;
}
.chart-wrap { padding: 4px 8px 0; position: relative; }
.chart-wrap canvas { width: 100%; height: 168px; display: block; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  font-size: 15px;
  pointer-events: none;
}
.ranges {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px 16px;
}
.ranges button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  padding: 6px;
  border-radius: 8px;
}
.ranges button.on { color: var(--text); background: var(--card-2); }
.section-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 16px;
  font-size: 17px;
  font-weight: 600;
}
.section-h a, .section-h button.link {
  color: var(--secondary);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 8px 0;
}
.carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 0 20px;
  scroll-padding-left: 16px;
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }
.agent-card {
  flex: 0 0 calc(100% - 32px);
  width: calc(100% - 32px);
  aspect-ratio: 504 / 470;
  background: var(--card);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.agent-card:first-child { margin-left: 16px; }
.agent-card:last-child { margin-right: 16px; }
.agent-card h3 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 8px; }
.agent-card .count { color: var(--secondary); font-size: 15px; }
.feed { display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.feed-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}
.feed-row .killed {
  color: var(--secondary);
  text-decoration: line-through;
  text-decoration-color: var(--red);
}
.feed-row .why { color: var(--red); text-align: right; }
.strips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.strip { height: 8px; border-radius: 4px; background: var(--card-2); }
.strip.pass { background: var(--green); }
.strip.fail { background: var(--red); }
.ring { width: 88px; height: 88px; }
.exec-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--card-2);
  overflow: hidden;
  margin-top: 8px;
}
.exec-bar > i {
  display: block;
  height: 100%;
  background: var(--green);
  width: 0;
  transition: width 1.2s ease-out;
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--card-2);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
}
.chip.red { color: var(--red); }
.chip.green { color: var(--green); }
.list { padding: 0 16px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  min-height: 44px;
  border-bottom: 0.5px solid var(--separator);
  color: inherit;
  text-decoration: none;
}
a.row { color: inherit; text-decoration: none; }
.row .title { font-size: 17px; }
.row .sub { font-size: 13px; color: var(--secondary); margin-top: 3px; }
.row .value { font-weight: 600; }
.group-title {
  margin: 22px 16px 6px;
  font-size: 13px;
  color: var(--secondary);
  letter-spacing: 0.02em;
}
.card {
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  margin: 0 16px;
}
.card .row { padding: 12px 16px; }
.btn {
  appearance: none;
  border: 0;
  width: calc(100% - 32px);
  margin: 16px 16px 0;
  background: var(--blue);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
  min-height: 44px;
  display: block;
  text-align: center;
  text-decoration: none;
}
.note { color: var(--secondary); font-size: 13px; line-height: 1.4; padding: 8px 16px 0; }
.msg { color: var(--secondary); text-align: center; padding: 36px 28px; font-size: 17px; }
.agent-full { background: var(--card); border-radius: 14px; margin: 0 16px 14px; padding: 16px; }
.agent-full .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); display: inline-block; }
.status-dot.on { background: var(--green); }
.switch {
  width: 51px; height: 31px; border-radius: 999px;
  background: var(--card-2); position: relative; border: 0;
}
.switch.on { background: var(--green); }
.switch:disabled { opacity: 0.45; }
.switch i {
  position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
}
.switch.on i { left: 22px; }
.decisions { margin-top: 8px; }
.audit-stack { padding: 8px 16px 16px; display: flex; flex-direction: column; align-items: center; gap: 0; }
.disc-col { display: flex; flex-direction: column; gap: 8px; position: relative; }
.disc {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--card-2); position: relative; z-index: 1;
  display: grid; place-items: center; font-size: 14px;
}
.disc.pass { background: var(--green); color: #000; }
.disc.fail { background: var(--red); }
.beam {
  position: absolute;
  top: 0; left: 11px;
  width: 2px;
  background: var(--cyan);
  z-index: 0;
  transition: height 350ms linear;
}
.layer-list { padding: 0 16px; }
.layer { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 6px 0; border-bottom: 0.5px solid var(--separator); }
.layer .n { color: var(--secondary); }
.headline { padding: 8px 16px 0; font-size: 20px; font-weight: 600; }
.follow { padding: 4px 16px 8px; color: var(--secondary); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; gap: 12px; min-height: 44px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 16px 18px; }
.stat { background: var(--card); border-radius: 12px; padding: 12px; }
.stat .k { color: var(--secondary); font-size: 12px; }
.stat .v { font-size: 17px; font-weight: 600; margin-top: 4px; }
.price-lg { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
.subline { color: var(--secondary); font-size: 15px; padding: 0 16px; }
.shield {
  display: inline-block;
  background: rgba(0, 211, 90, 0.16);
  color: var(--green);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 8px;
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--tabbar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
}
.tabbar button {
  appearance: none; border: 0; background: transparent;
  color: var(--secondary); font-size: 10px; font-weight: 600;
  padding: 8px 0; min-height: 44px;
}
.tabbar button.on { color: var(--blue); }
.toast {
  position: fixed; left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--card-2); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: 15px;
}
.skel {
  background: #1c1c1e;
  border-radius: 12px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.search-sheet, .modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  z-index: 20; display: flex; flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
.search-sheet input, .modal input {
  width: 100%; background: var(--card); color: var(--text);
  border: 0; border-radius: 12px; padding: 14px; font-size: 17px;
}
.modal { justify-content: center; }
.modal .box { background: var(--card); border-radius: 16px; padding: 20px; }
.modal h2 { margin: 0 0 8px; font-size: 20px; }
.modal p { color: var(--secondary); margin: 0 0 16px; }
.field {
  width: 100%; background: transparent; color: var(--text);
  border: 0; font-size: 17px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.seg {
  display: flex; background: var(--card-2); border-radius: 10px; padding: 2px;
}
.seg button {
  border: 0; background: transparent; color: var(--secondary);
  padding: 8px 14px; border-radius: 8px; min-height: 36px; font-weight: 600;
}
.seg button.on { background: var(--card); color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
