: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", system-ui, sans-serif;
  --textf: -apple-system, "SF Pro Text", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  --cardw: calc(100vw - 32px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 17px/1.3 var(--textf); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
       overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.sec { color: var(--sec); } .ter { color: var(--ter); }
.green { color: var(--green); } .red { color: var(--red); } .orange { color: var(--orange); }
.cyan { color: var(--cyan); } .blue { color: var(--blue); } .yellow { color: var(--yellow); } .pink { color: var(--pink); }

/* layout */
.view, .screen { min-height: 100vh; padding: calc(var(--top) + 8px) 16px calc(var(--bottom) + 96px); }
.screen { position: fixed; inset: 0; overflow-y: auto; background: var(--bg); z-index: 20;
          padding-bottom: calc(var(--bottom) + 32px); animation: push .28s ease-out; }
@keyframes push { from { transform: translateX(30%); opacity: 0; } to { transform: none; opacity: 1; } }
.err { position: fixed; z-index: 40; left: 0; right: 0; top: 0; padding: calc(var(--top) + 6px) 16px 8px;
       background: rgba(255,69,58,0.14); color: var(--red); font-size: 13px; backdrop-filter: blur(20px);
       -webkit-backdrop-filter: blur(20px); }

/* navbar */
.navbar { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 8px; }
.navbar .grow { flex: 1; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--card2); display: grid; place-items: center;
          font-size: 14px; font-weight: 600; min-width: 44px; min-height: 44px; background-clip: content-box; padding: 6px; }
