/* ============================================================================
   dashboard-v3.css — overlay applied AFTER dashboard-v2.css

   PURPOSE
     - Per-chain accent theming (BSC=yellow, Base=blue, ETH=light-blue,
       Robinhood=neon-green, Solana=purple).
     - Keeps Motions brand lime for global chrome; only chain-scoped surfaces
       (chain tabs, active chart chip, chain-tag pills) tint per chain.
   NON-GOAL
     - Do NOT change any trading logic, executor calls, routing, or swaps.
     - Do NOT change server API contracts.
     - Layout/markup migrations happen separately, incrementally.
   ============================================================================ */

:root {
  /* Motions brand — ice cyan. Was lime; retired in favour of cyan so brand
     and Robinhood chain accent don't collide, and so money-green (--pos)
     stays untouched as a signal for P&L / buys. */
  --brand:      #6de0c9;
  --brand-2:    #8feddb;
  --brand-soft: rgba(109,224,201,0.10);
  --brand-line: rgba(109,224,201,0.34);
  --brand-glow: rgba(109,224,201,0.45);

  /* Legacy aliases — the rebrand removed the --cyan/--mint definitions but
     20+ selectors still reference them (chrome-text gradients on the quote
     panel + tool tiles etc.). Without these, `background: linear-gradient
     (var(--cyan), var(--mint))` fails to resolve, background stays
     transparent, and any element with `color: transparent` (used for the
     background-clip:text trick) renders as INVISIBLE TEXT — which is why
     the Quote panel's "TXNS you'll get" number was blank after the rebrand.
     Aliased to --brand / --brand-2 to preserve the intended chrome effect. */
  --cyan: var(--brand);
  --mint: var(--brand-2);

  /* Per-chain accents. --chain-accent is the live one (swapped by app.js). */
  --chain-base:  #6db8ff;   /* Base — blue */
  --chain-bsc:   #ffb547;   /* BSC — yellow / amber */
  --chain-eth:   #8fcfff;   /* Ethereum — light blue */
  --chain-rh:    #a6e22e;   /* Robinhood — neon green (their brand) */
  --chain-sol:   #b48cff;   /* Solana — purple */

  --chain-base-soft: rgba(109,184,255,0.12);
  --chain-bsc-soft:  rgba(255,181,71,0.14);
  --chain-eth-soft:  rgba(143,207,255,0.12);
  --chain-rh-soft:   rgba(166,226,46,0.12);
  --chain-sol-soft:  rgba(180,140,255,0.14);

  --chain-base-line: rgba(109,184,255,0.32);
  --chain-bsc-line:  rgba(255,181,71,0.38);
  --chain-eth-line:  rgba(143,207,255,0.32);
  --chain-rh-line:   rgba(166,226,46,0.32);
  --chain-sol-line:  rgba(180,140,255,0.38);

  --chain-base-glow: rgba(109,184,255,0.42);
  --chain-bsc-glow:  rgba(255,181,71,0.48);
  --chain-eth-glow:  rgba(143,207,255,0.42);
  --chain-rh-glow:   rgba(166,226,46,0.42);
  --chain-sol-glow:  rgba(180,140,255,0.48);

  /* Live-active chain (swapped by JS on chain-tab click). Default: BASE. */
  --chain-accent:      var(--chain-base);
  --chain-accent-soft: var(--chain-base-soft);
  --chain-accent-line: var(--chain-base-line);
  --chain-accent-glow: var(--chain-base-glow);
}

/* Data-attribute driven — JS sets `data-active-chain` on <html>. Every
   selector below reads from --chain-accent, which the [data-active-chain]
   rules resolve at cascade time. */
html[data-active-chain="base"]     { --chain-accent: var(--chain-base);  --chain-accent-soft: var(--chain-base-soft);  --chain-accent-line: var(--chain-base-line);  --chain-accent-glow: var(--chain-base-glow); }
html[data-active-chain="bsc"]      { --chain-accent: var(--chain-bsc);   --chain-accent-soft: var(--chain-bsc-soft);   --chain-accent-line: var(--chain-bsc-line);   --chain-accent-glow: var(--chain-bsc-glow); }
html[data-active-chain="ethereum"] { --chain-accent: var(--chain-eth);   --chain-accent-soft: var(--chain-eth-soft);   --chain-accent-line: var(--chain-eth-line);   --chain-accent-glow: var(--chain-eth-glow); }
html[data-active-chain="robinhood"]{ --chain-accent: var(--chain-rh);    --chain-accent-soft: var(--chain-rh-soft);    --chain-accent-line: var(--chain-rh-line);    --chain-accent-glow: var(--chain-rh-glow); }
html[data-active-chain="solana"]   { --chain-accent: var(--chain-sol);   --chain-accent-soft: var(--chain-sol-soft);   --chain-accent-line: var(--chain-sol-line);   --chain-accent-glow: var(--chain-sol-glow); }

/* ─── Chain tabs — each tab shows its OWN colour when active,
       and the surrounding rail borrows --chain-accent so the whole
       chain-scoped panel gets tinted subtly. ────────────────────────────── */
.chain-tab[data-chain="base"].active,
.chain-tab[data-chain="base"].active::before     { color: var(--chain-base); }
.chain-tab[data-chain="base"].active::before     { background: var(--chain-base) !important; }

.chain-tab[data-chain="bsc"].active,
.chain-tab[data-chain="bsc"].active::before      { color: var(--chain-bsc); }
.chain-tab[data-chain="bsc"].active::before      { background: var(--chain-bsc) !important; }

.chain-tab[data-chain="ethereum"].active,
.chain-tab[data-chain="ethereum"].active::before { color: var(--chain-eth); }
.chain-tab[data-chain="ethereum"].active::before { background: var(--chain-eth) !important; }

.chain-tab[data-chain="robinhood"].active,
.chain-tab[data-chain="robinhood"].active::before{ color: var(--chain-rh); }
.chain-tab[data-chain="robinhood"].active::before{ background: var(--chain-rh) !important; }

.chain-tab[data-chain="solana"].active,
.chain-tab[data-chain="solana"].active::before   { color: var(--chain-sol); }
.chain-tab[data-chain="solana"].active::before   { background: var(--chain-sol) !important; }

/* Hover reads --chain-accent so it tints toward the CURRENTLY active chain
   (subtle — helps signal "still on BSC" while hovering another chain). */
.chain-tab:hover { color: var(--chain-accent); }

/* Chain-scoped chart controls & load button tint per active chain. */
.chart-controls .btn.primary.chart-load {
  border-color: var(--chain-accent-line);
  color: var(--chain-accent);
  background: var(--chain-accent-soft);
}
.chart-controls .btn.primary.chart-load:hover {
  background: color-mix(in srgb, var(--chain-accent) 20%, transparent);
  border-color: var(--chain-accent);
}
.chart-controls .chart-input:focus,
.chart-controls .chart-tf:focus {
  border-color: var(--chain-accent-line);
  box-shadow: 0 0 0 3px var(--chain-accent-soft);
  outline: none;
}

/* Live indicator on strategy boxes borrows --chain-accent when running */
.strat-box.running { border-color: var(--chain-accent-line); }
.strat-box.running .live-dot,
.strat-box.running .live-indicator .live-dot {
  background: var(--chain-accent);
  box-shadow: 0 0 8px var(--chain-accent-glow);
}

/* Chain-wallets summary bar tints per active chain */
.chain-wallets-toggle .cw-label b,
.chain-wallets-toggle b { color: var(--chain-accent); }
.chain-wallets.open .chain-wallets-toggle { border-color: var(--chain-accent-line); }

/* Existing .chain-tag pills — keep per-chain colours regardless of active */
.chain-tag.base      { color: var(--chain-base); border-color: var(--chain-base-line); background: var(--chain-base-soft); }
.chain-tag.bsc       { color: var(--chain-bsc);  border-color: var(--chain-bsc-line);  background: var(--chain-bsc-soft); }
.chain-tag.ethereum  { color: var(--chain-eth);  border-color: var(--chain-eth-line);  background: var(--chain-eth-soft); }
.chain-tag.robinhood { color: var(--chain-rh);   border-color: var(--chain-rh-line);   background: var(--chain-rh-soft); }
.chain-tag.solana    { color: var(--chain-sol);  border-color: var(--chain-sol-line);  background: var(--chain-sol-soft); }

/* Wallet-share buttons — keep neutral; per-chain tint too loud here */

/* Body-level subtle tint: a 1px top-border line coloured per chain, so
   at-a-glance you can tell which chain you're on without looking at tabs. */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--chain-accent);
  box-shadow: 0 0 12px var(--chain-accent-glow);
  z-index: 999;
  pointer-events: none;
  transition: background 200ms cubic-bezier(.32,.72,0,1),
              box-shadow 200ms cubic-bezier(.32,.72,0,1);
}

/* ============================================================================
   V3 STYLE PASS — polish overlay
     - Flatten cards/panels to solid var(--bg-1)
     - Bump rounding globally
     - Tighter borders using v2's hairline palette
     - Cleaner strat-box, metrics, panels
   Nothing here changes structure — pure visual on top of v2.
   ============================================================================ */

/* Bump radii up. v2 uses 6-8px for most things. */
.panel,
.strat-box,
.metric,
.chart-container,
.holders-panel,
.chain-wallets,
.chain-wallets-list,
.docs-container,
.log-entry {
  border-radius: 14px !important;
}

.btn, .kill-btn, .icon-btn,
.chain-tab, .funding-tab,
.mode-btn, .duration-btn, .speed-btn,
.pattern-btn, .ws-btn, .aggression-btn,
.obu-usage-btn,
.status-pill {
  border-radius: 10px !important;
}

.strat-box-status, .badge, .live-indicator,
.chain-tag {
  border-radius: 8px !important;
}

input[type=text], input[type=number], input[type=password],
select, textarea,
.chart-input, .chart-tf {
  border-radius: 10px !important;
}

/* Flatten card gradients — v2 already uses var(--bg-1), but some
   compound backgrounds (accent-soft gradients on active states)
   read a bit thin. Only flatten the "surface" backgrounds. */
.panel,
.metric,
.strat-box,
.chain-wallets,
.chart-container {
  background: var(--bg-1) !important;
}

/* Slight lift on strat-box when running — cleaner than v2's accent border */
.strat-box.running {
  box-shadow: 0 0 0 1px var(--chain-accent-line),
              0 12px 24px -12px rgba(0,0,0,0.4);
}

/* Metric strip — more air, softer read */
.metrics {
  gap: 10px !important;
}
.metric {
  padding: 12px 16px !important;
  transition: border-color 160ms cubic-bezier(.32,.72,0,1);
}
.metric:hover {
  border-color: var(--hairline-2) !important;
}

/* Chart controls — cleaner rounding + tighter input focus */
.chart-controls {
  padding: 12px 14px !important;
  gap: 8px !important;
}

/* Chain-tabs strip — pill container feel */
.chain-tabs {
  padding: 4px !important;
  border-radius: 12px !important;
  background: var(--bg-1);
  border: 1px solid var(--hairline);
  gap: 2px !important;
  width: fit-content;
}
.chain-tab {
  padding: 8px 16px !important;
  min-width: 60px;
  text-align: center;
  border: 0 !important;
}
.chain-tab.active::before {
  content: none !important;    /* kill the top-bar indicator, cleaner without */
}
.chain-tab.active {
  background: var(--bg-3) !important;
  box-shadow: inset 0 0 0 1px var(--chain-accent-line);
}

/* Chain-wallets summary — more of a card feel */
.chain-wallets-toggle {
  padding: 12px 14px !important;
  transition: border-color 160ms cubic-bezier(.32,.72,0,1);
}

/* Pattern-btn grid — tighter, more square, cleaner */
.pattern-grid .pattern-btn {
  border-radius: 10px !important;
  padding: 10px 6px !important;
}

/* ============================================================================
   SIDEBAR — brand block at top, cleaner spacing
   ============================================================================ */
nav.side {
  padding: 14px 10px 12px !important;
  gap: 2px;
}

