/* ============================================================
   FOMO MOFO — Black Modern Trading UI (Design Language)
   Backgrounds: pure black with subtle elevation
   Green #00FF41 · Red #FF0040 · Amber #FFB700 · Cyan #7DF9FF
   Easing: cubic-bezier(0.25, 0.46, 0.45, 0.94) (spec), ease-out,
           cubic-bezier(0.645, 0.045, 0.355, 1) (in-out)
   ============================================================ */

:root {
  /* ---- color primitives (semantic) ---- */
  --bg: #000000;
  --bg-elev: #0a0a0a;
  --bg-raise: #141414;
  --card: #0f0f0f;
  --card-border: rgba(255, 255, 255, 0.1);
  --card-border-strong: rgba(255, 255, 255, 0.22);
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --text-faint: #6f6f6f;
  --green: #00ff41;
  --red: #ff0040;
  --amber: #ffb700;
  --cyan: #7df9ff;
  --glow-green: rgba(0, 255, 65, 0.1);
  --glow-red: rgba(255, 0, 64, 0.1);
  --glow-amber: rgba(255, 183, 0, 0.12);

  /* ---- typography scale (fluid on body) ---- */
  --fs-2xs: 0.58rem;
  --fs-xs: 0.64rem;
  --fs-sm: 0.72rem;
  --fs-base: clamp(0.8rem, 0.75rem + 0.25vw, 0.9rem);
  --fs-md: clamp(0.95rem, 0.9rem + 0.3vw, 1.1rem);
  --fs-lg: clamp(1.4rem, 1.2rem + 0.9vw, 2rem);
  --fs-display: clamp(1.9rem, 1.4rem + 1.8vw, 3.2rem);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Roboto Mono', Menlo, Consolas, monospace;
  --tracking-tight: -0.025em;
  --tracking-wide: 0.1em;

  /* ---- spacing (8px grid) ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* ---- elevation ---- */
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --shadow-1: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, 0.7);
  --shadow-3: 0 18px 60px rgba(0, 0, 0, 0.8);
  --glow: 0 0 18px rgba(255, 255, 255, 0.05);

  /* ---- motion ---- */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.1s;
  --t-base: 0.2s;
  --t-slow: 0.4s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: var(--tracking-tight); }
h1 { font-size: var(--fs-display); font-weight: 600; }
h2 { font-size: var(--fs-lg); font-weight: 600; }
h3 { font-size: var(--fs-md); font-weight: 500; }

.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-xs); }
.hidden { display: none !important; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------------- HEADER ---------------- */
.header {
  display: flex; align-items: center; gap: var(--sp-5);
  height: 60px; padding: 0 var(--sp-5);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--card-border);
  z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 200px; }
.brand-mark { font-weight: 600; font-size: 1rem; letter-spacing: var(--tracking-tight); display: flex; align-items: center; gap: var(--sp-2); }
.brand-mark .slash { color: var(--green); }
.brand-mark .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green);
  animation: pulseDot 1.5s ease-in-out infinite;
}
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.brand-sub { font-size: var(--fs-xs); color: var(--text-muted); }

.nav { display: flex; gap: var(--sp-1); }
.nav-item {
  background: transparent; color: var(--text-muted);
  border: 1px solid transparent; padding: 6px 14px;
  font-family: var(--font); font-size: 0.82rem; cursor: pointer;
  border-radius: var(--radius-sm); transition: all var(--t-base) var(--ease-out);
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { color: var(--text); background: rgba(255,255,255,0.08); border-color: var(--card-border); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; }
.stat-label { font-size: 0.62rem; color: var(--text-muted); letter-spacing: 0.12em; }
.stat-value { font-size: 0.9rem; font-weight: 500; }
.stat-value.pos { color: var(--green); }
.stat-value.neg { color: var(--red); }

.profile-select { display: flex; flex-direction: column; align-items: flex-end; }
.profile-select select {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--card-border); border-radius: 6px;
  font-family: var(--mono); font-size: 0.76rem; padding: 2px 6px; outline: none;
}
.profile-select select:focus { border-color: rgba(255,255,255,0.4); }

/* ---------------- CONTROL SYSTEM ---------------- */
.icon-btn {
  position: relative; background: var(--bg-elev);
  border: 1px solid var(--card-border); color: var(--text);
  min-width: 40px; min-height: 40px; width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; font-size: 1rem; transition: all var(--t-base) var(--ease-out);
}
.icon-btn:hover { background: rgba(255,255,255,0.08); }
.icon-btn .badge {
  position: absolute; top: -4px; right: -6px;
  background: var(--red); color: #fff; font-size: 0.62rem;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
}

/* ---------------- USER MENU (avatar + integrations) ---------------- */
.hd-user { position: relative; }
.ava-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-elev); border: 1px solid var(--card-border);
  color: var(--text); cursor: pointer; font-family: var(--mono);
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-base) var(--ease-out);
}
.ava-btn:hover { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,255,65,0.12); }
.ava-btn.signed { border-color: var(--green); color: var(--green); }
.ava-btn.signed::after {
  content: ''; position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px var(--green);
}
.ava-btn:active { transform: scale(0.96); }

.cb-btn { position: relative; }
.cb-icon {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #4599ff, #0052ff);
  color: #fff; font-weight: 800; font-size: 0.72rem;
}
.cb-btn.signin::after {
  content: ''; position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px var(--green);
}

