/* Light, calm, Plasma One–inspired: soft gray canvas, white rounded sheets,
   regular-weight grotesk at large sizes, black/white pills, one dark card. */
:root {
  color-scheme: light;
  --bg: #efefef;
  --card: #ffffff;
  --sunk: #f4f4f4;
  --line: #ececec;
  --ink: #0f0f0f;
  --ink-2: #545454;
  --ink-3: #9a9a9a;
  --up: #1f9d4c;
  --up-soft: #5ed46c;
  --up-bg: #e6f7ea;
  --down: #e0453a;
  --down-bg: #fdeceb;
  --warn: #b7791f;
  --warn-bg: #fbf1df;
  --blue: #1863dc;
  --radius: 28px;
  --font: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  padding: 0 env(safe-area-inset-right) calc(96px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 14px; }

/* ---------- header */
header.top { padding: max(14px, env(safe-area-inset-top)) 14px 6px; }
header.top .in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 21px; letter-spacing: -.03em; }
.brand svg { display: block; }
.sp { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px;
  font-size: 14px; white-space: nowrap; background: var(--card); color: var(--ink); border: 0;
}
.pill.dark { background: var(--ink); color: #fff; }
.pill.ghost { background: transparent; color: var(--ink-2); padding: 0 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; display: inline-block; }
.dot.live { background: var(--up-soft); }
.dot.working { background: var(--blue); }
.dot.backoff, .dot.starting { background: #f0b03c; }
.dot.error { background: var(--down); }
.dot.idle { background: #c9c9c9; }

/* ---------- hero balance */
.hero { text-align: center; padding: 30px 0 22px; }
.hero .label { font-size: 16px; color: var(--ink-2); }
.hero .big { font-size: 60px; line-height: 1.05; letter-spacing: -.045em; margin: 6px 0 14px; }
.hero .big .c { color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--card); border-radius: 999px; padding: 7px 13px; font-size: 14px; color: var(--ink-2); }
.chip .ring { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink-3); }
.chip.up .ring { border-color: var(--up-bg); border-top-color: var(--up); }
.chip.down .ring { border-color: var(--down-bg); border-top-color: var(--down); }
.actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.actions .pill { height: 48px; padding: 0 24px; font-size: 16px; }

/* ---------- the dark card */
.paper-card {
  position: relative; overflow: hidden; border-radius: 22px; padding: 20px 20px 18px; color: #fff; min-height: 190px;
  background: radial-gradient(120% 140% at 0% 0%, #4a5f50 0%, #26302a 38%, #151916 70%, #101211 100%);
  box-shadow: 0 18px 40px -18px rgba(16, 24, 18, .55);
  display: flex; flex-direction: column;
}
.paper-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,0) 40%);
}
.paper-card .row { display: flex; justify-content: space-between; align-items: flex-start; }
.paper-card .mark { opacity: .9; }
.paper-card .k { font-size: 12.5px; color: rgba(255,255,255,.55); }
.paper-card .v { font-size: 17px; letter-spacing: -.02em; }
.paper-card .stats { display: flex; gap: 22px; margin-top: auto; padding-top: 26px; }
.paper-card .card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 14px; color: rgba(255,255,255,.8); }
.paper-card .live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up-soft); margin-left: 6px; vertical-align: 1px; }

/* ---------- sheets */
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 880px) { .grid.two { grid-template-columns: 1fr 1fr; align-items: start; } .span2 { grid-column: 1 / -1; } }
.sheet { background: var(--card); border-radius: var(--radius); padding: 20px; min-width: 0; }
.sheet h2 { margin: 0 0 14px; font-size: 19px; font-weight: 400; letter-spacing: -.025em; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sheet h2 small { font-size: 14px; color: var(--ink-3); letter-spacing: 0; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--ink-3); } .warn { color: var(--warn); }