.brand { font-weight: 600; font-size: 17px; min-height: 44px; display: flex; align-items: center; gap: 4px; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; position: relative; }
.iconbtn svg { width: 22px; height: 22px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.back { display: flex; align-items: center; gap: 2px; color: var(--green); min-height: 44px; font-size: 17px; }
.back svg { width: 22px; height: 22px; stroke: var(--green); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
h1 { font: 700 34px/1.15 var(--display); margin: 4px 0 12px; letter-spacing: 0.2px; }
h2 { font: 600 20px/1.2 var(--display); margin: 28px 0 10px; display: flex; align-items: baseline; gap: 6px; }
h2 .more { margin-left: auto; font: 400 15px var(--textf); color: var(--green); min-height: 44px; display: flex; align-items: center; }

/* search */
.search { display: none; margin-bottom: 8px; }
.search.on { display: block; }
.search input { width: 100%; height: 40px; border-radius: 10px; border: 0; background: var(--card); color: var(--text);
                padding: 0 12px; font: 17px var(--textf); outline: none; }
.results .row { min-height: 52px; }

/* balance */
.balance-row { display: flex; align-items: center; gap: 10px; }
.big { font: 700 66px/1 var(--display); letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px;
        font: 600 13px var(--textf); }
.pill.paper { background: rgba(255,159,10,0.18); color: var(--orange); }
.pill.mult { background: rgba(0,211,90,0.16); color: var(--green); }
.today { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 17px; font-weight: 600; }

/* odometer */
.odo { display: inline-flex; overflow: hidden; }
.odo .d { display: inline-block; height: 1em; overflow: hidden; position: relative; }
.odo .col { display: flex; flex-direction: column; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.odo .col span { height: 1em; line-height: 1em; text-align: center; }
.odo .s { display: inline-block; }

/* charts */
.chart { position: relative; width: 100%; height: 220px; margin: 18px 0 6px; }
.chart canvas { width: 100%; height: 100%; display: block; }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--sec); font-size: 15px; }
.ranges { display: flex; justify-content: space-between; margin: 6px -4px 0; }
.ranges button { min-width: 44px; min-height: 44px; border-radius: 14px; font: 600 13px var(--textf); color: var(--sec); }
.ranges button.on { color: var(--green); background: rgba(0,211,90,0.12); }

/* carousel + 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 var(--cardw); width: var(--cardw); aspect-ratio: 504 / 470; border-radius: calc(var(--cardw) * 42 / 504);
         background: var(--card); padding: calc(var(--cardw) * 26 / 504); scroll-snap-align: center;
         display: flex; flex-direction: column; overflow: hidden; }
.acard .top { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.acard .top .st { margin-left: auto; font: 400 15px var(--textf); color: var(--sec); }
.acard .stat { font: 700 34px/1.1 var(--display); margin-top: 10px; }
.acard .sub { color: var(--sec); font-size: 15px; margin-top: 2px; }
.acard .body { flex: 1; min-height: 0; margin-top: 12px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.feed .fr { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 5px 0; border-top: .5px solid var(--sep); }
.feed .fr.killed .n { color: var(--ter); text-decoration: line-through; text-decoration-color: var(--red); }
.feed .fr .r { color: var(--sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; text-align: right; }
.feed .fr.killed .r { color: var(--red); }
.feed .fr.pass .r { color: var(--cyan); }
.strips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.strips i { height: 8px; border-radius: 4px; background: var(--card2); }
.strips i.ok { background: var(--green); } .strips i.bad { background: var(--red); } .strips i.run { background: var(--cyan); }
.ring { width: 46%; aspect-ratio: 1; align-self: center; }
.bar { height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); width: 0; transition: width .3s; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.tpill { font: 500 13px var(--mono); padding: 5px 9px; border-radius: 8px; }
.tpill.r { color: var(--red); background: rgba(255,69,58,0.14); }
.tpill.g { color: var(--green); background: rgba(0,211,90,0.14); }

/* rows (activity, settings, decisions) */
.list { background: var(--card); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; position: relative; width: 100%; text-align: left; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 64px; right: 0; border-top: .5px solid var(--sep); }
.list.plain .row + .row::before { left: 16px; }
.row .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.row .ic svg { width: 18px; height: 18px; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ic.bought { background: rgba(10,132,255,0.16); } .ic.bought svg { stroke: var(--blue); }
.ic.sold { background: rgba(0,211,90,0.16); } .ic.sold svg { stroke: var(--green); }
.ic.stopped { background: rgba(255,69,58,0.16); } .ic.stopped svg { stroke: var(--red); }
.ic.rejected { background: var(--card2); } .ic.rejected svg { stroke: var(--sec); }
.row .mid { flex: 1; min-width: 0; }
.row .t1 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { font-size: 13px; color: var(--sec); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .val { text-align: right; font-weight: 500; white-space: nowrap; }
.row .val small { display: block; font-size: 13px; color: var(--sec); font-weight: 400; }
.chev { width: 8px; height: 13px; flex: none; stroke: var(--ter); fill: none; stroke-width: 2; }

/* empty + loading */
.emptybox { background: var(--card); border-radius: 14px; padding: 28px 16px; text-align: center; color: var(--sec); }
.sk { background: var(--card); border-radius: 12px; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .5; } to { opacity: 1; } }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border-radius: 14px;
       font: 600 17px var(--textf); background: var(--green); color: #000; }
.btn.red { background: var(--red); color: #fff; }
.btn.ghost { background: var(--card); color: var(--text); }
.sticky { position: sticky; bottom: calc(var(--bottom) + 12px); margin-top: 20px; }

/* switch */
.sw { position: relative; width: 51px; height: 31px; flex: none; min-height: 44px; display: flex; align-items: center; }
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sw i { width: 51px; height: 31px; border-radius: 16px; background: var(--card2); position: relative; transition: background .2s; }
.sw i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; }
.sw input:checked + i { background: var(--green); }
.sw input:checked + i::after { transform: translateX(20px); }
.sw input:disabled + i { opacity: .4; }

/* agents tab */
.agent { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.agent .hd { display: flex; align-items: center; gap: 10px; }
.agent .hd .nm { font: 600 20px var(--display); }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.sdot.off { background: var(--ter); } .sdot.dead { background: var(--red); }
.agent .cnt { color: var(--sec); font-size: 15px; margin-left: auto; }
.agent .dec { margin-top: 10px; }
.agent .dec .row { padding: 8px 0; min-height: 44px; }
.agent .dec .row + .row::before { left: 0; }
.agent .lnk { color: var(--green); font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
.vr { font-size: 13px; font-weight: 600; }

/* coin screen */
.coinhd { display: flex; align-items: center; gap: 10px; }
.coinhd .nm { font: 700 28px var(--display); }
.shield { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 13px;
          background: rgba(0,211,90,0.14); color: var(--green); font: 600 13px var(--textf); }
.shield svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.price { font: 700 44px/1.1 var(--display); margin-top: 14px; letter-spacing: -.5px; }
.candles { height: 260px; }
.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 14px; }
.stats b { display: block; font: 600 17px var(--textf); margin-top: 2px; }
.stats span { font-size: 13px; color: var(--sec); }
.exitcard { background: var(--card); border-radius: 14px; padding: 14px 16px; margin-top: 12px; }
.exitcard .l { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; }

/* auditor screen */
.counts { display: flex; gap: 36px; margin: 6px 0 18px; }
.counts span { font-size: 13px; color: var(--sec); display: block; }
.counts b { font: 700 28px var(--display); }
.coinline { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.coinline .lg { width: 40px; height: 40px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; font-weight: 700; }
.coinline .t1 { font: 600 20px var(--display); }
.coinline .badge { margin-left: auto; font: 600 13px var(--textf); color: var(--sec); background: var(--card); padding: 5px 10px; border-radius: 12px; }
.stack { position: relative; display: grid; grid-template-columns: 44% 1fr; row-gap: 0; }
.disc { height: 39px; display: flex; align-items: center; justify-content: center; position: relative; }
.disc i { display: block; width: 92%; height: 30px; border-radius: 50%; background: #121214; border: 1px solid #3a3a3c;
          box-shadow: 0 5px 0 -1px #0b0b0c; transition: border-color .15s, background .15s; }
.disc.read i { border-color: var(--cyan); background: rgba(100,210,255,0.10); }
.disc.ok i { border-color: rgba(0,211,90,0.55); }
.disc.bad i { border-color: var(--red); background: rgba(255,69,58,0.10); }
.disc.grey i { opacity: .45; }
.beam { position: absolute; left: 0; width: 44%; height: 39px; pointer-events: none; transition: top .35s linear; }
.beam::before { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; height: 2px; background: var(--cyan); border-radius: 1px; }
.lrow { height: 39px; display: flex; align-items: center; gap: 8px; padding-left: 10px; }
.lrow .tx { flex: 1; min-width: 0; }
.lrow .n { font-size: 12px; color: var(--sec); }
.lrow .v { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .v.reading { font-family: var(--mono); font-weight: 400; color: var(--cyan); }
.lrow .v.grey { color: var(--ter); font-weight: 400; }
.mark { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ter); flex: none; display: grid; place-items: center; }
.mark.ok { background: var(--green); border-color: var(--green); }
.mark.bad { background: var(--red); border-color: var(--red); }
.mark.read { border-color: var(--cyan); }
.mark svg { width: 12px; height: 12px; fill: none; stroke: #000; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mark.bad svg { stroke: #fff; }
.verdict { background: var(--card); border-radius: 14px; padding: 14px 16px; margin-top: 18px; display: flex; gap: 12px; align-items: center; }
.verdict .t1 { font-weight: 600; }
.verdict .t2 { font-size: 13px; color: var(--sec); margin-top: 2px; }
.verdict .bar { margin-top: 8px; }
.verdict .bar i { background: var(--cyan); }
.toggle { background: var(--card); border-radius: 14px; padding: 12px 16px; margin-top: 12px; display: flex; align-items: center; gap: 12px; }

/* account */
.field { display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 52px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.field .lb { flex: 1; font-size: 15px; }
.field input[type=number], .field input[type=text], .field select {
  width: 96px; height: 34px; border-radius: 8px; border: 0; background: var(--card2); color: var(--text);
  font: 15px var(--mono); text-align: right; padding: 0 8px; }
.field input[type=range] { width: 100%; accent-color: var(--green); height: 28px; }
.setting { display: block; padding: 10px 16px; position: relative; }
.setting + .setting::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.setting .top { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.setting .top .lb { flex: 1; font-size: 15px; }
.seg { display: flex; background: var(--card2); border-radius: 9px; padding: 2px; }
.seg button { flex: 1; min-height: 40px; border-radius: 7px; font-weight: 600; font-size: 15px; color: var(--sec); }
.seg button.on { background: #636366; color: var(--text); }
.seg button.on.live { background: var(--green); color: #000; }
.note { font-size: 13px; color: var(--sec); padding: 8px 16px 0; }
.toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 100px); transform: translateX(-50%); z-index: 60;
         background: var(--card2); padding: 10px 16px; border-radius: 12px; font-size: 15px; max-width: calc(100vw - 32px); }

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

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