.dd {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  width: 300px; background: rgba(16,16,16,0.96);
  border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.03);
  padding: var(--sp-4); animation: sigIn 260ms var(--ease-out) both;
}
.dd-head { display: flex; align-items: center; gap: var(--sp-3); }
.dd-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev); border: 2px solid var(--green);
  color: var(--green); font-family: var(--mono); font-weight: 700;
  font-size: 0.95rem;
}
.dd-id b { display: block; font-size: 0.92rem; text-transform: capitalize; }
.dd-state { font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.06em; }
.dd-auth { margin-top: var(--sp-3); }
.dd-nameform { display: flex; gap: var(--sp-2); }
.dd-nameform input {
  flex: 1; background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 0.8rem; padding: 8px 10px; outline: none;
}
.dd-nameform input:focus { border-color: var(--green); }
.dd-sep { height: 1px; background: var(--card-border); margin: var(--sp-4) 0; }
.dd-title { font-size: 0.66rem; letter-spacing: 0.14em; color: var(--text-muted); margin-bottom: var(--sp-3); }
.dd-list { display: flex; flex-direction: column; gap: 2px; }
.dd-int {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer; padding: 8px 10px;
  transition: background var(--t-fast) var(--ease-out);
  text-align: left;
}
.dd-int:hover { background: rgba(255,255,255,0.05); border-color: var(--card-border); }
.dd-int-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: #444; transition: all var(--t-fast) var(--ease-out);
}
.dd-int.on .dd-int-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dd-int.on .dd-int-dot.dot-cb { background: #4599ff; box-shadow: 0 0 8px #4599ff; }
.dd-int b { font-size: 0.82rem; min-width: 74px; }
.dd-int-sub { font-size: 0.66rem; color: var(--text-muted); flex: 1; text-align: left; }
.dd-int-chip {
  font-size: 0.58rem; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 4px;
  color: var(--text-muted); border: 1px solid var(--card-border); font-family: var(--mono);
}
.dd-int.on .dd-int-chip {
  color: var(--green); border-color: rgba(0,255,65,0.4); background: rgba(0,255,65,0.06);
}
.dd-int.on .dd-int-chip.dot-cb { color: #4599ff; border-color: rgba(69,153,255,0.4); background: rgba(69,153,255,0.06); }
.dd-footer { line-height: 1.7; }
.dd-footer a { color: var(--cyan); }
.dd-out {
  width: 100%; margin-top: var(--sp-3);
  background: rgba(255,0,64,0.08); color: var(--red);
  border: 1px solid rgba(255,0,64,0.35); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  padding: 8px; cursor: pointer; transition: all var(--t-fast) var(--ease-out);
}
.dd-out:hover { background: rgba(255,0,64,0.18); }

@media (max-width: 640px) {
  .ava-btn { width: 44px; height: 44px; }
  .dd { position: fixed; top: 64px; right: 12px; left: 12px; width: auto; }
}

/* Button system: primary / secondary / ghost, springy press physics. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  background: var(--green); color: #000; border: 1px solid var(--green);
  border-radius: var(--radius-sm); padding: 9px 18px;
  font-family: var(--font); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.04em; cursor: pointer;
  transition: transform var(--t-fast) ease-in, box-shadow var(--t-base) var(--ease-out), background var(--t-base) var(--ease-out);
}
.btn:hover { box-shadow: 0 0 18px var(--glow-green); }
.btn:active { transform: scale(0.98); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  background: transparent; color: var(--text); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 9px 18px;
  font-family: var(--font); font-size: 0.78rem; font-weight: 500; cursor: pointer;
  transition: transform var(--t-fast) ease-in, background var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out);
}
.btn-secondary:hover { background: rgba(255,255,255,0.06); border-color: var(--card-border-strong); }
.btn-secondary:active { transform: scale(0.98); }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: var(--radius-sm); }

/* Press feedback across the icon / nav / chart tools */
.icon-btn:active, .nav-item:active, .tbtn:active, .cd-btn:active, .ov-close:active, .cp-cmd button:active {
  transform: scale(0.97);
}

/* ---------------- LAYOUT ---------------- */
.layout {
  display: grid; grid-template-columns: 248px 1fr 304px;
  gap: 12px; flex: 1; padding: 12px 16px; min-height: 0;
}
.sidebar, .main { display: flex; flex-direction: column; gap: 12px; min-height: 0; }

.panel {
  background: var(--card);
  border: 0.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px;
}
.panel-title {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulseDot 1.2s infinite; }

/* ---------------- WATCHLIST ---------------- */
.watchlist { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.wt-row {
  display: grid; grid-template-columns: 42px 1fr auto;
  align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; transition: all 0.2s var(--ease);
}
.wt-row:hover { background: rgba(255,255,255,0.05); border-color: var(--card-border); }
.wt-row.active { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.25); }
.wt-sym { font-weight: 600; font-size: 0.8rem; }
.wt-name { font-size: 0.62rem; color: var(--text-muted); }
.wt-price { text-align: right; }
.wt-change { font-size: 0.72rem; font-family: var(--mono); text-align: right; }
.col-green { color: var(--green); }
.col-red { color: var(--red); }
.wt-alerts { display: flex; gap: 3px; margin-top: 3px; justify-content: flex-end; }
.bubble {
  font-size: 0.58rem; padding: 0 5px; border-radius: 4px;
  background: rgba(255,255,255,0.08); color: var(--text-muted);
  border: 1px solid var(--card-border);
}
.bubble.green { background: var(--glow-green); color: var(--green); border-color: var(--green); }
.bubble.red { background: var(--glow-red); color: var(--red); border-color: var(--red); }
.bubble.amber { background: rgba(255,183,0,0.1); color: var(--amber); border-color: var(--amber); }

/* ---------------- PORTFOLIO ---------------- */
.kv { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.78rem; }
.kv-k { color: var(--text-muted); }
.kv-v { font-family: var(--mono); }
.meter { margin-top: 10px; }
.meter-track { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--green); transition: width 0.4s var(--ease); }
.meter-fill.danger { background: var(--red); }
.meter-label { font-size: 0.62rem; color: var(--text-muted); margin-top: 4px; display: block; }

/* ---------------- PERFORMANCE (analytics) ---------------- */
.an-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-bottom: 12px;
}
.an-cell {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--bg-elev); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.an-k { font-size: var(--fs-2xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.an-v { font-family: var(--mono); font-size: 0.85rem; color: var(--text); }
.an-v.pos { color: var(--green); }
.an-v.neg { color: var(--red); }
.spark-canvas { width: 100%; height: 54px; display: block; margin-bottom: 10px; }
.an-foot { color: var(--text-faint); font-size: var(--fs-2xs); letter-spacing: 0.06em; text-transform: uppercase; }

/* R-distribution histogram */
.an-hist {
  display: flex; align-items: flex-end; gap: 3px;
  height: 46px; margin-bottom: 18px;
}
.an-bar {
  flex: 1; min-height: 8px; border-radius: 3px 3px 0 0;
  position: relative; transition: opacity var(--t-base) var(--ease-out);
}
.an-bar.pos { background: var(--green); opacity: 0.75; }
.an-bar.neg { background: var(--red); opacity: 0.75; }
.an-bar:hover { opacity: 1; }
.an-bar i {
  position: absolute; bottom: -15px; left: 0; right: 0; text-align: center;
  font-style: normal; font-size: 9px; font-family: var(--mono); color: var(--text-faint);
}

/* Per-token ledger */
.an-tokens { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.an-tk-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--card-border); background: var(--bg-elev);
}
.an-tk { font-size: 0.72rem; font-weight: 600; width: 42px; }
.an-tk-muted { font-size: 0.62rem; color: var(--text-muted); flex: 1; text-align: right; }
.an-tk-pnl { font-size: 0.72rem; min-width: 72px; text-align: right; }
.an-tk-pnl.pos { color: var(--green); }
.an-tk-pnl.neg { color: var(--red); }

/* ---------------- SETTINGS VIEW ---------------- */
.settings-view { overflow-y: auto; flex: 1; min-height: 0; }
.st-group { margin-bottom: 22px; }
.st-title {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px;
}
.st-desc { font-size: 0.74rem; margin-bottom: 10px; max-width: 520px; line-height: 1.5; }
.st-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 640px; }
.st-card {
  background: var(--bg-elev); border: 1px solid var(--card-border);
  border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 4px;
  text-align: left; cursor: pointer; color: var(--text);
  font-family: var(--font); transition: all var(--t-base) var(--ease-out);
}
.st-card b { font-size: 0.85rem; letter-spacing: var(--tracking-tight); }
.st-card-meta { font-size: 0.64rem; }
.st-card:hover { border-color: var(--card-border-strong); background: rgba(255,255,255,0.05); }
.st-card.active { border-color: var(--green); background: var(--glow-green); }
.st-kv { display: grid; grid-template-columns: minmax(140px, 1fr) auto; gap: 8px 24px; max-width: 460px; }
.st-kv span { color: var(--text-muted); font-size: 0.78rem; }
.st-kv b.pos { color: var(--green); }
.st-kv b.neg { color: var(--red); }
.st-modules { line-height: 1.7; max-width: 640px; }
.st-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.st-actions .btn, .st-actions .btn-secondary { padding: 8px 14px; font-size: 0.68rem; letter-spacing: 0.08em; }
@media (max-width: 640px) {
  .st-actions .btn, .st-actions .btn-secondary { flex: 1; min-height: 44px; }
}
.st-keys { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); }
.st-keys b { color: var(--green); font-family: var(--mono); background: var(--bg-elev); border: 1px solid var(--card-border); padding: 1px 6px; border-radius: 4px; margin-right: 4px; }

