/* ============================================================
   SIGNAL BOARD — CRYPTO TRADING DASHBOARD
   Dark Terminal Aesthetic — v1.0
   ============================================================ */

:root {
  --bg-base: #090909;
  --bg-card: #111111;
  --bg-hover: #1a1a1a;
  --bg-modal: #0f0f0f;
  --border: #222222;
  --border-light: #2a2a2a;
  --text-primary: #f0f0f0;
  --text-secondary: #888888;
  --text-muted: #444444;
  --signal-long: #00d084;
  --signal-short: #ff4d6d;
  --signal-neutral: #ffa500;
  --accent: #3b82f6;
  --gold: #c9a84c;
  --gold-dark: rgba(201, 168, 76, 0.15);
  --long-bg: rgba(0, 208, 132, 0.08);
  --long-border: rgba(0, 208, 132, 0.25);
  --short-bg: rgba(255, 77, 109, 0.08);
  --short-border: rgba(255, 77, 109, 0.25);
  --neutral-bg: rgba(255, 165, 0, 0.08);
  --header-h: 56px;
  --sidebar-w: 300px;
  --radius: 6px;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* ── TYPOGRAPHY HELPERS ── */
.mono { font-family: 'JetBrains Mono', monospace; }
.space { font-family: 'Space Grotesk', sans-serif; }

/* ============================================================
   HEADER
   ============================================================ */
#main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(9, 9, 9, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.logo-icon { color: var(--accent); font-size: 1.3rem; }
.logo-text { color: var(--text-primary); }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--signal-long);
  background: rgba(0, 208, 132, 0.08);
  border: 1px solid rgba(0, 208, 132, 0.2);
  padding: 3px 8px;
  border-radius: 4px;
}

.live-dot {
  width: 7px; height: 7px;
  background: var(--signal-long);
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(0,208,132,0.4); }
  50% { opacity: 0.7; transform: scale(0.9); box-shadow: 0 0 0 4px rgba(0,208,132,0); }
}

.header-center {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  justify-content: center;
}

.btc-price-widget, .eth-price-widget, .fear-greed-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius);
}

.btc-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.btc-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btc-change {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.refresh-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.countdown-bar-wrap {
  width: 60px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.countdown-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transition: width 1s linear;
}

.countdown-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-secondary);
  min-width: 28px;
}

.candle-info {
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.candle-info strong { color: var(--signal-neutral); font-family: 'JetBrains Mono', monospace; }

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.btn-icon.accent { color: var(--accent); border-color: rgba(59,130,246,0.3); }
.btn-icon.accent:hover { background: rgba(59,130,246,0.1); }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
  gap: 0;
}

.content-area {
  flex: 1;
  min-width: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.signals-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signals-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.filter-pills {
  display: flex;
  gap: 4px;
}

.pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 500;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.pill:hover { border-color: var(--border-light); color: var(--text-primary); }
.pill.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ============================================================
   SIGNAL CARDS
   ============================================================ */
.signals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.loading-state {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.signal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 3px solid transparent;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  animation: slideIn 0.3s ease;
}
.signal-card:hover { background: var(--bg-hover); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
.signal-card.long { border-left-color: var(--signal-long); border: 1px solid var(--long-border); border-left: 3px solid var(--signal-long); background: var(--long-bg); }
.signal-card.short { border-left-color: var(--signal-short); border: 1px solid var(--short-border); border-left: 3px solid var(--signal-short); background: var(--short-bg); }
.signal-card.high-priority::after {
  content: 'ALTA PRIORIDAD';
  position: absolute;
  top: 12px; right: 12px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: var(--gold-dark);
  border: 1px solid rgba(201,168,76,0.3);
  padding: 2px 6px;
  border-radius: 3px;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 3px;
}
.card-badge.long { background: rgba(0,208,132,0.12); color: var(--signal-long); border: 1px solid rgba(0,208,132,0.3); }
.card-badge.short { background: rgba(255,77,109,0.12); color: var(--signal-short); border: 1px solid rgba(255,77,109,0.3); }

.card-symbol {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.card-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.card-metrics { margin-bottom: 12px; }

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.score-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  width: 80px;
  flex-shrink: 0;
}

.score-bar-wrap {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}
.score-bar-fill.long { background: var(--signal-long); }
.score-bar-fill.short { background: var(--signal-short); }

.score-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-secondary);
  width: 30px;
  text-align: right;
}

.card-levels {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 0.7rem;
}

.level-item { display: flex; justify-content: space-between; }
.level-label { color: var(--text-secondary); }
.level-val { font-family: 'JetBrains Mono', monospace; font-weight: 500; }
.level-val.sl { color: var(--signal-short); }
.level-val.tp { color: var(--signal-long); }
.level-val.entry { color: var(--text-primary); }

.card-funding {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  gap: 12px;
}

.card-catalyst {
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: rgba(59,130,246,0.05);
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.candle-wait {
  font-size: 0.68rem;
  color: var(--signal-neutral);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── EXTRA SIGNAL BADGES ROW ── */
.card-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
  min-height: 0;
}

.card-badge-extra {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.card-badge-extra.confirmed {
  background: rgba(0, 208, 132, 0.12);
  color: var(--signal-long);
  border: 1px solid rgba(0, 208, 132, 0.3);
}

.card-badge-extra.waiting {
  background: rgba(255, 165, 0, 0.08);
  color: var(--signal-neutral);
  border: 1px solid rgba(255, 165, 0, 0.25);
}

.card-badge-extra.divergence {
  background: rgba(255, 77, 109, 0.1);
  color: var(--signal-short);
  border: 1px solid rgba(255, 77, 109, 0.3);
  animation: badge-pulse 2s ease-in-out infinite;
}

.card-badge-extra.adverse {
  background: rgba(255, 165, 0, 0.12);
  color: var(--signal-neutral);
  border: 1px solid rgba(255, 165, 0, 0.35);
  font-weight: 700;
}

.card-badge-extra.short-dim {
  background: rgba(255, 77, 109, 0.07);
  color: #ff8099;
  border: 1px solid rgba(255, 77, 109, 0.2);
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}


.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.card-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 500;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
  text-align: center;
}
.card-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.card-btn.primary { border-color: var(--accent); color: var(--accent); }
.card-btn.primary:hover { background: rgba(59,130,246,0.1); }

/* compact mode */
body.compact .signal-card .card-levels,
body.compact .signal-card .card-actions,
body.compact .signal-card .card-catalyst,
body.compact .signal-card .card-metrics { display: none; }
body.compact .signal-card { padding: 10px 14px; }
body.compact .signals-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ============================================================
   MARKET TABLE
   ============================================================ */
.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  width: 160px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 800px;
}

.market-table thead {
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--border);
}

.market-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
}

.market-table th.sortable { cursor: pointer; }
.market-table th.sortable:hover { color: var(--text-primary); }
.market-table th.active { color: var(--accent); }

.market-table tbody tr {
  border-bottom: 1px solid rgba(34,34,34,0.5);
  transition: background 0.12s;
  cursor: pointer;
}
.market-table tbody tr:hover { background: var(--bg-hover); }
.market-table tbody tr.signal-row-long { background: rgba(0,208,132,0.03); }
.market-table tbody tr.signal-row-short { background: rgba(255,77,109,0.03); }

.market-table td {
  padding: 9px 12px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.market-table td.mono { font-family: 'JetBrains Mono', monospace; }

.rank-num { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; }

.token-cell { display: flex; align-items: center; gap: 8px; }
.token-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}
.token-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.token-name { font-weight: 600; font-family: 'Space Grotesk', sans-serif; font-size: 0.8rem; }
.token-full { font-size: 0.65rem; color: var(--text-muted); }

.price-cell { font-family: 'JetBrains Mono', monospace; font-weight: 500; }
.change-cell { font-family: 'JetBrains Mono', monospace; font-weight: 500; }
.positive { color: var(--signal-long); }
.negative { color: var(--signal-short); }
.neutral-val { color: var(--text-secondary); }

.vol-mcap-cell { font-family: 'JetBrains Mono', monospace; }
.vol-mcap-cell.high { color: var(--gold); }

.funding-cell { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.funding-cell.positive { color: var(--signal-long); }
.funding-cell.negative { color: var(--signal-short); }

.rsi-cell { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; }
.rsi-cell.oversold { color: var(--signal-long); font-weight: 600; }
.rsi-cell.overbought { color: var(--signal-short); font-weight: 600; }

.score-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}
.score-mini-bar {
  width: 40px; height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.score-mini-fill { height: 100%; border-radius: 2px; }

.signal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.signal-badge.long { background: rgba(0,208,132,0.12); color: var(--signal-long); border: 1px solid rgba(0,208,132,0.25); }
.signal-badge.short { background: rgba(255,77,109,0.12); color: var(--signal-short); border: 1px solid rgba(255,77,109,0.25); }
.signal-badge.neutral { background: rgba(255,165,0,0.08); color: var(--signal-neutral); border: 1px solid rgba(255,165,0,0.2); }

.loading-cell {
  text-align: center;
  padding: 30px;
  color: var(--text-secondary);
}

/* ============================================================
   UNLOCKS SECTION
   ============================================================ */
.unlocks-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.unlocks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 600px;
}

.unlocks-table thead {
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border);
}