/* Brand block (moved from <header> — added markup will pick this up) */
nav.side .side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 10px;
  text-decoration: none;
}
nav.side .side-brand .brand-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(180deg, #6de0c9, #0891b2);
  color: #0a0b0d;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
  letter-spacing: -0.03em;
  box-shadow: 0 0 24px -4px rgba(109,224,201,0.42);
}
nav.side .side-brand .brand-word {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
nav.side .side-brand .brand-badge {
  margin-left: auto;
  font-size: 8.5px;
  color: var(--text-dim);
  font-family: var(--mono);
  padding: 2px 6px;
  background: var(--bg-2);
  border-radius: 4px;
  letter-spacing: 0.06em;
}

/* Section header polish */
nav.side .nav-section {
  padding: 14px 10px 6px !important;
  font-size: 9px !important;
  letter-spacing: 0.2em !important;
  color: var(--text-tiny) !important;
}
nav.side .nav-section::before {
  background: var(--text-tiny) !important;
}

/* Nav item — full-width row, rounded, no left border, use bg fill for active */
nav.side .nav-item {
  padding: 9px 12px !important;
  border-radius: 10px !important;
  border-left: 0 !important;
  gap: 12px !important;
  font-weight: 500 !important;
  letter-spacing: -0.005em;
}
nav.side .nav-item:hover {
  background: var(--bg-2) !important;
}
nav.side .nav-item.active {
  background: rgba(109,224,201,0.10) !important;
  box-shadow: inset 0 0 0 1px rgba(109,224,201,0.30);
  color: var(--accent) !important;
  border-left: 0 !important;
}
nav.side .nav-item.active::before {
  content: '' !important;
  display: block;
  position: absolute;
  left: -10px; top: 10px; bottom: 10px;
  width: 3px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(109,224,201,0.42);
}
nav.side .nav-icon {
  width: 17px !important; height: 17px !important;
  stroke-width: 1.7 !important;
}
nav.side .nav-item .count {
  border-radius: 4px !important;
  padding: 1px 6px !important;
  font-size: 10px !important;
  background: var(--bg-2) !important;
  border: 0 !important;
}
nav.side .nav-item.active .count {
  color: var(--accent) !important;
  background: rgba(109,224,201,0.10) !important;
}

/* Nav footer — more of a profile row */
nav.side .nav-footer {
  padding: 12px 8px 4px !important;
  border-top: 1px solid var(--hairline) !important;
  margin-top: 8px !important;
}
nav.side .nav-footer .user {
  color: var(--text-mid);
  font-family: var(--mono);
  font-size: 10.5px;
}

/* ============================================================================
   HEADER — tighter, brand moved to sidebar
   ============================================================================ */
header {
  padding: 0 16px !important;
  height: 84px;
}
/* v2 base grid fixes header at 52px — override so the taller 84px header
   doesn't overflow into the sidebar area. */
body {
  grid-template-rows: 84px 1fr 24px !important;
}
/* Header: brand + gear on the LEFT, Stop All alone on the RIGHT */
header {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}
header .brand {
  display: flex !important;
  align-items: center;
  gap: 12px;
}
header .brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}
header .brand-logo {
  height: 64px !important;
  width: auto !important;
  display: block !important;
  filter: drop-shadow(0 0 12px rgba(109,224,201,0.35));
}
header .header-right {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Status pill — softer, matches v3 language */
.status-pill {
  padding: 6px 12px !important;
  border-radius: 10px !important;
  background: var(--bg-2) !important;
  border-color: var(--hairline-2) !important;
  font-size: 10.5px !important;
}

/* Stop All — softer red, matches gear popover language */
.kill-btn {
  padding: 8px 16px !important;
  border-radius: 12px !important;
  font-size: 11px !important;
  letter-spacing: 0.14em;
}

/* Connect Wallet — top right primary CTA (matches pricing.html .btn-connect) */
.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: transparent;
  color: var(--cyan, #6de0c9);
  border: 1px solid var(--cyan, #6de0c9);
  border-radius: 12px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.wallet-btn:hover {
  background: var(--cyan, #6de0c9);
  color: var(--bg-0, #0b0e12);
  box-shadow: 0 0 22px rgba(109, 224, 201, 0.4);
}
.wallet-btn-icon {
  display: inline-flex;
  width: 18px; height: 18px;
  align-items: center; justify-content: center;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.9;
}
.wallet-btn.connected {
  background: var(--bg-2, #161920);
  color: var(--text, #e9ecf1);
  border-color: var(--hairline, rgba(255,255,255,0.09));
}
.wallet-btn.connected:hover {
  color: var(--cyan, #6de0c9);
  border-color: var(--cyan, #6de0c9);
  background: var(--bg-2, #161920);
  box-shadow: none;
}
.wallet-btn.connected .wallet-btn-icon {
  color: var(--cyan, #6de0c9);
}

/* Wallet picker modal — centered dialog */
#wallet-picker-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(6, 7, 9, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 20px;
}
#wallet-picker-modal.show,
#wallet-picker-modal[data-open="1"] { display: flex; }
.wallet-picker-card {
  width: 100%;
  max-width: 460px;
  background:
    radial-gradient(ellipse 55% 90% at 50% 0%, rgba(255,255,255,0.055), transparent 60%),
    radial-gradient(ellipse 90% 90% at 50% 60%, transparent 55%, rgba(0,0,0,0.55) 100%),
    #0a0a0b;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 20px;
  padding: 32px 30px 24px;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 40px 100px -40px rgba(0,0,0,1);
  color: #e9ecf1;
}
.wallet-picker-card::before {
  content: "";
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.20), transparent);
  pointer-events: none;
}
.wallet-picker-hd {
  text-align: center;
  padding: 0 0 22px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.wallet-picker-logo {
  height: 48px;
  width: auto;
  display: block;
  margin: 0 auto 14px;
  filter: drop-shadow(0 0 12px rgba(109,224,201,0.20));
}
.wallet-picker-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text-mid, #b3b9c4);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.wallet-picker-close:hover {
  background: var(--bg-2, #161920);
  color: var(--text, #e9ecf1);
  border-color: rgba(255, 255, 255, 0.09);
}
#wallet-picker-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text, #e9ecf1);
}
.wallet-picker-desc {
  margin: 0 0 18px;
  color: var(--text-dim, #7a808d);
  font-size: 12px;
  letter-spacing: 0.02em;
}
#wallet-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.wallet-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-2, #161920);
  color: var(--text, #e9ecf1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.wallet-opt:hover {
  background: var(--bg-3, #1a1e26);
  border-color: rgba(109, 224, 201, 0.34);
  transform: translateY(-1px);
}
.wallet-opt.unavailable {
  opacity: 0.5;
  cursor: not-allowed;
}
.wallet-opt.unavailable:hover {
  background: var(--bg-2, #161920);
  border-color: rgba(255, 255, 255, 0.06);
  transform: none;
}
.wallet-opt-icon {
  width: 26px; height: 26px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
}
.wallet-opt-icon.fallback {
  background: linear-gradient(135deg, var(--cyan, #6de0c9), var(--mint, #6de0c9));
  padding: 0;
}
.wallet-opt-name {
  flex: 1;
  color: var(--text, #e9ecf1);
}
.wallet-opt-status {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim, #7a808d);
  padding: 3px 8px;
  background: var(--bg-3, #1a1e26);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
}
.wallet-opt:hover .wallet-opt-status {
  color: var(--cyan, #6de0c9);
  border-color: rgba(109, 224, 201, 0.34);
}
.wallet-opt.unavailable .wallet-opt-status {
  color: var(--text-dim, #7a808d);
}

/* WalletConnect universal option — separates visually as the catch-all. */
.wallet-opt.wc-opt {
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.10);
  padding-top: 14px;
}

/* On mobile Safari (and any mobile browser), extension-based wallets can't
   inject, so they always read "NOT INSTALLED" even when the user has the
   wallet apps on their phone. Hide those rows on mobile — WalletConnect
   below covers every wallet in one flow, no confusion. */
@media (max-width: 720px) {
  .wallet-picker-card .wallet-opt.unavailable { display: none !important; }
  /* Give WC option no top border since it's the first (only) item now. */
  .wallet-picker-card .wallet-opt.wc-opt {
    margin-top: 0;
    border-top: none;
    padding-top: 10px;
  }
}
.wallet-opt.wc-opt .wallet-opt-icon.wc-logo {
  background: #3b99fc;
  display: flex; align-items: center; justify-content: center;
}
.wallet-opt.wc-opt .wallet-opt-icon.wc-logo svg { width: 22px; height: 14px; fill: #fff; }
.wallet-opt.wc-opt .wallet-opt-status {
  color: #6de0c9; border-color: rgba(109,224,201,0.34);
}

/* ============================================================================
   GEAR POPOVER — global runtime knobs (LIVE/DRY, slippage, gas caps)
   Wires to existing /api/settings — no new routes.
   ============================================================================ */
.gear-wrap { position: relative; }
.gear-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 160ms cubic-bezier(.32,.72,0,1);
  padding: 0;
}
.gear-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.7; fill: none; }
.gear-btn:hover { color: var(--text); border-color: var(--hairline-2); }
.gear-btn.open {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.gear-pop {
  position: fixed;
  left: auto !important;
  right: 16px !important;
  top: 60px !important;
  width: min(340px, calc(100vw - 32px));
  transform-origin: top right;
  background: var(--bg-1);
  border: 1px solid var(--hairline-2);
  border-radius: 14px;
  padding: 14px 16px 12px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.7);
  opacity: 0; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms cubic-bezier(.32,.72,0,1),
              transform 160ms cubic-bezier(.32,.72,0,1);
  z-index: 100;
}
.gear-pop.open { opacity: 1; pointer-events: auto; transform: translateY(0); }

.gp-head {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 10px;
}
.gp-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
}
.gp-row:last-of-type { border-bottom: 0; }
.gp-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
  line-height: 1.25;
}
.gp-hint { display: block; font-weight: 400; font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.gp-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.gp-seg button {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.gp-seg button.active {
  background: var(--bg-3);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.gp-seg button[data-mode="dry"].active {
  color: var(--warn);
  box-shadow: inset 0 0 0 1px rgba(255,181,71,0.4);
}
.gp-inp { position: relative; }
.gp-inp input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 7px 44px 7px 10px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
}
.gp-inp input:focus { outline: none; border-color: var(--accent-line); }
.gp-suf {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); letter-spacing: 0;
  pointer-events: none;
}
.gp-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--hairline);
}
.gp-note {
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0;
  flex: 1;
}
.gp-note.ok  { color: var(--accent); }
.gp-note.err { color: var(--neg); }
.gp-save {
  padding: 6px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.gp-save:hover { background: rgba(109,224,201,0.20); }
.gp-save:disabled { opacity: 0.5; cursor: default; }

/* ============================================================================
   DETECTION PILL — sits in .chart-info, one per chain panel.
   Polls /api/detection/risk when the chain is active and a CA is loaded.
   ============================================================================ */
.detection-pill {
  display: none;                 /* JS reveals when it has data */
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--hairline);
  background: var(--bg-2);
  color: var(--text-mid);
  transition: background 160ms cubic-bezier(.32,.72,0,1),
              border-color 160ms cubic-bezier(.32,.72,0,1),
              color 160ms cubic-bezier(.32,.72,0,1);
  cursor: help;
}
.detection-pill.show { display: inline-flex; }
.detection-pill .dp-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.detection-pill.safe {
  color: var(--pos);
  border-color: rgba(125,227,122,0.30);
  background: rgba(125,227,122,0.06);
}
.detection-pill.watch {
  color: var(--warn);
  border-color: rgba(255,181,71,0.36);
  background: rgba(255,181,71,0.08);
}
.detection-pill.exposed {
  color: var(--neg);
  border-color: rgba(255,77,90,0.36);
  background: rgba(255,77,90,0.10);
  animation: dpPulse 1.4s infinite cubic-bezier(.32,.72,0,1);
}
@keyframes dpPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,77,90,0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(255,77,90,0.00); }
}

/* ============================================================================
   MM COCKPIT — one row per running program on the active chain.
   ============================================================================ */
.mm-cockpit {
  background: var(--bg-1);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
}
.mm-cockpit-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}
.mm-cockpit-head .mm-hint { flex: 1; }
.mm-demo-btn {
  padding: 5px 12px;
  background: transparent;
  border: 1px dashed var(--hairline-2);
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 8px;
  cursor: pointer;
  transition: all 160ms cubic-bezier(.32,.72,0,1);
}
.mm-demo-btn:hover { color: var(--text); border-color: var(--hairline-3); }
.mm-demo-btn.on {
  color: var(--warn);
  border: 1px solid rgba(255,181,71,0.36);
  background: rgba(255,181,71,0.08);
}
.mm-title {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mid);
}
.mm-hint { font-size: 11px; color: var(--text-dim); letter-spacing: 0; font-family: var(--mono); }
.mm-hint b { color: var(--chain-accent); font-weight: 600; }
.mm-cockpit-body { padding: 6px; }
.mm-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--text-tiny);
  font-size: 11.5px;
  letter-spacing: 0;
}
.mm-row {
  display: grid;
  grid-template-columns: 42px minmax(140px, 1fr) minmax(110px, auto) minmax(140px, 1.2fr) 88px minmax(80px, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 160ms cubic-bezier(.32,.72,0,1);
  min-width: 0;
}
.mm-row > * { min-width: 0; }
.mm-row .mm-sym {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-row .mm-pattern {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-row .mm-phase span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
/* Narrow container — stack the row cleanly instead of squeezing */
@media (max-width: 1100px) {
  .mm-row {
    grid-template-columns: 42px 1fr auto;
    grid-template-areas:
      "slot tok pnl"
      "slot threat actions"
      "slot phase phase"
      "slot fleet fleet";
    row-gap: 6px;
  }
  .mm-row .mm-slot   { grid-area: slot; align-self: start; }
  .mm-row .mm-tok    { grid-area: tok; }
  .mm-row .mm-pnl    { grid-area: pnl; }
  .mm-row .mm-threat { grid-area: threat; justify-self: start; }
  .mm-row .mm-phase  { grid-area: phase; }
  .mm-row .mm-fleet  { grid-area: fleet; }
  .mm-row .mm-actions{ grid-area: actions; }
}
.mm-row + .mm-row { border-top: 1px dashed rgba(255,255,255,0.04); }
.mm-row:hover { background: rgba(255,255,255,0.02); }
.mm-row .mm-slot {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  text-align: center;
  letter-spacing: 0.06em;
}
.mm-row.stopped .mm-slot { background: var(--bg-3); color: var(--text-dim); }
.mm-row .mm-tok {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.mm-row .mm-sym {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-row .mm-pattern {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0;
}
.mm-row .mm-phase {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-mid);
  letter-spacing: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.mm-row .mm-phase-bar {
  height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden;
}
.mm-row .mm-phase-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 6px var(--brand-glow);
}
.mm-row .mm-threat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--hairline);
  background: var(--bg-2);
  color: var(--text-mid);
  justify-content: center;
}
.mm-row .mm-threat i {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 4px currentColor;
}
.mm-row .mm-threat.safe    { color: var(--pos); border-color: rgba(125,227,122,0.30); background: rgba(125,227,122,0.06); }
.mm-row .mm-threat.watch   { color: var(--warn); border-color: rgba(255,181,71,0.36); background: rgba(255,181,71,0.08); }
.mm-row .mm-threat.exposed { color: var(--neg); border-color: rgba(255,77,90,0.36); background: rgba(255,77,90,0.10); }
.mm-row .mm-fleet {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-mid);
  letter-spacing: 0;
}
.mm-row .mm-fleet b { color: var(--text); font-weight: 700; }
.mm-row .mm-pnl {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.mm-row .mm-pnl.plus  { color: var(--pos); }
.mm-row .mm-pnl.minus { color: var(--neg); }
.mm-row .mm-actions { display: flex; gap: 6px; }
.mm-row .mm-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid;
  background: transparent;
  transition: filter 160ms cubic-bezier(.32,.72,0,1);
}
.mm-row .mm-btn.stop { color: var(--neg); border-color: var(--neg); background: rgba(255,77,90,0.06); }
.mm-row .mm-btn:hover { filter: brightness(1.15); }

/* ============================================================================
   LIVE TAPE — Bloomberg-style compact trade feed.
   ============================================================================ */
.live-tape-panel { display: flex; flex-direction: column; }
.live-tape-panel .panel-title { display: flex; align-items: center; justify-content: space-between; }
.tape-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700;
}
.tape-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 6px var(--brand-glow);
  animation: dpPulse 1.6s infinite cubic-bezier(.32,.72,0,1);
}
.tape-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0;
}
.live-tape {
  padding: 4px 6px 8px !important;
  max-height: 320px;
  min-height: 180px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
}
.tape-empty { padding: 24px 12px; color: var(--text-tiny); text-align: center; font-family: var(--sans); font-size: 11.5px; }
.tp-row {
  display: grid;
  grid-template-columns: 76px 30px minmax(80px, 1fr) minmax(90px, 1fr) minmax(80px, 1fr) minmax(80px, 1fr) 44px;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 6px;
  align-items: center;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.tp-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-row .tp-side { overflow: visible; }
.tp-row .tp-tag { overflow: visible; }
.tp-row + .tp-row { border-top: 1px dashed rgba(255,255,255,0.03); }
.tp-row.fresh {
  background: linear-gradient(90deg, rgba(109,224,201,0.10) 0%, transparent 80%);
  animation: tape-flash 1.6s cubic-bezier(.32,.72,0,1);
}
@keyframes tape-flash {
  from { background: linear-gradient(90deg, rgba(109,224,201,0.28) 0%, transparent 80%); }
  to   { background: linear-gradient(90deg, rgba(109,224,201,0.10) 0%, transparent 80%); }
}
.tp-row .tp-time { color: var(--text-dim); }
.tp-row .tp-side {
  display: grid; place-items: center;
  width: 26px; height: 22px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0;
}
.tp-row .tp-side.b { color: var(--pos); background: rgba(125,227,122,0.10); box-shadow: inset 0 0 0 1px rgba(125,227,122,0.32); }
.tp-row .tp-side.s { color: var(--neg); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(255,77,90,0.30); }
.tp-row .tp-sym { color: var(--text); font-weight: 600; font-family: var(--sans); font-size: 11px; }
.tp-row .tp-amt { color: var(--text); font-weight: 500; }
.tp-row .tp-usd { color: var(--text-mid); }
.tp-row .tp-wallet { color: var(--text-dim); }
.tp-row .tp-tag {
  text-align: center;
  padding: 1px 6px;
  border-radius: 5px;
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--brand-soft);
  color: var(--brand);
}
.tp-row .tp-tag.ext {
  background: rgba(255,181,71,0.10);
  color: var(--warn);
}

/* ============================================================================
   VIEW MODE — Program Trading vs Manual Trading (both live in overview)
     - Program Trading: chart + right rail + strat-grid config + cockpit
                        + tape + Detection pill + Live Activity (auto MM)
     - Manual Trading:  chart + manual panel + tape (hand-driven)
   Both keep the chain-tab strip and chart section visible.
   ============================================================================ */
/* Program Trading — hide the manual panel */
body.view-program .manual-panel { display: none !important; }

/* Manual Trading — hide everything program-scoped */
body.view-manual .strat-grid,
body.view-manual .ws-banner,
body.view-manual .trading-rail,
body.view-manual .mm-cockpit,
body.view-manual #ov-log,
body.view-manual .detection-pill { display: none !important; }
body.view-manual .panel:has(#ov-log) { display: none !important; }

/* Manual view — Hyperliquid/Lighter shape: big chart left, trade panel right.
   Also hide the chain-wallets summary and the tape here — the manual panel
   is the whole interaction surface. */
body.view-manual .chain-wallets,
body.view-manual .live-tape-panel { display: none !important; }

body.view-manual .chain-panel.active {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 12px;
  align-items: start;
  padding: 12px 10px 0 !important;
}
body.view-manual .chain-panel.active .chart-section { grid-column: 1; min-width: 0; margin: 0 !important; }
body.view-manual .chain-panel.active .manual-panel { grid-column: 2; min-width: 0; margin: 0 !important; }
body.view-manual .chain-panel.active > *:not(.chart-section):not(.manual-panel) {
  grid-column: 1 / -1;
}

/* Make the chart taller in Manual — Hyperliquid gives the chart most of the
   viewport, so trader has enough vertical range to read structure */
body.view-manual .chart-section .chart-container {
  height: calc(100vh - 260px) !important;
  min-height: 480px;
}

/* Manual panel adopts the right-rail rhythm — sticky, matches chart height */
body.view-manual .manual-panel {
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}
body.view-manual .manual-panel .mp-body {
  overflow-y: auto;
  padding: 16px !important;
  gap: 12px !important;
}
body.view-manual .manual-panel .mp-head {
  padding: 12px 16px !important;
}
body.view-manual .manual-panel .mp-title {
  font-size: 12.5px !important;
}
body.view-manual .manual-panel .mp-fields {
  grid-template-columns: 1fr !important;   /* stack single-col in the right rail */
  gap: 12px !important;
}
body.view-manual .manual-panel .mp-mode {
  padding: 8px 10px !important;
  font-size: 10.5px !important;
  gap: 5px;
}
body.view-manual .manual-panel .mp-actions {
  grid-template-columns: 1fr 1fr !important;   /* 2x2 instead of 1x4 */
  gap: 8px !important;
}
body.view-manual .manual-panel .mp-actions-sched {
  grid-template-columns: 1fr !important;
  gap: 8px !important;
}
body.view-manual .manual-panel .mp-actions-sched .mp-sched-side {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
body.view-manual .manual-panel .mp-btn {
  padding: 12px 10px !important;
  font-size: 11px !important;
}

/* Narrow viewport — stack panel below chart */
@media (max-width: 1200px) {
  body.view-manual .chain-panel.active {
    grid-template-columns: 1fr;
  }
  body.view-manual .chain-panel.active .chart-section,
  body.view-manual .chain-panel.active .manual-panel {
    grid-column: 1;
  }
  body.view-manual .manual-panel { position: static; max-height: none; }
  body.view-manual .chart-section .chart-container {
    height: 420px !important;
    min-height: 420px;
  }
}

/* Manual-view chart chrome — the CA controls read like an exchange header */
body.view-manual .chart-section {
  background: var(--bg-1);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}
body.view-manual .chart-section::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-line), transparent);
  pointer-events: none;
}
body.view-manual .chart-controls {
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--hairline);
  background: transparent !important;
}
body.view-manual .chart-container {
  border: 0 !important;
  border-radius: 0 !important;
}

/* ============================================================================
   TRADING RAIL — right-side operator cockpit next to the chart.
   Only visible in view-trading. In view-programs, hidden and chart is full width.
   ============================================================================ */
/* Program Trading — chain-panel stays as it was originally: chart on top,
   strat-grid config below. Right rail was disrupting the config editor
   layout, so it's hidden here entirely. The cockpit strip + tape below
   provide the same monitoring signal without displacing anything. */
body.view-program .trading-rail { display: none !important; }

.trading-rail {
  background: var(--bg-1);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}
.trading-rail::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-line), transparent);
  pointer-events: none;
}

/* Program tabs P1-P4 */
.tr-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px 0;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-1);
}
.tr-tab {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 4px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 160ms cubic-bezier(.32,.72,0,1),
              border-color 160ms cubic-bezier(.32,.72,0,1);
}
.tr-tab:hover { color: var(--text); }
.tr-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.tr-tab .live-mini {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 6px rgba(125,227,122,0.6);
  animation: dpPulse 1.6s infinite cubic-bezier(.32,.72,0,1);
}
.tr-tab.empty { color: var(--text-tiny); }