/* ---------------- CHART ---------------- */
.chart-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chart-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.chart-select {
  background: var(--bg-elev); color: var(--text); font-weight: 600;
  border: 1px solid var(--card-border); border-radius: 8px;
  padding: 6px 12px; font-family: var(--mono); font-size: 0.9rem; outline: none;
  cursor: pointer; transition: border-color 0.2s;
}
.chart-select:focus { border-color: rgba(255,255,255,0.4); }
.chart-price { font-size: clamp(1.2rem, 1rem + 1vw, 1.7rem); font-weight: 500; letter-spacing: -0.02em; }
.chart-change { font-size: 0.85rem; margin-left: 8px; }
.chart-range { font-size: 0.72rem; }
.chart-tools { margin-left: auto; display: flex; gap: 4px; }
.tbtn {
  background: transparent; border: 1px solid var(--card-border);
  color: var(--text-muted); border-radius: 6px; padding: 5px 12px;
  font-family: var(--mono); font-size: 0.72rem; cursor: pointer;
  transition: all var(--t-base) var(--ease-out);
}
.tbtn:hover { color: var(--text); }
.tbtn.active { color: var(--green); border-color: var(--green); background: var(--glow-green); }

.chart-canvas { flex: 1; width: 100%; min-height: 220px; display: block; will-change: contents; }