.unlocks-table th {
  padding: 9px 14px;
  text-align: left;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.unlocks-table tbody tr {
  border-bottom: 1px solid rgba(34,34,34,0.5);
  transition: background 0.12s;
}
.unlocks-table tbody tr:hover { background: var(--bg-hover); }
.unlocks-table tbody tr.impact-high { background: var(--gold-dark); border-left: 2px solid var(--gold); }

.unlocks-table td {
  padding: 9px 14px;
  font-size: 0.78rem;
}

.impact-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
}
.impact-badge.high { background: var(--gold-dark); color: var(--gold); border: 1px solid rgba(201,168,76,0.3); }
.impact-badge.medium { background: rgba(255,165,0,0.08); color: var(--signal-neutral); border: 1px solid rgba(255,165,0,0.2); }
.impact-badge.low { background: rgba(255,255,255,0.04); color: var(--text-secondary); border: 1px solid var(--border); }

.empty-unlocks {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ── Toggle switch ── */
.toggle-switch {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-hover);
  border-radius: 24px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: rgba(0,255,136,0.15);
  border-color: var(--signal-long);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--signal-long);
}

/* ============================================================
   WATCHLIST SIDEBAR
   ============================================================ */
.watchlist-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: rgba(17,17,17,0.5);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.tab-content.active { display: flex; }

.watchlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.wl-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-small {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}
.btn-small:hover { background: rgba(59,130,246,0.1); }

.watchlist-list, .trades-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.wl-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
  transition: all 0.15s;
}
.wl-item:hover { border-color: var(--border-light); }

.wl-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.wl-symbol { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 0.85rem; }
.wl-current-price { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--text-secondary); }

.wl-pnl-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.wl-entry-price { font-size: 0.68rem; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }
.wl-pnl { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 600; }

.wl-alert-row {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.wl-catalyst { font-size: 0.65rem; color: var(--text-secondary); line-height: 1.4; margin-bottom: 6px; }

.wl-actions { display: flex; gap: 4px; }
.wl-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
  text-align: center;
}
.wl-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.wl-btn.danger:hover { color: var(--signal-short); border-color: rgba(255,77,109,0.3); }

.trade-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
}
.trade-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.trade-symbol-dir { display: flex; align-items: center; gap: 6px; }
.trade-sym { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 0.82rem; }
.trade-dir { font-size: 0.62rem; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.trade-dir.long { background: rgba(0,208,132,0.12); color: var(--signal-long); }
.trade-dir.short { background: rgba(255,77,109,0.12); color: var(--signal-short); }
.trade-result { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 600; }
.trade-result.win { color: var(--signal-long); }
.trade-result.loss { color: var(--signal-short); }
.trade-result.open { color: var(--signal-neutral); }
.trade-prices { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; color: var(--text-secondary); margin-top: 2px; }
.trade-notes-text { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.trade-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color 0.15s;
}
.trade-del-btn:hover { color: var(--signal-short); }

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ============================================================
   DETAIL PANEL
   ============================================================ */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.detail-overlay.open { opacity: 1; pointer-events: all; }

.detail-panel {
  position: fixed;
  top: 0; right: -440px;
  width: 440px;
  height: 100vh;
  background: var(--bg-modal);
  border-left: 1px solid var(--border);
  z-index: 201;
  overflow-y: auto;
  padding: 20px;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-panel.open { right: 0; }

.detail-close {
  position: sticky;
  top: 0;
  float: right;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 30px; height: 30px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 1;
}
.detail-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.detail-symbol {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
  clear: both;
}

.detail-price-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 600;
}

.detail-section { margin-bottom: 20px; }

.detail-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.detail-score-breakdown { display: flex; flex-direction: column; gap: 8px; }
.detail-score-row { display: flex; align-items: center; gap: 8px; }
.detail-score-label { width: 100px; font-size: 0.72rem; color: var(--text-secondary); }
.detail-score-bar-wrap { flex: 1; height: 5px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.detail-score-bar-fill { height: 100%; border-radius: 3px; }
.detail-score-pct { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; width: 36px; text-align: right; }

.levels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.level-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
}
.level-box-label { font-size: 0.62rem; color: var(--text-secondary); margin-bottom: 2px; }
.level-box-val { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 600; }
.level-box-val.entry { color: var(--text-primary); }
.level-box-val.sl { color: var(--signal-short); }
.level-box-val.tp { color: var(--signal-long); }
.level-box-val.rr { color: var(--accent); }

.indicators-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.indicator-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
}
.indicator-label { font-size: 0.62rem; color: var(--text-secondary); margin-bottom: 2px; }
.indicator-val { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 500; }

.catalyst-textarea {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  border-radius: var(--radius);
  padding: 10px;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 8px;
}
.catalyst-textarea:focus { border-color: var(--accent); }
.catalyst-textarea::placeholder { color: var(--text-muted); }