/* ---------- chart */
.chart { position: relative; height: 180px; margin: 0 -4px; touch-action: pan-y; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .tip { position: absolute; top: -4px; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 11px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; display: none; transform: translateX(-50%); }
.chart .tip .muted { color: #a8a8a8; }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }

/* ---------- list rows (positions, trades, feed, agents) */
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.item + .item { border-top: 1px solid var(--line); }
.av { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 15px; color: #fff; background: var(--ink); }
.av.soft { background: var(--sunk); color: var(--ink); }
.item .mid { flex: 1; min-width: 0; }
.item .t { font-size: 16px; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--ink-3); margin-top: 1px; }
.item .r { text-align: right; flex: none; }
.item .r .t { font-size: 16px; }
.item .r .s { font-size: 13px; }
.wrapline .s { white-space: normal; word-break: break-word; }

.empty-state { text-align: center; color: var(--ink-3); padding: 18px 0 8px; font-size: 14.5px; }
.empty-state .ic { width: 44px; height: 44px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; margin: 0 auto 10px; color: var(--ink-2); }

/* position progress: stop ←  entry  → trail arm */
.range { position: relative; height: 4px; border-radius: 2px; background: var(--sunk); margin: 2px 0 2px 52px; }
.range .knob { position: absolute; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 2px solid #fff; transform: translateX(-50%); box-shadow: 0 0 0 1px var(--line); }
.range .mid { position: absolute; top: -3px; width: 2px; height: 10px; background: var(--ink-3); left: 33.3%; }
.range-l { display: flex; justify-content: space-between; margin: 4px 0 10px 52px; font-size: 11.5px; color: var(--ink-3); }

/* ---------- big stats (like "4%") */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 10px; }
.stat .n { font-size: 30px; letter-spacing: -.04em; line-height: 1.1; white-space: nowrap; }
.stat .l { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
@media (max-width: 380px) { .stat .n { font-size: 25px; } .hero .big { font-size: 52px; } }
.funnel { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.funnel b { display: block; font-weight: 400; font-size: 20px; letter-spacing: -.03em; }
.funnel span { font-size: 11.5px; color: var(--ink-3); }

/* ---------- deaths */
.bars .row { margin-bottom: 14px; }
.bars .row:last-child { margin-bottom: 0; }
.bars .top { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; margin-bottom: 7px; }
.bars .track { height: 6px; background: var(--sunk); border-radius: 3px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--ink); border-radius: 3px; min-width: 4px; }
.bars .row:first-child .fill { background: var(--up-soft); }

/* ---------- segmented */
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font-size: 14px; padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--ink); color: #fff; }

.feed { margin-top: 8px; max-height: 560px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.feed .av { width: 34px; height: 34px; font-size: 12px; }
.feed .item { align-items: flex-start; }
.feed .t { font-size: 14.5px; white-space: normal; }
.feed .s { font-size: 13.5px; color: var(--ink-2); white-space: normal; word-break: break-word; }
.feed .time { font-size: 12px; color: var(--ink-3); flex: none; margin-top: 2px; }
.lv-reject .av { background: var(--down-bg); color: var(--down); }
.lv-pass .av { background: var(--up-bg); color: var(--up); }
.lv-trade .av { background: var(--ink); color: #fff; }
.lv-warn .av, .lv-error .av { background: var(--warn-bg); color: var(--warn); }
.lv-scout .av, .lv-info .av { background: var(--sunk); color: var(--ink-2); }

.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); vertical-align: 1px; }
.badge.up { background: var(--up-bg); color: var(--up); } .badge.down { background: var(--down-bg); color: var(--down); }

/* ---------- verdict */
.verdict p { margin: 0 0 12px; font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.verdict p:last-child { margin-bottom: 0; color: var(--ink); padding: 16px 18px; background: var(--sunk); border-radius: 20px; }

/* ---------- bottom tab bar */
nav.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 10;
  display: flex; gap: 4px; padding: 5px; border-radius: 999px;
  background: rgba(255,255,255,.96); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 8px 30px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.04);
}
nav.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 16px 6px; border-radius: 999px; font-size: 11px; color: var(--ink-3); min-width: 66px; }
nav.tabs a.on { background: var(--sunk); color: var(--ink); }
nav.tabs svg { width: 20px; height: 20px; }

.foot { color: var(--ink-3); font-size: 12.5px; margin: 26px auto 0; text-align: center; max-width: 520px; line-height: 1.6; }

form.login { max-width: 340px; margin: 20vh auto 0; display: grid; gap: 12px; padding: 0 16px; text-align: center; }
form.login input, form.login button { font: inherit; font-size: 16px; padding: 15px 18px; border-radius: 999px; border: 0; background: var(--card); color: var(--ink); }
form.login button { background: var(--ink); color: #fff; }