.chart-indicators { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.indi {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 0.66rem; color: var(--text-muted);
  background: var(--bg-elev); border: 1px solid var(--card-border);
  border-radius: 8px; padding: 6px 10px; min-width: 96px;
}
.indi b { font-family: var(--mono); color: var(--text); font-size: 0.76rem; }
.indi b.pos { color: var(--green); }
.indi b.neg { color: var(--red); }

/* ---------------- SIGNAL FEED ---------------- */
.feed-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.feed { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }

.sig-card {
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--bg-elev);
  padding: 12px 14px;
  transition: all 0.2s var(--ease);
}
.sig-card:hover { background: rgba(255,255,255,0.04); }
.sig-card.buy { border-left: 3px solid var(--green); }
.sig-card.sell { border-left: 3px solid var(--red); }
.sig-card.increase { border-left: 3px solid var(--amber); }
.sig-card.flash { animation: sigFlash 1.1s var(--ease); }
@keyframes sigFlash {
  0% { box-shadow: 0 0 0 0 var(--flash-color, var(--green)); }
  100% { box-shadow: 0 0 24px 14px transparent; }
}
.sig-card.stagger { animation: sigIn 380ms var(--ease-out) both; }
@keyframes sigIn {
  from { opacity: 0; transform: translateY(-5px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.sig-top { display: flex; align-items: center; gap: 10px; }
.sig-type {
  font-family: var(--mono); font-weight: 700; font-size: 0.72rem;
  padding: 3px 8px; border-radius: 6px; letter-spacing: 0.06em;
}
.sig-type.buy { color: var(--green); background: var(--glow-green); border: 1px solid var(--green); }
.sig-type.sell { color: var(--red); background: var(--glow-red); border: 1px solid var(--red); }
.sig-type.increase { color: var(--amber); background: rgba(255,183,0,0.1); border: 1px solid var(--amber); }
.sig-token { font-weight: 600; font-size: 0.9rem; }
.sig-pct { font-family: var(--mono); font-size: 0.8rem; margin-left: auto; }
.sig-pct.buy { color: var(--green); }
.sig-pct.sell { color: var(--red); }
.sig-pct.increase { color: var(--amber); }
.sig-time { font-size: 0.62rem; color: var(--text-muted); font-family: var(--mono); }

.sig-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-top: 10px;
}
.sig-cell { display: flex; flex-direction: column; }
.sig-cell .k { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.sig-cell .v { font-family: var(--mono); font-size: 0.8rem; }

.sig-rationale { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.rat-chip {
  font-size: 0.64rem; color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--card-border);
  border-radius: 6px; padding: 2px 7px;
}
.rat-chip.buy { color: var(--green); border-color: rgba(0,255,65,0.3); }
.rat-chip.sell { color: var(--red); border-color: rgba(255,0,64,0.3); }
.rat-chip.increase { color: var(--amber); border-color: rgba(255,183,0,0.3); }

.empty { text-align: center; padding: 18px 0; font-size: 0.78rem; }

/* ---------------- POSITIONS ---------------- */
.pos-item {
  border: 1px solid var(--card-border); border-radius: 8px;
  padding: 10px; margin-bottom: 8px; background: var(--bg-elev);
}
.pos-head { display: flex; justify-content: space-between; font-size: 0.78rem; }
.pos-arrow { font-family: var(--mono); font-weight: 600; }
.pos-arrow.long { color: var(--green); }
.pos-arrow.delta { font-family: var(--mono); font-weight: 600; }
.pos-arrow.short { color: var(--red); }
.pos-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.68rem; color: var(--text-muted); font-family: var(--mono); }
.pos-bar { height: 3px; border-radius: 2px; margin-top: 8px; background: rgba(255,255,255,0.08); overflow: hidden; }
.pos-bar i { display: block; height: 100%; background: var(--green); transition: width 0.4s var(--ease); }
.pos-bar i.neg { background: var(--red); }

/* ---------------- SMART MONEY ---------------- */
.sm-panel { display: flex; flex-direction: column; gap: 8px; }
.sm-token { font-size: 0.72rem; }
.sm-row {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--card-border); border-radius: 8px; padding: 7px 10px;
  background: var(--bg-elev);
}
.sm-acc { color: var(--green); font-family: var(--mono); font-size: 0.72rem; }
.sm-div { color: var(--red); font-family: var(--mono); font-size: 0.72rem; }
.sm-neutral { color: var(--text-muted); font-family: var(--mono); font-size: 0.72rem; }

/* ---------------- GLYPHS (color independence) ---------------- */
.pos-arrow.long::before, .wt-chg.pos::before, .stat-value.pos::before, .sig-pct.buy::before { content: '\25B2  '; }
.pos-arrow.short::before, .wt-chg.neg::before, .stat-value.neg::before, .sig-pct.sell::before { content: '\25BC  '; }
.pos-arrow.long::after, .pos-arrow.short::after { content: ''; }

/* ---------------- SETTINGS ---------------- */
.settings-stack { display: flex; flex-direction: column; gap: 12px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.78rem; cursor: pointer; }
.switch-label { color: var(--text-muted); }
.switch { accent-color: var(--green); width: 16px; height: 16px; cursor: pointer; }
.range { width: 100%; accent-color: var(--green); }

/* ---------------- BOTTOM TICKER ---------------- */
.ticker-wrap {
  border-top: 1px solid var(--card-border);
  background: var(--bg-elev);
  height: 40px; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker { display: flex; align-items: center; gap: 0; height: 100%; white-space: nowrap; will-change: transform; }
.tk-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 22px; font-family: var(--mono); font-size: 0.76rem;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.tk-sym { font-weight: 600; color: var(--text); }
.tk-pr { color: var(--text-muted); }
.tk-chg { font-weight: 600; }
.tk-chg.up { color: var(--green); }
.tk-chg.down { color: var(--red); }

/* ---------------- NOTIFICATIONS ---------------- */
.notif-stack { position: fixed; top: 64px; right: 16px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 32px); }

.slide-notif {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-right: 4px solid var(--green);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8), 0 0 24px var(--glow-green);
  animation: slideIn 0.3s var(--ease);
}
.slide-notif.sell { border-right-color: var(--red); box-shadow: 0 10px 40px rgba(0,0,0,0.8), 0 0 24px var(--glow-red); }
.slide-notif.increase { border-right-color: var(--amber); box-shadow: 0 10px 40px rgba(0,0,0,0.8), 0 0 24px rgba(255,183,0,0.15); }
.slide-notif.out { animation: slideOut 0.3s var(--ease) forwards; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { to { transform: translateX(120%); opacity: 0; } }
.sn-head { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; }
.sn-head .sn-type { font-family: var(--mono); font-size: 0.68rem; padding: 2px 7px; border-radius: 5px; }
.sn-type.buy { color: var(--green); background: rgba(0,255,65,0.12); }
.sn-type.sell { color: var(--red); background: rgba(255,0,64,0.12); }
.sn-type.increase { color: var(--amber); background: rgba(255,183,0,0.12); }
.sn-body { font-size: 0.74rem; margin-top: 6px; color: var(--text-muted); }
.sn-body b { color: var(--text); font-family: var(--mono); font-weight: 500; }

/* full-screen overlay */
.overlay {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.overlay.show { opacity: 1; }
.overlay-card {
  width: min(560px, 92vw);
  border-radius: 14px;
  padding: 28px 32px;
  background: var(--card);
  border: 1px solid var(--card-border);
  transform: translateY(20px);
  animation: overlayIn 0.2s var(--ease);
}
.overlay.show .overlay-card { animation: overlayIn 0.25s var(--ease); }
@keyframes overlayIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.overlay.buy  { box-shadow: inset 0 0 0 1px rgba(0,255,65,0.4), 0 0 80px var(--glow-green); }
.overlay.sell { box-shadow: inset 0 0 0 1px rgba(255,0,64,0.4), 0 0 80px var(--glow-red); }
.overlay.increase { box-shadow: inset 0 0 0 1px rgba(255,183,0,0.4), 0 0 80px rgba(255,183,0,0.15); }
.ov-type { font-size: 2rem; font-weight: 700; font-family: var(--mono); letter-spacing: 0.04em; }
.ov-type.buy { color: var(--green); text-shadow: 0 0 24px var(--green); }
.ov-type.sell { color: var(--red); text-shadow: 0 0 24px var(--red); }
.ov-type.increase { color: var(--amber); text-shadow: 0 0 24px var(--amber); }
.ov-token { font-size: 1rem; color: var(--text-muted); }
.ov-conf { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.ov-conf-big { font-family: var(--mono); font-size: 2.4rem; font-weight: 600; }
.ov-conf-big.buy { color: var(--green); }
.ov-conf-big.sell { color: var(--red); }
.ov-conf-big.increase { color: var(--amber); }
.ov-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.ov-cell { background: var(--bg-elev); border: 1px solid var(--card-border); border-radius: 8px; padding: 10px; }
.ov-cell .k { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.ov-cell .v { font-family: var(--mono); font-size: 0.92rem; }
.ov-rationale { margin-top: 16px; font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--card-border); padding-top: 12px; }
.ov-close {
  margin-top: 20px; width: 100%;
  background: rgba(255,255,255,0.08); border: 1px solid var(--card-border);
  color: var(--text); padding: 10px; border-radius: 8px; cursor: pointer;
  font-family: var(--font); transition: background 0.2s;
}
.ov-close:hover { background: rgba(255,255,255,0.14); }

/* notification center drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 94vw;
  background: var(--card); border-left: 1px solid var(--card-border);
  z-index: 92; padding: 20px; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.3s var(--ease);
}
.drawer.open { transform: none; box-shadow: -12px 0 48px rgba(0,0,0,0.7); }
.drawer h3 { font-size: 0.85rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.drawer .sig-mini { font-size: 0.74rem; border: 1px solid var(--card-border); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; background: var(--bg-elev); }

/* ---------------- ACCESSIBILITY ---------------- */
/* High-contrast override: brighter muted text + stronger borders */
body.hc { --text-muted: #d4d4d4; --text-faint: #b8b8b8; --card-border: rgba(255,255,255,0.28); --card-border-strong: rgba(255,255,255,0.5); }
body.hc .panel, body.hc .pos-item, body.hc .sm-row, body.hc .wt-row:hover { background: var(--bg-raise); }
body.hc .sig-card, body.hc .an-cell, body.hc .indi { border-width: 1px; }

/* Reduced motion override (user toggle OR OS preference) */
body.rm *,
body.rm *::before,
body.rm *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001s !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------- SCROLLBARS ---------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 1280px) {
  .layout { grid-template-columns: 216px 1fr 264px; }
}
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; overflow-y: auto; }
  .sidebar.left { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .sidebar.right { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .ticker-wrap { height: 34px; }
}
@media (max-width: 768px) {
  .header { gap: 14px; }
  .brand { min-width: 0; }
  .sidebar.left, .sidebar.right { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .header { padding: 0 12px; gap: 10px; }
  .brand-sub, .nav { display: none; }
  .header-right { gap: 10px; }
  .sidebar.left, .sidebar.right { grid-template-columns: 1fr; }
  .chart-price { font-size: 1.2rem; }
  .sig-grid { grid-template-columns: repeat(3, 1fr); }
  .st-cards { grid-template-columns: 1fr; }

  /* 44px touch targets */
  .nav-item, .tbtn, .cd-btn, .cp-cmd button, .ov-close {
    min-height: 44px; min-width: 44px; padding: 8px 12px;
  }
  .icon-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .wt-row { min-height: 44px; }
  .switch { width: 20px; height: 20px; }
  .range { min-height: 28px; }
}
/* ---------------- FOMO MOFO COMPANION ---------------- */
.companion-dock {
  position: fixed; left: 16px; bottom: 52px; z-index: 80;
  display: flex; align-items: center; gap: 14px;
  background: rgba(10,10,10,0.92); backdrop-filter: blur(8px);
  border: 1px solid var(--card-border); border-radius: 14px;
  padding: 10px 14px; max-width: min(560px, calc(100vw - 32px));
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
}
.cd-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cd-avatar { position: relative; width: 52px; height: 52px; flex: none; will-change: transform; contain: layout style; }
.cd-avatar svg { width: 52px; height: 52px; display: block; }
#companionMoodRing {
  border-radius: 50%; transition: box-shadow 0.4s var(--ease);
  animation: avatarIdle 4s var(--ease-in-out) infinite;
}
#companionMoodRing[data-mood="euphoric"] {
  box-shadow: 0 0 24px rgba(0,255,65,0.6);
  animation: avatarCelebrate 0.8s var(--ease-in-out) infinite;
}
#companionMoodRing[data-mood="pumped"] {
  box-shadow: 0 0 18px rgba(0,255,65,0.35);
  animation: avatarExcited 0.5s var(--ease-in-out) infinite;
}
#companionMoodRing[data-mood="worried"] {
  box-shadow: 0 0 18px rgba(255,183,0,0.4);
  animation: avatarConcerned 2s var(--ease-in-out) infinite;
}
#companionMoodRing[data-mood="panic"] {
  box-shadow: 0 0 22px rgba(255,0,64,0.55);
  animation: panicShake 0.5s infinite;
}
#companionMoodRing[data-mood="analytical"] {
  animation: avatarAnalyze 1s var(--ease-in-out) infinite;
}
@keyframes avatarIdle { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes avatarAnalyze { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes avatarExcited { 0%,100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-3px) scale(1.05); } }
@keyframes avatarConcerned { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(1px) rotate(-3deg); } }
@keyframes avatarCelebrate { 0%,100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-6px) rotate(-4deg); } 60% { transform: translateY(-2px) rotate(4deg); } }
@keyframes panicShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-2px)} 75%{transform:translateX(2px)} }