/* Body — scrollable */
.tr-body {
  overflow-y: auto;
  padding: 14px 14px 10px;
  flex: 1;
}
.tr-empty {
  padding: 24px 12px;
  color: var(--text-tiny);
  font-size: 11.5px;
  letter-spacing: 0;
  text-align: center;
  line-height: 1.5;
}
.tr-empty b { color: var(--text-mid); }

/* Selected program contents */
.tr-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.tr-head > div:first-child { min-width: 0; flex: 1; }
.tr-sym {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tr-ca {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tr-badges {
  display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
}
.tr-badge {
  padding: 3px 8px;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--text-mid);
  font-size: 10px;
  letter-spacing: 0;
  font-weight: 500;
}
.tr-badge.live { background: var(--pos-soft, rgba(125,227,122,0.10)); border-color: rgba(125,227,122,0.30); color: var(--pos); font-weight: 700; }

/* Threat hero (big) */
.tr-threat {
  padding: 12px 14px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid;
}
.tr-threat.safe    { background: radial-gradient(120% 100% at 0% 0%, rgba(125,227,122,0.16), rgba(125,227,122,0.02) 60%, transparent); border-color: rgba(125,227,122,0.32); }
.tr-threat.watch   { background: radial-gradient(120% 100% at 0% 0%, rgba(255,181,71,0.16), rgba(255,181,71,0.02) 60%, transparent); border-color: rgba(255,181,71,0.36); }
.tr-threat.exposed { background: radial-gradient(120% 100% at 0% 0%, rgba(255,77,90,0.18), rgba(255,77,90,0.02) 60%, transparent); border-color: rgba(255,77,90,0.40); }
.tr-threat-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.tr-threat-status { display: flex; align-items: center; gap: 8px; }
.tr-threat-dot {
  width: 8px; height: 8px; border-radius: 50%;
  animation: dpPulse 2s infinite cubic-bezier(.32,.72,0,1);
}
.tr-threat.safe .tr-threat-dot    { background: var(--pos); box-shadow: 0 0 8px rgba(125,227,122,0.6); }
.tr-threat.watch .tr-threat-dot   { background: var(--warn); box-shadow: 0 0 8px rgba(255,181,71,0.6); }
.tr-threat.exposed .tr-threat-dot { background: var(--neg); box-shadow: 0 0 8px rgba(255,77,90,0.6); }
.tr-threat-word {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.tr-threat.safe .tr-threat-word    { color: var(--pos); }
.tr-threat.watch .tr-threat-word   { color: var(--warn); }
.tr-threat.exposed .tr-threat-word { color: var(--neg); }
.tr-threat-score {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0;
}
.tr-threat-reason {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-mid);
  letter-spacing: 0;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Phase progress */
.tr-phase {
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.tr-phase-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.tr-phase-head .tr-phase-active {
  color: var(--brand); font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0; text-transform: none; font-weight: 600;
}
.tr-phase-bar {
  height: 5px; background: var(--bg-3);
  border-radius: 3px; overflow: hidden;
  margin-bottom: 6px;
}
.tr-phase-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 6px var(--brand-glow);
}
.tr-phase-meta {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px;
  color: var(--text-dim); letter-spacing: 0;
}

/* Stat pair grid */
.tr-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.tr-stat {
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 8px 10px;
}
.tr-stat .k {
  font-size: 8.5px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-dim);
}
.tr-stat .v {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 700;
  color: var(--text);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tr-stat { min-width: 0; }
.tr-phase-head { flex-wrap: wrap; gap: 4px; }
.tr-phase-head .tr-phase-active {
  color: var(--brand); font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0; text-transform: none; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 60%;
}
.tr-stat .v.plus  { color: var(--pos); }
.tr-stat .v.minus { color: var(--neg); }

/* Foot buttons */
.tr-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.tr-foot-btn {
  padding: 9px 10px;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid;
  transition: filter 160ms cubic-bezier(.32,.72,0,1);
  text-align: center;
  background: transparent;
}
.tr-foot-btn.stop { color: var(--neg); border-color: rgba(255,77,90,0.4); background: rgba(255,77,90,0.06); }
.tr-foot-btn.edit { color: var(--text); border-color: var(--hairline-2); }

/* Quick trade at bottom */
.tr-qt {
  border-top: 1px solid var(--hairline);
  background: linear-gradient(180deg, transparent, rgba(109,224,201,0.02) 100%);
  padding: 12px 14px 14px;
}
.tr-qt-head {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.tr-qt-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 6px var(--brand-glow);
}
.tr-qt-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  margin-bottom: 6px;
}
.tr-qt-row:has(select) { grid-template-columns: 1fr; }
.tr-qt-row:has(.full)  { grid-template-columns: 1fr 1fr; }
.tr-qt select, .tr-qt input {
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0;
  width: 100%;
}
.tr-qt select:focus, .tr-qt input:focus { outline: none; border-color: var(--brand-line); }
.tr-qt-btn {
  padding: 8px 10px;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid;
}
.tr-qt-btn.buy  { color: var(--pos); border-color: rgba(125,227,122,0.36); background: rgba(125,227,122,0.06); }
.tr-qt-btn.sell { color: var(--neg); border-color: rgba(255,77,90,0.36); background: rgba(255,77,90,0.06); }
.tr-qt-btn:hover { filter: brightness(1.15); }
.tr-qt-btn.full { padding: 10px; }

/* ============================================================================
   MANUAL TRADING PANEL — hands-on execution, not tied to programs.
   Visible only in view-manual. Instant reuses /api/quick-trade endpoints;
   TWAP + MM run as client-side timers that also hit the same endpoints.
   ============================================================================ */
.manual-panel {
  background: var(--bg-1);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.5);
  margin: 10px;
}
.manual-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-line), transparent);
  pointer-events: none;
}
.mp-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
}
.mp-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}
.mp-hint {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0;
  font-family: var(--mono);
}
.mp-body {
  padding: 18px;
  display: grid;
  gap: 14px;
}

/* Mode toggle */
.mp-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
}
.mp-mode {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 160ms cubic-bezier(.32,.72,0,1),
              background 160ms cubic-bezier(.32,.72,0,1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.mp-mode .info-icon {
  cursor: help;
}
.mp-mode:hover { color: var(--text); }
.mp-mode.active {
  background: var(--bg-3);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand-line);
}

/* Fields grid */
.mp-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr);
  gap: 10px;
}
.mp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.mp-lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.mp-field input,
.mp-field select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.mp-field select { font-family: var(--sans); font-weight: 500; }
.mp-field input:focus, .mp-field select:focus {
  outline: none;
  border-color: var(--brand-line);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Action rows */
.mp-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}
.mp-actions-sched {
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.mp-actions-sched .mp-sched-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mp-btn {
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid;
  transition: filter 160ms cubic-bezier(.32,.72,0,1);
}
.mp-btn.buy  { color: var(--pos); border-color: rgba(125,227,122,0.36); background: rgba(125,227,122,0.08); }
.mp-btn.sell { color: var(--neg); border-color: rgba(255,77,90,0.36); background: rgba(255,77,90,0.08); }
.mp-btn.stop { color: var(--warn); border-color: rgba(255,181,71,0.36); background: rgba(255,181,71,0.06); }
.mp-btn:hover { filter: brightness(1.15); }
.mp-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Session status pill */
.mp-status {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-mid);
  letter-spacing: 0;
}
.mp-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.mp-status.running .mp-status-dot {
  background: var(--brand);
  box-shadow: 0 0 6px var(--brand-glow);
  animation: dpPulse 1.6s infinite cubic-bezier(.32,.72,0,1);
}
.mp-status.running { color: var(--text); }
.mp-status.err .mp-status-dot { background: var(--neg); box-shadow: 0 0 6px rgba(255,77,90,0.5); }
.mp-status.err { color: var(--neg); }

/* ============================================================================
   FUNDING TAB POLISH — matches the mockup wallets tab
   Sub-tabs pill container, cleaner card headers, better spacing on panes.
   ============================================================================ */
section[data-section="funding"] .chain-tabs {
  margin: 0 10px 14px !important;
}

section[data-section="funding"] .funding-tab-pane {
  padding: 0 10px !important;
}

section[data-section="funding"] .panel {
  border-radius: 18px !important;
  background: var(--bg-1) !important;
  border: 1px solid rgba(255,255,255,0.09) !important;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.5);
}
section[data-section="funding"] .panel::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-line), transparent);
  pointer-events: none;
}

section[data-section="funding"] .panel-title {
  padding: 14px 18px !important;
  border-bottom: 1px solid var(--hairline) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent !important;
}
section[data-section="funding"] .panel-title span:first-child {
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: -0.005em !important;
  color: var(--text) !important;
  text-transform: none !important;
}
section[data-section="funding"] .panel-title span:last-child {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0;
  font-weight: 400;
}

section[data-section="funding"] .panel-body {
  padding: 18px !important;
}

/* Setting labels get more air */
section[data-section="funding"] .setting-label {
  font-size: 9.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase !important;
  color: var(--text-dim) !important;
  margin-bottom: 6px !important;
  margin-top: 4px !important;
}

/* Docs-notes read cleaner — info-style */
section[data-section="funding"] .docs-note {
  background: rgba(109, 184, 255, 0.06) !important;
  border: 1px solid rgba(109, 184, 255, 0.20) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  font-size: 11.5px !important;
  color: var(--text-mid) !important;
  letter-spacing: 0 !important;
  line-height: 1.6 !important;
}
section[data-section="funding"] .docs-note strong[style*="amber"],
section[data-section="funding"] .docs-note[style*="amber"] {
  background: rgba(255, 181, 71, 0.06) !important;
  border-color: rgba(255, 181, 71, 0.25) !important;
  color: var(--warn) !important;
}

/* Batch list rows look like cards, not raw text */
section[data-section="funding"] #batch-list,
section[data-section="funding"] #defund-batch-list {
  display: grid;
  gap: 8px;
}
section[data-section="funding"] #batch-list > *,
section[data-section="funding"] #defund-batch-list > * {
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 10px 14px;
  transition: border-color 160ms cubic-bezier(.32,.72,0,1);
}
section[data-section="funding"] #batch-list > *:hover,
section[data-section="funding"] #defund-batch-list > *:hover {
  border-color: var(--hairline-2);
}
section[data-section="funding"] #batch-list .empty,
section[data-section="funding"] #defund-batch-list .empty {
  background: transparent;
  border: 1px dashed var(--hairline);
  color: var(--text-dim);
  text-align: center;
  padding: 20px;
  font-size: 11.5px;
}

/* Inputs + selects — slightly bigger and rounder */
section[data-section="funding"] input[type=text],
section[data-section="funding"] input[type=number],
section[data-section="funding"] input[type=password],
section[data-section="funding"] input[type=file] + button,
section[data-section="funding"] select {
  padding: 9px 12px !important;
  border-radius: 10px !important;
  background: var(--bg-2) !important;
  border: 1px solid var(--hairline) !important;
  font-size: 12px !important;
}

/* Wallet-share row segment inside privacy/refund */
section[data-section="funding"] .wallet-share-row {
  padding: 3px !important;
  border-radius: 10px !important;
  background: var(--bg-2) !important;
  border: 1px solid var(--hairline) !important;
  gap: 2px !important;
  display: grid !important;
}
section[data-section="funding"] .wallet-share-row .ws-btn {
  border-radius: 7px !important;
  background: transparent !important;
  border: 0 !important;
  padding: 8px 10px !important;
  font-size: 11px !important;
  color: var(--text-dim) !important;
}
section[data-section="funding"] .wallet-share-row .ws-btn.active {
  background: var(--bg-3) !important;
  color: var(--brand) !important;
  box-shadow: inset 0 0 0 1px var(--brand-line) !important;
}

/* Keystore panel — wallets-list block below the sub-tabs */
section[data-section="funding"] #wallets-list {
  padding: 6px !important;
}
section[data-section="funding"] #wallets-list .empty {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0;
}

/* Warning docs-note (yellow) */
section[data-section="funding"] .docs-note.warn,
section[data-section="funding"] div[class="docs-note"][style*="var(--amber)"] {
  background: rgba(255, 181, 71, 0.06) !important;
  border-color: rgba(255, 181, 71, 0.25) !important;
  color: var(--warn) !important;
}

/* Section-head + crumbs on funding */
section[data-section="funding"] .section-head {
  padding: 22px 20px 18px !important;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 8px;
}
section[data-section="funding"] .section-head h1 {
  font-size: 22px !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
}
section[data-section="funding"] .section-head .crumbs {
  font-size: 11.5px;
  color: var(--text-dim);
}

/* Sub-tab strip — pill container as in the mockup */
section[data-section="funding"] .chain-tabs {
  padding: 4px !important;
  border-radius: 12px !important;
  background: var(--bg-1);
  border: 1px solid var(--hairline);
  width: fit-content;
  gap: 2px !important;
  margin: 0 10px 14px !important;
}
section[data-section="funding"] .funding-tab {
  border: 0 !important;
  padding: 8px 18px !important;
  min-width: 0 !important;
  border-radius: 8px !important;
}
section[data-section="funding"] .funding-tab.active {
  background: var(--bg-3) !important;
  color: var(--brand) !important;
  box-shadow: inset 0 0 0 1px var(--brand-line) !important;
}
section[data-section="funding"] .funding-tab.active::before {
  content: none !important;
}

/* Card-style panel: darker shine + cyan top hairline */
section[data-section="funding"] .panel {
  background: var(--bg-1) !important;
  border: 1px solid rgba(255,255,255,0.09) !important;
  border-radius: 18px !important;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.5);
}

/* Better field grouping inside panels — first-row layouts on
   Create Wallets and Refund tabs */
section[data-section="funding"] .funding-tab-pane .panel-body > div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"] {
  display: grid !important;
  grid-template-columns: 2fr 1.2fr 0.8fr !important;
  gap: 10px !important;
  align-items: end;
  margin-bottom: 14px !important;
  flex-wrap: unset !important;
}
section[data-section="funding"] .funding-tab-pane .panel-body > div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"] > div {
  width: auto !important;
  min-width: 0 !important;
  flex: unset !important;
}

/* Encryption block reads as its own card */
section[data-section="funding"] .funding-tab-pane .panel-body > div[style*="border:1px solid var(--border)"] {
  background: var(--bg-2) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: 12px !important;
  padding: 14px !important;
}

/* Generate button aligns right, becomes cyan primary */
section[data-section="funding"] #generate-batch-btn {
  background: var(--brand-soft) !important;
  border: 1px solid var(--brand-line) !important;
  color: var(--brand) !important;
  padding: 10px 18px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
  font-size: 11.5px !important;
}
section[data-section="funding"] #generate-batch-btn:hover {
  background: rgba(109,224,201,0.20) !important;
}

/* Wallets-list keystore rows — table-ish */
section[data-section="funding"] #wallets-list > * {
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
}
section[data-section="funding"] #wallets-list > *:last-child { border-bottom: 0; }

/* Fund action buttons — cleaner */
section[data-section="funding"] .btn.pattern-btn-full {
  padding: 10px 16px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
  font-size: 11px !important;
}

/* Section head — align with mockup spacing */
section[data-section="funding"] .section-head {
  padding: 22px 20px 16px !important;
}

/* ============================================================================
   FUNDING — new card system (fund-card / fund-card-h / fund-card-body / etc.)
   Matches the dashboard-v3-wallets.html mockup vocabulary. Applies only inside
   section[data-section="funding"] to avoid leaking styles.
   ============================================================================ */
section[data-section="funding"] .funding-tab-pane {
  padding: 0 10px 14px !important;
  display: grid;
  gap: 14px;
}

section[data-section="funding"] .fund-card {
  background: var(--bg-1);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.5);
  margin: 0 0 14px 0;
}
section[data-section="funding"] .fund-card:last-child { margin-bottom: 12px; }
section[data-section="funding"] .fund-card::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-line), transparent);
  pointer-events: none;
}

section[data-section="funding"] .fund-card-h {
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
section[data-section="funding"] .fund-card-t {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}
section[data-section="funding"] .fund-card-t small,
section[data-section="funding"] .fund-batch-slug {
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 6px;
  font-size: 11px;
  letter-spacing: 0;
  font-family: var(--mono);
}
section[data-section="funding"] .fund-card-d {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0;
  margin-top: 3px;
  line-height: 1.5;
}
section[data-section="funding"] .fund-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
section[data-section="funding"] .fund-card-body {
  padding: 18px;
  display: grid;
  gap: 14px;
}

/* Field grid */
section[data-section="funding"] .fund-grid-3 {
  display: grid;
  grid-template-columns: 2fr 1.2fr 0.8fr;
  gap: 10px;
}
section[data-section="funding"] .fund-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
section[data-section="funding"] .fund-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
section[data-section="funding"] .fund-field.fund-span-2 { grid-column: span 2; }
section[data-section="funding"] .fund-field.fund-full { grid-column: 1 / -1; }

section[data-section="funding"] .fund-lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

section[data-section="funding"] .fund-inline-value {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-mid);
  padding: 8px 0;
  letter-spacing: 0;
}
section[data-section="funding"] .fund-inline-value strong {
  color: var(--brand);
  font-weight: 600;
}

