/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:        #0a0a0a;
  --surface:   #111113;
  --surface2:  #1c1c1e;
  --border:    #2a2a2e;
  --border2:   #3a3a3e;
  --text:      #f0f0f0;
  --text2:     #a0a0a8;
  --text3:     #606068;
  --accent:    #0a84ff;
  --go:        #30d158;
  --watch:     #ff9f0a;
  --nogo:      #ff453a;
  --go-bg:     rgba(48,209,88,0.12);
  --watch-bg:  rgba(255,159,10,0.12);
  --nogo-bg:   rgba(255,69,58,0.12);
  --radius:    12px;
  --radius-sm: 6px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.4; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 13px; outline: none; width: 100%; }
input::placeholder { color: var(--text3); }
input:focus, select:focus { border-color: var(--accent); }

/* ── Header ────────────────────────────────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 100;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 10px; gap: 8px;
}
.header-left  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-center { flex: 1; overflow: hidden; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.logo { font-weight: 700; font-size: 15px; letter-spacing: 0.5px; white-space: nowrap; }

.hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  font-size: 18px; color: var(--text);
}

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  font-size: 16px;
}
.icon-btn:hover { border-color: var(--accent); }

.ws-indicator { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text3); }
.ws-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); }
.ws-dot.connected { background: var(--go); }
.ws-dot.error     { background: var(--nogo); }

.hstat { font-size: 11px; color: var(--text3); white-space: nowrap; }

/* ── Sidebar Overlay ───────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 98;
  background: rgba(0,0,0,0.5);
}
.sidebar-overlay.open { display: block; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 52px; bottom: 48px; width: 260px;
  z-index: 99; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  transform: translateX(-100%); transition: transform 0.25s ease;
  display: flex; flex-direction: column; gap: 0;
}
.sidebar.open { transform: translateX(0); }

.sidebar-section { padding: 12px; border-bottom: 1px solid var(--border); }
.sidebar-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--text3); margin-bottom: 8px; text-transform: uppercase; }

.strat-tabs, .filter-btns, .mode-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.strat-tab, .filter-btn, .mode-btn {
  padding: 5px 10px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); font-size: 11px; font-weight: 600;
}
.strat-tab.active, .mode-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-btn.active       { background: var(--surface2); border-color: var(--text2); color: var(--text); }
.filter-btn.go.active    { background: var(--go-bg); border-color: var(--go); color: var(--go); }
.filter-btn.watch.active { background: var(--watch-bg); border-color: var(--watch); color: var(--watch); }
.filter-btn.nogo.active  { background: var(--nogo-bg); border-color: var(--nogo); color: var(--nogo); }

.filter-input { margin-top: 0; }

.toggle-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); cursor: pointer; }
.toggle-label input { width: auto; }

.badge { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 1px 6px; font-size: 10px; color: var(--text3); }

.sidebar-empty { font-size: 12px; color: var(--text3); padding: 8px 0; }

/* ── Main ──────────────────────────────────────────────────────────────────── */
.main {
  margin-top: 52px; margin-bottom: 48px;
  padding: 8px; min-height: calc(100vh - 100px);
}

.feed-header { padding: 4px 4px 8px; font-size: 12px; color: var(--text3); }

/* ── Feed ──────────────────────────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; gap: 8px; }

.feed-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; gap: 8px; font-size: 24px; color: var(--text3);
}
.feed-empty > div:nth-child(2) { font-size: 14px; color: var(--text2); }

/* ── Token Card ────────────────────────────────────────────────────────────── */
.launch-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 12px 12px 15px;
  cursor: pointer; overflow: hidden;
}
.launch-card:hover { border-color: var(--border2); }
.launch-card.selected { border-color: var(--accent); }

/* Left color bar */
.launch-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--text3);
}
.launch-card.go::before    { background: var(--go); }
.launch-card.watch::before { background: var(--watch); }
.launch-card.nogo::before  { background: var(--nogo); }

.card-line {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px; font-size: 13px; margin-bottom: 4px;
}
.card-line:last-child { margin-bottom: 0; }