/* celebrating confetti particles (spawned by companion.js) */
.confetti {
  position: absolute; width: 6px; height: 6px; pointer-events: none;
  border-radius: 2px; z-index: 5;
  animation: confettiPop 0.9s var(--ease-out) forwards;
}
@keyframes confettiPop {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx, 0px), -34px) scale(0.4) rotate(240deg); opacity: 0; }
}
.cd-analyzing {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  font-size: 0.52rem; letter-spacing: 0.1em; color: var(--green);
  background: #000; border: 1px solid rgba(0,255,65,0.4);
  padding: 1px 6px; border-radius: 4px; opacity: 0; white-space: nowrap;
}
.cd-analyzing.on { opacity: 1; animation: analyzeBlink 0.8s infinite; }
@keyframes analyzeBlink { 0%,100%{opacity:1} 50%{opacity:0.35} }
.cd-speech { min-width: 0; }
.cd-mood { font-size: 0.58rem; color: var(--green); letter-spacing: 0.14em; font-weight: 600; }
.cd-bubble {
  font-size: 0.8rem; color: var(--text); line-height: 1.35;
  max-height: 44px; overflow: hidden; white-space: pre-wrap;
  border-radius: 10px; padding: 6px 10px; margin-left: -10px;
  border: 1px solid transparent;
  transition: border-color var(--t-base) var(--ease-out), background var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}