/* Inputs / selects */
section[data-section="funding"] .fund-card input[type=text],
section[data-section="funding"] .fund-card input[type=number],
section[data-section="funding"] .fund-card input[type=password],
section[data-section="funding"] .fund-card select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 9px 12px !important;
  border-radius: 10px !important;
  font-family: var(--mono);
  font-size: 12px !important;
  letter-spacing: 0;
  transition: border-color 160ms cubic-bezier(.32,.72,0,1);
}
section[data-section="funding"] .fund-card select { font-family: var(--sans); font-weight: 500; }
section[data-section="funding"] .fund-card input:focus,
section[data-section="funding"] .fund-card select:focus {
  outline: none;
  border-color: var(--brand-line);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Sub-card for encryption block */
section[data-section="funding"] .fund-subcard {
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
section[data-section="funding"] .fund-radio-row {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 12px;
  color: var(--text-mid);
  flex-wrap: wrap;
}
section[data-section="funding"] .fund-radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
section[data-section="funding"] .fund-radio-row input[type=radio] { accent-color: var(--brand); }

/* Notes */
section[data-section="funding"] .fund-note {
  background: rgba(109, 184, 255, 0.06);
  border: 1px solid rgba(109, 184, 255, 0.20);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 11.5px;
  color: var(--text-mid);
  letter-spacing: 0;
  line-height: 1.6;
}
section[data-section="funding"] .fund-note.warn {
  background: rgba(255, 181, 71, 0.06);
  border-color: rgba(255, 181, 71, 0.28);
  color: var(--warn);
}
section[data-section="funding"] .fund-note.warn strong { color: #ffce7a; }
section[data-section="funding"] .fund-warn-text { color: var(--warn); }

/* Badges */
section[data-section="funding"] .fund-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  border-radius: 6px;
  color: var(--text-dim);
  background: var(--bg-3);
  border: 1px solid var(--hairline);
  text-transform: uppercase;
  white-space: nowrap;
}
section[data-section="funding"] .fund-badge.warn {
  color: var(--warn);
  background: rgba(255,181,71,0.10);
  border-color: rgba(255,181,71,0.28);
}
section[data-section="funding"] .fund-badge.err {
  color: var(--neg);
  background: rgba(255,77,90,0.10);
  border-color: rgba(255,77,90,0.36);
}

/* Buttons */
section[data-section="funding"] .fund-btn {
  padding: 9px 16px;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: 10px;
  cursor: pointer;
  transition: all 160ms cubic-bezier(.32,.72,0,1);
}
section[data-section="funding"] .fund-btn:hover {
  border-color: var(--hairline-2);
  background: var(--bg-3);
}
section[data-section="funding"] .fund-btn.primary {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11.5px;
  padding: 10px 18px;
}
section[data-section="funding"] .fund-btn.primary:hover {
  background: rgba(109,224,201,0.20);
}
section[data-section="funding"] .fund-btn.danger {
  background: rgba(255,77,90,0.06);
  border-color: rgba(255,77,90,0.36);
  color: var(--neg);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11.5px;
  padding: 10px 18px;
}
section[data-section="funding"] .fund-btn.danger:hover {
  background: rgba(255,77,90,0.14);
}
section[data-section="funding"] .fund-btn.fund-full-btn {
  width: 100%;
  justify-self: stretch;
}
section[data-section="funding"] .fund-mini {
  padding: 5px 11px;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--text-mid);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 8px;
  cursor: pointer;
  transition: color 160ms cubic-bezier(.32,.72,0,1), border-color 160ms cubic-bezier(.32,.72,0,1);
}
section[data-section="funding"] .fund-mini:hover {
  color: var(--brand);
  border-color: var(--brand-line);
}

/* Actions row */
section[data-section="funding"] .fund-actions-right {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

/* File-picker row */
section[data-section="funding"] .fund-file-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
section[data-section="funding"] .fund-file-row .fund-btn { flex: 1; }
section[data-section="funding"] .fund-file-name {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0;
}

/* Batch list / orders list / addr list / keystore — card-like rows */
section[data-section="funding"] .fund-batch-list,
section[data-section="funding"] .fund-orders-list,
section[data-section="funding"] .fund-addr-list,
section[data-section="funding"] .fund-keystore {
  display: grid;
  gap: 0;
  padding: 6px;
  min-height: 60px;
}
section[data-section="funding"] .fund-batch-list > *,
section[data-section="funding"] .fund-orders-list > *,
section[data-section="funding"] .fund-addr-list > *,
section[data-section="funding"] .fund-keystore > * {
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0;
  color: var(--text-mid);
  border-bottom: 1px solid var(--hairline);
}
section[data-section="funding"] .fund-batch-list > *:last-child,
section[data-section="funding"] .fund-orders-list > *:last-child,
section[data-section="funding"] .fund-addr-list > *:last-child,
section[data-section="funding"] .fund-keystore > *:last-child { border-bottom: 0; }
section[data-section="funding"] .fund-batch-list > *:hover,
section[data-section="funding"] .fund-orders-list > *:hover,
section[data-section="funding"] .fund-addr-list > *:hover,
section[data-section="funding"] .fund-keystore > *:hover {
  background: rgba(255,255,255,0.02);
}
section[data-section="funding"] .fund-empty {
  color: var(--text-dim);
  text-align: center;
  padding: 22px !important;
  font-family: var(--sans) !important;
  font-size: 11.5px !important;
  border-bottom: 0 !important;
  background: transparent !important;
}

/* Sub-tab strip — cleaner pill container matching the mockup */
section[data-section="funding"] .chain-tabs {
  padding: 4px !important;
  border-radius: 12px !important;
  background: var(--bg-1);
  border: 1px solid var(--hairline);
  width: fit-content;
  gap: 2px !important;
  margin: 0 10px 14px !important;
}
section[data-section="funding"] .funding-tab {
  border: 0 !important;
  padding: 8px 18px !important;
  min-width: 0 !important;
  border-radius: 8px !important;
}
section[data-section="funding"] .funding-tab.active {
  background: var(--bg-3) !important;
  color: var(--brand) !important;
  box-shadow: inset 0 0 0 1px var(--brand-line) !important;
}
section[data-section="funding"] .funding-tab.active::before { content: none !important; }

/* Wallet-share-row inside funding = pill segment */
section[data-section="funding"] .wallet-share-row {
  padding: 3px !important;
  border-radius: 10px !important;
  background: var(--bg-2) !important;
  border: 1px solid var(--hairline) !important;
  gap: 2px !important;
  display: grid !important;
}
section[data-section="funding"] .wallet-share-row .ws-btn {
  border-radius: 7px !important;
  background: transparent !important;
  border: 0 !important;
  padding: 8px 10px !important;
  font-size: 11px !important;
  color: var(--text-dim) !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
}
section[data-section="funding"] .wallet-share-row .ws-btn.active {
  background: var(--bg-3) !important;
  color: var(--brand) !important;
  box-shadow: inset 0 0 0 1px var(--brand-line) !important;
}

/* ============================================================================
   INFO-ICON TOOLTIP FIX — base app.css forces `white-space: nowrap`, so long
   tooltips push right off the viewport edge. Wrap them properly.
   ============================================================================ */
.info-icon .tooltip,
.mode-btn .info-icon .tooltip,
.qt-buy-all .info-icon .tooltip,
.qt-sell-all .info-icon .tooltip,
.mp-mode .info-icon .tooltip {
  white-space: normal !important;
  min-width: 200px !important;
  max-width: 300px !important;
  width: max-content !important;
  text-align: left !important;
  line-height: 1.5 !important;
  padding: 10px 12px !important;
  font-size: 11.5px !important;
  border-radius: 10px !important;
  background: var(--bg-1) !important;
  border: 1px solid var(--hairline-2) !important;
  color: var(--text-mid) !important;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.6);
  word-wrap: break-word;
  overflow-wrap: break-word;
  z-index: 200 !important;
}
.info-icon:hover .tooltip { display: block !important; }

/* In narrow containers (rail / panel / cockpit) shift so the tooltip's right
   edge aligns with the icon instead of centering, otherwise it clips right. */
.trading-rail .info-icon .tooltip,
.manual-panel .info-icon .tooltip,
.mm-cockpit .info-icon .tooltip {
  left: auto !important;
  right: 0 !important;
  transform: none !important;
}
.trading-rail .info-icon .tooltip::after,
.manual-panel .info-icon .tooltip::after,
.mm-cockpit .info-icon .tooltip::after {
  left: auto !important;
  right: 6px !important;
  transform: none !important;
}

/* Restyle the arrow tip + cyan hover tint on the icon itself */
.info-icon .tooltip::after { border-top-color: var(--hairline-2) !important; }
.info-icon:hover { color: var(--brand) !important; border-color: var(--brand-line) !important; }

/* ----------------------------------------------------------------------------
   Tooltip escape — remove overflow:hidden on cards so info-icon tooltips
   aren't clipped. The 1px top-shine ::before stays visually inside the
   border-radius (positioned at left:20% right:20%, well away from corners).
   ---------------------------------------------------------------------------- */
.manual-panel,
.mm-cockpit,
.trading-rail,
.fund-card,
section[data-section="funding"] .panel {
  overflow: visible !important;
}
/* But the top-shine ::before shouldn't spill either — clip its own bounds */
.manual-panel::before,
.mm-cockpit::before,
.trading-rail::before,
.fund-card::before {
  overflow: hidden;
}
/* Scrollable inner bodies keep their scroll but allow the tooltip to escape
   ONE level up (into the containing panel body) */
body.view-manual .manual-panel .mp-body { overflow: visible !important; }
.trading-rail .tr-body { overflow: visible !important; }

/* ============================================================================
   CHART TOOLS PANEL — floating toolbar top-left of chart-container.
   Buttons: Target / Trend / Range / Fills / Clear.
   Each opens a small popover below with the tool's controls.
   Positioned absolute inside chart-container.
   ============================================================================ */
.chart-tools-panel {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 30;
  display: flex;
  gap: 3px;
  padding: 4px;
  background: rgba(10,12,16,0.85);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid var(--hairline-2);
  border-radius: 12px;
  box-shadow: 0 12px 32px -12px rgba(0,0,0,0.5);
}
.ct-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 0;
  color: var(--text-mid);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 8px;
  cursor: pointer;
  transition: color 160ms cubic-bezier(.32,.72,0,1),
              background 160ms cubic-bezier(.32,.72,0,1);
}
.ct-tool svg {
  width: 14px; height: 14px;
  stroke: currentColor; stroke-width: 1.7; fill: none;
}
.ct-tool:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.ct-tool.active {
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-line);
}
.ct-tool.ct-clear { padding: 7px 8px; color: var(--text-dim); }
.ct-tool.ct-clear:hover { color: var(--neg); background: rgba(255,77,90,0.06); }

/* Popover — shown when its parent .ct-tool is active */
.ct-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-1);
  border: 1px solid var(--hairline-2);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 240px;
  max-width: 320px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.6);
  display: none;
  z-index: 40;
}
.ct-pop.open { display: block; }
.ct-pop-lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.ct-pop-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-bottom: 8px;
}
.ct-pop-row.two { grid-template-columns: 1fr 1fr; }
.ct-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--text);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
}
.ct-input:focus {
  outline: none;
  border-color: var(--brand-line);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.ct-btn {
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--text);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: filter 160ms cubic-bezier(.32,.72,0,1);
}
.ct-btn.primary {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  color: var(--brand);
}
.ct-btn:hover { filter: brightness(1.15); }
.ct-pop-hint {
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0;
  line-height: 1.5;
  margin-top: 4px;
}
.ct-pop-hint b { color: var(--text-mid); font-weight: 600; }

/* Trend-drawing crosshair mode */
body.ct-drawing .chart-container { cursor: crosshair !important; }

/* ----------------------------------------------------------------------------
   Chart tools — Cursor default, Drawings inventory, individual delete.
   ---------------------------------------------------------------------------- */
.ct-divider {
  width: 1px;
  align-self: stretch;
  background: var(--hairline);
  margin: 2px 2px;
}
.ct-hint {
  align-self: center;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--brand);
  letter-spacing: 0;
  white-space: nowrap;
}
.ct-drawings-btn { position: relative; }
.ct-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--brand);
  color: #0a0b0d;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
  display: grid; place-items: center;
  border: 2px solid var(--bg-1);
}

.ct-drawings-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  max-width: 340px;
  background: var(--bg-1);
  border: 1px solid var(--hairline-2);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.6);
  display: none;
  z-index: 40;
}
.ct-drawings-list.open { display: block; }
.ct-drawings-head {
  padding: 10px 12px 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--hairline);
  margin: 0 4px 6px;
}
.ct-drawings-body {
  display: grid;
  gap: 2px;
  padding: 0 2px 4px;
}
.ct-drawings-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--sans);
}
.ct-drawing-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 10px;
  padding: 8px 10px;
  align-items: center;
  border-radius: 8px;
  transition: background 160ms cubic-bezier(.32,.72,0,1);
}
.ct-drawing-row:hover { background: rgba(255,255,255,0.04); }
.ct-dr-ico {
  color: var(--brand);
  display: grid; place-items: center;
}
.ct-dr-lbl {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ct-dr-del {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
  transition: color 160ms, background 160ms, border-color 160ms;
}
.ct-dr-del:hover {
  color: var(--neg);
  border-color: rgba(255,77,90,0.36);
  background: rgba(255,77,90,0.06);
}

.ct-dr-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.ct-dr-edit {
  padding: 3px 9px;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--text-mid);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms, border-color 160ms, background 160ms;
}
.ct-dr-edit:hover {
  color: var(--brand);
  border-color: var(--brand-line);
  background: var(--brand-soft);
}

/* ----------------------------------------------------------------------------
   Chart select-chip — floating popover that appears at the click position
   when you click near a placed Target or Range line in Cursor mode.
   ---------------------------------------------------------------------------- */
.ct-select-chip {
  position: absolute;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  background: var(--bg-1);
  border: 1px solid var(--brand-line);
  border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5);
  z-index: 50;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0;
  white-space: nowrap;
  pointer-events: auto;
}
.ct-select-chip.open { display: inline-flex; }
.ct-chip-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mid);
  padding-right: 4px;
  border-right: 1px solid var(--hairline);
}
.ct-chip-del {
  padding: 5px 10px;
  background: rgba(255,77,90,0.08);
  border: 1px solid rgba(255,77,90,0.36);
  color: var(--neg);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 160ms;
}
.ct-chip-del:hover { filter: brightness(1.15); }
.ct-chip-close {
  width: 22px; height: 22px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.ct-chip-close:hover { color: var(--text); background: rgba(255,255,255,0.04); }

/* Sidebar brand — real Motions PNG (1373×400 natural). Force compact display. */
nav.side .side-brand {
  padding: 8px 10px 16px !important;
  justify-content: flex-start !important;
}
nav.side .side-brand .brand-mark-img {
  height: 26px !important;
  width: auto !important;
  max-width: 100% !important;
  display: block !important;
  filter: drop-shadow(0 0 12px rgba(109,224,201,0.35));
}

/* ============================================================
   BOTS + HOME OVERVIEW — new tabs, matches Motions terminal aesthetic.
   Adds:
     - Home landing (video hero + tool tiles)
     - Trending Bot config UI
     - Volume Bot config UI
     - Market Maker upgrade landing
   All colours use existing --cyan / --mint / --bg-* tokens.
   ============================================================ */

/* --- Sidebar: locked nav-items get a compact UPGRADE pill.
       Overrides tighten padding + shrink pill so it doesn't clip. --- */
nav.side .nav-item.locked {
  padding-right: 8px !important;
  gap: 8px !important;
}
nav.side .nav-item .upgrade-pill {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: rgba(109, 224, 201, 0.08);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  border-radius: 0;
  transition: all 140ms ease;
  line-height: 1.2;
}
nav.side .nav-item .upgrade-pill svg { flex-shrink: 0; }
nav.side .nav-item:hover .upgrade-pill {
  background: rgba(109, 224, 201, 0.18);
}
nav.side .nav-item.active .upgrade-pill {
  border-color: var(--mint);
  color: var(--mint);
}

nav.side .nav-item-home {
  border-bottom: 1px dashed var(--border);
  padding-bottom: 12px;
  margin-bottom: 8px;
}

/* ============================================================
   HOME HERO — split layout: copy on the LEFT, video panel on the
   RIGHT (mint-tinted box, matches Motions card rhythm).
   ============================================================ */

.home-hero.split {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  margin-bottom: 20px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .home-hero.split { grid-template-columns: 1fr; }
}

.home-hero-left {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.home-hero-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 14px;
}
.home-hero-title {
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  text-wrap: balance;
}
.home-hero-accent {
  background: linear-gradient(90deg, var(--cyan), var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-hero-desc {
  color: var(--text-mid);
  font-size: 13px;
  line-height: 1.6;
  max-width: 460px;
  margin-bottom: 22px;
}
.home-hero-stats {
  display: flex;
  gap: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.home-hero-stats > div { min-width: 60px; }
.hs-lbl {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.hs-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* --- RIGHT side: mint-tinted video box --- */
.home-hero-right {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 260px;
  background:
    linear-gradient(135deg,
      rgba(109, 224, 201, 0.12) 0%,
      rgba(109, 224, 201, 0.06) 50%,
      transparent 100%),
    var(--bg-1);
}
.home-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}
.home-hero-tint {
  position: absolute;
  inset: 0;
  mix-blend-mode: overlay;
  background: linear-gradient(135deg,
    rgba(109, 224, 201, 0.35) 0%,
    rgba(109, 224, 201, 0.22) 55%,
    rgba(11, 12, 14, 0.20) 100%);
  pointer-events: none;
}
.home-hero-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--mint);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
  opacity: 0.7;
}
.home-hero-corner.tl { top: 10px; left: 10px; border-top-width: 1px; border-left-width: 1px; }
.home-hero-corner.tr { top: 10px; right: 10px; border-top-width: 1px; border-right-width: 1px; }
.home-hero-corner.bl { bottom: 10px; left: 10px; border-bottom-width: 1px; border-left-width: 1px; }
.home-hero-corner.br { bottom: 10px; right: 10px; border-bottom-width: 1px; border-right-width: 1px; }

/* --- Group headings above tool tile rows --- */
.tool-group-hd {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 22px 2px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mid);
}
.tool-group-hd:first-of-type { padding-top: 8px; }
.tool-group-note {
  font-size: 9px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border: 1px solid var(--border-hi);
}

/* Locked nav-item styling */
nav.side .nav-item.locked { color: var(--text-dim); }
nav.side .nav-item.locked .nav-icon { opacity: 0.6; }

/* ============================================================
   TOOL TILES — grid under the video hero.
   ============================================================ */

.tool-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.tool-tile {
  background: var(--bg-1);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: background 140ms ease;
}
.tool-tile:hover { background: var(--bg-2); }
.tool-tile.locked { opacity: 0.95; }
.tool-tile.locked:hover { background: rgba(109, 224, 201, 0.04); }

.tool-tile-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tool-tile-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  transition: color 140ms, border-color 140ms;
}
.tool-tile-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.tool-tile:hover .tool-tile-icon {
  color: var(--cyan);
  border-color: var(--cyan);
}
.tool-tile-status {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  padding: 2px 8px;
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tool-tile-status.ok {
  border-color: rgba(61, 220, 132, 0.4);
  color: #3ddc84;
  background: rgba(61, 220, 132, 0.05);
}
.tool-tile-status.locked {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(109, 224, 201, 0.08);
}
.tool-tile-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.tool-tile-desc {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
  flex: 1;
}
.tool-tile-cta {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  transition: color 140ms;
}
.tool-tile-cta.locked { color: var(--mint); }
.tool-tile-cta span { margin-left: 4px; }

/* ============================================================
   BOT CONFIG PAGES — Trending + Volume shared layout
   ============================================================ */

.bot-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 960px) {
  .bot-grid { grid-template-columns: 1fr; }
}