.card-symbol   { font-weight: 700; font-size: 14px; }
.card-dot      { color: var(--text3); }
.card-mc       { color: var(--text2); }
.card-age      { font-size: 11px; color: var(--text3); }
.card-conf     { font-weight: 700; }
.card-decision { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.card-decision.GO    { color: var(--go);    background: var(--go-bg); }
.card-decision.WATCH { color: var(--watch); background: var(--watch-bg); }
.card-decision.NO_GO { color: var(--nogo);  background: var(--nogo-bg); }
.card-metric { font-size: 11px; color: var(--text3); }
.card-metric b { color: var(--text2); }
.card-flag { font-size: 10px; padding: 2px 5px; border-radius: 3px; background: var(--surface2); }

.card-verdict-emoji { font-size: 12px; }
.good { color: var(--go); }
.warn { color: var(--watch); }
.bad  { color: var(--nogo); }

/* Mini bars */
.card-bars { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.mini-bar { width: 40px; height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.mini-bar-fill { height: 100%; border-radius: 2px; }
.mini-bar-fill.cluster { background: var(--accent); }
.mini-bar-fill.risk    { background: var(--nogo); }
.mini-bar-fill.flow    { background: var(--go); }

/* Chips */
.meta-chip, .strat-chip, .source-chip {
  font-size: 10px; padding: 2px 5px; border-radius: 3px;
  border: 1px solid var(--border); color: var(--text3);
}
.meta-chip  { background: var(--surface2); }
.strat-chip { background: rgba(10,132,255,0.15); border-color: var(--accent); color: var(--accent); }
.source-chip { background: var(--surface2); }

/* LP */
.card-lp { font-size: 11px; }
.card-lp.locked   { color: var(--go); }
.card-lp.unlocked { color: var(--text3); }
.card-ta { font-size: 11px; color: var(--text3); }

/* Card actions */
.card-actions {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.btn-buy {
  background: var(--go-bg); border: 1px solid var(--go); color: var(--go);
  padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; min-height: 36px;
}
.btn-buy:hover { background: rgba(48,209,88,0.2); }
.btn-buy:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-details {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text2);
  padding: 5px 10px; border-radius: var(--radius-sm); font-size: 12px; min-height: 36px;
}
.btn-skip {
  background: transparent; border: 1px solid var(--border); color: var(--text3);
  padding: 5px 10px; border-radius: var(--radius-sm); font-size: 12px; min-height: 36px;
}

/* ── Detail Panel ──────────────────────────────────────────────────────────── */
.detail-panel {
  position: fixed; right: 0; top: 52px; bottom: 48px; width: 400px;
  z-index: 95; background: var(--surface); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform 0.25s ease;
  display: flex; flex-direction: column; overflow: hidden;
}
.detail-panel.open { transform: translateX(0); }

.detail-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.back-btn {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text2);
  padding: 5px 10px; border-radius: var(--radius-sm); font-size: 12px;
}
.detail-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; gap: 8px; text-align: center;
}

/* Detail sections */
.detail-section { border-bottom: 1px solid var(--border); }
.detail-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; cursor: pointer; user-select: none;
}
.detail-section-header:hover { background: var(--surface2); }
.detail-section-title { font-size: 12px; font-weight: 700; color: var(--text2); }
.detail-section-chevron { font-size: 10px; color: var(--text3); transition: transform 0.2s; }
.detail-section.open .detail-section-chevron { transform: rotate(180deg); }
.detail-section-body { display: none; padding: 0 16px 12px; }
.detail-section.open .detail-section-body { display: block; }

.detail-kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-kv-label { font-size: 10px; color: var(--text3); margin-bottom: 2px; }
.detail-kv-value { font-size: 13px; font-weight: 600; }