.cd-bubble.typing::after { content: '▌'; color: var(--green); animation: analyzeBlink 0.8s infinite; }

/* Commentary type system — entry/exit/risk/education/analysis */
.cd-bubble.bub-entry { color: var(--green); border-color: rgba(0,255,65,0.45); background: rgba(0,255,65,0.07); text-shadow: 0 0 12px rgba(0,255,65,0.4); }
.cd-bubble.bub-exit { color: var(--red); border-color: rgba(255,0,64,0.5); background: rgba(255,0,64,0.07); }
.cd-bubble.bub-risk { color: var(--amber); border-color: rgba(255,183,0,0.55); background: rgba(255,183,0,0.06); animation: riskPulse 1.4s var(--ease-in-out) infinite; }
.cd-bubble.bub-edu { color: var(--text-muted); text-decoration: underline; text-decoration-color: rgba(255,255,255,0.25); text-underline-offset: 3px; }
.cd-bubble.bub-analysis { color: var(--text); border-left: 2px solid var(--cyan); }
@keyframes riskPulse { 0%,100% { border-color: rgba(255,183,0,0.55); } 50% { border-color: rgba(255,183,0,0.9); } }
.cd-controls { display: flex; gap: 6px; flex: none; }
.cd-btn {
  background: rgba(255,255,255,0.06); color: var(--text);
  border: 1px solid var(--card-border); border-radius: 8px;
  font-family: var(--font); font-size: 0.68rem; font-weight: 600;
  padding: 7px 10px; cursor: pointer; transition: all 0.2s;
}
.cd-btn:hover { background: rgba(255,255,255,0.12); }
.cd-btn.primary { color: #000; background: var(--green); border-color: var(--green); }
.cd-btn.primary:hover { box-shadow: 0 0 16px rgba(0,255,65,0.5); }
.cd-btn.mic { border-radius: 50%; width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.cd-btn.mic.listening {
  border-color: var(--red); color: var(--red);
  animation: micPulse 1.1s var(--ease-out) infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,0,64,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255,0,64,0); }
}
.mic-caption { padding: 2px 6px; min-height: 16px; color: var(--text-muted); }
.mic-caption.on { color: var(--red); }