.bot-config { display: flex; flex-direction: column; gap: 12px; }

.bot-panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.bot-panel.sticky {
  position: sticky;
  top: 96px;
}
.bot-panel-hd {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mid);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}
.bot-panel-hd.flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bot-panel-hd-r {
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: color 140ms;
}
.bot-panel-hd-r:hover { color: var(--cyan); }
.bot-panel-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.bot-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.bot-input {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 140ms;
}
.bot-input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.bot-input:focus { outline: none; border-color: var(--cyan); }

.bot-chain-row,
.bot-tier-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.bot-chain,
.bot-tier {
  flex: 1;
  min-width: 62px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 10px;
  border-radius: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 140ms ease;
}
.bot-chain:hover,
.bot-tier:hover {
  color: var(--text);
  border-color: var(--border-hi);
}
.bot-chain.active,
.bot-tier.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(109, 224, 201, 0.08);
}

.bot-fixed-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px dashed var(--border-hi);
  font-size: 12px;
}
.bot-fixed-lbl {
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
}
.bot-fixed-val { color: var(--text); font-weight: 600; }
.bot-fixed-note { color: var(--text-dim); font-weight: 400; font-size: 10px; margin-left: 4px; }

.bot-detected {
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 0;
  font-style: italic;
}

/* --- Live quote panel --- */
.bot-live-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bot-live-row .eyebrow {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.bot-live-row .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.bot-hairline { height: 1px; background: var(--border); }

.bot-cost-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--text-mid);
}
.bot-cost-line .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}
.bot-cost-line.total {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  padding-top: 2px;
}
.bot-cost-line.total .mono { color: var(--cyan); font-size: 14px; }

.bot-headline {
  text-align: center;
  padding: 10px 0 4px;
}
.bot-headline .eyebrow {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.bot-headline-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 34px;
  font-weight: 700;
  color: var(--cyan);
  line-height: 1.2;
  margin-top: 2px;
}
.bot-headline-sub {
  color: var(--text-mid);
  font-size: 11px;
  margin-top: 2px;
}

.bot-cta {
  width: 100%;
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  border-radius: 0;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms ease;
  margin-top: 6px;
}
.bot-cta:hover {
  background: var(--cyan);
  color: var(--bg-0);
  box-shadow: 0 0 22px rgba(109, 224, 201, 0.35);
}

.bot-note {
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-dim);
  padding-top: 6px;
}

/* ============================================================
   MARKET MAKER — upgrade landing
   ============================================================ */

.upgrade-hero {
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(109, 224, 201, 0.06) 0%, transparent 50%),
    var(--bg-1);
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.upgrade-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.5;
}
.upgrade-lock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: rgba(109, 224, 201, 0.08);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.upgrade-hero h2 {
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
  max-width: 700px;
}
.upgrade-lede {
  color: var(--text-mid);
  font-size: 15px;
  line-height: 1.6;
  max-width: 640px;
  margin-bottom: 32px;
}
.upgrade-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 32px;
}
.upgrade-feat { background: var(--bg-1); padding: 18px; }
.upgrade-feat-hd {
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.upgrade-feat p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0;
}
.upgrade-cta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.upgrade-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cyan);
  color: var(--bg-0);
  border: 1px solid var(--cyan);
  padding: 14px 32px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 140ms ease;
}
.upgrade-cta:hover {
  background: var(--mint);
  border-color: var(--mint);
  box-shadow: 0 0 28px rgba(109, 224, 201, 0.45);
}
.upgrade-cta-note {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============================================================
   RUN DASHBOARD — the live view revealed after Sign & start.
   Same aesthetic as Motions overview: hairline grids, mono numbers,
   cyan accent, tabular figures.
   ============================================================ */

.run-dashboard {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.run-dashboard[hidden] { display: none; }

.run-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
}
.run-hd-l, .run-hd-r { display: flex; align-items: center; gap: 12px; }
.run-hd-title { font-size: 13px; font-weight: 600; color: var(--text); }
.run-hd-chain {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: rgba(109, 224, 201, 0.08);
}
.run-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 8px #3ddc84;
  position: relative;
}
.run-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #3ddc84;
  animation: run-pulse 1.6s ease-out infinite;
}
@keyframes run-pulse {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(3); opacity: 0; }
}
.btn-pause, .btn-stop {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-mid);
  padding: 5px 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  transition: all 140ms ease;
}
.btn-pause:hover { color: var(--text); border-color: var(--text-mid); }
.btn-stop { color: var(--red); border-color: rgba(255,94,94,0.35); }
.btn-stop:hover { background: rgba(255,94,94,0.1); }

.run-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
@media (max-width: 720px) { .run-stats { grid-template-columns: repeat(2, 1fr); } }
.run-stat {
  background: var(--bg-1);
  padding: 14px 16px;
}
.run-stat.accent { background: linear-gradient(135deg, rgba(109,224,201,0.06), var(--bg-1)); }
.run-stat-v {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin: 4px 0 2px;
}
.run-stat.accent .run-stat-v { color: var(--cyan); }
.run-stat-s { font-size: 10px; color: var(--text-dim); }

.run-progress {
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: 14px 16px;
}
.run-progress-hd {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.run-progress-hd .ml-auto { margin-left: auto; }
.run-progress-bar { height: 4px; background: var(--bg-3); overflow: hidden; }
.run-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--mint));
  transition: width 400ms ease;
}

.run-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) { .run-grid { grid-template-columns: 1fr; } }
.run-panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: 14px 16px;
}
.run-panel-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.run-panel-hd .r { margin-left: auto; }
.run-rank { display: flex; align-items: flex-end; gap: 20px; }
.run-rank-v { font-size: 36px; font-weight: 700; color: var(--text); line-height: 1; }
.run-rank-delta {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 700;
  padding-bottom: 4px;
}
.run-rank-delta.up { color: var(--good, #3ddc84); }
.run-rank-delta.down { color: var(--red); }

.run-spark { width: 100%; height: 60px; display: block; }

.run-feed {
  max-height: 240px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.run-feed .run-empty { color: var(--text-dim); padding: 12px 0; text-align: center; font-size: 11px; }
.run-feed-row {
  display: grid;
  grid-template-columns: 42px 110px 90px 1fr auto;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  align-items: center;
}
.run-feed-row:last-child { border-bottom: 0; }
.run-feed-side {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  text-align: center;
  letter-spacing: 0.1em;
}
.run-feed-side.buy  { color: var(--good, #3ddc84); background: rgba(61,220,132,0.08); border: 1px solid rgba(61,220,132,0.25); }
.run-feed-side.sell { color: var(--cyan); background: rgba(109,224,201,0.08); border: 1px solid rgba(109,224,201,0.25); }
.run-feed-wallet, .run-feed-hash, .run-feed-ts { color: var(--text-dim); }
.run-feed-amt { color: var(--text); text-align: right; }

/* ============================================================
   BOT — Step-numbered panels + prominent CA input
   ============================================================ */

.bot-panel-hd-step {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bot-panel-hd-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.bot-panel-hd-step .req-pill {
  margin-left: auto;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--mint);
  border: 1px solid var(--mint);
  background: rgba(109, 224, 201, 0.08);
}

.bot-panel-ca { background: var(--bg-1); }

.bot-input-ca {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 16px 18px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  font-weight: 500;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.bot-input-ca::placeholder { color: var(--text-dim); }
.bot-input-ca:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(109, 224, 201, 0.15);
}
.bot-input-ca.valid { border-color: var(--mint); }
.bot-input-ca.invalid { border-color: var(--red); }

.bot-detected {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px dashed var(--border-hi);
  font-size: 11px;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.bot-detected.ok {
  color: var(--mint);
  border-color: rgba(109, 224, 201, 0.35);
  border-style: solid;
  background: rgba(109, 224, 201, 0.05);
}
.bot-detected.loading { color: var(--cyan); }
.bot-detected.err { color: var(--red); border-color: rgba(255,94,94,0.35); }

/* ============================================================
   CHAIN COLOURS — reuse Motions's existing chain tokens so bots
   match Market Maker chain tabs 1-for-1.
     --chain-base  blue     · --chain-base-soft / -line
     --chain-bsc   amber    · --chain-bsc-soft  / -line
     --chain-rh    neon-grn · --chain-rh-soft   / -line
     --chain-sol   purple   · --chain-sol-soft  / -line
   ============================================================ */

.bot-chain[data-chain="base"].active,
.bot-chain[data-chain="base"]:hover {
  color: var(--chain-base);
  border-color: var(--chain-base-line);
  background: var(--chain-base-soft);
}
.bot-chain[data-chain="bsc"].active,
.bot-chain[data-chain="bsc"]:hover {
  color: var(--chain-bsc);
  border-color: var(--chain-bsc-line);
  background: var(--chain-bsc-soft);
}
.bot-chain[data-chain="robinhood"].active,
.bot-chain[data-chain="robinhood"]:hover {
  color: var(--chain-rh);
  border-color: var(--chain-rh-line);
  background: var(--chain-rh-soft);
}
.bot-chain[data-chain="solana"].active,
.bot-chain[data-chain="solana"]:hover {
  color: var(--chain-sol);
  border-color: var(--chain-sol-line);
  background: var(--chain-sol-soft);
}

/* Chain badge in run-dashboard header picks the same colour */
.run-hd-chain.chain-base      { color: var(--chain-base); border-color: var(--chain-base-line); background: var(--chain-base-soft); }
.run-hd-chain.chain-bsc       { color: var(--chain-bsc);  border-color: var(--chain-bsc-line);  background: var(--chain-bsc-soft); }
.run-hd-chain.chain-robinhood { color: var(--chain-rh);   border-color: var(--chain-rh-line);   background: var(--chain-rh-soft); }
.run-hd-chain.chain-solana    { color: var(--chain-sol);  border-color: var(--chain-sol-line);  background: var(--chain-sol-soft); }

/* ============================================================
   COST GROUPS — split On-chain vs Motions fees, each with an
   info-hover explaining what's in it.
   ============================================================ */

.cost-group {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.cost-group:first-of-type { border-top: 0; }
.cost-group-hd {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.bot-cost-line.subtotal {
  font-weight: 600;
  color: var(--text);
  padding-top: 4px;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}

/* Info hover — small "i" chip with tooltip on hover */
.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border: 1px solid var(--border-hi);
  border-radius: 50%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 700;
  font-style: italic;
  color: var(--text-dim);
  cursor: help;
  position: relative;
  transition: color 140ms, border-color 140ms;
}
.info:hover { color: var(--cyan); border-color: var(--cyan); }
.info::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 300px;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--border-hi);
  color: var(--text-mid);
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.55;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 30;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.info:hover::after { opacity: 1; }

/* ============================================================
   SIMPLIFIED QUOTE PANEL — Trending + Volume bots.
   Three big rows (primary metric · cost · time), tiny breakdown
   underneath, brag line about our low fee, then Sign & start.
   ============================================================ */

.bot-live-row.small { gap: 16px; padding: 4px 0 10px; }
.bot-live-row.small .eyebrow { font-size: 9px; }
.bot-live-row.small .mono.s { font-size: 12px; font-weight: 600; }

.quote-simple {
  padding: 8px 0 14px;
  border-top: 1px solid var(--border);
}
.qs-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 0;
}
.qs-row + .qs-row { border-top: 1px dashed var(--border); }
.qs-lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.qs-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.qs-row.primary .qs-lbl { color: var(--cyan); }
.qs-row.primary .qs-val {
  font-size: 30px;
  background: linear-gradient(90deg, var(--cyan), var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.qs-breakdown {
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px dashed var(--border-hi);
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.qs-breakdown .mono {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.qs-b-note { color: var(--text-dim); font-size: 10px; }

.motions-brag {
  margin-top: 10px;
  padding: 8px 12px;
  background: linear-gradient(90deg, rgba(109,224,201,0.10), rgba(109,224,201,0.06));
  border-left: 2px solid var(--mint);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
}
.motions-brag b { color: var(--mint); font-weight: 700; }

/* --- Quote panel: TOTAL is the primary row, gated pre-CA state --- */
.qs-row.total {
  padding: 14px 12px;
  background: linear-gradient(135deg, rgba(109,224,201,0.12), rgba(109,224,201,0.05));
  border: 1px solid var(--cyan);
  margin: -4px 0 8px;
  align-items: center;
}
.qs-row.total .qs-lbl {
  color: var(--cyan);
  font-size: 12px;
  letter-spacing: 0.18em;
}
.qs-row.total .qs-val {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--cyan), var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.qs-row + .qs-row.total { border-top: 1px solid var(--cyan); }

.qs-quote-tag {
  margin-top: 8px;
  padding: 6px 8px;
  font-size: 10px;
  color: var(--text-dim);
  border: 1px dashed var(--border-hi);
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Gated pre-CA state for Volume Bot */
.qs-gated {
  padding: 24px 18px;
  border: 1px dashed var(--border-hi);
  text-align: center;
  background: var(--bg-0);
  margin: 6px 0;
}
.qs-gated-icon {
  font-size: 28px;
  color: var(--cyan);
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.qs-gated-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.qs-gated-sub {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
}

/* Custom budget input — revealed when Custom tier button is picked */
.bot-input-custom {
  margin-top: 8px;
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--cyan);
  border-radius: 0;
  padding: 10px 12px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  transition: border-color 140ms;
}
.bot-input-custom:focus {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 16px rgba(109, 224, 201, 0.18);
}
.bot-input-custom[hidden] { display: none; }

/* Coming-soon chain button (Solana until Jito bundles ship) */
.bot-chain.soon {
  opacity: 0.4;
  cursor: not-allowed;
  color: var(--text-dim) !important;
  border-color: var(--border) !important;
  background: transparent !important;
  position: relative;
}
.bot-chain.soon:hover {
  color: var(--text-dim) !important;
  border-color: var(--border) !important;
  background: transparent !important;
}

/* Kill switch header button — only visible on Market Maker sections
   (overview/programs/manual/funding/history/logs/settings). Hidden on
   Overview home tab and the new bot tabs. */
body:has(.section.active[data-section="home"]) .kill-btn,
body:has(.section.active[data-section="trending"]) .kill-btn,
body:has(.section.active[data-section="volume"]) .kill-btn,
body:has(.section.active[data-section="upgrade"]) .kill-btn {
  display: none !important;
}

/* ============================================================
   STUCK BAGS — orphaned wallets from failed sells.
   ============================================================ */

.sb-wrap { display: flex; flex-direction: column; gap: 12px; }

.sb-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  align-items: stretch;
}
.sb-metric { background: var(--bg-1); padding: 14px 16px; }
.sb-metric-v { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; }
.sb-metric-cta { background: var(--bg-1); padding: 14px 16px; display: flex; align-items: center; }
.btn-sb-sweep {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  border-radius: 0;
  padding: 10px 22px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms ease;
}
.btn-sb-sweep:hover {
  background: var(--cyan);
  color: var(--bg-0);
  box-shadow: 0 0 22px rgba(109, 224, 201, 0.35);
}
.btn-sb-sweep:disabled { opacity: 0.4; cursor: not-allowed; }

.sb-explainer {
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: 16px 18px;
}
.sb-explainer-hd { color: var(--cyan); margin-bottom: 10px; }
.sb-explainer p {
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-mid);
  margin: 0 0 8px;
}
.sb-explainer p:last-child { margin-bottom: 0; }
.sb-explainer b { color: var(--text); }

.sb-table-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border);
}
.sb-table-hd,
.sb-table-body .sb-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.8fr 1.4fr 0.8fr;
  gap: 12px;
  padding: 10px 14px;
  align-items: center;
  font-size: 11px;
}
.sb-table-hd {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-size: 9px;
}
.sb-table-body .sb-row {
  border-bottom: 1px solid var(--border);
  color: var(--text-mid);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sb-table-body .sb-row:last-child { border-bottom: 0; }
.sb-empty {
  padding: 32px 14px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
.sb-row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.sb-row-actions button {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-mid);
  padding: 3px 8px;
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms;
}
.sb-row-actions button:hover { color: var(--cyan); border-color: var(--cyan); }

/* End-of-run stuck-bags panel (per-bot dashboard, revealed only on completion with orphans) */
.run-stuck {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  background: linear-gradient(90deg, rgba(255,181,71,0.08), rgba(255,181,71,0.02));
  border: 1px solid rgba(255,181,71,0.35);
}
.run-stuck[hidden] { display: none; }
.run-stuck-icon {
  font-size: 22px;
  color: var(--warn);
  text-align: center;
}
.run-stuck-title { color: var(--text); font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.run-stuck-title .mono { color: var(--warn); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.run-stuck-desc { color: var(--text-mid); font-size: 11px; line-height: 1.55; max-width: 620px; }
.run-stuck-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 160px; }
.btn-support {
  text-align: center;
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border-hi);
  padding: 7px 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 140ms ease;
}
.btn-support:hover { color: var(--cyan); border-color: var(--cyan); }

/* ============================================================
   CA input row — big input + Load button side-by-side.
   Load pulls token metadata (symbol/logo/pool fee/liquidity) and
   renders a preview card so user confirms it's the right token.
   ============================================================ */

.ca-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.btn-ca-load {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  border-radius: 0;
  padding: 0 22px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms ease;
}
.btn-ca-load:hover:not(:disabled) {
  background: var(--cyan);
  color: var(--bg-0);
  box-shadow: 0 0 22px rgba(109, 224, 201, 0.35);
}
.btn-ca-load:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-ca-load.loading { color: var(--mint); border-color: var(--mint); }

/* Token preview card — revealed after Load succeeds. */
.token-preview {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-0);
  border: 1px solid var(--mint);
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
}
.token-preview[hidden] { display: none; }
.tp-logo {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
}
.tp-logo img { width: 100%; height: 100%; object-fit: cover; }
.tp-body { min-width: 0; }
.tp-name { color: var(--text); font-weight: 600; font-size: 13px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-name .tp-symbol { color: var(--mint); margin-right: 8px; }
.tp-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-dim);
  font-size: 10px;
  display: flex; flex-wrap: wrap; gap: 12px;
}
.tp-meta span { color: var(--text-mid); }
.tp-actions { display: flex; gap: 6px; }
.tp-link {
  padding: 5px 10px;
  border: 1px solid var(--border-hi);
  color: var(--text-mid);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: all 140ms ease;
}
.tp-link:hover { color: var(--cyan); border-color: var(--cyan); }

/* ============================================================================
   TRADING INTEL — terminal-style token dashboard for view-manual
   Positioned above chain-panels. Hidden in view-program.
   Color key: --tin-good #4ade80 · --tin-warn #f5b93a · --tin-bad #ef4444
   ============================================================================ */
:root {
  --tin-good: #4ade80;
  --tin-warn: #f5b93a;
  --tin-bad:  #ef4444;
  --tin-neutral: rgba(255,255,255,0.14);
}

/* Only visible in Manual Trading view */
#trading-intel { display: none; }
body.view-manual #trading-intel { display: block; }

/* In Manual Trading, the intel panel is the SINGLE entry point. Hide the
   duplicate/legacy Program-Trading UI so users don't paste in the wrong box:
   - the top chain-tabs (BASE/BSC/ETH/RH/SOL) — intel has its own picker
   - the metrics KPI strip (Program-Trading only)
   - the old chart-section (only the intel panel drives token selection)
*/
/* Terminal is the ONLY thing visible in Manual Trading view. Hide EVERY
   child of the overview section except #trading-intel. */
body.view-manual section[data-section="overview"] > *:not(#trading-intel) {
  display: none !important;
}
body.view-manual #trading-intel { display: block !important; margin: 0; }
/* Kill any stray floating elements that might live outside chain-panels */
body.view-manual .trading-rail,
body.view-manual .ws-banner,
body.view-manual .chain-tabs,
body.view-manual .metrics,
body.view-manual .chain-wallets,
body.view-manual .chain-panel,
body.view-manual .mm-cockpit,
body.view-manual .strat-grid,
body.view-manual .detection-pill,
body.view-manual .live-tape-panel,
body.view-manual .chart-section { display: none !important; }

.tin {
  margin: 4px 10px 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  font-family: inherit;
}

/* CA input row */
.tin-ca-row {
  position: relative;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.tin-ca-input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--hairline, rgba(255,255,255,0.09));
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: border-color 120ms, background 120ms;
}
.tin-ca-input::placeholder { color: var(--text-dim); font-family: inherit; letter-spacing: 0.01em; }
.tin-ca-input:focus { outline: none; border-color: var(--cyan); background: var(--bg-1); }
.tin-ca-clear {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  display: none;
  align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.tin[data-state="loaded"] .tin-ca-clear,
.tin[data-state="loading"] .tin-ca-clear { display: flex; }
.tin-ca-clear:hover { background: var(--bg-2); color: var(--text); }

/* Chain picker row */
.tin-chain-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.tin-chain-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: 4px;
}
.tin-chain {
  padding: 5px 11px;
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--hairline, rgba(255,255,255,0.09));
  border-radius: 8px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.10em;
  cursor: pointer;
  transition: all 120ms ease;
}
.tin-chain:hover { color: var(--text); border-color: var(--text-mid); }
.tin-chain.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(109, 224, 201, 0.08);
}
.tin-chain-hint {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Token header card */
.tin-header {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.tin-logo-wrap {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--hairline, rgba(255,255,255,0.09));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tin-logo {
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}
.tin-logo.loaded { display: block; }
.tin-logo-fallback {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 20px;
  color: var(--text-dim);
}
.tin-logo.loaded + .tin-logo-fallback { display: none; }

.tin-title { min-width: 0; }
.tin-symbol {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.1;
}
.tin-name {
  font-size: 12px;
  color: var(--text-mid);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tin-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
}
.tin-badge {
  padding: 3px 9px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: rgba(109, 224, 201, 0.08);
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tin-pool { color: var(--text-mid); }
.tin-ca-link {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px dashed var(--hairline, rgba(255,255,255,0.09));
}
.tin-ca-link:hover { color: var(--cyan); border-color: var(--cyan); }

/* Intel body */
.tin-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tin[data-state="empty"] .tin-body,
.tin[data-state="empty"] .tin-header { display: none; }
.tin[data-state="loading"] .tin-body { opacity: 0.4; pointer-events: none; }

/* Price tiles */
.tin-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
@media (max-width: 900px) { .tin-tiles { grid-template-columns: repeat(2, 1fr); } }

.tin-tile {
  background: var(--bg-2);
  padding: 12px 14px;
  position: relative;
}
.tin-tile-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.tin-tile-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.tin-tile-sub {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 3px;
}
.tin-tile-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--tin-neutral);
  margin-left: 2px;
}
.tin-tile-dot[data-level="good"] { background: var(--tin-good); box-shadow: 0 0 8px var(--tin-good); }
.tin-tile-dot[data-level="warn"] { background: var(--tin-warn); box-shadow: 0 0 8px var(--tin-warn); }
.tin-tile-dot[data-level="bad"]  { background: var(--tin-bad);  box-shadow: 0 0 8px var(--tin-bad); }

/* Change row */
.tin-changes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.tin-chg {
  background: var(--bg-2);
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.tin-chg-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tin-chg-v {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-mid);
}
.tin-chg[data-level="good"] .tin-chg-v { color: var(--tin-good); }
.tin-chg[data-level="bad"]  .tin-chg-v { color: var(--tin-bad); }

/* Safety strip */
.tin-safety {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.tin-safety-lbl {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-right: 10px;
  margin-right: 4px;
  border-right: 1px solid var(--border);
}
.tin-safety-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-mid);
  padding: 4px 10px;
  background: var(--bg-1);
  border: 1px solid var(--hairline, rgba(255,255,255,0.09));
  border-radius: 8px;
}
.tin-safety-name { color: var(--text); font-weight: 500; }
.tin-safety-v {
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text-mid);
  font-weight: 600;
  margin-left: 4px;
}
.tin-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tin-neutral);
  flex-shrink: 0;
}
.tin-dot[data-level="good"] { background: var(--tin-good); box-shadow: 0 0 8px var(--tin-good); }
.tin-dot[data-level="warn"] { background: var(--tin-warn); box-shadow: 0 0 8px var(--tin-warn); }
.tin-dot[data-level="bad"]  { background: var(--tin-bad);  box-shadow: 0 0 8px var(--tin-bad); }

