:root {
  --bg: #000;
  --text: #fff;
  --text2: rgba(235, 235, 245, .6);
  --text3: rgba(235, 235, 245, .3);
  --sep: rgba(84, 84, 88, .55);
  --card: #1c1c1e;
  --card2: #2c2c2e;
  --green: #00d35a;
  --red: #ff453a;
  --orange: #ff9f0a;
  --cyan: #64d2ff;
  --blue: #0a84ff;
  --yellow: #ffd60a;
  --pink: #ff6b9a;
  --display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --body: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --tabbar: 78px;  /* the floating bar (64px) and the gap under it */
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
/* An app, not a page: no iOS copy/select menu on a long press (it took the finger from the chart). Fields keep it. */
body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-touch-callout: default; -webkit-user-select: text; user-select: text; }
body {
  font: 15px/1.35 var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

#view {
  padding: calc(env(safe-area-inset-top) + 4px) 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px);
  max-width: 560px;
  margin: 0 auto;
}

/* --- offline row -------------------------------------------------------------------------------- */
.offline {
  position: sticky; top: 0; z-index: 30;
  margin: 0 -16px 8px; padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: #2a0e0c; color: var(--red); font-size: 13px; font-weight: 500;
}
.offline + #view { padding-top: 4px; }

/* --- navbar ------------------------------------------------------------------------------------- */
.navbar { display: flex; align-items: center; height: 44px; gap: 12px; margin-bottom: 8px; }
.navbar h1 { flex: 1; margin: 0; text-align: center; font: 600 17px/1 var(--display); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--card2);
  display: grid; place-items: center; font: 600 14px var(--display); color: var(--text);
}
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; position: relative; color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
.dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); }
.back { font: 400 17px var(--body); color: var(--green); display: flex; align-items: center; gap: 2px; min-width: 60px; }
.back svg { width: 12px; height: 20px; }
.navbar .spacer { min-width: 60px; }