.companion-panel {
  position: fixed; left: 16px; bottom: 100px; z-index: 79;
  width: min(430px, calc(100vw - 32px));
  max-height: 55vh; display: flex; flex-direction: column; gap: 10px;
  background: rgba(10,10,10,0.96); backdrop-filter: blur(10px);
  border: 1px solid var(--card-border); border-radius: 14px;
  padding: 14px; box-shadow: 0 18px 60px rgba(0,0,0,0.8);
  transform: translateY(16px) scale(0.98); opacity: 0; pointer-events: none;
  transition: all 0.25s var(--ease);
}
.companion-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.cp-head { display: flex; align-items: center; justify-content: space-between; }
.cp-head b { font-size: 0.8rem; letter-spacing: 0.04em; }
.cp-head .slash { color: var(--green); }
.cp-tools { display: flex; gap: 10px; }
.cp-mini { font-size: 0.6rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; cursor: pointer; }
.cp-mini input { accent-color: var(--green); }
.cp-session {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px;
  border: 1px solid var(--card-border); border-radius: 10px;
  background: var(--bg-elev); padding: 10px 12px;
}
.cs-idle { grid-column: 1 / -1; text-align: center; padding: 8px; }
.cs-row { display: flex; justify-content: space-between; font-size: 0.72rem; }
.cs-k { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cs-v { font-family: var(--mono); }
.cp-stats {
  display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.66rem; color: var(--text-muted);
  border-bottom: 1px solid var(--card-border); padding-bottom: 8px;
}
.cp-stats b { color: var(--text); font-family: var(--mono); }
.cp-cmd { display: flex; gap: 6px; }
.cp-cmd input {
  flex: 1; background: var(--bg-elev); border: 1px solid var(--card-border);
  border-radius: 8px; color: var(--text); padding: 7px 10px;
  font-family: var(--font); font-size: 0.76rem; outline: none;
}
.cp-cmd input:focus { border-color: rgba(0,255,65,0.5); }
.cp-cmd button {
  background: var(--bg-elev); color: var(--green); border: 1px solid rgba(0,255,65,0.4);
  border-radius: 8px; font-size: 0.7rem; font-weight: 600; padding: 0 12px; cursor: pointer;
}
.cp-log { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; max-height: 26vh; padding-right: 2px; }
.cl-row { display: flex; gap: 8px; font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }
.cl-mood { flex: none; font-size: 0.56rem; padding: 1px 5px; border-radius: 4px; font-family: var(--mono); }

.ach-popup {
  position: fixed; top: 72px; left: 50%; transform: translate(-50%, -24px);
  background: var(--card); border: 1px solid rgba(255,183,0,0.5);
  border-radius: 12px; padding: 12px 22px; text-align: center;
  box-shadow: 0 0 40px rgba(255,183,0,0.25); z-index: 99;
  opacity: 0; transition: all 0.5s var(--ease); pointer-events: none;
}
.ach-popup.show { opacity: 1; transform: translate(-50%, 0); }
.ach-title { font-size: 0.62rem; letter-spacing: 0.2em; color: var(--amber); font-weight: 700; }
.ach-name { font-size: 1rem; font-weight: 600; margin-top: 4px; }
.ach-desc { font-size: 0.72rem; }

@media (max-width: 640px) {
  .companion-dock { left: 8px; right: 8px; bottom: 44px; max-width: none; }
  .cd-controls .cd-btn { padding: 7px 8px; font-size: 0.62rem; }
  .companion-panel { left: 8px; width: calc(100vw - 16px); max-height: 60vh; }
}

/* ================= fomo-mofo COPY DESK BANNER ================= */
.traders-bar {
  position: fixed; z-index: 75;
  left: 620px; right: 16px; bottom: 52px;
  display: flex; align-items: stretch; gap: 12px;
  background: rgba(10,10,10,0.92); backdrop-filter: blur(8px);
  border: 1px solid var(--card-border); border-radius: 12px;
  padding: 8px 12px; height: 60px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.traders-bar.hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }
.tb-head { display: flex; flex-direction: column; justify-content: center; gap: 2px; flex: none; padding-right: 12px; border-right: 1px dashed var(--card-border); }
.tb-title { font-size: 0.68rem; letter-spacing: 0.14em; color: var(--accent); font-weight: 800; }
.tb-sub { font-size: 0.56rem; letter-spacing: 0.1em; color: var(--muted); }
.tb-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; cursor: grab; overscroll-behavior-x: contain; }
.tb-strip.dragging { cursor: grabbing; user-select: none; }
.tb-strip::-webkit-scrollbar { display: none; }
.tb-cell {
  display: flex; align-items: center; gap: 8px; flex: none;
  border: 1px solid var(--card-border); border-radius: 9px;
  padding: 6px 8px; background: rgba(255,255,255,0.02); min-width: 0;
}
.tb-cell.is-copied { border-color: var(--good); background: rgba(34,197,94,0.08); }
.tb-rank { font-size: 0.6rem; color: var(--muted); font-weight: 800; width: 14px; text-align: right; }
.tb-ava {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 0.72rem; font-weight: 800;
  background: hsl(var(--ha), 70%, 22%); color: #fff;
}
.tb-main { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.tb-name { font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.tb-style { font-size: 0.52rem; letter-spacing: 0.08em; color: var(--accent); font-style: normal; white-space: nowrap; }
.tb-nums { font-size: 0.54rem; color: var(--good); white-space: nowrap; }
.tb-nums.neg { color: var(--bad); }
.tb-copy {
  flex: none; border: 1px solid var(--accent); color: var(--accent);
  background: transparent; border-radius: 7px; padding: 5px 10px;
  font-size: 0.58rem; font-weight: 800; letter-spacing: 0.08em; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.tb-copy:hover { background: var(--accent); color: #0a0a0a; }
.tb-cell.is-copied .tb-copy { border-color: var(--good); color: var(--good); }
.tb-cell.is-copied .tb-copy:hover { background: var(--good); color: #0a0a0a; }
.tb-close {
  flex: none; align-self: flex-start; border: 0; background: transparent;
  color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; padding: 2px 4px;
}
.tb-close:hover { color: var(--bad); }
@media (max-width: 1240px) {
  .traders-bar { left: 16px; right: 16px; bottom: 0; height: 60px; border-radius: 12px 12px 0 0; }
  .app { padding-bottom: 60px; }
}
@media (max-width: 640px) {
  .traders-bar { left: 8px; right: 8px; }
  .companion-dock { bottom: 108px; }
  .tb-sub { display: none; }
}

/* ================= MOBILE POLISH (phone-sized) ================= */
@media (max-width: 640px) {
  /* Header stacks into two clean rows: brand, then stats */
  .header { flex-wrap: wrap; height: auto; min-height: 60px; padding: 8px 12px; row-gap: 6px; }
  .brand { width: 100%; min-width: 0; order: 1; }
  .brand-mark { white-space: nowrap; font-size: 0.95rem; }
  .header-right { order: 2; width: 100%; margin-left: 0; justify-content: space-between; gap: 8px; }
  .stat { align-items: flex-start; }
  .stat-label { white-space: nowrap; font-size: 0.55rem; }
  .stat-value { font-size: 0.8rem; }
  .profile-select { align-items: flex-start; }
  .profile-select select { font-size: 0.72rem; padding: 4px 6px; max-width: 104px; }
  .icon-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
  .ava-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }

  /* Content clears dock (66px) + banner (56px) + gaps */
  .app { padding-bottom: 150px; }

  /* Compact single-row dock above the banner */
  .companion-dock { bottom: 64px; left: 8px; right: 8px; padding: 6px 8px; gap: 8px; border-radius: 12px; }
  .cd-left { gap: 8px; flex: 1 1 auto; min-width: 0; }
  .cd-avatar, .cd-avatar svg { width: 36px; height: 36px; }
  .cd-analyzing { font-size: 0.44rem; }
  .cd-mood { display: none; }
  .cd-speech { flex: 1 1 auto; min-width: 0; }
  .cd-bubble { font-size: 0.68rem; padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cd-controls { display: flex; flex-wrap: nowrap; gap: 5px; overflow-x: auto; scrollbar-width: none; flex: 0 1 auto; }
  .cd-controls::-webkit-scrollbar { display: none; }
  .cd-controls .cd-btn { min-height: 40px; min-width: 0; padding: 6px 7px; font-size: 0.55rem; letter-spacing: 0; white-space: nowrap; }

  /* Banner tightens to 56px */
  .traders-bar { height: 56px; bottom: 0; left: 8px; right: 8px; padding: 6px 8px; gap: 8px; }
  .tb-title { font-size: 0.6rem; letter-spacing: 0.1em; }
  .tb-head { padding-right: 8px; }
  .tb-ava { width: 26px; height: 26px; font-size: 0.64rem; }
  .tb-nums { display: none; }
  .tb-copy { padding: 5px 8px; }
}

/* ------------------------------------------------------------------ gate
   Full-screen sign-in shown before the desk. Visible by default in markup so
   the dashboard cannot flash for a signed-out visitor; Gate.init() hides it
   immediately when a profile already exists. */
.gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.gate.hidden { display: none; }
/* The gate is position:fixed, so without this the desk still scrolls behind it. */
body.gate-open { overflow: hidden; }
.gate-card {
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--card);
  padding: 28px 24px 22px;
}
.gate-brand { display: flex; align-items: center; gap: 9px; }
.gate-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 10px var(--green);
}
.gate-name { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; }
.gate-tag {
  margin: 4px 0 22px 18px;
  font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-faint);
}
.gate-form { display: flex; flex-direction: column; gap: 8px; }
.gate-label {
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
}
.gate-input {
  background: var(--bg-raise); color: var(--text);
  border: 1px solid var(--card-border); border-radius: 9px;
  padding: 11px 12px; font-size: 0.9rem; font-family: inherit;
}
.gate-input:focus { outline: none; border-color: var(--green); }
.gate-primary {
  margin-top: 4px; padding: 11px 12px;
  background: var(--green); color: #0a0a0a;
  border: none; border-radius: 9px;
  font-weight: 800; font-size: 0.82rem; font-family: inherit;
  cursor: pointer;
}
.gate-primary:hover { filter: brightness(1.08); }
.gate-primary[disabled] { opacity: 0.55; cursor: progress; }
.gate-or {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 12px;
  color: var(--text-faint); font-size: 0.6rem; letter-spacing: 0.14em;
  text-transform: uppercase;
}
.gate-or::before, .gate-or::after {
  content: ''; flex: 1; height: 1px; background: var(--card-border);
}
.gate-oauth {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 10px 12px;
  background: transparent; color: var(--text);
  border: 1px solid var(--card-border); border-radius: 9px;
  font-size: 0.82rem; font-family: inherit; cursor: pointer;
}
.gate-oauth[disabled] { opacity: 0.4; cursor: not-allowed; }
.gate-g { font-weight: 800; color: var(--cyan); }
.gate-note {
  margin: 7px 0 0; text-align: center;
  font-size: 0.62rem; color: var(--text-faint);
}
.gate-ghost {
  margin-top: 18px; padding: 9px;
  background: none; border: none;
  color: var(--text-muted); font-size: 0.74rem; font-family: inherit;
  text-decoration: underline; cursor: pointer;
}
.gate-ghost:hover { color: var(--text); }
.gate-fine {
  margin: 14px 0 0; text-align: center;
  font-size: 0.58rem; letter-spacing: 0.06em; color: var(--text-faint);
}
@media (max-width: 520px) { .gate-card { padding: 22px 18px 18px; } }

/* The card the shepherd is currently talking about. Light blue so it reads as
   "look here" without colliding with the green/red the market uses for
   direction. Cleared by Companion.setFocus() when it moves on. */
.panel.talking {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan), 0 0 22px rgba(125, 249, 255, 0.35);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .panel.talking { transition: none; }
}
body.reduce-motion .panel.talking { transition: none; }

/* Coinbase quick-launch beside the avatar. The dot is lit only when the server
   confirms a real OAuth token exists — never from a local flag. */
.cb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-right: 8px; padding: 5px 9px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--card-border); border-radius: 8px;
  font-family: inherit; font-size: 0.66rem; letter-spacing: 0.04em;
  cursor: pointer;
}
.cb-btn:hover { color: var(--text); border-color: var(--card-border-strong); }
.cb-mark {
  display: inline-grid; place-items: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: #0052ff; color: #fff;
  font-size: 0.58rem; font-weight: 800;
}
.cb-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
}
.cb-dot.on { background: var(--green); box-shadow: 0 0 7px var(--green); }
@media (max-width: 900px) { .cb-word { display: none; } }

/* Manual paper-trade controls in the chart header. */
.chart-trade { display: flex; align-items: center; gap: 6px; }
.trade-btn {
  padding: 5px 12px;
  border-radius: 7px; border: 1px solid transparent;
  font-family: inherit; font-size: 0.66rem; font-weight: 800;
  letter-spacing: 0.08em; cursor: pointer;
}
.trade-btn.buy { background: var(--green); color: #0a0a0a; }
.trade-btn.sell { background: var(--red); color: #ffffff; }
.trade-btn.close { background: transparent; color: var(--amber); border-color: var(--amber); }
.trade-btn:hover { filter: brightness(1.1); }
.trade-btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }
.trade-btn.hidden { display: none; }