/* ── Trade Plan (detail panel) ─────────────────────────────── */
.detail-quality-chip {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 4px; border: 1px solid;
  background: rgba(255,255,255,0.02); text-transform: uppercase;
  margin-left: auto;
}
.tp-summary {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
  background: rgba(255,255,255,0.015); border: 1px solid var(--border-light);
  border-radius: 8px; overflow: hidden;
}
.tp-summary td {
  padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
}
.tp-summary tr:last-child td { border-bottom: none; }
.tp-summary td:first-child { color: var(--text-muted); width: 48%; }
.tp-summary td:last-child  { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tp-summary td.tp-pos strong { color: #10b981; }
.tp-summary td.tp-neg strong { color: #ef4444; }
.tp-muted { color: var(--text-muted); font-weight: 400; font-size: 0.72rem; }

.tp-narrative { display: flex; flex-direction: column; gap: 10px; }
.tp-narrative p {
  margin: 0; font-size: 0.78rem; line-height: 1.55;
  color: var(--text-secondary);
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border-left: 2px solid var(--border);
  border-radius: 0 6px 6px 0;
}
.tp-narrative p strong { color: var(--text-primary); font-weight: 600; }
.tp-narrative p.tp-risk {
  border-left-color: #ef4444;
  background: rgba(239,68,68,0.06);
}
.tp-narrative p.tp-risk strong { color: #ef4444; }

.tp-plan {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 0.72rem; line-height: 1.7;
  color: var(--text-primary);
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
}

.signal-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-item {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.72rem;
}
.history-date { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; margin-bottom: 2px; }
.history-trade { color: var(--text-secondary); }
.history-result { font-weight: 600; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 460px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
.modal.small-modal { width: 360px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 3px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-group {
  margin-bottom: 8px;
}
.settings-group h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
}

label input, label select, label textarea {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
label input:focus, label select:focus, label textarea:focus { border-color: var(--accent); }
label select { cursor: pointer; }
label select option { background: #111; }
label textarea { resize: vertical; line-height: 1.5; }

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.input-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.input-row span { font-family: 'JetBrains Mono', monospace; color: var(--accent); font-weight: 600; }

.btn-primary {
  background: var(--accent);
  border: none;
  color: white;
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
  width: 100%;
  margin-top: 4px;
}
.btn-primary:hover { background: #2563eb; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   TOASTS
   ============================================================ */
#toasts-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 260px;
  max-width: 340px;
  border-left: 3px solid;
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
  animation: toastIn 0.3s ease;
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.toast.long { border-left-color: var(--signal-long); border: 1px solid rgba(0,208,132,0.3); border-left: 3px solid var(--signal-long); }
.toast.short { border-left-color: var(--signal-short); border: 1px solid rgba(255,77,109,0.3); border-left: 3px solid var(--signal-short); }
.toast.info { border-left-color: var(--accent); border: 1px solid rgba(59,130,246,0.3); border-left: 3px solid var(--accent); }
.toast.success { border-left-color: var(--signal-long); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-body { flex: 1; }
.toast-title { font-family: 'Space Grotesk', sans-serif; font-size: 0.8rem; font-weight: 600; margin-bottom: 2px; }
.toast-msg { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.4; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
  align-self: flex-start;
}
.toast-close:hover { color: var(--text-primary); }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.small { width: 14px; height: 14px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   STALE INDICATOR
   ============================================================ */
.stale-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  color: var(--signal-neutral);
  background: rgba(255,165,0,0.08);
  border: 1px solid rgba(255,165,0,0.2);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ============================================================
   RISK MANAGEMENT PANEL
   ============================================================ */

.risk-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 0 0 12px;
}

.risk-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
}

.risk-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.risk-capital-row {
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border);
}

.risk-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.risk-input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 5px 8px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
.risk-input:focus { border-color: var(--accent); }

.risk-metrics {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.risk-traffic {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.risk-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease, background 0.4s ease;
}

.risk-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}

.risk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.risk-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.risk-item-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.risk-item-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.risk-alert {
  background: rgba(255, 165, 0, 0.1);
  border: 1px solid rgba(255, 165, 0, 0.3);
  border-radius: 4px;
  color: #ffa500;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 6px 8px;
  margin-top: 4px;
}

/* ============================================================
   ACTIVE TRADES PANEL
   ============================================================ */

.active-trades-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.at-balance {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.active-trades-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.at-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.at-item:hover { border-color: var(--border-bright); }

.at-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 4px;
}

.at-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  flex: 1;
}

.at-item-body {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.at-pnl {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   RESPONSIVE — MOBILE FIRST

   ============================================================ */

/* ── TABLET (< 1100px) ── */
@media (max-width: 1100px) {
  .watchlist-sidebar { display: none; }
  .header-center { gap: 12px; }
  #dominance-widget { display: none; }
}

/* ── MOBILE (< 768px) ── */
@media (max-width: 768px) {
  :root { --header-h: 50px; }

  /* Header mobile */
  #main-header {
    padding: 0 12px;
    gap: 8px;
  }
  .logo-text { font-size: 0.95rem; }
  .header-center { display: none; }
  .refresh-info { display: none; }
  .candle-info { display: none; }
  .btn-icon { padding: 5px 8px; font-size: 0.7rem; }

  /* Show a minimal BTC price in header on mobile */
  #main-header::after {
    content: '';
    display: none;
  }

  /* Layout mobile — single column */
  .main-layout {
    flex-direction: column;
    padding-bottom: 60px; /* space for bottom nav */
  }

  .content-area {
    padding: 10px;
    gap: 16px;
  }

  /* Signals grid — single column */
  .signals-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .signal-card { padding: 14px; }

  .card-levels {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .card-actions {
    flex-direction: row;
  }

  .card-btn { padding: 7px 6px; font-size: 0.7rem; }

  /* Section headers */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .table-controls {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 8px;
  }

  .search-input { width: 100%; }

  .filter-pills { flex-wrap: wrap; gap: 4px; }

  /* Market table — scrollable horizontally */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .market-table th, .market-table td { padding: 8px 10px; font-size: 0.72rem; }

  /* Hide less critical columns on mobile */
  .market-table th:nth-child(5),
  .market-table td:nth-child(5),
  .market-table th:nth-child(6),
  .market-table td:nth-child(6),
  .market-table th:nth-child(7),
  .market-table td:nth-child(7) {
    display: none;
  }

  /* Detail panel full screen on mobile */
  .detail-panel {
    width: 100%;
    right: -100%;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
  }
  .detail-panel.open { right: 0; }

  /* Modals full screen on mobile */
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius) var(--radius) 0 0;
    align-self: flex-end;
  }
  .modal-overlay { align-items: flex-end; }

  /* Unlocks table */
  .unlocks-table th:nth-child(3),
  .unlocks-table td:nth-child(3) { display: none; }

  /* Levels grid in detail */
  .levels-grid { grid-template-columns: 1fr 1fr; }
  .indicators-grid { grid-template-columns: 1fr 1fr; }
}

/* ── BOTTOM NAV (mobile only) ── */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: rgba(9, 9, 9, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 150;
    align-items: stretch;
  }

  .mob-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    transition: color 0.15s;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-nav-btn:active { background: rgba(255,255,255,0.04); }
  .mob-nav-btn.active { color: var(--accent); }
  .mob-nav-icon { font-size: 1.1rem; line-height: 1; }
  .mob-nav-label { font-size: 0.58rem; }

  /* Mobile section visibility */
  .market-section,
  .unlocks-section,
  .signals-section,
  .nav-section {
    display: none !important;
  }
  .market-section.mobile-active,
  .unlocks-section.mobile-active,
  .signals-section.mobile-active,
  .nav-section.mobile-active {
    display: block !important;
  }

  /* Mobile watchlist overlay — hidden by default, shown via .mobile-open */
  .watchlist-sidebar {
    display: none;
    position: fixed;
    bottom: 56px; left: 0; right: 0;
    height: calc(60vh);
    width: 100%;
    z-index: 140;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    background: var(--bg-modal);
  }
  .watchlist-sidebar.mobile-open {
    display: flex;
  }
}

/* ── HIDDEN ON DESKTOP ── */
@media (min-width: 769px) {
  .mobile-bottom-nav { display: none; }
}

/* ── PWA / iPhone safe areas ── */
@supports (padding-top: env(safe-area-inset-top)) {
  #main-header {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--header-h) + env(safe-area-inset-top));
  }
  .main-layout {
    margin-top: calc(var(--header-h) + env(safe-area-inset-top));
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
  }
  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(56px + env(safe-area-inset-bottom));
  }
  .detail-panel {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ── TOUCH IMPROVEMENTS ── */
@media (hover: none) {
  .signal-card:hover { transform: none; box-shadow: none; }
  .market-table tbody tr:hover { background: transparent; }
  .market-table tbody tr:active { background: var(--bg-hover); }
  .signal-card:active { background: var(--bg-hover); }
  .wl-item:hover { border-color: var(--border); }

  /* Bigger tap targets */
  .pill { padding: 6px 12px; }
  .tab-btn { padding: 14px; }
  .wl-btn { padding: 6px 8px; }
}

/* ── SIGNAL LIFECYCLE STYLES ─────────────────────────────── */

/* Status bar at top of card */
.signal-status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.signal-status-bar.pending {
  background: rgba(255,165,0,0.08);
  border: 1px solid rgba(255,165,0,0.2);
  color: #ffa500;
}

.signal-status-bar.active {
  background: rgba(0,208,132,0.12);
  border: 1px solid rgba(0,208,132,0.3);
  color: #00d084;
  justify-content: space-between;
}

.signal-status-bar.weak {
  background: rgba(255,165,0,0.1);
  border: 1px solid rgba(255,140,0,0.35);
  color: #ff8c00;
}

.signal-status-bar.invalid {
  background: rgba(255,77,109,0.1);
  border: 1px solid rgba(255,77,109,0.3);
  color: #ff4d6d;
}

/* Status dots */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pending-dot {
  background: #ffa500;
}

.active-dot {
  background: #00d084;
  box-shadow: 0 0 6px rgba(0,208,132,0.8);
  animation: pulse-green 1.5s infinite;
}

.weak-dot {
  background: #ff8c00;
}

.invalid-dot {
  background: #ff4d6d;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 4px rgba(0,208,132,0.6); }
  50% { box-shadow: 0 0 10px rgba(0,208,132,1); }
}

/* Close button in active status bar */
.status-close-btn {
  background: rgba(255,77,109,0.15);
  border: 1px solid rgba(255,77,109,0.3);
  color: #ff4d6d;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  margin-left: auto;
  transition: background 0.15s;
}
.status-close-btn:hover {
  background: rgba(255,77,109,0.25);
}

/* Card state variants */
.signal-card.card-active {
  border-color: rgba(0,208,132,0.35) !important;
  box-shadow: 0 0 12px rgba(0,208,132,0.08);
}

.signal-card.card-weak {
  opacity: 0.75;
  border-color: rgba(255,140,0,0.3) !important;
}

.signal-card.card-invalid {
  opacity: 0.5;
  filter: grayscale(30%);
}

/* Enter trade button */
.card-btn.enter-btn {
  background: rgba(0,208,132,0.12);
  border: 1px solid rgba(0,208,132,0.35);
  color: #00d084;
  font-weight: 600;
  transition: background 0.15s;
}
.card-btn.enter-btn:hover {
  background: rgba(0,208,132,0.22);
}

.card-btn.enter-btn.weak-enter {
  background: rgba(255,140,0,0.1);
  border-color: rgba(255,140,0,0.3);
  color: #ff8c00;
}

/* Invalid overlay */
.signal-invalid-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9,9,9,0.85);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 10;
  backdrop-filter: blur(2px);
}

.invalid-icon {
  font-size: 2rem;
  color: #ff4d6d;
}

.invalid-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ff4d6d;
  letter-spacing: 0.1em;
}

.invalid-sub {
  font-size: 0.7rem;
  color: #888;
  text-align: center;
  padding: 0 20px;
}

.invalid-dismiss {
  margin-top: 6px;
  padding: 5px 16px;
  background: rgba(255,77,109,0.15);
  border: 1px solid rgba(255,77,109,0.3);
  color: #ff4d6d;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}
.invalid-dismiss:hover {
  background: rgba(255,77,109,0.25);
}

/* ── DURATION PILL ── */
.dur-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid;
  margin-top: 4px;
  white-space: nowrap;
}
.dur-detail {
  font-weight: 400;
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
}

/* ── FRESHNESS BAR ── */
.freshness-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.freshness-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
  width: 46px;
}
.freshness-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.freshness-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease, background 0.4s ease;
}
.freshness-val {
  font-size: 0.6rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  min-width: 72px;
  text-align: right;
}

/* ── RETEST WARNING ── */
.retest-warning {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.65rem;
  color: #f59e0b;
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 4px;
  padding: 5px 8px;
  margin: 4px 0;
  line-height: 1.4;
}
.retest-icon { flex-shrink: 0; }

/* Card retested state — amber tint on border */
.signal-card.card-retested:not(.card-active):not(.card-invalid) {
  border-color: rgba(245,158,11,0.3) !important;
}