/* Holders + Activity 2-col */
.tin-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 900px) { .tin-cols { grid-template-columns: 1fr; } }

.tin-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tin-block-hd {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.tin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.tin-row-lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-mid);
}
.tin-row-v {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.tin-row-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tin-neutral);
}
.tin-row-dot[data-level="good"] { background: var(--tin-good); box-shadow: 0 0 6px var(--tin-good); }
.tin-row-dot[data-level="warn"] { background: var(--tin-warn); box-shadow: 0 0 6px var(--tin-warn); }
.tin-row-dot[data-level="bad"]  { background: var(--tin-bad);  box-shadow: 0 0 6px var(--tin-bad); }

/* Live tape */
.tin-tape {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.tin-tape-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tin-tape-sub {
  margin-left: 8px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: none;
}
.tin-tape-list {
  max-height: 260px;
  overflow-y: auto;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px;
}
.tin-tape-empty {
  padding: 20px 14px;
  color: var(--text-dim);
  text-align: center;
  font-family: inherit;
  font-size: 12px;
}
.tin-tape-row {
  display: grid;
  grid-template-columns: 70px 46px 1fr 100px 70px;
  gap: 8px;
  align-items: center;
  padding: 5px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-mid);
}
.tin-tape-row:hover { background: var(--bg-1); }
.tin-tape-row-side {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  padding: 2px 6px;
  border-radius: 4px;
}
.tin-tape-row-side.buy  { color: var(--tin-good); background: rgba(74,222,128,0.10); }
.tin-tape-row-side.sell { color: var(--tin-bad);  background: rgba(239,68,68,0.10); }
.tin-tape-row-usd { text-align: right; color: var(--text); font-weight: 600; }
.tin-tape-row-wallet { color: var(--cyan); text-decoration: none; }
.tin-tape-row-wallet:hover { text-decoration: underline; }
.tin-tape-row-tag {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  text-align: right;
  color: var(--text-dim);
}

/* Empty state overlay */
.tin-empty {
  padding: 44px 24px;
  text-align: center;
}
.tin[data-state="loaded"] .tin-empty,
.tin[data-state="loading"] .tin-empty { display: none; }
.tin-empty-icon {
  font-size: 40px;
  color: var(--cyan);
  opacity: 0.6;
  margin-bottom: 10px;
}
.tin-empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.tin-empty-desc {
  font-size: 12px;
  color: var(--text-mid);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.55;
}

/* Loading shimmer on tile values */
.tin[data-state="loading"] .tin-tile-val,
.tin[data-state="loading"] .tin-tile-sub,
.tin[data-state="loading"] .tin-chg-v,
.tin[data-state="loading"] .tin-row-v { opacity: 0.4; }

/* MOTIONS GLASSMORPHISM — reverted the aggressive site-wide sweep that
   flattened hierarchy. Keeping only the ambient page-background aurora and
   the header/sidebar heavier glass; individual containers keep their own
   styling. Buttons are in motions.css. */
body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(109,224,201,0.06), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(109,224,201,0.04), transparent 55%),
    var(--bg-0, #0b0e12);
}

/* ============================================================================
   MOTIONS BUTTONS — three tiers.
   .motions-btn         static liquid glass, transparent      (default)
   .motions-btn--dark   static liquid glass, dark solid       (paired with above)
   .motions-btn-hero    animated liquid metal (shader)        (Connect/Enter/etc)
   ============================================================================ */

/* Static liquid glass — the site-wide default. */
.motions-btn,
.motions-btn--dark {
  --_btn-h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--_btn-h);
  padding: 0 22px;
  border-radius: calc(var(--_btn-h) / 2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text, #e9ecf1);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 220ms ease,
              border-color 220ms ease,
              background 220ms ease;
}

/* Static glass CLEAR variant — deprecated here, real rules live in motions.css */

/* Static glass — DARK variant (paired next to CLEAR) */
.motions-btn--dark {
  background:
    linear-gradient(180deg, rgba(30,32,38,0.95), rgba(10,12,16,0.95));
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text, #e9ecf1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.50),
    0 8px 24px -12px rgba(0,0,0,0.6);
}
.motions-btn--dark:hover {
  border-color: rgba(109,224,201,0.45);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.50),
    0 12px 28px -10px rgba(109,224,201,0.22),
    0 0 0 1px rgba(109,224,201,0.25);
}
.motions-btn--dark:active { transform: translateY(0); }

/* Sizes */
.motions-btn--sm { --_btn-h: 36px; font-size: 11.5px; padding: 0 16px; }
.motions-btn--lg { --_btn-h: 52px; font-size: 13.5px; padding: 0 28px; }
.motions-btn--xl { --_btn-h: 62px; font-size: 14px;   padding: 0 34px; }

/* Full-width helper */
.motions-btn--block { display: flex; width: 100%; }

/* Icon slot */
.motions-btn > svg,
.motions-btn--dark > svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.9;
}

/* ---------- Animated hero button (liquid metal shader) ----------
   Applied only to Connect Wallet, Enter Dashboard, Get Started, Sign & Start.
   Structure: <button class="motions-btn-hero"><span>Label</span></button>
   JS module motions-btn.js mounts the WebGL shader canvas + ripples. */
.motions-btn-hero {
  --_h: 52px;
  --_w: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--_h);
  min-width: 168px;
  padding: 0 30px;
  border: none;
  background: transparent;
  border-radius: calc(var(--_h) / 2);
  cursor: pointer;
  outline: none;
  font-family: inherit;
  color: #d8dae0;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.4),
    0 20px 40px -18px rgba(0,0,0,0.6),
    0 8px 20px -8px rgba(0,0,0,0.4);
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease;
}
.motions-btn-hero:hover  { transform: translateY(-1px); }
.motions-btn-hero:active { transform: translateY(1px) scale(0.98); }
.motions-btn-hero > span,
.motions-btn-hero > .mbh-label {
  position: relative;
  z-index: 3;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  pointer-events: none;
}
/* Base dark surface (visible before shader mounts + as fallback) */
.motions-btn-hero::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: linear-gradient(180deg, #202024 0%, #0a0a0c 100%);
  z-index: 1;
}
/* Shader canvas mount point (populated by motions-btn.js) */
.motions-btn-hero > canvas,
.motions-btn-hero > .mbh-shader {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  z-index: 2;
  pointer-events: none;
}
/* Ripple element added by JS on click */
.motions-btn-hero .mbh-ripple {
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.40) 0%, rgba(255,255,255,0) 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
  animation: mbh-ripple 600ms ease-out;
}
@keyframes mbh-ripple {
  0%   { transform: translate(-50%, -50%) scale(0);   opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(4);   opacity: 0; }
}
/* Size modifiers */
.motions-btn-hero.motions-btn-hero--sm { --_h: 44px; font-size: 12px;   padding: 0 22px; min-width: 138px; }
.motions-btn-hero.motions-btn-hero--lg { --_h: 60px; font-size: 14.5px; padding: 0 36px; min-width: 200px; }

/* ============================================================================
   MOTIONS TRADING TERMINAL — full-screen trading UI in Manual Trading view.
   Layout: topbar · header · main [chart | rail] · tape.
   Only rendered in body.view-manual (existing rule already toggles visibility).
   ============================================================================ */

:root {
  --tt-buy:  #4ade80;
  --tt-sell: #ef4444;
  --tt-mint: #6de0c9;
  --tt-bg:   #0a0a0b;
  --tt-bg-1: #0f1013;
  --tt-bg-2: #16181d;
  --tt-line: rgba(255,255,255,0.06);
  --tt-line-2: rgba(255,255,255,0.10);
  --tt-text: #eef1f5;
  --tt-mid:  rgba(255,255,255,0.65);
  --tt-dim:  rgba(255,255,255,0.42);
}

/* Base wrapper — full width, dark, sits above the old chain-panel content */
.term {
  margin: 8px 10px 12px;
  background: var(--tt-bg);
  border: 1px solid var(--tt-line);
  border-radius: 14px;
  font-family: inherit;
  color: var(--tt-text);
  display: flex;
  flex-direction: column;
  /* Natural size. Inner .term-rail and .tt-tape-list handle their own scroll. */
}

/* ── ROW 1: topbar ── */
.term-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--tt-line);
  background: var(--tt-bg-1);
}
.term-ca-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 260px;
}
.term-ca-input {
  width: 100%;
  padding: 11px 40px 11px 14px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  border-radius: 10px;
  color: var(--tt-text);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: border-color 140ms;
}
.term-ca-input::placeholder { color: var(--tt-dim); font-family: inherit; letter-spacing: 0; }
.term-ca-input:focus { outline: none; border-color: var(--tt-mint); background: var(--tt-bg-1); }
.term-ca-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--tt-dim); font-size: 16px; cursor: pointer;
  display: none;
}
.term[data-state="loaded"] .term-ca-clear,
.term[data-state="loading"] .term-ca-clear { display: inline-flex; align-items: center; justify-content: center; }
.term-ca-clear:hover { background: var(--tt-bg-2); color: var(--tt-text); }

.term-chains {
  display: flex; gap: 4px; align-items: center; flex-shrink: 0;
}
.term-chains .tin-chain {
  padding: 6px 10px;
  background: transparent;
  color: var(--tt-mid);
  border: 1px solid var(--tt-line-2);
  border-radius: 8px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.10em;
  cursor: pointer;
  transition: all 140ms;
}
.term-chains .tin-chain:hover { color: var(--tt-text); border-color: var(--tt-mid); }
.term-chains .tin-chain.active {
  color: var(--tt-mint);
  border-color: var(--tt-mint);
  background: rgba(109,224,201,0.08);
}
.term-chains .tin-chain-hint {
  margin-left: 6px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tt-dim);
}