/* --- balance ------------------------------------------------------------------------------------ */
.balance-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.balance { font: 600 40px/1.1 var(--display); letter-spacing: -.5px; display: inline-flex; overflow: hidden; }
.odo { display: inline-block; height: 1.1em; overflow: hidden; }
.odo > span { display: flex; flex-direction: column; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.odo > span > i { font-style: normal; height: 1.1em; }
.badge-paper {
  font: 600 12px/1 var(--body); color: var(--orange); background: rgba(255, 159, 10, .16);
  padding: 5px 8px; border-radius: 6px; letter-spacing: .3px;
}
.today { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 500; }
.up { color: var(--green); }
.down { color: var(--red); }
.muted { color: var(--text2); }
.faint { color: var(--text3); }
.pill-mult { font: 600 13px/1 var(--display); padding: 5px 8px; border-radius: 999px; background: rgba(0, 211, 90, .16); color: var(--green); }
.pill-mult.neg { background: rgba(255, 69, 58, .16); color: var(--red); }
.pill-mult.solid { background: var(--green); color: #000; font-size: 15px; padding: 6px 11px; }
.pill-mult.solid.neg { background: var(--red); color: #fff; }

/* --- home header -------------------------------------------------------------------------------- */
.home-bar { display: flex; align-items: center; gap: 4px; height: 50px; }
.home-bar .spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 9px; font: 600 20px var(--display); min-width: 0; }
/* the long name stays on one line next to the icons; on a narrow phone it ends in "…" rather than wrapping */
.brand span { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand img, .brand svg { flex: none; }
.brand img { width: 34px; height: 34px; border-radius: 50%; background: var(--card2); }
.brand svg { width: 7px; height: 12px; color: var(--text2); margin-left: 1px; }
.mode-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 6px;
  font: 600 14px/1 var(--display); padding: 9px 13px; border-radius: 999px;
}
.mode-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mode-pill.paper { color: var(--orange); background: rgba(255, 159, 10, .14); }
.mode-pill.live { color: var(--green); background: rgba(0, 211, 90, .14); }
/* PC-only parts (see the PC block at the end): the page title, the search field's words, the sidebar brand */
.page-title, .search-lbl, .tabbar .side-brand { display: none; }
.home-side .row:nth-child(n+6) { display: none; }  /* the phone lists 5, the PC's activity column 9 */
.home-info { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); margin: 2px 0 4px; }
.balance.big { font-size: 58px; font-weight: 700; letter-spacing: -1.5px; }
.gain { font: 600 17px var(--display); }

/* --- charts ------------------------------------------------------------------------------------- */
.chart { width: 100%; height: 220px; display: block; margin: 16px 0 10px; }
#line { touch-action: pan-y; -webkit-touch-callout: none; }  /* sideways drag scrubs, up/down scrolls */
.chart.tall { height: 260px; }
.ranges { display: flex; justify-content: space-between; margin-bottom: 20px; }
.ranges button {
  font: 600 13px var(--body); color: var(--text2); padding: 7px 10px; border-radius: 8px; min-width: 44px;
}
.ranges button.on { background: var(--green); color: #000; border-radius: 999px; }
.ranges button i { display: none; }
.ranges button.on i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #000; margin-right: 5px; vertical-align: 1px; }

/* --- sections, cards, rows ---------------------------------------------------------------------- */
h2 { font: 600 20px/1.2 var(--display); margin: 24px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
h2 a { font: 400 15px var(--body); color: var(--green); }
.card { background: var(--card); border-radius: 14px; padding: 16px; }
.card + .card { margin-top: 12px; }
.carousel {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 4px;
  scroll-padding: 0 16px; scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.agent-card {
  flex: 0 0 176px; scroll-snap-align: start; background: var(--card); border-radius: 22px; padding: 14px;
  display: flex; flex-direction: column; gap: 12px; min-height: 172px;
}
.ac-head { display: flex; align-items: center; gap: 10px; }
.ac-icon {
  width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent);
}
.ac-icon svg { width: 20px; height: 20px; }
.ac-id { min-width: 0; }
.ac-name { font: 600 16px/1.2 var(--display); }
.ac-line { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2); white-space: nowrap; }
.ac-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ac-coin { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.ac-coin .logo { width: 30px; height: 30px; font-size: 12px; }
.ac-c { min-width: 0; }
.ac-c .t { font: 600 14px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-c .s { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-bar {
  margin-top: auto; font: 600 13px var(--display); text-align: center; padding: 9px 8px; border-radius: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ac-bar.ok { background: rgba(0, 211, 90, .16); color: var(--green); }
.ac-bar.red { background: rgba(255, 69, 58, .14); color: var(--red); }
.ac-bar.idle { background: var(--card2); color: var(--text2); }
.ac-pills { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.pillx { font: 600 11px var(--mono); padding: 6px 8px; border-radius: 8px; background: var(--card2); color: var(--text2); }
.pillx.red { background: rgba(255, 69, 58, .14); color: var(--red); }
.pillx.green { background: rgba(0, 211, 90, .14); color: var(--green); }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); }
.dots i.on { background: var(--text); }

/* coin logos: the letter shows until the image loads (or when there is none) */
.logo {
  position: relative; width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: hsl(var(--h, 200) 38% 28%); color: #fff; font: 700 16px var(--display);
}
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.logo .badge {
  position: absolute; right: -3px; bottom: -3px; z-index: 1; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; font: 700 10px/1 var(--display); font-style: normal; border: 2px solid var(--card);
}
.badge.blue { background: var(--blue); color: #fff; }
.badge.green { background: var(--green); color: #000; }
.badge.red { background: var(--red); color: #fff; }
.badge.grey { background: #48484a; color: #fff; }
.coin-head .logo { width: 36px; height: 36px; font-size: 14px; }
.row.act .value { font-size: 15px; }
.row.act .value .sub { font-size: 12px; }
.status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.status.running { background: var(--green); }
.status.paused { background: var(--orange); }
.status.stale { background: var(--red); }

.rows { background: var(--card); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; position: relative; width: 100%; text-align: left; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.row .main { flex: 1; min-width: 42%; }
.row .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .value { text-align: right; font-weight: 500; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.row .value .sub { text-align: right; }
.kind { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 700 13px var(--display); }
.kind.bought { background: rgba(0, 211, 90, .16); color: var(--green); }
.kind.sold { background: rgba(100, 210, 255, .16); color: var(--cyan); }
.kind.stopped { background: rgba(255, 69, 58, .16); color: var(--red); }
.kind.rejected { background: var(--card2); color: var(--text2); }
.chev { color: var(--text3); flex: none; }
.empty { padding: 28px 16px; text-align: center; color: var(--text2); }

/* --- agents tab --------------------------------------------------------------------------------- */
.agent { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.agent .head { display: flex; align-items: center; gap: 8px; }
.agent .head h3 { margin: 0; font: 600 17px var(--display); flex: 1; }
.agent .stat { display: flex; align-items: baseline; gap: 6px; margin: 10px 0 12px; }
.agent .stat b { font: 600 28px/1 var(--display); }
.btn-small { font: 600 13px var(--body); padding: 7px 12px; border-radius: 999px; background: var(--card2); }
.btn-small:disabled { color: var(--text3); }
.decisions { border-top: .5px solid var(--sep); margin: 0 -16px; }
.decision { display: flex; gap: 10px; padding: 9px 16px; font-size: 13px; align-items: center; width: 100%; text-align: left; }
.decision + .decision { border-top: .5px solid var(--sep); }
.decision time { color: var(--text3); flex: none; width: 40px; }
.decision .c { font-weight: 500; flex: none; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.decision .t { color: var(--text2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; }
.agent .foot a { color: var(--green); }
.lock-note { font-size: 12px; color: var(--text3); }

/* --- coin & auditor ----------------------------------------------------------------------------- */
.coin-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.coin-head h1 { font: 700 28px/1.15 var(--display); margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font: 600 12px var(--mono); padding: 4px 8px;
  border-radius: 999px; border: 1px solid var(--sep); color: var(--text2);
}
.chip.ok { color: var(--green); border-color: rgba(0, 211, 90, .5); }
.chip.red { color: var(--red); border-color: rgba(255, 69, 58, .5); }
.chip svg { width: 12px; height: 12px; }
.price { font: 600 34px/1.1 var(--display); margin-top: 10px; }
.price-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.price-row .price { margin-top: 0; }
.since { font-weight: 500; }
.live-pill {
  display: inline-flex; align-items: center; gap: 5px; font: 700 11px/1 var(--display); letter-spacing: .4px;
  color: var(--green); background: rgba(0, 211, 90, .14); padding: 5px 8px; border-radius: 999px;
}
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
#candles { touch-action: pan-y; -webkit-touch-callout: none; }  /* sideways drag scrubs, up/down scrolls */
#coin-ranges { margin-top: -2px; }
.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 span { display: block; font-size: 12px; color: var(--text2); }
.stats b { font: 600 17px var(--display); }
.pos { margin-top: 16px; }
.pos .grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.pos .grid span { display: block; font-size: 12px; color: var(--text2); }
.pos .grid b { font: 600 15px var(--display); }
.btn-wide {
  display: block; width: 100%; margin-top: 20px; padding: 16px; border-radius: 14px; text-align: center;
  font: 600 17px var(--display); background: var(--green); color: #000;
}
.btn-wide.sell { background: var(--red); color: #fff; }
.btn-wide.ghost { background: var(--card2); color: var(--text); }

.stack { position: relative; width: 240px; margin: 24px auto 8px; height: 300px; }
.disc {
  position: absolute; left: 0; width: 240px; height: 44px; border-radius: 50%;
  background: var(--card2); border: 1.5px solid var(--sep);
}
.disc.ok { background: #0c2a18; border-color: var(--green); }
.disc.red { background: #2e0f0d; border-color: var(--red); }
.disc.skip { background: var(--card); border-color: var(--sep); opacity: .5; }
.beam { position: absolute; left: -12px; right: -12px; height: 2px; background: var(--cyan); top: 0; opacity: 0; }
.reading .disc { transition: background .25s, border-color .25s; }
.layer-row .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--mono); background: var(--card2); flex: none; }
.layer-row .n.ok { background: rgba(0, 211, 90, .16); color: var(--green); }
.layer-row .n.red { background: rgba(255, 69, 58, .16); color: var(--red); }
.mono { font-family: var(--mono); font-size: 12px; padding: 3px 7px; border-radius: 6px; background: var(--card2); }

/* --- account ------------------------------------------------------------------------------------ */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card2); border-radius: 9px; padding: 2px; }
.seg button { padding: 8px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--text2); }
.seg button.on { background: #636366; color: var(--text); }
.seg.many { display: flex; }
.seg.many button { flex: 1; }
.field { display: flex; gap: 8px; align-items: center; }
.field input[type=number], .field input[type=text], .num {
  background: var(--card2); border: 0; border-radius: 8px; padding: 8px 10px; width: 100%; font-variant-numeric: tabular-nums;
}
.num { width: 92px; text-align: right; font-family: var(--mono); font-size: 13px; }
.setting { padding: 12px 16px; position: relative; }
.setting + .setting::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.setting .label { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; }
.setting .label span { font-size: 14px; }
.setting .label small { font-family: var(--mono); color: var(--text3); font-size: 11px; }
.setting .controls { display: flex; gap: 12px; align-items: center; }
input[type=range] { flex: 1; accent-color: var(--green); }
.switch { width: 51px; height: 31px; border-radius: 999px; background: var(--card2); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch.on { background: var(--green); }
.switch.on::after { left: 22px; }
.group-title { font: 600 13px var(--body); color: var(--text2); text-transform: uppercase; letter-spacing: .4px; margin: 24px 4px 8px; }
.wallet-actions { display: flex; gap: 10px; margin: 14px 0 2px; }
.wallet-actions button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 12px;
  border-radius: 999px; background: var(--card2); color: var(--text); font: 600 15px var(--body); }
.wallet-actions i { width: 18px; height: 18px; display: inline-flex; color: var(--green); }
.wallet-actions svg { width: 18px; height: 18px; }
.wallet-card .wallet-actions { margin: 0; }
.wsheet { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end;
  justify-content: center; }
.wsheet-card { width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; background: var(--card);
  border-radius: 22px 22px 0 0; padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr); }  /* no child (the amount field) may push the sheet wider than the screen */
.wsheet-card .btn-wide { margin-top: 4px; }
.wsheet-card .btn-wide:disabled { background: var(--card2); color: var(--text3); }
.wsheet-head { display: flex; justify-content: space-between; align-items: center; font: 600 19px var(--display); }
.wsheet .addr { text-align: left; font-size: 12px; word-break: break-all; background: var(--card2); border-radius: 10px;
  padding: 10px 12px; color: var(--text); }
.qr { justify-self: center; background: #fff; border-radius: 16px; padding: 6px; line-height: 0; }
.small { font-size: 13px; }
.warn { color: var(--orange); }
.ws-amount { display: flex; align-items: center; gap: 10px; background: var(--card2); border-radius: 14px; padding: 8px 10px 8px 14px; }
.ws-amount input { flex: 1; min-width: 0; width: 0; background: none; border: 0; color: var(--text); font: 600 28px var(--display); outline: none; }
.ws-amount span { font-weight: 600; color: var(--text2); }
.ws-to { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 2px 2px; }
.ws-done { font: 600 30px var(--display); }
@media (min-width: 1000px) {
  .wsheet { align-items: center; }
  .wsheet-card { border-radius: 22px; padding: 22px; }
  .home-main .wallet-actions { max-width: 360px; }
}
.wallet-card { display: grid; gap: 10px; }
.wallet-top { display: flex; justify-content: space-between; align-items: flex-start; }
.wallet-usd { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.wallet-card .addr { text-align: left; font-size: 12px; word-break: break-all; background: var(--card2); border-radius: 8px;
  padding: 8px 10px; color: var(--text); }
.wallet-btns { display: flex; gap: 8px; }
#trades-list .rows { margin-top: 10px; }
.confirm-live { margin-top: 12px; display: flex; gap: 8px; }
.confirm-live input { flex: 1; background: var(--card2); border: 1px solid var(--orange); border-radius: 8px; padding: 8px 10px; }

/* --- tab bar: a floating capsule of frosted glass ---------------------------------------------- */
.tabbar {
  position: fixed; z-index: 20; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 6px);
  max-width: 532px; margin: 0 auto; height: 64px; padding: 6px; border-radius: 999px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(180deg, rgba(64, 64, 74, .52), rgba(30, 30, 38, .62));
  -webkit-backdrop-filter: blur(24px) saturate(190%); backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, .09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -1px 0 rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .6);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar { background: rgba(36, 36, 44, .96); }
}
.tabbar a { position: relative; z-index: 1; display: grid; place-items: center; color: rgba(235, 235, 245, .55); transition: color .25s; }
.tabbar a.on { color: #fff; }
.tabbar svg { width: 27px; height: 27px; }
.tabbar a.on .fill { fill: currentColor; }
.tabbar .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tab-pill {
  position: absolute; top: 5px; bottom: 5px; left: 0; width: 0; z-index: 0; border-radius: 999px; opacity: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05));
  border: 1px solid rgba(255, 255, 255, .11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 3px 10px rgba(0, 0, 0, .35);
  transition: transform .4s cubic-bezier(.3, 1.25, .5, 1), width .4s cubic-bezier(.3, 1.25, .5, 1), opacity .2s;
}
.tab-pill.on { opacity: 1; }

/* --- overlays ----------------------------------------------------------------------------------- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px); z-index: 40;
  background: var(--card2); border-radius: 12px; padding: 12px 14px; font-size: 14px; text-align: center;
}
.toast.err { color: var(--red); }
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .92); padding: calc(env(safe-area-inset-top) + 12px) 16px 16px; overflow-y: auto; }
.sheet .field { margin-bottom: 12px; }
.locked { min-height: 80vh; display: grid; place-items: center; text-align: center; }
.locked .card { max-width: 360px; }
.locked h1 { font: 700 24px var(--display); margin: 0 0 8px; }
.locked p { color: var(--text2); margin: 0 0 16px; }

/* --- loading ------------------------------------------------------------------------------------ */
.sk { background: var(--card); border-radius: 10px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.sk.line { height: 14px; margin: 8px 0; }
.sk.big { height: 44px; width: 60%; margin: 12px 0; }
.sk.chart { height: 220px; margin: 16px 0; }
.sk.card { height: 96px; margin-bottom: 12px; }

/* --- PC: 1000px and wider -------------------------------------------------------------------------
   The tab bar becomes a sidebar on the left, Home and Coin split into a wide column and a side column, Agents is a
   grid, list screens sit in a centred column. Below 1000px nothing here applies, so the phone looks as before. */
@media (min-width: 1000px) {
  :root { --side: 240px; --tabbar: 0px; }
  body { padding-left: var(--side); }
  body:has(.tabbar[hidden]) { padding-left: 0; }  /* the locked screen has no sidebar */
  #view { max-width: 1480px; padding: 18px 40px 48px; }
  #view[data-screen="activity"], #view[data-screen="account"], #view[data-screen="report"],
  #view[data-screen="audit"] { max-width: 880px; }
  .offline { margin: 0; padding: 10px 40px; }

  /* sidebar */
  .tabbar {
    top: 0; bottom: 0; left: 0; right: auto; width: var(--side); height: auto; max-width: none; margin: 0;
    display: flex; flex-direction: column; gap: 6px; padding: 22px 14px; border-radius: 0;
    background: linear-gradient(180deg, rgba(30, 30, 36, .92), rgba(12, 12, 16, .92));
    border: 0; border-right: 1px solid rgba(255, 255, 255, .07); box-shadow: inset -1px 0 0 rgba(255, 255, 255, .03);
  }
  .tabbar .side-brand {
    display: flex; align-items: center; gap: 11px; padding: 0 10px; margin-bottom: 22px; height: 44px;
    font: 700 22px var(--display); color: var(--text);
  }
  .side-brand img { width: 36px; height: 36px; border-radius: 50%; background: var(--card2); }
  .tabbar a[data-tab] {
    display: flex; align-items: center; gap: 14px; height: 50px; padding: 0 16px; border-radius: 16px;
    font: 600 16px var(--display);
  }
  .tabbar a[data-tab]:hover { color: #fff; }
  .tabbar svg { width: 23px; height: 23px; flex: none; }
  .tabbar .lbl { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .tab-pill {
    top: 0; bottom: auto; border-radius: 16px;
    transition: transform .4s cubic-bezier(.3, 1.25, .5, 1), width .4s, height .4s, opacity .2s;
  }

  /* top bars: the title on the left, a search field, the bell (and the avatar or mode on the right) */
  .home-bar, .navbar { height: 64px; gap: 10px; margin-bottom: 10px; }
  .home-bar .brand { display: none; }
  .page-title, .navbar h1 { display: block; margin: 0; text-align: left; font: 700 30px/1 var(--display); letter-spacing: -.3px; }
  .navbar h1 { flex: 1; order: 0; }
  .navbar .back { order: -1; }
  .navbar .spacer { display: none; }
  .navbar .icon-btn { order: 1; }
  .navbar .avatar { order: 2; width: 40px; height: 40px; font-size: 16px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--card); }
  .icon-btn:hover, .btn-small:hover { background: var(--card2); }
  .icon-btn.search {
    width: 340px; display: flex; justify-content: flex-start; gap: 10px; padding: 0 16px; border-radius: 999px;
    color: var(--text2); background: var(--card);
  }
  .icon-btn.search svg { width: 18px; height: 18px; }
  .search-lbl { display: inline; font-size: 15px; }
  .mode-pill { padding: 12px 16px; }

  /* Home: two columns */
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 36px; align-items: start; }
  .home-side { position: sticky; top: 18px; }
  .home-side h2 { margin-top: 6px; }
  .home-side .row:nth-child(n+6) { display: flex; }
  .balance.big { font-size: 64px; }
  #line { height: 300px; cursor: crosshair; }
  #candles { cursor: crosshair; }
  .ranges { justify-content: flex-start; gap: 6px; }
  .ranges button { min-width: 60px; padding: 8px 14px; }
  .ranges button:not(.on):hover { background: var(--card); }
  .carousel { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; overflow: visible; margin: 0; padding: 0; }
  .agent-card { flex: none; transition: background .2s; }
  .agent-card:hover { background: #242427; }
  .dots { display: none; }
  @media (min-width: 1400px) {  /* all 5 in a row */
    .carousel { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .agent-card .ac-icon { width: 34px; height: 34px; }
    .agent-card .ac-head { gap: 8px; }
  }

  /* lists: a soft highlight under the mouse */
  a.row:hover, button.row:hover, a.decision:hover { background: rgba(255, 255, 255, .04); }

  /* Agents: a grid of cards */
  .agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; align-items: start; }
  .agent-grid .agent { margin: 0; }

  /* Coin: the chart wide, the numbers beside it */
  .coin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }
  .coin-side { position: sticky; top: 18px; }
  .coin-side .stats { margin-top: 8px; }
  .chart.tall { height: 440px; }

  /* overlays */
  .toast { left: auto; right: 24px; bottom: 24px; width: 380px; }
  .sheet { padding: 40px; }
  .sheet > * { max-width: 640px; margin-left: auto; margin-right: auto; }
}

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