/* ── CLOSE TRADE MODAL ── */
.ct-summary {
  background: var(--surface-2, rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ct-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.ct-label { opacity: 0.55; }
.ct-value { font-weight: 600; font-size: 0.9rem; }
.ct-pnl-val { font-size: 1rem; }
.ct-result-btns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.btn-result {
  padding: 10px 4px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-result:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-result.win  { background: rgba(16,185,129,0.2); color: #10b981; border: 1px solid rgba(16,185,129,0.35); }
.btn-result.loss { background: rgba(239,68,68,0.2);  color: #ef4444; border: 1px solid rgba(239,68,68,0.35); }
.btn-result.be   { background: rgba(148,163,184,0.15); color: #94a3b8; border: 1px solid rgba(148,163,184,0.25); }

/* ── CLOSE TRADE CARD BUTTON ── */
.close-trade-btn {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(251,191,36,0.08));
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.3);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}
.close-trade-btn:hover {
  background: linear-gradient(135deg, rgba(245,158,11,0.28), rgba(251,191,36,0.15));
  transform: translateY(-1px);
}

/* inline PnL in active status bar */
.active-pnl-inline {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
}

/* ── BINANCE POSITIONS ── */
.bn-section {
  margin-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 10px;
}
.bn-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.7;
  margin-bottom: 8px;
}
.bn-balance { font-weight: 400; opacity: 0.8; }
.bn-position { border-left: 2px solid #f59e0b !important; }
.bn-badge {
  font-size: 0.58rem;
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: auto;
}

/* ── BTN SECONDARY ── */
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* ════════════════════════════════════════════════════════════════
   SIGNAL CARD V2 — Bloomberg Terminal / TradingView feel
   ════════════════════════════════════════════════════════════════ */

/* Grid: 2 wide cards per row instead of 3-4 small ones */
.signals-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)) !important;
  gap: 14px !important;
}

.sc2-card {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}
.sc2-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.sc2-card:hover { border-color: rgba(255,255,255,0.16); box-shadow: 0 4px 24px rgba(0,0,0,0.4); }
.sc2-card.short { border-left: 3px solid var(--signal-short); }
.sc2-card.long  { border-left: 3px solid var(--signal-long); }
.sc2-card.is-active { border-color: rgba(251,191,36,0.4); box-shadow: 0 0 0 1px rgba(251,191,36,0.15); }
.sc2-card.is-invalid { opacity: 0.55; }
.sc2-card.state-ideal  { border-left-color: #10b981; }
.sc2-card.state-expired { opacity: 0.6; }

/* ① HEADER */
/* NOW CONDITIONS widget */
.sc2-now-cond {
  border-left: 3px solid;
  border-radius: 0 6px 6px 0;
  background: rgba(255,255,255,0.02);
  padding: 7px 10px;
  margin: 0 0 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nc-header { display: flex; align-items: center; gap: 5px; }
.nc-icon   { font-size: 0.78rem; }
.nc-label  { font-size: 0.68rem; font-weight: 700; }
.nc-details { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.nc-ok  { font-size: 0.6rem; color: #10b981; background: rgba(16,185,129,0.08); padding: 1px 6px; border-radius: 4px; }
.nc-bad { font-size: 0.6rem; color: #ef4444; background: rgba(239,68,68,0.08);  padding: 1px 6px; border-radius: 4px; }

.sc2-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.sc2-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.sc2-dir {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.sc2-dir.short { background: rgba(239,68,68,0.15);  color: var(--signal-short); border: 1px solid rgba(239,68,68,0.3); }
.sc2-dir.long  { background: rgba(16,185,129,0.15); color: var(--signal-long);  border: 1px solid rgba(16,185,129,0.3); }
.sc2-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.02em;
}

/* Lifecycle chip */
.lc-chip {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.lc-active   { background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); animation: lc-pulse 2s infinite; }
.lc-weak     { background: rgba(245,158,11,0.12); color: #f59e0b; border: 1px solid rgba(245,158,11,0.25); }
.lc-invalid  { background: rgba(239,68,68,0.1);  color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
.lc-zone     { background: rgba(16,185,129,0.1); color: #10b981; border: 1px solid rgba(16,185,129,0.2); }
@keyframes lc-pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

/* Health ring */
.sc2-header-right { flex-shrink: 0; }
.sc2-health-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: conic-gradient(var(--hc) var(--hp), rgba(255,255,255,0.07) 0deg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.sc2-health-inner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sc2-health-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--hc);
}

/* ② PRICE ROW */
.sc2-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.sc2-price {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-right: 6px;
}
.sc2-change { font-size: 0.82rem; font-weight: 600; }
.card-pnl-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid;
  margin-left: 6px;
}
.sc2-state-chip {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ③ HEALTH BAR */
.sc2-health-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sc2-health-bar-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
.sc2-health-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.sc2-health-pct {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 34px;
  text-align: right;
}
.sc2-quicksum {
  display: flex; gap: 10px; padding: 6px 14px 8px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.7rem;
}
.sc2-qs-item { display: flex; align-items: center; gap: 5px; }
.sc2-qs-lbl  { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.6rem; }
.sc2-qs-val  { color: var(--text-primary); font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; }
.sc2-qs-val.rb { color: var(--accent); }
.sc2-bd-warn { color: #ef4444; font-weight: 700; margin-left: 3px; opacity: 0.7; }
.sc2-bd-weak { color: #f59e0b; font-weight: 700; margin-left: 3px; opacity: 0.7; }

/* ══ 🏦 LABORATORIO DEFI ══════════════════════════════════════ */
.defi-content { display: flex; flex-direction: column; gap: 14px; }
.defi-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.defi-sum-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px;
  background: var(--bg-card, rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.defi-sum-lbl { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.defi-sum-val { font-size: 1.05rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: #10b981; }
.defi-sum-sub { font-size: 0.64rem; color: var(--text-muted); }
.defi-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.defi-filters { display: flex; gap: 6px; }
.defi-fbtn {
  padding: 6px 13px;
  font-size: 0.7rem; font-weight: 600;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.defi-fbtn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.defi-search {
  flex: 1; min-width: 180px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}
.defi-list { display: flex; flex-direction: column; gap: 10px; }
.defi-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card, rgba(255,255,255,0.02));
  padding: 12px 14px;
  transition: border-color 0.15s;
}
.defi-card:hover { border-color: rgba(255,255,255,0.16); }
.defi-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.defi-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.defi-sym  { font-weight: 700; font-size: 0.86rem; font-family: 'JetBrains Mono', monospace; }
.defi-proj { font-size: 0.7rem; color: var(--text-secondary); }
.defi-chain {
  font-size: 0.6rem; font-weight: 600;
  padding: 2px 7px; border-radius: 4px;
  background: rgba(99,102,241,0.12); color: #818cf8;
  border: 1px solid rgba(99,102,241,0.3);
}
.defi-tag-stable {
  font-size: 0.56rem; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(16,185,129,0.1); color: #10b981;
  border: 1px solid rgba(16,185,129,0.3);
  letter-spacing: 0.05em;
}
.defi-sig { font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.defi-card-metrics {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin: 10px 0 8px;
}
.defi-m { display: flex; flex-direction: column; gap: 1px; }
.defi-m-lbl { font-size: 0.56rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.defi-m-val { font-size: 0.8rem; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.defi-m-val.apy { color: #10b981; font-size: 0.92rem; }
.defi-risk-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.06); overflow: hidden; }
.defi-risk-fill { height: 100%; border-radius: 2px; transition: width 0.4s; }
.defi-card-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; align-items: baseline; }
.defi-risk-lbl { font-size: 0.64rem; font-weight: 700; white-space: nowrap; }
.defi-reason { font-size: 0.62rem; color: var(--text-muted); text-align: right; }
.defi-note {
  font-size: 0.68rem; line-height: 1.6;
  color: var(--text-muted);
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Variantes por sección: estables (verde) vs alto rendimiento (naranja) */
.defi-card--stable {
  border-left: 3px solid #10b981;
  background: linear-gradient(90deg, rgba(16,185,129,0.05), var(--bg-card, rgba(255,255,255,0.02)) 30%);
}
.defi-card--high {
  border-left: 3px solid #f97316;
  background: linear-gradient(90deg, rgba(249,115,22,0.06), var(--bg-card, rgba(255,255,255,0.02)) 30%);
}
.defi-card--stable:hover { border-color: rgba(16,185,129,0.5); border-left-color: #10b981; }
.defi-card--high:hover   { border-color: rgba(249,115,22,0.5); border-left-color: #f97316; }
.defi-tag-high {
  font-size: 0.56rem; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(249,115,22,0.1); color: #f97316;
  border: 1px solid rgba(249,115,22,0.3);
  letter-spacing: 0.05em;
}
.defi-m-val.apy-high { color: #f97316; }
.defi-sum-val--high { color: #f97316; }
.defi-sum-card--high { border-color: rgba(249,115,22,0.3); }

/* Cabeceras de sección */
.defi-sec-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-top: 4px;
}
.defi-sec-head--stable { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); }
.defi-sec-head--high   { background: rgba(249,115,22,0.08); border: 1px solid rgba(249,115,22,0.25); }
.defi-sec-head--track  { background: rgba(139,92,246,0.08); border: 1px solid rgba(139,92,246,0.3); }
.defi-sec-title { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.06em; }
.defi-sec-head--stable .defi-sec-title { color: #10b981; }
.defi-sec-head--high   .defi-sec-title { color: #f97316; }
.defi-sec-head--track  .defi-sec-title { color: #a78bfa; }
.defi-sec-sub { font-size: 0.64rem; color: var(--text-muted); }

/* Seguimiento de pools (violeta) */
.defi-card--track {
  border-left: 3px solid #8b5cf6;
  background: linear-gradient(90deg, rgba(139,92,246,0.07), var(--bg-card, rgba(255,255,255,0.02)) 30%);
}
.defi-card--track:hover { border-color: rgba(139,92,246,0.5); border-left-color: #8b5cf6; }
.defi-sum-card--track { border-color: rgba(139,92,246,0.35); }
.defi-sum-val--track { color: #a78bfa; }
.defi-m-val small { font-size: 0.62rem; font-weight: 600; opacity: 0.85; }
.defi-track-btn {
  font-size: 0.62rem; font-weight: 700;
  padding: 3px 10px; border-radius: 12px;
  border: 1px solid rgba(139,92,246,0.45);
  background: transparent; color: #a78bfa;
  cursor: pointer;
  transition: all 0.15s;
}
.defi-track-btn:hover { background: rgba(139,92,246,0.15); }
.defi-track-btn.on { background: rgba(139,92,246,0.2); color: #c4b5fd; border-color: #8b5cf6; }

/* Checklist EXIT (metodología RugDoc) */
.defi-checklist {
  padding: 12px 16px;
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: var(--radius);
  background: rgba(245,158,11,0.05);
}
.defi-checklist-title { font-size: 0.72rem; font-weight: 700; color: #f59e0b; margin-bottom: 7px; }
.defi-checklist ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.defi-checklist li { font-size: 0.68rem; line-height: 1.5; color: var(--text-secondary); }
.defi-checklist code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.64rem;
  padding: 1px 4px; border-radius: 3px;
  background: rgba(255,255,255,0.07);
}
.defi-checklist a { color: #f59e0b; }

/* Chip de timing (ventana de yield) */
.defi-window { font-size: 0.64rem; font-weight: 600; margin-top: 6px; }

/* Links de verificación por pool */
.defi-links {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.defi-link {
  font-size: 0.62rem; font-weight: 600;
  padding: 3px 9px; border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
}
.defi-link:hover { border-color: rgba(255,255,255,0.3); color: var(--text-primary); }
.defi-link--rug { border-color: rgba(245,158,11,0.4); color: #f59e0b; }
.defi-link--rug:hover { background: rgba(245,158,11,0.1); color: #f59e0b; }
.defi-exit-hint { font-size: 0.58rem; color: var(--text-muted); margin-left: auto; font-style: italic; }

@media (max-width: 768px) {
  .defi-summary { grid-template-columns: 1fr; }
  .defi-card-metrics { gap: 12px; }
  .defi-reason { text-align: left; }
  .defi-card-foot { flex-direction: column; gap: 3px; }
  .defi-exit-hint { margin-left: 0; width: 100%; }
}

/* ⭐ SEÑAL PREMIUM (score ≥ 75) */
.sc2-card.sc2-premium {
  border-color: rgba(240,185,11,0.45);
  box-shadow: 0 0 0 1px rgba(240,185,11,0.25), 0 0 24px rgba(240,185,11,0.10);
  position: relative;
}
.sc2-card.sc2-premium::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(240,185,11,0.07), transparent 35%);
}
.sc2-premium-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.6rem; font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  color: #f0b90b;
  background: rgba(240,185,11,0.12);
  border: 1px solid rgba(240,185,11,0.4);
  letter-spacing: 0.04em;
  animation: premiumPulse 2.4s ease-in-out infinite;
}
@keyframes premiumPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,185,11,0.25); }
  50%      { box-shadow: 0 0 10px 2px rgba(240,185,11,0.15); }
}
.sc2-health-ring.premium { filter: drop-shadow(0 0 6px rgba(240,185,11,0.35)); }

/* 🧪 LABORATORIO TÉCNICO */
.tm-lab {
  margin-top: 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.015);
}
.tm-lab-title {
  padding: 8px 12px;
  font-size: 0.72rem; font-weight: 700;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 6px;
}
.tm-lab-sub { font-size: 0.58rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tm-lab-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-light);
}
.tm-lab-row {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  background: var(--bg-card, #0d0d0d);
  font-size: 0.66rem;
}
.tm-lab-row.fav .tm-lab-val { color: #10b981; }
.tm-lab-row.adv .tm-lab-val { color: #ef4444; }
.tm-lab-ic   { font-size: 0.6rem; }
.tm-lab-name { color: var(--text-muted); flex: 1; }
.tm-lab-val  { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.tm-lab-empty { padding: 10px 12px; font-size: 0.66rem; color: var(--text-muted); }
.tm-lab-read { padding: 9px 12px; border-top: 1px solid var(--border-light); }
.tm-lab-read-title { font-size: 0.66rem; font-weight: 700; margin-bottom: 5px; color: var(--text-secondary); }
.tm-lab-p {
  font-size: 0.68rem; line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 6px;
}
.tm-lab-p:last-child { margin-bottom: 0; color: var(--text-primary); font-weight: 500; }

/* ③b MEJORAS — badges de riesgo, timeframes, expiradas, flash crash */
.sc2-badges {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border-light);
}
.sc2-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.64rem; font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid;
  line-height: 1.3;
}
.sc2-tf-row {
  display: flex; gap: 8px; justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-light);
}
.sc2-tf-item { display: flex; flex-direction: column; align-items: center; gap: 1px; flex: 1; }
.sc2-tf-lbl  { font-size: 0.56rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sc2-tf-val  { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; font-weight: 700; }
.sc2-expired-recalc {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(245,158,11,0.05);
  display: flex; flex-direction: column; gap: 3px;
}
.er-head   { font-size: 0.66rem; font-weight: 600; color: var(--text-secondary); }
.er-age    { color: var(--text-muted); font-weight: 400; }
.er-levels { font-size: 0.64rem; color: var(--text-secondary); }
.er-warn   { font-size: 0.66rem; font-weight: 600; }
.sc2-flashcrash {
  padding: 7px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.64rem;
  color: #f59e0b;
  background: rgba(245,158,11,0.06);
  line-height: 1.45;
}

/* ④ SIGNAL BREAKDOWN */
.sc2-breakdown {
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sc2-bd-dom {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sc2-bd-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sc2-bd-lbl {
  font-size: 0.59rem;
  color: var(--text-muted);
  width: 78px;
  flex-shrink: 0;
}
.sc2-bd-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.sc2-bd-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.sc2-bd-fill.tech { background: #6366f1; }
.sc2-bd-fill.sent { background: #f59e0b; }
.sc2-bd-fill.fund { background: #10b981; }
.sc2-bd-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.59rem;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
}

/* ⑤ RECOMMENDATION */
.sc2-rec {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  border-left: 3px solid;
}
.sc2-rec-icon { font-size: 0.9rem; flex-shrink: 0; }
.sc2-rec-text { font-size: 0.78rem; font-weight: 600; line-height: 1.3; }

/* ⑤ FACTORS GRID */
.sc2-factors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 10px;
}
.sc2-factors-col { display: flex; flex-direction: column; gap: 2px; }
.sc2-factor {
  font-size: 0.63rem;
  line-height: 1.4;
  padding: 1px 0;
}
.sc2-factor.pos { color: #10b981; }
.sc2-factor.neg { color: #ef4444; }

/* ⑥ LEVELS */
.sc2-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 6px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.025);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05);
}
.sc2-level { display: flex; flex-direction: column; gap: 1px; }
.sc2-ll { font-size: 0.55rem; opacity: 0.45; text-transform: uppercase; letter-spacing: 0.05em; }
.sc2-lv {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
}
.sc2-lv.entry { color: #3b82f6; }
.sc2-lv.sl    { color: #ef4444; }
.sc2-lv.tp    { color: #10b981; }
.sc2-lv.rr    { color: #a78bfa; }

/* ⑦ METRICS */
.sc2-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.66rem;
  color: rgba(255,255,255,0.45);
}
.sc2-metrics span { white-space: nowrap; }

/* ⑧ TIMELINE */
.signal-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 4px 2px 2px;
}
.tl-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.2);
  z-index: 1;
  flex-shrink: 0;
}
.tl-hit .tl-dot {
  background: #10b981;
  border-color: #10b981;
  box-shadow: 0 0 6px rgba(16,185,129,0.5);
}
.tl-line {
  position: absolute;
  top: 4px;
  left: 50%;
  right: -50%;
  height: 1.5px;
  background: rgba(255,255,255,0.1);
}
.tl-line-hit { background: #10b981; }
.tl-label {
  font-size: 0.5rem;
  opacity: 0.4;
  margin-top: 3px;
  text-align: center;
  white-space: nowrap;
}
.tl-hit .tl-label { opacity: 0.8; color: #10b981; }

/* ⑨ ACTIONS */
.sc2-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.sc2-btn {
  flex: 1;
  padding: 7px 6px;
  border: none;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  text-align: center;
}
.sc2-btn:hover { opacity: 0.82; transform: translateY(-1px); }
.sc2-btn-detail { background: rgba(255,255,255,0.06); color: #94a3b8; border: 1px solid rgba(255,255,255,0.1); flex: 1.5; }
.sc2-btn-enter  { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); flex: 1.8; }
.sc2-btn-enter.ideal { background: rgba(16,185,129,0.25); box-shadow: 0 0 12px rgba(16,185,129,0.2); }
.sc2-btn-enter.weak  { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: rgba(245,158,11,0.3); }
.sc2-btn-close  { background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); flex: 1.8; }
.sc2-btn-dismiss{ background: rgba(239,68,68,0.1); color: #ef4444; border: 1px solid rgba(239,68,68,0.2); flex: 0.8; }
.sc2-btn-wl     { flex: 0.5; background: rgba(255,255,255,0.04); color: #94a3b8; border: 1px solid rgba(255,255,255,0.08); }

.sc2-catalyst {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  padding: 4px 8px;
  border-left: 2px solid rgba(255,255,255,0.1);
}

/* ════════════════════════════════════════════════════════════════
   RANKING PANEL
   ════════════════════════════════════════════════════════════════ */
.ranking-list { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }
.rank-row {
  display: grid;
  grid-template-columns: 20px 16px 48px 1fr 90px 64px 40px;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.025);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.72rem;
}
.rank-row:hover { background: rgba(255,255,255,0.05); }
.rank-pos     { font-size: 0.6rem; opacity: 0.4; font-family: monospace; }
.rank-dir     { font-size: 0.6rem; font-weight: 700; }
.rank-dir.short { color: var(--signal-short); }
.rank-dir.long  { color: var(--signal-long); }
.rank-sym     { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 0.8rem; color: #f1f5f9; }
.rank-health-wrap { display: flex; align-items: center; gap: 5px; }
.rank-health-track { flex: 1; height: 4px; background: rgba(255,255,255,0.07); border-radius: 2px; overflow: hidden; }
.rank-health-bar { height: 100%; border-radius: 2px; }
.rank-score   { font-family: monospace; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.rank-state-chip { font-size: 0.5rem; font-weight: 700; white-space: nowrap; }
.rank-price   { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: #94a3b8; }
.rank-rec     { font-size: 0.6rem; opacity: 0.65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; grid-column: 1 / -1; padding-left: 44px; }

/* ── Binance permission check UI ─────────────────────────── */
.btn-danger {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.4);
  color: #fca5a5;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.15s;
}
.btn-danger:hover { background: rgba(239,68,68,.28); }

.bn-perm-danger {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.5);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.bn-perm-danger-title {
  font-weight: 800;
  color: #f87171;
  font-size: 0.8rem;
  margin-bottom: 4px;
}
.bn-perm-danger-body { font-size: 0.72rem; opacity: 0.8; margin-bottom: 6px; }
.bn-perm-action { font-size: 0.7rem; color: #fbbf24; margin-top: 6px; }
.bn-perm-warn {
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.35);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 0.75rem;
}
.bn-perm-item { font-size: 0.72rem; margin: 2px 0; }
.bn-perm-item.danger { color: #f87171; font-weight: 700; }
.bn-perm-item.warn   { color: #fbbf24; }
.bn-perm-ok { font-size: 0.72rem; opacity: 0.65; padding: 4px 0; }

/* ============================================================
   LEFT NAV SIDEBAR
   ============================================================ */
:root { --left-nav-w: 72px; }

#left-nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--left-nav-w);
  height: calc(100vh - var(--header-h));
  background: rgba(9,9,9,0.98);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 20px;
  gap: 4px;
  z-index: 99;
  overflow-y: auto;
  overflow-x: hidden;
}

.left-nav-logo {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 12px;
  padding: 6px;
}

.left-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 56px;
  padding: 10px 4px;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--text-secondary);
  background: none;
  border: none;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.left-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.left-nav-item.active { background: rgba(59,130,246,0.14); color: var(--accent); }

.left-nav-icon { font-size: 1.1rem; line-height: 1; }
.left-nav-label { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.02em; text-align: center; }

/* Shift main layout right */
.main-layout { margin-left: var(--left-nav-w); }

/* Nav section show/hide */
.nav-section { display: none; }
.nav-section.active { display: block; }

/* signals-section is a flex/grid section so override display */
.signals-section.active { display: block; }
.market-section.active  { display: block; }
.unlocks-section.active { display: block; }

/* ============================================================
   ANÁLISIS SECTION
   ============================================================ */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.analysis-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.analysis-card.long  { border-left: 3px solid var(--signal-long); }
.analysis-card.short { border-left: 3px solid var(--signal-short); }

.ac-header { display: flex; align-items: center; justify-content: space-between; }
.ac-symbol { font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 700; }
.ac-dir { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.ac-dir.long  { background: var(--long-bg); color: var(--signal-long); }
.ac-dir.short { background: var(--short-bg); color: var(--signal-short); }

.ac-indicators { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ac-ind-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
}
.ac-ind-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.ac-ind-val { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 600; }
.ac-ind-bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 5px; }
.ac-ind-bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s; }

.ac-patterns { display: flex; flex-wrap: wrap; gap: 4px; }
.ac-pattern-chip {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
}
.ac-pattern-chip.bull { background: rgba(0,208,132,0.1); border-color: rgba(0,208,132,0.3); color: var(--signal-long); }
.ac-pattern-chip.bear { background: rgba(255,77,109,0.1); border-color: rgba(255,77,109,0.3); color: var(--signal-short); }

.ac-score-row { display: flex; align-items: center; gap: 8px; }
.ac-score-bar-wrap { flex: 1; height: 4px; background: var(--border); border-radius: 2px; }
.ac-score-bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s; }
.ac-score-num { font-size: 0.78rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; min-width: 28px; }

/* ============================================================
   RECOMENDACIONES SECTION
   ============================================================ */
.recommendations-list { display: flex; flex-direction: column; gap: 14px; }

.rec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rec-card.urgency-high   { border-left: 3px solid var(--signal-short); }
.rec-card.urgency-medium { border-left: 3px solid var(--signal-neutral); }
.rec-card.urgency-low    { border-left: 3px solid var(--signal-long); }
.rec-card.urgency-none   { border-left: 3px solid var(--border-light); }

.rec-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.rec-symbol { font-size: 1.05rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.rec-dir { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.rec-dir.long  { background: var(--long-bg); color: var(--signal-long); }
.rec-dir.short { background: var(--short-bg); color: var(--signal-short); }
.rec-pnl { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: 700; }
.rec-pnl.pos { color: var(--signal-long); }
.rec-pnl.neg { color: var(--signal-short); }

.rec-metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.rec-metric { font-size: 0.72rem; color: var(--text-secondary); }
.rec-metric span { display: block; font-family: 'JetBrains Mono', monospace; color: var(--text-primary); font-size: 0.8rem; margin-top: 2px; }

.rec-progress { display: flex; flex-direction: column; gap: 5px; }
.rec-prog-row { display: flex; align-items: center; gap: 8px; font-size: 0.7rem; color: var(--text-muted); }
.rec-prog-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.rec-prog-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.rec-prog-label { min-width: 36px; text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; }

.rec-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-light);
}
.rec-action-icon { font-size: 1.2rem; }
.rec-action-text { font-size: 0.82rem; font-weight: 600; }
.rec-source { font-size: 0.65rem; color: var(--text-muted); margin-left: auto; }

/* Mobile: hide left nav, restore margin */
@media (max-width: 768px) {
  #left-nav { display: none; }
  .main-layout { margin-left: 0; }
}

/* ============================================================
   TRADE MANAGER — copiloto por operación (renderAnalysis)
   ============================================================ */

/* Empty state */
.tm-empty {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 60px 24px; text-align: center;
}
.tm-empty-icon { font-size: 2.5rem; opacity: 0.4; }
.tm-empty-title { font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.tm-empty-sub   { font-size: 0.78rem; color: var(--text-muted); max-width: 300px; line-height: 1.5; }

/* Cards grid */
#analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}

/* Card */
.tm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid #10b981;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Header row */
.tm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tm-header-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-symbol { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 800; color: var(--text-primary); }
.tm-dir { font-size: 0.68rem; font-weight: 800; padding: 2px 8px; border-radius: 4px; }
.tm-dir.long  { background: var(--long-bg);  color: var(--signal-long); }
.tm-dir.short { background: var(--short-bg); color: var(--signal-short); }
.tm-leverage {
  font-size: 0.62rem; font-weight: 700; padding: 2px 6px;
  border-radius: 4px; background: rgba(255,255,255,0.07);
  color: var(--text-secondary); border: 1px solid var(--border);
}
.tm-badge-bn {
  font-size: 0.6rem; font-weight: 700; padding: 2px 6px;
  border-radius: 4px; background: rgba(59,130,246,0.15);
  color: var(--accent); border: 1px solid rgba(59,130,246,0.3);
}

/* Health ring */
.tm-health-ring {
  width: 52px; height: 52px; border-radius: 50%;
  background: conic-gradient(var(--hc, #10b981) calc(var(--hp, 0) * 3.6deg), rgba(255,255,255,0.07) 0deg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tm-health-ring::before {
  content: '';
  position: absolute;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-card);
}
.tm-health-ring {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.tm-health-num { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 800; color: var(--hc, #10b981); z-index: 1; line-height: 1; }
.tm-health-lbl { font-size: 0.5rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; z-index: 1; }

/* PnL + time row */
.tm-row2 {
  display: flex; align-items: center; justify-content: space-between;
}
.tm-pnl { font-family: 'JetBrains Mono', monospace; font-size: 1rem; font-weight: 700; }
.tm-pnl.pos { color: var(--signal-long); }
.tm-pnl.neg { color: var(--signal-short); }
.tm-time { font-size: 0.7rem; color: var(--text-muted); }

/* Success probability */
.tm-prob-row { display: flex; align-items: center; gap: 10px; }
.tm-prob-lbl { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }
.tm-prob-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.tm-prob-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.tm-prob-num { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; font-weight: 700; min-width: 36px; text-align: right; }

/* Distances row */
.tm-distances {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
}
.tm-dist {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 7px 8px;
  display: flex; flex-direction: column; gap: 3px;
  text-align: center;
}
.tm-dist.sl .tm-dist-val { color: var(--signal-short); }
.tm-dist.tp .tm-dist-val { color: var(--signal-long); }
.tm-dist.critical { border-color: #ef444450; background: rgba(239,68,68,0.06); }
.tm-dist.critical .tm-dist-val { color: var(--signal-short); animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.tm-dist-lbl { font-size: 0.58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tm-dist-val { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; font-weight: 700; }

/* Price boxes */
.tm-prices {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
}
.tm-px { background: rgba(255,255,255,0.03); border: 1px solid var(--border-light); border-radius: 5px; padding: 6px 8px; }
.tm-px-l { display: block; font-size: 0.58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.tm-px-v { font-size: 0.76rem; font-weight: 600; color: var(--text-primary); }
.tm-px-v.sl { color: var(--signal-short); }
.tm-px-v.tp { color: var(--signal-long); }

/* Context signals */
.tm-context {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}
.tm-ctx-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.72rem; color: var(--text-secondary);
}
.tm-ctx-item.good { color: var(--signal-long); }
.tm-ctx-item.bad  { color: var(--signal-short); }
.tm-ctx-icon { font-size: 0.8rem; width: 16px; text-align: center; flex-shrink: 0; }
.tm-ctx-text { flex: 1; }
.tm-ctx-val  { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; opacity: 0.75; }

/* Health factors */
.tm-factors {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.tm-factor {
  font-size: 0.67rem; padding: 3px 8px;
  border-radius: 20px; border: 1px solid transparent;
}
.tm-factor.pos { background: rgba(16,185,129,0.08); color: #10b981; border-color: rgba(16,185,129,0.2); }
.tm-factor.neg { background: rgba(239,68,68,0.08);  color: #ef4444; border-color: rgba(239,68,68,0.2); }

/* Main recommendation */
.tm-rec {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 7px;
}
.tm-rec-hd { display: flex; align-items: center; gap: 10px; }
.tm-rec-emoji { font-size: 1.2rem; }
.tm-rec-action { font-family: 'Space Grotesk', sans-serif; font-size: 0.92rem; font-weight: 800; }
.tm-rec-reason { font-size: 0.73rem; color: var(--text-secondary); line-height: 1.55; padding-left: 30px; }

/* Timeline */
.tm-timeline {
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}
.tm-tl-title {
  font-size: 0.6rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.tm-tl-ev {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 0.68rem;
}
.tm-tl-icon { font-size: 0.75rem; flex-shrink: 0; margin-top: 1px; }
.tm-tl-detail { flex: 1; color: var(--text-secondary); line-height: 1.4; }
.tm-tl-time   { color: var(--text-muted); font-size: 0.62rem; white-space: nowrap; flex-shrink: 0; }

/* Responsive */
@media (max-width: 600px) {
  #analysis-grid { grid-template-columns: 1fr; }
  .tm-distances, .tm-prices { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   ANALYSIS SUB-TABS
   ============================================================ */
.ast-hdr {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.ast-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.ast-btn:hover  { color: var(--text-primary); border-color: var(--border-light); }
.ast-btn.active { background: rgba(255,255,255,0.07); color: var(--text-primary); border-color: rgba(255,255,255,0.2); }

/* ============================================================
   PERFORMANCE DASHBOARD — finance-style
   ============================================================ */
.perf-wrap { display: flex; flex-direction: column; gap: 14px; width: 100%; }

/* Period tabs */
.perf-ptabs { display: flex; gap: 4px; }
.perf-ptab {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem; font-weight: 600;
  padding: 5px 16px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer; transition: all 0.15s;
}
.perf-ptab:hover { color: var(--text-primary); }
.perf-ptab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Summary cards */
.perf-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.psum-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.psum-card.win  { border-top: 2px solid #10b981; }
.psum-card.loss { border-top: 2px solid #ef4444; }
.psum-card.net  { border-top: 2px solid var(--accent); }
.psum-lbl { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; margin-bottom: 6px; }
.psum-val { font-family: 'JetBrains Mono', monospace; font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.psum-val.pos { color: #10b981; }
.psum-val.neg { color: #ef4444; }
.psum-sub { font-size: 0.7rem; color: var(--text-secondary); }

/* Stat pills */
.perf-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.ppill {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 14px; gap: 2px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  flex: 1; min-width: 80px;
}
.ppill-v { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: 800; color: var(--text-primary); }
.ppill-v.pos { color: #10b981; }
.ppill-v.neg { color: #ef4444; }
.ppill-l { font-size: 0.58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Chart cards */
.perf-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.perf-chart-ttl {
  font-size: 0.65rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700;
}

/* Triple donut row */
.perf-charts3 .perf-donuts-row {
  display: flex; gap: 32px; flex-wrap: wrap; justify-content: space-around;
}
.perf-donut-sublbl { font-size: 0.65rem; color: var(--text-muted); text-align: center; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.perf-donut-svg { width: 180px; height: 180px; display: block; margin: 0 auto; }
.perf-donut-legend { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.pdl { font-size: 0.66rem; color: var(--text-secondary); }
.pdl.win  { color: #10b981; }
.pdl.loss { color: #ef4444; }
.pdl.neu  { color: #6b7280; }

/* Bar + line charts */
.perf-bars-svg { width: 100%; height: 140px; }
.perf-line-svg { width: 100%; height: 120px; }

/* Empty */
.perf-empty-chart {
  display: flex; align-items: center; justify-content: center;
  min-height: 80px; font-size: 0.72rem;
  color: var(--text-muted); text-align: center;
  border: 1px dashed var(--border); border-radius: 8px; padding: 12px;
}

/* Best / Worst */
.perf-extremes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.perf-trade-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.perf-trade-card.best  { border-left: 3px solid #10b981; }
.perf-trade-card.worst { border-left: 3px solid #ef4444; }
.ptc-badge  { font-size: 0.66rem; color: var(--text-muted); font-weight: 700; }
.ptc-sym    { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 800; }
.ptc-pnl    { font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 800; }
.ptc-pnl.pos { color: #10b981; } .ptc-pnl.neg { color: #ef4444; }
.ptc-dir { font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; display: inline-block; }
.ptc-dir.long  { background: var(--long-bg);  color: var(--signal-long); }
.ptc-dir.short { background: var(--short-bg); color: var(--signal-short); }
.ptc-reasons { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.ptc-reason  { font-size: 0.68rem; color: var(--text-secondary); line-height: 1.4; }

/* Trades table section */
.perf-table-section { display: flex; flex-direction: column; gap: 10px; }
.pts-header { display: flex; align-items: center; justify-content: space-between; padding: 2px 0 8px; }
.pts-title  { font-family: 'Space Grotesk', sans-serif; font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }

/* Month group */
.pmg { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pmg-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: default;
}
.pmg-arrow { font-size: 0.65rem; color: var(--text-muted); }
.pmg-lbl   { font-family: 'Space Grotesk', sans-serif; font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.pmg-count { font-size: 0.68rem; color: var(--text-muted); background: rgba(255,255,255,0.05); border: 1px solid var(--border); padding: 1px 7px; border-radius: 20px; }
.pmg-net   { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; font-weight: 700; margin-left: auto; }
.pmg-net.pos { color: #10b981; } .pmg-net.neg { color: #ef4444; }

/* Table */
.pmg-table { width: 100%; border-collapse: collapse; }
.pmg-table thead tr { border-bottom: 1px solid var(--border-light); }
.pmg-table th {
  text-align: left; font-size: 0.6rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 8px 14px; background: rgba(255,255,255,0.01);
}
.pmg-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); transition: background 0.1s; }
.pmg-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.pmg-table td { padding: 9px 14px; font-size: 0.75rem; color: var(--text-secondary); vertical-align: middle; }
.pmg-date { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem !important; color: var(--text-muted) !important; }
.pmg-sym  { font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: var(--text-primary); font-size: 0.8rem; }
.pmg-dir  { font-size: 0.65rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.pmg-dir.long  { background: var(--long-bg);  color: var(--signal-long); }
.pmg-dir.short { background: var(--short-bg); color: var(--signal-short); }
.pmg-res  { font-size: 0.65rem; font-weight: 800; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.04em; }
.pmg-res.win  { background: rgba(16,185,129,0.12); color: #10b981; }
.pmg-res.loss { background: rgba(239,68,68,0.12);  color: #ef4444; }
.pmg-res.neu  { background: rgba(107,114,128,0.12); color: #6b7280; }
.pmg-pnl  { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.pmg-pnl.pos { color: #10b981; } .pmg-pnl.neg { color: #ef4444; }
.pmg-status { font-size: 0.62rem; padding: 2px 7px; border-radius: 20px; white-space: nowrap; font-weight: 600; }
.pmg-status.confirmed { background: rgba(16,185,129,0.1); color: #10b981; border: 1px solid rgba(16,185,129,0.25); }
.pmg-status.pending   { background: rgba(245,158,11,0.1); color: #f59e0b; border: 1px solid rgba(245,158,11,0.25); }
.pmg-notes { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.68rem !important; color: var(--text-muted) !important; }

.pmg-time { font-size: 0.6rem; color: var(--text-muted); opacity: 0.7; margin-top: 1px; }
.pmg-price  { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem !important; color: var(--text-primary) !important; }
.pmg-lev    { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem !important; color: var(--accent) !important; font-weight: 600; }
.pmg-margin { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem !important; color: var(--text-secondary) !important; }
.pmg-pnl-usd { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 0.75rem; }
.pmg-pnl-usd.pos { color: #10b981; } .pmg-pnl-usd.neg { color: #ef4444; }
.pmg-net-usd { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; font-weight: 700; margin-left: 12px; }
.pmg-net-usd.pos { color: #10b981; } .pmg-net-usd.neg { color: #ef4444; }
.pmg-table tfoot tr { border-top: 1px solid var(--border-light); background: rgba(255,255,255,0.015); }
.pmg-table tfoot td { padding: 8px 14px; font-size: 0.68rem; font-weight: 700; }
.pmg-foot-lbl { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Onboarding */
.perf-onboard {
  background: rgba(255,255,255,0.02); border: 1px dashed var(--border);
  border-radius: 12px; padding: 40px 32px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.perf-ob-icon  { font-size: 2.2rem; opacity: 0.35; }
.perf-ob-title { font-family: 'Space Grotesk', sans-serif; font-size: 0.92rem; font-weight: 700; color: var(--text-primary); }
.perf-ob-sub   { font-size: 0.72rem; color: var(--text-muted); max-width: 440px; line-height: 1.65; }

@media (max-width: 768px) {
  .perf-summary   { grid-template-columns: 1fr; }
  .perf-extremes  { grid-template-columns: 1fr; }
  .perf-donuts-row { gap: 20px; }
  .perf-donut-svg { width: 140px; height: 140px; }
}

/* ── Detalle section ─────────────────────────────────────────── */
.det-wrap { display: flex; flex-direction: column; gap: 18px; }
.det-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px;
}
.det-sum-card {
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px;
  padding: 14px 16px; text-align: center;
}
.det-sum-lbl { font-size: 0.62rem; letter-spacing: 0.08em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.det-sum-val { font-family: 'JetBrains Mono', monospace; font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.det-sum-val.pos { color: #10b981; }
.det-sum-val.neg { color: #ef4444; }
.det-sum-sub { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }

.det-chart-card {
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px;
  padding: 18px 16px 10px;
}
.det-chart-ttl {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.82rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 10px;
}
.det-chart-svg { width: 100%; height: auto; display: block; }

.det-list-section {
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px;
  padding: 16px; overflow-x: auto;
}
.det-list-hdr {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.82rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 12px;
}
.det-table {
  width: 100%; border-collapse: collapse; font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
}
.det-table thead th {
  text-align: left; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-color);
  white-space: nowrap; font-weight: 600;
}
.det-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.03); }
.det-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.det-table td { padding: 7px 8px; white-space: nowrap; color: var(--text-secondary); }
.det-date { color: var(--text-muted); }
.det-time { color: var(--text-muted); font-size: 0.65rem; }
.det-sym { color: var(--text-primary); font-weight: 600; }
.det-dir { font-size: 0.65rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.det-dir.long { color: #10b981; background: rgba(16,185,129,0.1); }
.det-dir.short { color: #ef4444; background: rgba(239,68,68,0.1); }
.det-lev { color: var(--text-muted); }
.det-px { font-size: 0.68rem; }
.det-margin { color: var(--text-muted); }
.det-pnl { font-weight: 600; }
.det-pnl.pos { color: #10b981; }
.det-pnl.neg { color: #ef4444; }
.det-res {
  font-size: 0.6rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.det-res.win  { color: #10b981; background: rgba(16,185,129,0.12); }
.det-res.loss { color: #ef4444; background: rgba(239,68,68,0.12); }
.det-res.neu  { color: var(--text-muted); background: rgba(255,255,255,0.05); }

/* Chart header + period tabs */
.det-chart-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
}
.det-period-tabs { display: flex; gap: 4px; }
.det-period-btn {
  font-size: 0.65rem; font-weight: 600; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border-color); background: transparent; color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.det-period-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.det-period-btn.active { background: rgba(59,130,246,0.15); color: var(--accent); border-color: rgba(59,130,246,0.3); }

/* Chart crosshair + tooltip */
.det-chart-container { position: relative; }
.det-tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: rgba(15,15,20,0.92); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
  padding: 8px 10px; font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  backdrop-filter: blur(8px); min-width: 100px;
}

/* Collapsible list header */
.det-list-header {
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  padding: 4px 0; user-select: none;
}
.det-list-header:hover .det-toggle-icon { color: var(--text-primary); }
.det-toggle-icon { font-size: 0.7rem; color: var(--text-muted); transition: color 0.15s; }
.det-list-count { font-size: 0.68rem; color: var(--text-muted); font-weight: 400; }

/* Search bar */
.det-search-row { margin-bottom: 10px; }
.det-search {
  width: 100%; padding: 8px 12px; border-radius: 8px; box-sizing: border-box;
  border: 1px solid var(--border-color); background: rgba(255,255,255,0.03);
  color: var(--text-primary); font-size: 0.72rem; font-family: 'JetBrains Mono', monospace;
  outline: none; transition: border-color 0.15s;
}
.det-search:focus { border-color: rgba(59,130,246,0.4); }
.det-search::placeholder { color: var(--text-muted); }
.det-list-body { max-height: 500px; overflow-y: auto; }

.det-balance-bar {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(59,130,246,0.06));
  border: 1px solid rgba(16,185,129,0.2); border-radius: 10px;
  padding: 12px 18px;
}
.det-bal-item { display: flex; gap: 8px; align-items: center; }
.det-bal-lbl { font-size: 0.68rem; color: var(--text-muted); }
.det-bal-val { font-family: 'JetBrains Mono', monospace; font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }

.det-import-row {
  display: flex; align-items: center; gap: 12px; margin-top: 4px;
}
.det-import-status { font-size: 0.72rem; color: var(--text-muted); }

@media (max-width: 768px) {
  .det-summary { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .det-sum-card { padding: 10px 12px; }
  .det-sum-val { font-size: 1rem; }
  .det-table { font-size: 0.62rem; }
  .det-table td { padding: 8px 6px; }
  .det-table th { padding: 6px; }
  /* Hide less critical columns on mobile */
  .det-table th:nth-child(2), .det-table td:nth-child(2),
  .det-table th:nth-child(5), .det-table td:nth-child(5),
  .det-table th:nth-child(8), .det-table td:nth-child(8) { display: none; }
  .det-balance-bar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 14px; }
  .det-chart-header { flex-direction: column; align-items: flex-start; }
  .det-period-tabs { width: 100%; }
  .det-period-btn { flex: 1; text-align: center; }
  .det-import-row { flex-direction: column; }
  .det-import-row .sc2-btn { width: 100%; }
  .det-list-body { max-height: 400px; -webkit-overflow-scrolling: touch; }
  /* Analysis section mobile */
  .analysis-section { padding: 10px; }
  #analysis-grid { grid-template-columns: 1fr !important; }
  .tm-card { min-width: 0; }
}

/* ── DeFi: detalle expandible por card ─────────────────────── */
.defi-card[data-defi-open] { cursor: pointer; }
.defi-card--open { box-shadow: 0 0 0 1px rgba(148, 163, 184, .25); }
.defi-caret { font-size: 9px; opacity: .6; margin-left: 4px; }
.defi-detail {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed rgba(148, 163, 184, .25);
  cursor: default; display: flex; flex-direction: column; gap: 12px;
  animation: fadeIn .18s ease;
}
.defi-detail-verdict {
  font-size: 13px; font-weight: 700; padding: 8px 12px;
  border: 1px solid; border-radius: 8px; background: rgba(0, 0, 0, .2);
}
.defi-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .defi-detail-grid { grid-template-columns: 1fr; } }
.defi-detail-block { background: rgba(148, 163, 184, .05); border-radius: 8px; padding: 10px 12px; }
.defi-detail-h { font-size: 12px; font-weight: 700; color: var(--text, #e2e8f0); margin-bottom: 8px; }
.defi-detail-h small { font-weight: 400; color: #94a3b8; }
.defi-detail-p { font-size: 12px; line-height: 1.55; color: #cbd5e1; margin: 0; }
.defi-req { display: flex; gap: 8px; align-items: baseline; font-size: 11.5px; padding: 3px 0; }
.defi-req-ic { flex: 0 0 auto; }
.defi-req-lbl { color: #cbd5e1; }
.defi-req-det { margin-left: auto; color: #94a3b8; white-space: nowrap; }
.defi-detail-block--steps { border: 1px solid rgba(139, 92, 246, .35); background: rgba(139, 92, 246, .07); }
.defi-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.defi-steps li { font-size: 12px; line-height: 1.55; color: #cbd5e1; }
.defi-steps a { color: #a78bfa; }
.defi-steps code { font-size: 11px; background: rgba(0, 0, 0, .3); padding: 1px 4px; border-radius: 4px; }