.detail-header-inner { padding: 16px; border-bottom: 1px solid var(--border); }
.detail-symbol { font-size: 20px; font-weight: 700; }
.detail-name   { font-size: 12px; color: var(--text3); }
.detail-mint   { font-size: 10px; color: var(--text3); font-family: monospace; display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.detail-close-row { display: flex; justify-content: space-between; align-items: flex-start; }
.detail-close { background: var(--surface2); border: 1px solid var(--border); color: var(--text2); padding: 4px 8px; border-radius: var(--radius-sm); font-size: 14px; }
.detail-actions { display: flex; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }

.detail-signal-list { display: flex; flex-direction: column; gap: 8px; }
.detail-signal { display: flex; align-items: center; gap: 6px; }
.detail-signal-label { font-size: 11px; width: 130px; flex-shrink: 0; text-transform: uppercase; }
.detail-signal-bar { flex: 1; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.detail-signal-fill { height: 100%; border-radius: 3px; }
.detail-signal-val  { font-size: 11px; font-weight: 700; width: 24px; text-align: right; }
.detail-signal-time { font-size: 10px; color: var(--text3); }

.detail-wallet-list { display: flex; flex-direction: column; gap: 6px; }
.detail-wallet { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.detail-wallet-score { background: var(--accent); color: #fff; padding: 1px 5px; border-radius: 3px; font-size: 10px; font-weight: 700; }
.detail-wallet-addr  { flex: 1; font-family: monospace; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-wallet-amt   { color: var(--go); font-weight: 600; }
.detail-wallet-time  { color: var(--text3); }

.entry-plan { display: flex; flex-direction: column; gap: 6px; }
.entry-row  { display: flex; justify-content: space-between; font-size: 12px; }
.entry-label { color: var(--text3); }
.entry-value { font-weight: 600; }
.tp-ladder  { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.tp-item    { background: var(--surface2); border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; font-size: 10px; }

.reasons-list { display: flex; flex-direction: column; gap: 4px; }
.reason-item  { font-size: 11px; color: var(--text2); padding: 4px 6px; background: var(--surface2); border-radius: 4px; }

.flag-list  { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.flag-item  { font-size: 11px; color: var(--nogo); padding: 3px 6px; background: var(--nogo-bg); border-radius: 4px; }

.copy-btn {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text3);
  padding: 2px 5px; border-radius: 3px; font-size: 11px;
}

/* ── Bottom Bar ────────────────────────────────────────────────────────────── */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 48px;
  z-index: 100; background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 12px; gap: 8px; overflow: hidden;
}
.bottom-pos-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 8px; font-size: 12px;
}
.bottom-pos-sym  { font-weight: 700; }
.bottom-pos-pnl.pos { color: var(--go); }
.bottom-pos-pnl.neg { color: var(--nogo); }
.bottom-pos-sell {
  background: var(--nogo-bg); border: 1px solid var(--nogo); color: var(--nogo);
  padding: 2px 6px; border-radius: 3px; font-size: 10px;
}

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8);
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.flex, .modal-overlay[style*="flex"] { display: flex !important; }

.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; max-width: 500px; width: 90%; padding: 24px;
  position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); width: 28px; height: 28px;
  border-radius: 50%; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Wallet Manager ────────────────────────────────────────────────────────── */
.wallet-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.wallet-form input { flex: 1; min-width: 180px; }
.wallet-form button { padding: 6px 14px; background: var(--accent); color: #fff; border-radius: var(--radius-sm); font-size: 13px; }
.wallet-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.wallet-row-score { background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.wallet-row-addr  { flex: 1; font-family: monospace; font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallet-row-del   { color: var(--nogo); font-size: 16px; padding: 2px 6px; }

/* ── Research Panel ────────────────────────────────────────────────────────── */
.research-panel { display: flex; height: 80vh; max-height: 700px; }
.research-left  { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.research-right { flex: 1; overflow-y: auto; padding: 16px; }
.research-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.research-title { font-size: 16px; font-weight: 700; }
.research-search { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.research-input { flex: 1; }
.research-search-btn { padding: 6px 12px; background: var(--accent); color: #fff; border-radius: var(--radius-sm); font-size: 12px; flex-shrink: 0; }
.research-actions { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.r-action-btn { padding: 5px 10px; background: var(--accent); color: #fff; border-radius: var(--radius-sm); font-size: 11px; }
.r-action-btn.secondary { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.research-leaderboard-header { padding: 8px 12px 4px; font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--text3); }
.research-leaderboard { flex: 1; overflow-y: auto; }

.r-wallet-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.r-wallet-row:hover { background: var(--surface2); }
.r-rank { font-size: 11px; color: var(--text3); width: 24px; flex-shrink: 0; }
.r-wallet-info { flex: 1; min-width: 0; }
.r-wallet-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-wallet-addr { font-size: 10px; color: var(--text3); font-family: monospace; }
.r-wallet-stats { display: flex; gap: 6px; }
.r-stat { display: flex; flex-direction: column; align-items: center; }
.r-stat-label { font-size: 9px; color: var(--text3); }
.r-stat-val   { font-size: 11px; font-weight: 700; }
.r-score { font-size: 16px; font-weight: 700; flex-shrink: 0; }
.r-loading { padding: 20px; text-align: center; color: var(--text3); font-size: 12px; }
.r-empty   { padding: 20px; text-align: center; color: var(--text3); font-size: 12px; }

.r-profile-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.r-profile-name { font-size: 16px; font-weight: 700; }
.r-profile-addr { font-size: 10px; color: var(--text3); font-family: monospace; display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.r-score-big { font-size: 28px; font-weight: 700; }
.r-stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.r-stat-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.r-stat-card-label { font-size: 10px; color: var(--text3); margin-bottom: 4px; }
.r-stat-card-val { font-size: 14px; font-weight: 700; }
.r-section-title { font-size: 11px; font-weight: 700; color: var(--text3); letter-spacing: 1px; margin-bottom: 8px; }
.r-trades { display: flex; flex-direction: column; gap: 6px; }
.r-trade-row { display: flex; gap: 8px; align-items: center; font-size: 12px; padding: 6px; background: var(--surface2); border-radius: var(--radius-sm); }
.r-trade-token { font-weight: 700; flex: 1; }
.r-trade-roi { font-weight: 700; }
.r-trade-vol { color: var(--text3); }
.r-btn-add    { padding: 5px 12px; background: var(--go-bg); border: 1px solid var(--go); color: var(--go); border-radius: var(--radius-sm); font-size: 12px; }
.r-btn-remove { padding: 5px 12px; background: var(--nogo-bg); border: 1px solid var(--nogo); color: var(--nogo); border-radius: var(--radius-sm); font-size: 12px; }

/* ── Meta badges ───────────────────────────────────────────────────────────── */
.meta-badge {
  font-size: 10px; padding: 2px 7px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text3);
  white-space: nowrap;
}
.meta-badge.hot      { border-color: var(--watch); color: var(--watch); }
.meta-badge.emerging { border-color: var(--accent); color: var(--accent); }
.meta-badge.cooling  { color: var(--text3); }

/* ── Position items ────────────────────────────────────────────────────────── */
.position-item { display: flex; justify-content: space-between; padding: 6px 0; font-size: 12px; border-bottom: 1px solid var(--border); }
.position-pnl.pos { color: var(--go); }
.position-pnl.neg { color: var(--nogo); }

/* ── Alert items ───────────────────────────────────────────────────────────── */
.alert-item { padding: 6px 0; font-size: 11px; border-bottom: 1px solid var(--border); }
.alert-sym { font-weight: 700; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .main { margin-left: 0; }
  .detail-panel { width: 100%; }
  .hstat { display: none; }
  .header-center { display: none; }
  .research-panel { flex-direction: column; height: 90vh; }
  .research-left { width: 100%; height: 50%; border-right: none; border-bottom: 1px solid var(--border); }
}

@media (min-width: 769px) {
  .hamburger { display: none; }
  .sidebar { transform: translateX(0); }
  .sidebar-overlay { display: none !important; }
  .main { margin-left: 260px; }
  .detail-panel { width: 420px; }
}