/* ── Empty state (shown until CA loaded) ── */
.term-empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--tt-mid);
}
.term-empty-icon { font-size: 44px; color: var(--tt-mint); opacity: 0.6; margin-bottom: 12px; }
.term-empty-title { font-size: 17px; font-weight: 700; color: var(--tt-text); margin-bottom: 8px; }
.term-empty-desc {
  font-size: 13px; max-width: 520px; margin: 0 auto; line-height: 1.55;
  color: var(--tt-mid);
}
.term-empty-desc b { color: var(--tt-mint); font-weight: 600; }
.term[data-state="loaded"] .term-empty,
.term[data-state="loading"] .term-empty { display: none; }

/* ── ROW 2: token header strip ── */
.term-header {
  display: none;                              /* revealed on loaded */
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--tt-line);
  background: var(--tt-bg-1);
}
.term[data-state="loaded"] .term-header { display: flex; }

.term-header-left { display: flex; gap: 12px; align-items: center; min-width: 240px; }
.term-logo-wrap {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.term-logo { width: 100%; height: 100%; object-fit: cover; display: none; }
.term-logo.loaded { display: block; }
.term-logo-fallback { font-family: ui-monospace, Menlo, monospace; font-size: 18px; color: var(--tt-dim); }
.term-logo.loaded + .term-logo-fallback { display: none; }

.term-title { min-width: 0; }
.term-title-row { display: flex; align-items: center; gap: 8px; }
.term-symbol { font-size: 17px; font-weight: 700; color: var(--tt-text); letter-spacing: -0.01em; }
.term-badge {
  padding: 3px 8px;
  border: 1px solid var(--tt-mint);
  color: var(--tt-mint);
  background: rgba(109,224,201,0.08);
  border-radius: 5px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.term-pool {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--tt-mid);
}
.term-title-sub {
  margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--tt-dim);
}
.term-ca-link {
  color: var(--tt-dim);
  text-decoration: none;
  border-bottom: 1px dashed var(--tt-line-2);
}
.term-ca-link:hover { color: var(--tt-mint); border-color: var(--tt-mint); }
.term-copy {
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  color: var(--tt-dim); cursor: pointer; padding: 1px 5px; font-size: 12px;
}
.term-copy:hover { color: var(--tt-mint); border-color: var(--tt-line-2); }

.term-header-stats {
  display: flex; gap: 20px; margin-left: auto; align-items: center;
}
.th-stat { display: flex; flex-direction: column; gap: 2px; }
.th-lbl { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tt-dim); font-weight: 600; }
.th-val {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px; font-weight: 700; color: var(--tt-text); line-height: 1;
}
@media (max-width: 1100px) {
  .th-stat:nth-child(n+4) { display: none; }
}

/* ── ROW 3: main split (chart+txns LEFT + rail RIGHT) ── */
.term-main {
  display: none;                              /* revealed on loaded */
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;    /* rail takes its own natural height */
  gap: 0;
}
.term[data-state="loaded"] .term-main { display: grid; }
@media (max-width: 1000px) {
  .term-main { grid-template-columns: 1fr; }
}

/* Left column stacks chart (~60%) on top of the live txns table (~40%).
   Fixed row heights so both panes stay usable without one starving the other. */
.term-left {
  display: grid;
  /* Fixed heights: chart 680 + txns 300 = 980 total. Chart gets a bit more
     room than before (+10%) and the txns table +35% so ~14 rows visible
     without scroll. Stable regardless of right-rail content. */
  grid-template-rows: 680px 300px;
  height: 980px;
  min-height: 0;
  border-right: 1px solid var(--tt-line);
  overflow: hidden;
}
@media (max-width: 1000px) {
  .term-left { height: auto; grid-template-rows: 500px 260px; }
}

/* Chart pane */
.term-chart {
  position: relative;
  background: #000;
  min-height: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--tt-line);
}
.term-chart-frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  display: block;
}
/* Chart iframe — original DexScreener colours preserved (no tint) */
/* Solid black strip matching the DexScreener bottom bar exactly. */
.term-chart-mask--top {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 44px;
  background: #0a0a0b;
  pointer-events: none;
  z-index: 2;
}
/* Bottom-left corner mask — spare, in case the embed shows a corner logo */
.term-chart-mask--bl {
  position: absolute;
  left: 0; bottom: 0;
  width: 200px; height: 34px;
  background: linear-gradient(90deg, #0a0a0b 60%, transparent);
  pointer-events: none;
  z-index: 2;
}
/* Motions logo centered inside the black strip */
.term-chart-brand--top {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  height: 44px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
.term-chart-brand-lbl {
  font-family: inherit;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-style: italic;
  letter-spacing: 0.02em;
}
.term-chart-brand-logo { height: 28px; width: auto; display: block; filter: drop-shadow(0 0 6px rgba(0,0,0,0.7)); }

/* ═══════ LIVE TXNS TABLE (under the chart in the left column) ═══════ */
.term-txns {
  background: var(--tt-bg-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.tx-hd {
  padding: 10px 16px;
  border-bottom: 1px solid var(--tt-line);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tt-mid);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.tx-hd-title { color: var(--tt-text); }
.tx-hd-sub {
  color: var(--tt-dim);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: none;
  margin-left: auto;
}
.tx-tbl-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.tx-tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  table-layout: fixed;
}
.tx-tbl thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 6px 10px;
  background: var(--tt-bg-1);
  border-bottom: 1px solid var(--tt-line);
  text-align: left;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tt-dim);
  white-space: nowrap;
}
.tx-tbl tbody td {
  padding: 5px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--tt-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.tx-tbl tbody tr:hover td { background: rgba(109,224,201,0.04); }
.tx-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Column widths (chart-wide-friendly). Adjust in mobile media block below. */
.tx-c-date { width: 68px;  color: var(--tt-dim); }
.tx-c-type { width: 56px; }
.tx-c-tok  { width: 84px; }
.tx-c-qte  { width: 110px; }
.tx-c-usd  { width: 90px; }
.tx-c-prc  { width: 96px; }
.tx-c-mak  { width: 96px; }
.tx-c-lnk  { width: 32px; text-align: center; }

/* Type pill — buy = mint, sell = red. */
.tx-pill {
  display: inline-block;
  min-width: 40px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  text-align: center;
  font-family: inherit;
}
.tx-pill--buy  { color: var(--tt-buy);  background: rgba(74,222,128,0.10); border: 1px solid rgba(74,222,128,0.25); }
.tx-pill--sell { color: var(--tt-sell); background: rgba(239,68,68,0.10);  border: 1px solid rgba(239,68,68,0.25); }

/* USD + PRICE tint match side */
.tx-tbl tbody tr[data-side="buy"]  .tx-c-usd { color: var(--tt-buy); }
.tx-tbl tbody tr[data-side="sell"] .tx-c-usd { color: var(--tt-sell); }
.tx-tbl tbody tr .tx-c-prc { color: var(--tt-mid); }

/* Maker link */
.tx-maker-lnk {
  color: var(--tt-mid);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  font-family: ui-monospace, Menlo, monospace;
}
.tx-maker-lnk:hover { color: var(--tt-mint); border-bottom-color: var(--tt-mint); }

/* Own-wallet row highlight (server sets isOurs on active batch trades) */
.tx-tbl tbody tr[data-ours="1"] td { background: rgba(109,224,201,0.06); }
.tx-tbl tbody tr[data-ours="1"] td:first-child { border-left: 2px solid var(--tt-mint); padding-left: 8px; }

/* External link icon */
.tx-lnk {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px;
  color: var(--tt-dim);
  text-decoration: none;
  transition: color 140ms, background 140ms;
}
.tx-lnk:hover { color: var(--tt-mint); background: rgba(109,224,201,0.08); }
.tx-lnk svg { width: 12px; height: 12px; }

/* Flash animation on new rows (green for buys, red for sells) */
@keyframes tx-flash-buy  { 0% { background: rgba(74,222,128,0.30); } 100% { background: transparent; } }
@keyframes tx-flash-sell { 0% { background: rgba(239,68,68,0.30); }  100% { background: transparent; } }
.tx-tbl tbody tr.tx-new[data-side="buy"]  td { animation: tx-flash-buy 1400ms ease-out 1; }
.tx-tbl tbody tr.tx-new[data-side="sell"] td { animation: tx-flash-sell 1400ms ease-out 1; }
@media (prefers-reduced-motion: reduce) {
  .tx-tbl tbody tr.tx-new td { animation: none !important; }
}

/* Empty + loading skeleton */
.tx-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--tt-dim);
  font-size: 12px;
}
.tx-skel { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.tx-skel-row {
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: tx-skel-shimmer 1400ms ease-in-out infinite;
}
@keyframes tx-skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Hide the txns pane while terminal is empty/loading — matches .term-tape behaviour */
.term[data-state="empty"] .term-txns,
.term[data-state="empty"] .term-left { }
.term[data-state="empty"] .term-txns { display: none !important; }
.term[data-state="loading"] .term-txns { opacity: 0.5; pointer-events: none; }

/* Mobile <720px: drop low-priority columns. Keep DATE, TYPE, USD, PRICE, link. */
@media (max-width: 720px) {
  .tx-tbl .tx-c-tok,
  .tx-tbl .tx-c-qte,
  .tx-tbl .tx-c-mak { display: none !important; }
  .tx-c-usd { width: auto; }
  .tx-c-prc { width: auto; }
  .tx-tbl thead th,
  .tx-tbl tbody td { padding: 5px 8px; }
}

/* ── Right rail (trade + subs) ── */
.term-rail {
  background: var(--tt-bg-1);
  display: flex; flex-direction: column;
  /* Grows to fit its content; page scroll handles overflow. Internal scroll
     inside the rail creates a scroll-within-scroll UX that people hate. */
  min-height: 0;
}

/* ═══════ TRADING PANEL ═══════ */
.term-trade {
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  border-bottom: 1px solid var(--tt-line);
}

/* Buy / Sell tabs */
.tt-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  border-radius: 12px;
}
.tt-side {
  padding: 10px;
  background: transparent;
  color: var(--tt-mid);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms;
}
.tt-side:hover { color: var(--tt-text); }
.tt-side--buy.active {
  background: rgba(74,222,128,0.14);
  color: var(--tt-buy);
  border-color: rgba(74,222,128,0.30);
}
.tt-side--sell.active {
  background: rgba(239,68,68,0.14);
  color: var(--tt-sell);
  border-color: rgba(239,68,68,0.30);
}

/* Market / Limit toggle */
.tt-modes {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: transparent;
  border-bottom: 1px solid var(--tt-line);
  padding-bottom: 8px;
  margin-bottom: 2px;
}
.tt-mode {
  padding: 6px 12px;
  background: transparent;
  color: var(--tt-dim);
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms;
}
.tt-mode:hover { color: var(--tt-mid); }
.tt-mode.active {
  color: var(--tt-text);
  background: var(--tt-bg-2);
  border-color: var(--tt-line-2);
}

/* Labels */
.tt-lbl {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tt-dim);
  font-weight: 600;
  display: block;
  margin-top: 4px;
}
.tt-lbl-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* Amount input */
.tt-amount-row {
  display: flex; gap: 0; align-items: stretch;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 140ms;
}
.tt-amount-row:focus-within { border-color: var(--tt-mint); }
.tt-amount {
  flex: 1 1 auto;
  padding: 12px 14px;
  background: transparent;
  border: 0; outline: none;
  color: var(--tt-text);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 18px;
  font-weight: 600;
  min-width: 0;
}
.tt-amount::placeholder { color: var(--tt-dim); }
.tt-unit, .tt-trigger-unit {
  padding: 0 14px;
  background: transparent;
  border: 0; border-left: 1px solid var(--tt-line-2);
  color: var(--tt-mid);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex; align-items: center;
}
.tt-unit:hover { color: var(--tt-mint); }
.tt-trigger-unit { cursor: default; }

.tt-trigger {
  flex: 1 1 auto;
  padding: 12px 14px;
  background: transparent;
  border: 0; outline: none;
  color: var(--tt-text);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 16px;
  font-weight: 600;
  min-width: 0;
}

/* Quick chips */
.tt-quick {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.tt-quick button {
  padding: 6px 10px;
  background: var(--tt-bg-2);
  color: var(--tt-mid);
  border: 1px solid var(--tt-line-2);
  border-radius: 6px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms;
  flex: 1 0 auto;
}
.tt-quick button:hover { color: var(--tt-text); border-color: var(--tt-mid); }
.tt-quick button.active {
  color: var(--tt-mint);
  border-color: var(--tt-mint);
  background: rgba(109,224,201,0.10);
}
.tt-quick .tt-gear {
  flex: 0 0 auto;
  padding: 6px 8px;
  color: var(--tt-dim);
  font-size: 13px;
}
.tt-quick .tt-max { color: var(--tt-mint); }
.tt-pcts button { padding: 6px 4px; font-size: 10.5px; letter-spacing: 0.06em; }

/* Preview */
.tt-preview {
  padding: 8px 12px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.tt-preview-row { display: flex; justify-content: space-between; font-size: 11.5px; }
.tt-preview-lbl { color: var(--tt-dim); }
.tt-preview-val {
  color: var(--tt-text); font-weight: 600;
  font-family: ui-monospace, Menlo, monospace;
}
.tt-preview-val--sub { color: var(--tt-mid); font-weight: 500; font-size: 11px; }

/* Limit block (hidden until data-mode=limit) */
.tt-limit { display: none; flex-direction: column; gap: 8px; }
.term-trade[data-mode="limit"] .tt-limit { display: flex; }
.term-trade[data-mode="limit"] .tt-market-extras { display: none; }

.tt-limit-summary {
  padding: 10px 12px;
  background: rgba(109,224,201,0.06);
  border: 1px dashed rgba(109,224,201,0.32);
  border-radius: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.tt-limit-delta {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: var(--tt-mint);
  font-weight: 700;
}
.tt-limit-desc {
  font-size: 11.5px;
  color: var(--tt-mid);
}

.tt-expiry {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.tt-expiry button {
  padding: 8px 4px;
  background: var(--tt-bg-2);
  color: var(--tt-mid);
  border: 1px solid var(--tt-line-2);
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 140ms;
}
.tt-expiry button:hover { color: var(--tt-text); border-color: var(--tt-mid); }
.tt-expiry button.active { color: var(--tt-mint); border-color: var(--tt-mint); background: rgba(109,224,201,0.10); }

/* Slippage + MEV row */
.tt-slippage { display: flex; flex-direction: column; gap: 6px; }
.tt-slip button { flex: 1 1 auto; padding: 5px 6px; font-size: 11px; }
.tt-mev {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px;
  font-size: 12px; color: var(--tt-mid);
}
.tt-toggle {
  position: relative;
  width: 34px; height: 20px;
  display: inline-block;
  cursor: pointer;
}
.tt-toggle input { display: none; }
.tt-toggle span {
  position: absolute; inset: 0;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  border-radius: 999px;
  transition: all 140ms;
}
.tt-toggle span::after {
  content: "";
  position: absolute;
  left: 2px; top: 2px;
  width: 14px; height: 14px;
  background: var(--tt-dim);
  border-radius: 50%;
  transition: all 140ms;
}
.tt-toggle input:checked + span { background: rgba(109,224,201,0.20); border-color: var(--tt-mint); }
.tt-toggle input:checked + span::after { transform: translateX(14px); background: var(--tt-mint); }

/* Fee breakdown */
.tt-fees {
  padding: 8px 12px;
  background: transparent;
  border-top: 1px solid var(--tt-line);
  border-bottom: 1px solid var(--tt-line);
  display: flex; flex-direction: column; gap: 4px;
}
.tt-fee-row {
  display: flex; justify-content: space-between;
  font-size: 11.5px;
  color: var(--tt-dim);
}
.tt-fee-val {
  color: var(--tt-text);
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 600;
}
.tt-fee-zero { color: var(--tt-mint); }
.tt-zero { color: var(--tt-mint); font-weight: 800; letter-spacing: 0.10em; }

/* ═══════ WALLET PICKER ═══════ */
.tt-wallet { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.tt-wallet-lbl {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--tt-dim); font-weight: 600;
}
.tt-wallet-row { display: flex; gap: 6px; }
.tt-wallet-picker {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  border-radius: 10px;
  color: var(--tt-text);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 140ms;
}
.tt-wallet-picker:hover { border-color: var(--tt-mint); }
.tt-wallet-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tt-dim);
  flex-shrink: 0;
}
.tt-wallet-dot[data-status="on"] { background: var(--tt-mint); box-shadow: 0 0 8px var(--tt-mint); }
.tt-wallet-label { flex: 1 1 auto; text-align: left; }
.tt-wallet-bal { color: var(--tt-dim); font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.tt-wallet-arrow { color: var(--tt-dim); }
.tt-wallet-manage {
  padding: 10px 12px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  border-radius: 10px;
  color: var(--tt-dim);
  text-decoration: none;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all 140ms;
}
.tt-wallet-manage:hover { color: var(--tt-mint); border-color: var(--tt-mint); }

.tt-wallet-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  border-radius: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
/* `display: flex` above overrode the `hidden` attribute so an empty wallet
   list rendered as a stray bordered pill between the wallet picker and the
   Buy/Sell switcher. Restore hidden semantics. */
.tt-wallet-list[hidden] { display: none !important; }
.tt-wallet-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--tt-text);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.tt-wallet-item:hover { background: var(--tt-bg-1); border-color: var(--tt-line-2); }
.tt-wallet-item.active { color: var(--tt-mint); border-color: var(--tt-mint); }
.tt-wallet-item-bal { margin-left: auto; color: var(--tt-mid); font-size: 11px; }

/* ═══════ FIRE BUTTONS (Solo + All) ═══════ */
.tt-fire-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}
.tt-fire { width: 100%; }
.term-trade[data-side="buy"]  .tt-fire { color: var(--tt-buy); }
.term-trade[data-side="sell"] .tt-fire { color: var(--tt-sell); }
.tt-fire--all {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.tt-fire-all-count {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  padding: 2px 7px;
  background: rgba(255,255,255,0.10);
  border-radius: 4px;
  color: var(--tt-text);
  letter-spacing: 0;
}
.term-trade[data-side="buy"]  .tt-fire-all-count { background: rgba(74,222,128,0.18); color: var(--tt-buy); }
.term-trade[data-side="sell"] .tt-fire-all-count { background: rgba(239,68,68,0.18);  color: var(--tt-sell); }

/* Sell All label */
.term-trade[data-side="sell"] #tt-fire-label { content: none; }

/* Multi-wallet preview panel */
.tt-multi-preview {
  padding: 8px 12px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.tt-multi-row {
  display: flex; justify-content: space-between;
  font-size: 11.5px;
  color: var(--tt-dim);
  font-family: ui-monospace, Menlo, monospace;
}
.tt-multi-row span:last-child { color: var(--tt-text); font-weight: 600; }
.tt-multi-row--total {
  padding-top: 4px; margin-top: 2px;
  border-top: 1px dashed var(--tt-line);
  font-size: 12.5px;
}
.tt-multi-row--total span:last-child { color: var(--tt-mint); font-weight: 700; }

.tt-signer {
  text-align: center;
  font-size: 10.5px;
  color: var(--tt-dim);
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.term-trade[data-mode="limit"] #tt-fire-label::before { content: "Place limit "; }
.term-trade[data-mode="limit"] #tt-fire-all-label::before { content: "Place limit "; }

/* ═══════ SUB PANELS ═══════ */
.term-subs { display: flex; flex-direction: column; }
.term-sub {
  border-bottom: 1px solid var(--tt-line);
}
.term-sub > summary {
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tt-mid);
  font-weight: 600;
  user-select: none;
}
.term-sub > summary::-webkit-details-marker { display: none; }
.term-sub > summary:hover { color: var(--tt-text); background: rgba(255,255,255,0.02); }
.sub-hint { color: var(--tt-dim); font-weight: 400; text-transform: none; letter-spacing: 0.01em; font-size: 11px; }
.sub-arrow { margin-left: auto; color: var(--tt-dim); transition: transform 140ms; }
.term-sub[open] > summary .sub-arrow { transform: rotate(180deg); }
.sub-count {
  padding: 1px 6px;
  background: var(--tt-bg-2);
  border: 1px solid var(--tt-line-2);
  border-radius: 4px;
  color: var(--tt-mint);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0;
}
.sub-body { padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 8px; }

/* Reuse tin-* classes inside sub bodies */
.term .tin-changes { grid-template-columns: repeat(4, 1fr); background: transparent; border: 0; padding: 0; }
.term .tin-chg { background: var(--tt-bg-2); padding: 6px 8px; border-radius: 6px; }
.term .tin-chg-lbl { font-size: 9.5px; }
.term .tin-chg-v { font-size: 11.5px; }
.term .tin-row { font-size: 12px; padding: 3px 0; }
.term .tin-row-lbl { color: var(--tt-mid); }
.term .tin-row-v { font-size: 12px; color: var(--tt-text); }
.term .tin-safety { padding: 0; background: transparent; border: 0; flex-direction: column; gap: 6px; }
.term .tin-safety-item {
  background: var(--tt-bg-2); border-color: var(--tt-line-2);
  padding: 6px 10px; border-radius: 6px; font-size: 12px;
}

.tt-orders, .tt-positions {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.tt-orders-empty, .tt-positions-empty {
  padding: 12px 0;
  font-size: 12px;
  color: var(--tt-dim);
  text-align: center;
}

/* ═══════ LIVE TAPE ═══════ */
.term-tape {
  background: var(--tt-bg-1);
  border-top: 1px solid var(--tt-line);
  max-height: 220px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.tt-tape-hd {
  padding: 10px 16px;
  border-bottom: 1px solid var(--tt-line);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tt-mid);
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.tt-tape-sub { color: var(--tt-dim); font-size: 10px; letter-spacing: 0.08em; text-transform: none; margin-left: auto; }
.tt-tape-list {
  flex: 1 1 auto;
  overflow-y: auto;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px;
}
.tt-tape-empty { padding: 20px; color: var(--tt-dim); text-align: center; font-family: inherit; }

/* Hide state — loading/empty variants */
.term[data-state="empty"] .term-main,
.term[data-state="empty"] .term-header,
.term[data-state="empty"] .term-tape { display: none !important; }
.term[data-state="loading"] .term-main { opacity: 0.5; pointer-events: none; }

/* ---------- Motions toast (rebranded from clyx-toast) ---------- */
.motions-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 100000;
  padding: 12px 18px;
  background: #0a0a0b;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: #e9ecf1;
  font-family: inherit;
  font-size: 13px;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.9);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.motions-toast.show { opacity: 1; transform: translateY(0); }
.motions-toast.success { border-color: rgba(109,224,201,0.4); box-shadow: 0 20px 50px -20px rgba(0,0,0,0.9), 0 0 0 1px rgba(109,224,201,0.20); }
.motions-toast.error   { border-color: rgba(239,68,68,0.4);  color: #ffd6d6; }

/* When WalletConnect modal is active, hide the mobile bottom nav so it
   doesn't cover the wallet list. wc-signin.js toggles body.wc-active. */
body.wc-active .mnav,
body.wc-active .mnav-sheet,
body.wc-active .ds-bottom-nav {
  display: none !important;
}

/* NOTE: previously hid all Reown/WC attribution + feedback widgets here.
   Un-suppressed so we can identify + restyle the specific blue popup the
   user wants themed. Add targeted rules once we know the exact selector. */

/* ── Motions-branded centered loader — chrome heads pulse ──
   Reusable across pages (WC signin, profile hydrate, anywhere async).
   `.motions-loader` is the shared class; `#wc-loader` is the specific
   overlay for WalletConnect. `.p-loading` also uses the graphic. */
.motions-loader-graphic {
  display: block;
  width: 96px; height: 96px;
  margin: 0 auto 18px;
  background: url('/public/loading.png') center/contain no-repeat;
  animation: motions-loader-pulse 1400ms ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(109,224,201,0.28));
}
@keyframes motions-loader-pulse {
  0%, 100% { opacity: 0.72; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.04); }
}
.motions-loader-msg {
  color: #e9ecf1;
  font-size: 14px; font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
}

/* Full-screen overlay for the WalletConnect signin flow. */
#wc-loader {
  position: fixed; inset: 0;
  z-index: 100050;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 180ms ease;
}
#wc-loader.show { opacity: 1; pointer-events: auto; }
.wc-loader-card {
  background: #0a0a0b;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 36px 44px;
  min-width: 280px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(109,224,201,0.10);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

/* ============================================================================
   MOBILE — GMGN-style floating liquid glass bottom tab bar (≤ 900px)
   ============================================================================ */
.mnav { display: none; }
.mnav-sheet { display: none; }

@media (max-width: 900px) {
  /* Safe-area padding so nothing slips under the iOS notch */
  html, body { padding-top: env(safe-area-inset-top, 0) !important; }
  body {
    grid-template-columns: 1fr !important;
    grid-template-rows: 64px 1fr !important;
  }
  nav.side { display: none !important; }
  header {
    height: 64px !important;
    padding: 0 12px !important;
    position: sticky;
    top: env(safe-area-inset-top, 0);
    z-index: 500;
  }
  header .brand-logo { height: 40px !important; }
  main { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0)) !important; }

  /* Floating bottom nav */
  .mnav {
    position: fixed;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom, 14px));
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 6px;
    background:
      linear-gradient(180deg, rgba(20,22,28,0.85), rgba(10,12,16,0.90));
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 999px;
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.08),
      0 24px 48px -12px rgba(0,0,0,0.75),
      0 8px 20px -8px rgba(0,0,0,0.5);
    max-width: calc(100vw - 20px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .mnav::-webkit-scrollbar { display: none; }
  .mnav-tab {
    flex: 0 0 auto;
    min-width: 62px;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: rgba(255,255,255,0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .mnav-tab svg { width: 22px; height: 22px; }
  .mnav-tab.active {
    color: #6de0c9;
    background: rgba(109,224,201,0.14);
    text-shadow: 0 0 8px rgba(109,224,201,0.4);
  }
  .mnav-tab:not(.active):active { color: #f7f8fa; transform: scale(0.94); }

  /* More sheet */
  .mnav-sheet {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(6,7,9,0.60);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }
  .mnav-sheet.show { opacity: 1; pointer-events: auto; }
  .mnav-sheet[hidden] { display: none !important; }
  .mnav-sheet-inner {
    position: absolute;
    left: 50%;
    bottom: 90px;
    transform: translate(-50%, 20px);
    width: min(360px, calc(100vw - 24px));
    background:
      radial-gradient(ellipse 55% 90% at 50% 0%, rgba(255,255,255,0.05), transparent 60%),
      #0a0a0b;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 40px 80px -20px rgba(0,0,0,0.9);
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .mnav-sheet.show .mnav-sheet-inner { transform: translate(-50%, 0); }
  .mnav-sheet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .mnav-sheet-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    color: #e9ecf1;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
    transition: all 160ms;
  }
  .mnav-sheet-item svg { width: 18px; height: 18px; color: #6de0c9; flex-shrink: 0; }
  .mnav-sheet-item:hover { background: rgba(109,224,201,0.08); border-color: rgba(109,224,201,0.30); }

  /* ── Dashboard sections mobile ── */
  section.section { padding: 12px !important; }
  .section-head h1 { font-size: 22px !important; }
  .metrics { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .metric { padding: 12px !important; }
  .metric-value { font-size: 20px !important; }

  /* Terminal: chart on top, txns table below, rail below that (stack). Let
     the WHOLE page scroll — kill internal scroll containers so nothing gets
     stuck under the nav. */
  .term-main { grid-template-columns: 1fr !important; }
  .term-left {
    display: block !important;
    grid-template-rows: none !important;
    border-right: none !important;
    overflow: visible !important;
  }
  .term-chart { min-height: 320px !important; border-right: none !important; border-bottom: 1px solid var(--tt-line); }
  .term-rail { overflow-y: visible !important; overflow: visible !important; height: auto !important; }
  .tt-tape-list { overflow-y: visible !important; max-height: none !important; }
  .term-tape { max-height: none !important; }
  .term { height: auto !important; min-height: auto !important; overflow: visible !important; }
  .term-txns { overflow: visible !important; }
  .tx-tbl-wrap { max-height: 380px; overflow-y: auto !important; }
  #trading-intel {
    display: block !important;
    margin-bottom: 0 !important;
    padding-bottom: calc(180px + env(safe-area-inset-bottom, 0)) !important;
  }
  /* Ensure main + body both scroll and reach the true bottom */
  main { overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
  html, body { overflow-x: hidden; }
  main { padding-bottom: calc(140px + env(safe-area-inset-bottom, 0)) !important; }

  /* Ensure EVERY section (History, Logs, Settings, Docs, Funding, etc.)
     has enough bottom clearance for the floating nav pill — not just the
     Trading Terminal. */
  section.section { padding-bottom: calc(140px + env(safe-area-inset-bottom, 0)) !important; }
  /* Kill any nested overflow containers that block full-page scroll on mobile */
  section.section > .strat-grid,
  section.section > .chain-panel,
  section.section .live-tape-panel,
  section.section .strat-card,
  section.section .log-list,
  section.section .settings-card,
  section.section .funding-scroll { overflow: visible !important; max-height: none !important; height: auto !important; }
  .term-header { flex-wrap: wrap; gap: 10px !important; padding: 10px 12px !important; }
  .term-header-stats { gap: 12px !important; margin-left: 0 !important; }
  .th-stat:nth-child(n+4) { display: none; }
  .term-topbar { flex-wrap: wrap; padding: 10px !important; }
  .term-chains { flex-wrap: wrap; }
  .tt-fire-row { grid-template-columns: 1fr; gap: 8px; }
  .tt-quick { justify-content: space-between; }

  /* Wallet picker modal — full-width on mobile */
  .wallet-picker-card { max-width: calc(100vw - 20px) !important; padding: 22px 20px !important; }

  /* Hide kill-btn / other header extras on mobile */
  #kill-btn { display: none !important; }
}

/* ═══════════ Trade confirmation modal ═══════════
   Fires after a Terminal buy/sell — shows tx hash, pool + fee, MEV
   status, and per-stage timing. Stays until dismissed so the user can
   copy the hash + click through to the explorer.
*/
.tt-confirm-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  padding: 20px;
}
.tt-confirm-card {
  width: 100%; max-width: 420px;
  background: var(--tt-bg);
  border: 1px solid var(--tt-line-2);
  border-radius: 14px;
  padding: 18px 18px 16px;
  color: var(--tt-text);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  font: 13px/1.4 var(--font-sans, system-ui);
}
.tt-confirm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tt-line);
  margin-bottom: 12px;
}
.tt-confirm-head .ttc-title {
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
}
.tt-confirm-head .ttc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tt-buy);
  box-shadow: 0 0 8px var(--tt-buy);
}
.tt-confirm-card.is-sell .ttc-dot { background: var(--tt-sell); box-shadow: 0 0 8px var(--tt-sell); }
.tt-confirm-card.is-fail .ttc-dot { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.tt-confirm-head .ttc-close {
  background: none; border: 0; color: var(--tt-dim);
  cursor: pointer; font-size: 18px; line-height: 1;
  padding: 2px 6px; border-radius: 6px;
}
.tt-confirm-head .ttc-close:hover { color: var(--tt-text); background: var(--tt-bg-2); }
.tt-confirm-body { display: flex; flex-direction: column; gap: 6px; }
.ttc-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 0;
  min-height: 24px;
}
.ttc-row .ttc-k { color: var(--tt-dim); font-size: 12px; }
.ttc-row .ttc-v {
  color: var(--tt-text); font-weight: 500; font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  max-width: 65%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ttc-v.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; }
.ttc-v .ttc-copy {
  margin-left: 6px; padding: 1px 6px; font-size: 10.5px;
  background: var(--tt-bg-2); border: 1px solid var(--tt-line);
  border-radius: 5px; color: var(--tt-mid); cursor: pointer;
}
.ttc-v .ttc-copy:hover { color: var(--tt-text); border-color: var(--tt-line-2); }
.ttc-badge {
  padding: 2px 7px; border-radius: 999px; font-size: 10.5px;
  font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
}
.ttc-badge.on { background: rgba(74,222,128,0.15); color: #4ade80; }
.ttc-badge.off { background: var(--tt-bg-2); color: var(--tt-dim); }
.tt-confirm-cta {
  display: block;
  margin-top: 14px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--brand, #6de0c9), var(--brand-2, #4ade80));
  color: #0a0a0b; font-weight: 600; font-size: 13px;
  border: 0; border-radius: 9px; text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.tt-confirm-cta:hover { filter: brightness(1.08); }
.tt-confirm-cta.secondary {
  background: var(--tt-bg-2); color: var(--tt-text);
  border: 1px solid var(--tt-line-2);
  margin-top: 8px;
}

/* Sub-mobile — even tighter */
@media (max-width: 480px) {
  .mnav-tab { min-width: 54px; padding: 6px 8px; font-size: 9.5px; }
  .mnav-tab svg { width: 20px; height: 20px; }
  .term-header-left { min-width: 0 !important; }
  .term-symbol { font-size: 15px !important; }
  .th-stat:nth-child(n+3) { display: none; }
}

/* ── Non-custodial pledge modal — post-wallet-creation acknowledgement ── */
.motions-pledge-back {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}
.motions-pledge-card {
  width: 100%; max-width: 460px;
  background: #0a0a0b;
  border: 1px solid rgba(109,224,201,0.30);
  border-radius: 16px;
  padding: 30px 32px 24px;
  color: #e9ecf1;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.motions-pledge-graphic {
  width: 84px; height: 84px; margin: 0 auto 18px;
  background: url('/public/loading.png') center/contain no-repeat;
  filter: drop-shadow(0 0 16px rgba(109,224,201,0.25));
  animation: motions-loader-pulse 2400ms ease-in-out infinite;
}
.motions-pledge-card h3 {
  font-size: 20px; font-weight: 600; letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: #6de0c9;
}
.motions-pledge-card p {
  font-size: 13.5px; color: rgba(255,255,255,0.72);
  margin: 0 0 16px; line-height: 1.55;
}
.motions-pledge-card p code {
  display: inline-block; margin-top: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: #fff; background: rgba(255,255,255,0.06);
  padding: 3px 8px; border-radius: 4px;
  word-break: break-all;
}
.motions-pledge-card ul {
  text-align: left; margin: 0 0 22px; padding: 0; list-style: none;
  border-top: 1px solid rgba(255,255,255,0.10);
  padding-top: 16px;
}
.motions-pledge-card ul li {
  font-size: 13px; line-height: 1.55;
  color: rgba(255,255,255,0.72);
  padding: 6px 0 6px 22px;
  position: relative;
}
.motions-pledge-card ul li::before {
  content: "◆"; position: absolute; left: 4px; top: 6px;
  color: #6de0c9; font-size: 10px;
}
.motions-pledge-card ul li b { color: #fff; font-weight: 600; }
.motions-pledge-card button {
  width: 100%; font-size: 14px; padding: 12px;
}
