/* ─── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #080b12;
  --bg-card:    #0e1118;
  --bg-hover:   #161b24;
  --border:     #1c2030;
  --accent:     #3b82f6;
  --accent2:    #4f46e5;
  --green:      #16a34a;
  --green-dim:  #052e16;
  --red:        #dc2626;
  --red-dim:    #450a0a;
  --yellow:     #ca8a04;
  --yellow-dim: #713f12;
  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #94a3b8;
  --radius:     10px;
  --radius-sm:  7px;
  --font-ui:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-data:  'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font:       var(--font-ui);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.25);
  --shadow-card-hover: 0 2px 8px rgba(0,0,0,0.5), 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(59,130,246,0.1);
  --glow-green: 0 0 16px rgba(22,163,74,0.25);
  --glow-blue:  0 0 20px rgba(59,130,246,0.2);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Data font — monospace for all prices, codes, numbers ──────────────── */
.signal-pair, .top-pair, .live-pair, .risk-pair, .state-pair, .spread-pair,
.live-conf-num, .conf-num, .spread-val, .quality-val,
.signal-prices, .risk-prices, .signal-price-item,
.tf-item, .tfa, .sb-behavior,
.ai-modal-score-num, .ai-modal-pair-name,
.mom-item, .strength-time, .last-update, .ai-modal-footer,
.sess-hours-utc, .sent-comp-val, .sent-group-sum, .stat-pill {
  font-family: var(--font-data);
}

/* ─── Plan Switcher ─────────────────────────────────────────────────────────── */
.plan-switcher-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0d1117;
  border-bottom: 1px solid rgba(251,191,36,0.2);
  padding: 6px 20px;
  position: sticky;
  top: 0;
  z-index: 200;
  flex-wrap: wrap;
}
.plan-sw-label {
  font-size: 11px;
  font-weight: 600;
  color: #fbbf24;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.plan-sw-pills {
  display: flex;
  gap: 4px;
}
.plan-sw-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.plan-sw-pill:hover { border-color: #fbbf24; color: #fbbf24; }
.plan-sw-pill.active { background: #fbbf24; color: #000; border-color: #fbbf24; }
.plan-sw-note {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.5;
  margin-left: auto;
}

/* ─── Plan Lock Overlay — two-column on all sizes ───────────────────────────── */
.plan-lock-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(8, 11, 18, 0.82);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: inherit;
  /* two-column: padlock | text */
  grid-template-columns: 48px 1fr;
  grid-template-rows: auto auto auto auto;
  align-items: start;
  justify-items: start;
  column-gap: 14px;
  row-gap: 5px;
  text-align: left;
  padding: 16px;
}
.plan-lock-overlay.visible { display: grid; }

/* padlock circle — spans all 4 rows, vertically centered */
.plan-lock-overlay.visible::before {
  content: '';
  width: 40px;
  height: 40px;
  grid-column: 1;
  grid-row: 1 / 5;
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background-color: rgba(79, 70, 229, 0.12);
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23a5b4fc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
  flex-shrink: 0;
}

.plan-lock-icon  { display: none; }
.plan-lock-title { grid-column: 2; grid-row: 1; font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3; }
.plan-lock-desc  { grid-column: 2; grid-row: 2; font-size: 11px; color: var(--text-muted); line-height: 1.5; margin: 0; }

/* bullets hidden on mobile to prevent overflow */
.plan-lock-features { display: none; }

.plan-lock-btn {
  grid-column: 2;
  grid-row: 3;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  text-decoration: none;
  transition: opacity 0.15s;
}
.plan-lock-btn:hover { opacity: 0.85; }

/* Desktop: show bullets, larger fonts, more padding */
@media (min-width: 700px) {
  .plan-lock-overlay {
    grid-template-columns: 56px 1fr;
    column-gap: 24px;
    row-gap: 6px;
    padding: 24px 40px;
  }
  .plan-lock-overlay.visible::before {
    width: 46px;
    height: 46px;
    background-size: 22px;
    grid-row: 1 / 5;
  }
  .plan-lock-title { font-size: 15px; }
  .plan-lock-desc  { font-size: 12.5px; }
  .plan-lock-features {
    grid-column: 2;
    grid-row: 3;
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 0;
    margin: 2px 0 0;
    gap: 3px;
    width: 100%;
  }
  .plan-lock-features li {
    font-size: 12px;
    color: var(--text-muted);
    padding-left: 15px;
    position: relative;
    line-height: 1.5;
  }
  .plan-lock-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #818cf8;
    font-weight: 700;
  }
  .plan-lock-btn { grid-row: 4; font-size: 12px; padding: 7px 18px; }
}

/* ensure cards are tall enough for overlay */
section.card:has(.plan-lock-overlay.visible) { min-height: 160px; overflow: hidden; }

/* Free plan: dim the tf buttons that are disabled */
.tf-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Free plan: upgrade tooltip on locked tf buttons */
.tf-pro-tip {
  position: relative;
  display: inline-block;
}
.plan-free .tf-pro-tip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1f35;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  border: 1px solid rgba(99, 102, 241, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
}
.plan-free .tf-pro-tip::before {
  content: '';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-bottom-color: rgba(99, 102, 241, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
}
.plan-free .tf-pro-tip:hover::after,
.plan-free .tf-pro-tip:hover::before { opacity: 1; }

/* Free plan: reorder grid so free sections appear directly after Trading Session */
.plan-free #section-session    { order: 1; }
.plan-free #section-strength   { order: 2; }
.plan-free #section-ranking-12h { order: 3; }
.plan-free #section-live,
.plan-free #section-top,
.plan-free #section-sentiment,
.plan-free #section-signals,
.plan-free #section-states,
.plan-free #section-spreads,
.plan-free #section-risk,
.plan-free #section-actions,
.plan-free #section-quality,
.plan-free #section-journal    { order: 4; }

/* ─── Header ───────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 24px;
  background: rgba(8,11,18,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2.5px;
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
}

.tagline {
  font-family: var(--font-ui);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 400;
  margin-left: 10px;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-pill {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 11px;
  color: var(--text-dim);
  transition: border-color 0.2s;
}
.stat-pill:hover { border-color: #2d3748; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s, box-shadow 0.3s;
  flex-shrink: 0;
}
.status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
  animation: pulse-dot 2.5s ease-out infinite;
}
.status-dot.stale { background: var(--yellow); }

@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.last-update { color: var(--text-muted); font-size: 11px; }

.header-user-email {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.logout-btn:hover {
  border-color: #f87171;
  color: #f87171;
}

/* ─── Grid layout ──────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto;
  gap: 16px;
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.2s;
  animation: card-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: #252d3d;
  transform: translateY(-1px);
}
/* Gradient edge on hover */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(59,130,246,0.25) 0%, rgba(139,92,246,0.1) 50%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.card-title {
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.sub {
  font-family: var(--font-ui);
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.8;
}

/* ─── Signal board ─────────────────────────────────────────────────────────── */
.signal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

/* WAIT cards always 2-per-row */
.wait-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.signal-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  flex: 1 1 220px;
  min-width: 0;
}

.signal-card.buy  { border-left: 3px solid var(--green); }
.signal-card.sell { border-left: 3px solid var(--red); }
.signal-card.wait { border-left: 3px solid var(--yellow); opacity: 0.75; }

.signal-pair {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
}

.signal-dir {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 3px;
  margin-left: 8px;
}
.signal-dir.buy  { background: var(--green-dim); color: #4ade80; }
.signal-dir.sell { background: var(--red-dim);   color: #f87171; }
.signal-dir.wait { background: var(--yellow-dim); color: #fbbf24; }

.signal-prices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 8px;
  font-size: 11px;
}

.signal-price-item span:first-child { color: var(--text-muted); display: block; font-size: 10px; }

.signal-conf {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.conf-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.conf-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.4s;
}

.notrade-row {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0;
}

/* ─── Strength chart ───────────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 200px;
}

.tf-toggle { margin-left: auto; display: flex; gap: 4px; }

.tf-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
}
.tf-btn:hover { border-color: var(--accent); color: var(--text); }
.tf-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.strength-time { font-size: 10px; color: var(--text-muted); margin-top: 6px; text-align: right; }

/* ─── Market states table ──────────────────────────────────────────────────── */
.states-table {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 320px;
  overflow-y: auto;
}

.state-row {
  display: grid;
  grid-template-columns: 80px 50px 110px 40px 1fr;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  background: var(--bg);
  font-size: 11px;
  transition: background 0.15s;
}
.state-row:hover { background: var(--bg-hover); }

.state-pair { font-weight: 600; letter-spacing: 0.5px; }

.state-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  text-align: center;
}
.state-badge.TREND        { background: #1e3a5f; color: #60a5fa; }
.state-badge.PULLBACK     { background: var(--yellow-dim); color: #fbbf24; }
.state-badge.CONTINUATION { background: var(--green-dim); color: #4ade80; }
.state-badge.REVERSAL     { background: #3b1f2b; color: #f472b6; }
.state-badge.NO_TRADE     { background: #1a1d24; color: var(--text-muted); }

.state-spread { color: var(--text-dim); font-size: 10px; }
.state-spread.pos { color: #4ade80; }
.state-spread.neg { color: #f87171; }

.state-conf-mini {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.state-conf-mini-fill { height: 100%; background: var(--accent); border-radius: 2px; }

/* ─── Spread ranking ───────────────────────────────────────────────────────── */
.spreads-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 320px;
  overflow-y: auto;
}

.spread-row {
  display: grid;
  grid-template-columns: 6px 80px 42px 80px 1fr;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 11px;
}

.spread-accent { width: 3px; height: 18px; border-radius: 2px; }
.spread-accent.buy  { background: var(--green); }
.spread-accent.sell { background: var(--red); }

.spread-pair { font-weight: 600; }
.spread-bias { font-size: 9px; font-weight: 700; }
.spread-bias.buy  { color: #4ade80; }
.spread-bias.sell { color: #f87171; }
.spread-val  { color: var(--text-dim); }

.spread-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.spread-bar-fill { height: 100%; border-radius: 2px; }
.spread-bar-fill.buy  { background: var(--green); }
.spread-bar-fill.sell { background: var(--red); }

/* ─── Risk list ────────────────────────────────────────────────────────────── */
.risk-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

/* Neutral sentiment — inline warning on trade cards */
.sent-neutral-warn {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  color: #fbbf24;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.25);
  border-left: 3px solid #fbbf24;
  border-radius: 4px;
  padding: 8px 10px;
  margin: 6px 0;
  line-height: 1.5;
}

/* Neutral sentiment — approved trades block */
.risk-neutral-block {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 12px;
  background: rgba(251,191,36,0.06);
  border: 1px solid rgba(251,191,36,0.2);
  border-left: 3px solid #fbbf24;
  border-radius: 6px;
}
.risk-neutral-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.risk-neutral-msg {
  font-family: var(--font-ui);
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.6;
}
.risk-neutral-msg b {
  color: #fbbf24;
  font-weight: 700;
}

.risk-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.risk-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.risk-pair { font-weight: 700; font-size: 13px; }

.risk-prices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  font-size: 10px;
}

.risk-price-item span:first-child { color: var(--text-muted); display: block; font-size: 9px; }

.empty-state {
  font-family: var(--font-ui);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
  padding: 14px 0;
  text-align: center;
  line-height: 1.5;
}

/* ─── Actions log ──────────────────────────────────────────────────────────── */
.actions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.action-row {
  display: grid;
  grid-template-columns: 80px 70px 90px 1fr auto;
  gap: 8px;
  padding: 5px 8px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 11px;
  align-items: center;
}

.action-time {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.55;
  white-space: nowrap;
  text-align: right;
}

.action-status {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}
.action-status.SENT     { background: var(--green-dim); color: #4ade80; }
.action-status.EXECUTED { background: #1e3a5f; color: #60a5fa; }
.action-status.SKIPPED  { background: #1a1d24; color: var(--text-muted); }
.action-status.FAILED   { background: var(--red-dim); color: #f87171; }

.action-msg { color: var(--text-muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Data quality ─────────────────────────────────────────────────────────── */
.quality-card { grid-column: span 1; }

.quality-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quality-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.quality-row:last-child { border-bottom: none; }
.quality-label { color: var(--text-muted); }
.quality-val.ok   { color: #4ade80; }
.quality-val.warn { color: #fbbf24; }
.quality-val.bad  { color: #f87171; }

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Loading shimmer ──────────────────────────────────────────────────────── */
.shimmer {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 14px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Live Opportunities ───────────────────────────────────────────────────── */
.live-title { color: #4ade80; }

.live-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.live-card {
  background: linear-gradient(135deg, #052e16 0%, #0a1a0a 100%);
  border: 1px solid #4ade80;
  border-radius: var(--radius);
  padding: 16px 20px;
  flex: 1 1 240px;
  min-width: 0;
  position: relative;
  box-shadow: 0 0 20px rgba(74,222,128,0.08);
}
.live-card.sell {
  background: linear-gradient(135deg, #450a0a 0%, #1a0a0a 100%);
  border-color: #f87171;
  box-shadow: 0 0 20px rgba(248,113,113,0.08);
}

.live-pair   { font-size: 18px; font-weight: 800; letter-spacing: 1.5px; }
.live-signal { font-size: 22px; font-weight: 800; margin: 4px 0; }
.live-signal.buy  { color: #4ade80; }
.live-signal.sell { color: #f87171; }
.live-reason { font-family: var(--font-ui); font-size: 11px; color: var(--text-dim); margin: 4px 0; line-height: 1.5; }

.live-conf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.live-conf-num { font-size: 24px; font-weight: 800; color: #4ade80; }
.live-card.sell .live-conf-num { color: #f87171; }

/* ─── Top Setups ───────────────────────────────────────────────────────────── */
.top-setups-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.top-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  position: relative;
}
.top-card.hot  { border-left: 3px solid #4ade80; }
.top-card.warm { border-left: 3px solid #60a5fa; }
.top-card.cool { border-left: 3px solid #94a3b8; }

.top-rank {
  font-size: 28px;
  font-weight: 800;
  color: var(--border);
  line-height: 1;
  min-width: 24px;
  padding-top: 2px;
}
.top-card.hot  .top-rank { color: #166534; }
.top-card.warm .top-rank { color: #1e3a5f; }

.top-body { flex: 1; min-width: 0; }

.top-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.top-pair {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
}

.top-entry-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.top-entry-status.entry-READY_TO_ENTER    { color: #4ade80; }
.top-entry-status.entry-WAIT_CONFIRMATION { color: #fbbf24; }
.top-entry-status.entry-WAIT_PULLBACK     { color: #60a5fa; }
.top-entry-status.entry-NO_TRADE          { color: var(--text-muted); }

.top-tf {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.top-next {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.top-conf {
  min-width: 72px;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.conf-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.conf-factors {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
  margin-top: 4px;
}
.conf-factors span {
  font-size: 9px;
  color: #4ade80;
  white-space: normal;
  word-break: break-word;
}

/* ─── Phase & action badges ────────────────────────────────────────────────── */
.phase-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.phase-badge.ENTRY_ACTIVE      { background: #4ade80; color: #052e16; }
.phase-badge.READY_TO_ENTER    { background: #14532d; color: #4ade80; }
.phase-badge.PULLBACK_ACTIVE   { background: #713f12; color: #fde68a; }
.phase-badge.PULLBACK_STARTING { background: var(--yellow-dim); color: #fbbf24; }
.phase-badge.TREND             { background: #1e3a5f; color: #60a5fa; }
.phase-badge.REVERSAL_RISK     { background: #3b1f2b; color: #f472b6; }
.phase-badge.NO_TRADE, .phase-badge.NO\.TRADE { background: #1a1d24; color: var(--text-muted); }
/* legacy aliases kept for backward compat */
.phase-badge.READY    { background: #14532d; color: #4ade80; }
.phase-badge.PULLBACK { background: var(--yellow-dim); color: #fbbf24; }

.action-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.action-badge.ENTER { background: #4ade80; color: #052e16; }
.action-badge.WAIT  { background: var(--yellow-dim); color: #fbbf24; }
.action-badge.WATCH { background: #1e3a5f; color: #93c5fd; }

/* ─── TF alignment arrows ──────────────────────────────────────────────────── */
.tf-item {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.tf-item.↑, .tf-item.\↑  { color: #4ade80; border-color: #14532d; }
.tf-item.↑↑               { color: #4ade80; border-color: #4ade80; background: #052e16; }
.tf-item.↓, .tf-item.\↓  { color: #f87171; border-color: #7f1d1d; }
.tf-item.↓↓               { color: #f87171; border-color: #f87171; background: #450a0a; }
.tf-item.→                { color: var(--text-muted); }

/* ─── Spread behavior ──────────────────────────────────────────────────────── */
.sb-behavior {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}
.sb-behavior.EXPANDING     { background: #052e16; color: #4ade80; }
.sb-behavior.COMPRESSING   { background: var(--yellow-dim); color: #fbbf24; }
.sb-behavior.BASE_FORMING  { background: #1e3a5f; color: #93c5fd; }
.sb-behavior.RE-EXPANDING  { background: #4ade80; color: #052e16; font-weight:800; }
.sb-behavior.BREAKING      { background: var(--red-dim); color: #f87171; }
.sb-behavior.STABLE        { background: #1a1d24; color: var(--text-muted); }

/* ─── Invalidation warning ─────────────────────────────────────────────────── */
.invalidation {
  font-size: 9px;
  color: #fbbf24;
  background: var(--yellow-dim);
  border-radius: 3px;
  padding: 2px 7px;
  margin-top: 5px;
  display: inline-block;
}

/* ─── Signal card TF row ───────────────────────────────────────────────────── */
.signal-tf-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin: 6px 0;
}

/* ─── Signal next condition ────────────────────────────────────────────────── */
.signal-next {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  font-style: italic;
}

/* ─── Currency momentum strip ──────────────────────────────────────────────── */
.mom-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.mom-item {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.mom-item.pos { color: #4ade80; border-color: #14532d; }
.mom-item.neg { color: #f87171; border-color: #7f1d1d; }
.mom-item.neu { color: var(--text-muted); }

/* ─── Redesigned state rows ────────────────────────────────────────────────── */
.state-row-v2 {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--bg);
  transition: background 0.15s;
}
.state-row-v2:hover { background: var(--bg-hover); }

.state-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.state-row-bottom {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.tfa {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--bg-card);
}
.tfa.↑ { color: #4ade80; }
.tfa.↓ { color: #f87171; }
.tfa.→ { color: var(--text-muted); }

/* ─── Setup pipeline ───────────────────────────────────────────────────────── */
.pipeline {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 5px 0;
  flex-wrap: nowrap;
}

.pipe-step {
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-card);
  color: var(--border);
  border: 1px solid var(--border);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.pipe-step.done {
  background: #052e16;
  color: #4ade80;
  border-color: #14532d;
  opacity: 0.6;
}
.pipe-step.active {
  background: #1e3a5f;
  color: #60a5fa;
  border-color: #3b82f6;
  opacity: 1;
}
.pipe-step.active.s4 {
  background: #14532d;
  color: #4ade80;
  border-color: #4ade80;
}
.pipe-arrow {
  color: var(--border);
  font-size: 9px;
  flex-shrink: 0;
}

/* ─── Next action ──────────────────────────────────────────────────────────── */
.next-action {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  margin-top: 5px;
  letter-spacing: 0.1px;
}
.next-action.enter { color: #4ade80; }
.next-action.wait  { color: #fbbf24; }
.next-action.watch { color: #60a5fa; }
.next-action.none  { color: var(--text-muted); }

/* ─── Pullback depth badge ─────────────────────────────────────────────────── */
.pb-depth {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}
.pb-depth.LIGHT    { background: #14532d; color: #86efac; }   /* healthy */
.pb-depth.MODERATE { background: #713f12; color: #fde68a; }   /* watch */
.pb-depth.DEEP     { background: #7f1d1d; color: #fca5a5; }   /* caution */

/* ─── AI lifecycle phase badge ──────────────────────────────────────────────── */
.ai-lp-badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px; font-size: 9px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap;
  border: 1px solid;
}
.ai-lp-badge.early_pullback  { background:#422006; color:#fb923c; border-color:#9a3412; }
.ai-lp-badge.mid_pullback    { background:#431407; color:#f97316; border-color:#c2410c; }
.ai-lp-badge.late_pullback   { background:#1e1b4b; color:#a5b4fc; border-color:#4338ca; }
.ai-lp-badge.re_expanding    { background:#052e16; color:#4ade80; border-color:#16a34a; }
.ai-lp-badge.trending        { background:#083344; color:#67e8f9; border-color:#0e7490; }
.ai-lp-badge.exhausting      { background:#450a0a; color:#fca5a5; border-color:#b91c1c; }

/* ─── AI lifecycle completion bar on card ────────────────────────────────────── */
.ai-lc-bar-wrap {
  display: flex; align-items: center; gap: 6px;
  height: 4px; background: var(--bg); border-radius: 2px;
  margin: 4px 0 3px; position: relative;
}
.ai-lc-bar-fill {
  height: 4px; border-radius: 2px; transition: width 0.5s;
}
.ai-lc-bar-fill.early_pullback { background: #f97316; }
.ai-lc-bar-fill.mid_pullback   { background: #f97316; }
.ai-lc-bar-fill.late_pullback  { background: #818cf8; }
.ai-lc-bar-fill.re_expanding   { background: #4ade80; }
.ai-lc-bar-fill.trending       { background: #22d3ee; }
.ai-lc-bar-fill.exhausting     { background: #f87171; }
.ai-lc-pct {
  font-size: 9px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0;
}

/* ─── AI 4-score row on card ─────────────────────────────────────────────────── */
.ai-scores-row {
  display: flex; gap: 8px; margin: 5px 0 4px; flex-wrap: wrap;
}
.ai-score-item {
  display: flex; align-items: center; gap: 3px; font-size: 9px; color: var(--text-muted);
}
.ai-score-item b { color: var(--text-dim); font-weight: 700; }
.ai-mini-score {
  width: 28px; height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden;
}
.ai-mini-fill { height: 100%; border-radius: 2px; }
.ai-mini-score.cont  .ai-mini-fill { background: #60a5fa; }
.ai-mini-score.trend .ai-mini-fill { background: #4ade80; }
.ai-mini-score.pbq   .ai-mini-fill { background: #a78bfa; }
.ai-mini-score.clean .ai-mini-fill { background: #22d3ee; }

/* ─── AI bulb button ───────────────────────────────────────────────────────── */
.ai-bulb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #92400e;
  border: 1px solid #d97706;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  padding: 3px 8px 3px 6px;
  line-height: 1;
  color: #fde68a;
  opacity: 1;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  margin-left: 4px;
  box-shadow: 0 0 6px rgba(217,119,6,0.25);
}
.ai-bulb-btn:hover {
  background: #b45309;
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245,158,11,0.4);
}
.ai-bulb-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ─── AI Modal overlay ─────────────────────────────────────────────────────── */
.ai-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ai-modal-overlay.open { display: flex; }

.ai-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  animation: modalIn 0.18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.ai-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.ai-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-modal-pair-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
}
.ai-modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.ai-modal-close:hover { border-color: var(--text); color: var(--text); }

/* ─── AI Modal body ────────────────────────────────────────────────────────── */
.ai-modal-body { padding: 16px 20px 20px; }

/* ─── Modal lifecycle block ──────────────────────────────────────────────────── */
.ai-modal-lifecycle {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.ai-modal-lp-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.ai-modal-lc-label {
  font-family: var(--font-ui);
  font-size: 9.5px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.7px; flex: 1; font-weight: 600;
}
.ai-modal-lc-pct {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
}
.ai-modal-lc-bar {
  height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden;
}
.ai-modal-lc-fill {
  height: 100%; border-radius: 3px; transition: width 0.5s;
}
.ai-modal-lc-fill.early_pullback { background: linear-gradient(90deg,#f97316,#fb923c); }
.ai-modal-lc-fill.mid_pullback   { background: linear-gradient(90deg,#ea580c,#f97316); }
.ai-modal-lc-fill.late_pullback  { background: linear-gradient(90deg,#4338ca,#818cf8); }
.ai-modal-lc-fill.re_expanding   { background: linear-gradient(90deg,#16a34a,#4ade80); }
.ai-modal-lc-fill.trending       { background: linear-gradient(90deg,#0e7490,#22d3ee); }
.ai-modal-lc-fill.exhausting     { background: linear-gradient(90deg,#b91c1c,#f87171); }

/* ─── Modal 4-score blocks ───────────────────────────────────────────────────── */
.ai-modal-scores {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 14px;
}
@media (max-width: 520px) { .ai-modal-scores { grid-template-columns: repeat(2,1fr); } }
.ai-modal-score-block {
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 10px;
}
.ai-modal-score-label {
  font-family: var(--font-ui);
  font-size: 9.5px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.7px; margin-bottom: 5px; font-weight: 600;
}
.ai-modal-score-num {
  font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 5px;
}
.ai-modal-score-bar {
  height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden;
}
.ai-modal-score-fill { height: 100%; border-radius: 2px; transition: width 0.5s; }
.ai-modal-score-fill.cont  { background: #60a5fa; }
.ai-modal-score-fill.trend { background: #4ade80; }
.ai-modal-score-fill.pbq   { background: #a78bfa; }
.ai-modal-score-fill.clean { background: #22d3ee; }

.ai-modal-summary {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.ai-modal-sections { display: flex; flex-direction: column; gap: 12px; }

.ai-modal-section {
  background: var(--bg);
  border-radius: 6px;
  padding: 10px 14px;
}
.ai-modal-section-title {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.ai-modal-section-text {
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.65;
}

.ai-modal-factors-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ai-modal-factors {
  background: var(--bg);
  border-radius: 6px;
  padding: 10px 14px;
}
.ai-factor {
  font-family: var(--font-ui);
  font-size: 11.5px;
  padding: 3px 0;
  line-height: 1.5;
}
.ai-factor.support { color: #4ade80; }
.ai-factor.risk    { color: #f87171; }

.ai-modal-warning {
  font-family: var(--font-ui);
  margin-top: 12px;
  padding: 9px 14px;
  background: var(--yellow-dim);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #fbbf24;
  line-height: 1.5;
}
/* ─── Flow of Money block ──────────────────────────────────────────────────── */
.ai-modal-flow {
  background: #0d1117;
  border: 1px solid #1e2d3d;
  border-left: 3px solid #3b82f6;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.ai-modal-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.ai-modal-flow-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 800;
  color: #93c5fd;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.ai-modal-flow-text {
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.65;
}

/* Macro alignment badge */
.ai-macro-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  text-transform: uppercase;
}
.ai-macro-badge.aligned    { background: #052e16; color: #4ade80; border: 1px solid #16a34a; }
.ai-macro-badge.conflicted { background: #450a0a; color: #f87171; border: 1px solid #dc2626; }
.ai-macro-badge.neutral    { background: #1e2128; color: #64748b; border: 1px solid #374151; }

.ai-modal-footer {
  font-family: var(--font-data);
  margin-top: 14px;
  font-size: 9px;
  color: var(--text-muted);
  text-align: right;
  letter-spacing: 0.3px;
}

/* ─── AI Analysis block ────────────────────────────────────────────────────── */
.ai-block {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
}
.ai-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.ai-badge {
  font-size: 8px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
/* structure_type */
.ai-struct.HEALTHY_PULLBACK { background: #14532d; color: #86efac; }
.ai-struct.WEAK_PULLBACK    { background: #713f12; color: #fde68a; }
.ai-struct.STRONG_TREND     { background: #1e3a5f; color: #93c5fd; }
.ai-struct.REVERSAL_RISK    { background: #7f1d1d; color: #fca5a5; }
.ai-struct.CHOPPY           { background: #1a1d24; color: var(--text-muted); }
.ai-struct.EXHAUSTED        { background: #3b1f2b; color: #f472b6; }
/* trend_health */
.ai-health.strong   { background: #14532d; color: #4ade80; }
.ai-health.moderate { background: #713f12; color: #fbbf24; }
.ai-health.weak     { background: #7f1d1d; color: #f87171; }
/* market_quality */
.ai-quality.clean  { color: #4ade80; }
.ai-quality.noisy  { color: #fbbf24; }
.ai-quality.choppy { color: #f87171; }
.ai-cont {
  font-size: 9px;
  color: var(--text-muted);
  margin-left: auto;
}
.ai-cont b { color: var(--text); }
.ai-summary {
  font-family: var(--font-ui);
  font-size: 10.5px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 3px;
}
.ai-warning {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  color: #fbbf24;
  margin-top: 2px;
}

/* ─── Last signal time ─────────────────────────────────────────────────────── */
.last-signal-bar {
  font-size: 10px;
  color: var(--text-muted);
  padding: 6px 0 2px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ─── Responsive — tablet ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .span-2 { grid-column: span 2; }
  .span-3 { grid-column: span 2; }
  .top-setups-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Responsive — mobile ──────────────────────────────────────────────────── */
@media (max-width: 700px) {

  /* Base */
  html, body { font-size: 12px; }

  /* Header */
  .header {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .tagline { display: none; }
  .header-right {
    gap: 6px;
    flex-wrap: wrap;
  }
  .stat-pill {
    font-size: 10px;
    padding: 2px 8px;
  }
  .last-update { display: none; }

  /* Grid */
  .grid {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }
  .span-2, .span-3 { grid-column: span 1; }

  /* Top Setups — stack vertically */
  .top-setups-grid { grid-template-columns: 1fr; }

  .top-card {
    flex-direction: column;
    gap: 8px;
  }
  .top-rank { font-size: 20px; }
  .top-conf {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: unset;
    text-align: left;
  }
  .conf-factors { align-items: flex-start; }

  /* Live cards — full width */
  .live-grid { flex-direction: column; }
  .live-card { min-width: unset; width: 100%; }
  .live-pair { font-size: 16px; }
  .live-signal { font-size: 18px; }
  .live-conf-num { font-size: 20px; }

  /* Signal cards — full width */
  .signal-grid { flex-direction: column; }
  .signal-card { min-width: unset; width: 100%; }
  .wait-grid { grid-template-columns: 1fr; }

  /* Pipeline — allow wrap */
  .pipeline { flex-wrap: wrap; }

  /* Signal prices — 2 cols on mobile */
  .signal-prices { grid-template-columns: repeat(2, 1fr); }

  /* Risk prices — 2 cols on mobile */
  .risk-prices { grid-template-columns: repeat(2, 1fr); }

  /* Action rows — stack */
  .action-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }
  .action-msg {
    grid-column: span 2;
    white-space: normal;
  }
  .action-time {
    grid-column: span 2;
    text-align: left;
  }

  /* Chart */
  .chart-wrap { height: 160px; }

  /* Card padding */
  .card { padding: 12px; }

  /* Spread rows — tighter */
  .spread-row {
    grid-template-columns: 4px 70px 36px 70px 1fr;
    gap: 5px;
  }

  /* States max-height relaxed */
  .states-table { max-height: none; }
  .spreads-list { max-height: none; }

  /* Card title wrap */
  .card-title {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* TF toggle buttons */
  .tf-toggle { margin-left: 0; }
}

/* ─── Risk Sentiment ──────────────────────────────────────────────────────── */

.sentiment-display {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

/* Main badge + confidence block */
.sentiment-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 170px;
}

/* Badge row: sentiment + environment side by side */
.sent-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.sentiment-badge {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 9px 18px;
  border-radius: var(--radius);
  text-align: center;
  white-space: nowrap;
}
.sentiment-badge.risk-on  { background: #052e16; color: #4ade80; border: 1px solid #16a34a; }
.sentiment-badge.risk-off { background: #450a0a; color: #f87171; border: 1px solid #dc2626; }
.sentiment-badge.neutral  { background: #1c1917; color: #d4a017; border: 1px solid #ca8a04; }

/* Environment badge */
.sent-env-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.sent-env-badge.calm     { background: #0f172a; color: #64748b; border: 1px solid #1e293b; }
.sent-env-badge.elevated { background: #431407; color: #fb923c; border: 1px solid #c2410c; }
.sent-env-badge.stress   { background: #450a0a; color: #f87171; border: 1px solid #dc2626;
                            animation: stress-pulse 1.5s ease-in-out infinite; }

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

.sentiment-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.sent-conf-label {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sent-conf-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.sent-conf-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.sent-conf-bar-fill.risk-on  { background: #4ade80; }
.sent-conf-bar-fill.risk-off { background: #f87171; }
.sent-conf-bar-fill.neutral  { background: #d4a017; }

.sent-conf-pct {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  min-width: 28px;
  text-align: right;
}

.sentiment-net {
  font-size: 10px;
  color: var(--text-muted);
}

.sent-net-val {
  font-weight: 700;
  margin-left: 4px;
}
.sent-net-val.risk-on  { color: #4ade80; }
.sent-net-val.risk-off { color: #f87171; }
.sent-net-val.neutral  { color: #d4a017; }

/* Acceleration indicator */
.sent-accel {
  font-size: 10px;
  font-weight: 700;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.sent-accel.risk-on  { background: #052e16; color: #4ade80; }
.sent-accel.risk-off { background: #450a0a; color: #f87171; }
.sent-accel.neutral  { background: #1e2128; color: #64748b; }

/* Groups + donut wrapper */
.sent-groups-and-chart {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  min-width: 0;
}

/* Component breakdown bars */
.sentiment-components {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

/* Donut chart */
.sent-donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sent-donut {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.sent-donut-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-card);
}

.sent-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.sent-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
}

.sent-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sent-legend-label {
  font-family: var(--font-ui);
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
}

.sent-legend-val {
  font-family: var(--font-data);
  font-size: 9px;
  font-weight: 700;
}

.sent-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 4px 6px;
  margin-top: 8px;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-left: 2px solid #334155;
  border-radius: 0 4px 4px 0;
}
.sent-group-row:first-child {
  margin-top: 0;
  border-top: none;
}

.sent-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #94a3b8;
}

.sent-group-sum {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}
.sent-group-sum.risk-on  { color: #4ade80; }
.sent-group-sum.risk-off { color: #f87171; }
.sent-group-sum.neutral  { color: #64748b; }

.sent-align-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}
.sent-align-badge.risk-on      { background: rgba(74,222,128,0.12);  color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }
.sent-align-badge.risk-off     { background: rgba(248,113,113,0.12); color: #f87171; border: 1px solid rgba(248,113,113,0.25); }
.sent-align-badge.not-aligned  { background: rgba(100,116,139,0.1);  color: #475569; border: 1px solid rgba(100,116,139,0.2); }

.sent-comp-row {
  display: grid;
  grid-template-columns: 60px 1fr 36px;
  align-items: center;
  gap: 8px;
}

.sent-comp-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.sent-comp-bar-wrap {
  position: relative;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.sent-comp-bar-fill {
  position: absolute;
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease, left 0.4s ease;
}
.sent-comp-bar-fill.risk-on  { background: #4ade80; }
.sent-comp-bar-fill.risk-off { background: #f87171; }
.sent-comp-bar-fill.neutral  { background: #475569; }

/* Center tick line */
.sent-comp-center {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: #374151;
  transform: translateX(-50%);
}

.sent-comp-val {
  font-size: 10px;
  font-weight: 700;
  text-align: right;
}
.sent-comp-val.risk-on  { color: #4ade80; }
.sent-comp-val.risk-off { color: #f87171; }
.sent-comp-val.neutral  { color: var(--text-muted); }

.sent-comp-na {
  font-size: 10px;
  color: var(--text-muted);
}

.sentiment-time {
  width: 100%;
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

/* ─── Market Journal ────────────────────────────────────────────────────────── */

.journal-live-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #4ade80;
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.25);
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: auto;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.journal-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 520px;
  overflow-y: auto;
}

.jrn-entry {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.jrn-entry.open { border-color: #334155; }

.jrn-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  cursor: pointer;
  flex-wrap: wrap;
  transition: background 0.15s;
}
.jrn-header:hover { background: var(--bg-hover); }
.jrn-entry.open .jrn-header { background: var(--bg-hover); }

.jrn-time {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 160px;
}

.jrn-sent {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.jrn-sent.sent-risk-on  { background: #052e16; color: #4ade80; }
.jrn-sent.sent-risk-off { background: #450a0a; color: #f87171; }
.jrn-sent.sent-neutral  { background: #1e2128; color: #64748b; }

.jrn-conf {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text-muted);
}

.jrn-counts {
  display: flex;
  gap: 4px;
  margin-left: 2px;
}
.jrn-count {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}
.jrn-count.trend { background: #1e3a5f; color: #60a5fa; }
.jrn-count.pb    { background: #713f12; color: #fbbf24; }
.jrn-count.ready { background: #14532d; color: #4ade80; }
.jrn-count.sig   { background: #4ade80; color: #052e16; }

.jrn-outcomes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}

.jrn-outcome-pill {
  font-family: var(--font-data);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid;
  white-space: nowrap;
}
.jrn-outcome-pill.pending { background: #1a1d24; color: #475569; border-color: #1e2128; cursor: default; }
.jrn-outcome-pill.good    { background: #052e16; color: #4ade80; border-color: #16a34a; }
.jrn-outcome-pill.mid     { background: #713f12; color: #fbbf24; border-color: #ca8a04; }
.jrn-outcome-pill.bad     { background: #450a0a; color: #f87171; border-color: #dc2626; }

.jrn-chevron {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.15s;
  margin-left: 4px;
}
.jrn-entry.open .jrn-chevron { transform: rotate(90deg); }

/* Journal entry body */
.jrn-body {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jrn-sent-groups {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.jrn-summary {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 5px;
  border-left: 3px solid #334155;
}

.jrn-setups {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.jrn-setup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 3px 0;
}
.jrn-setup-pair  { font-family: var(--font-data); font-weight: 700; min-width: 60px; }
.jrn-setup-state { color: var(--text-muted); font-size: 10px; flex: 1; }
.jrn-setup-conf  { font-family: var(--font-data); font-size: 10px; color: var(--text-dim); }

/* Outcome blocks */
.jrn-outcome-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.jrn-outcome-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.jrn-outcome-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.jrn-outcome-score {
  font-family: var(--font-data);
  font-size: 13px;
  font-weight: 800;
}
.jrn-outcome-score.good { color: #4ade80; }
.jrn-outcome-score.mid  { color: #fbbf24; }
.jrn-outcome-score.bad  { color: #f87171; }
.jrn-outcome-tally {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}
.jrn-verdict {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
}
.jrn-sent-assess {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}
.jrn-setup-outcome {
  font-family: var(--font-ui);
  font-size: 10.5px;
  padding: 2px 0;
}
.jrn-setup-outcome.correct { color: #4ade80; }
.jrn-setup-outcome.wrong   { color: #f87171; }
.jrn-setup-outcome.flat    { color: var(--text-muted); }

/* Mobile: stack sentiment layout */
@media (max-width: 600px) {
  .sentiment-display { flex-direction: column; }
  .sentiment-components { min-width: 0; width: 100%; }
}

/* ─── Trading Session card ──────────────────────────────────────────────────── */
.session-display {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.session-main {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(150px, 180px) 1fr auto;
  align-items: start;
  gap: 16px;
}

/* Session name block */
.session-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sess-name-badge {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 10px 18px;
  border-radius: var(--radius);
  text-align: center;
  white-space: nowrap;
  border: 1px solid;
  width: 100%;
  box-sizing: border-box;
}

.sess-hours-utc {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.5px;
}
.sess-dst-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #fb923c;
  background: rgba(251,146,60,0.12);
  border: 1px solid rgba(251,146,60,0.3);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  text-transform: uppercase;
}

/* Quality block */
.session-quality-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sess-qlabel {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 5px 12px;
  border-radius: 5px;
  border: 1px solid;
  display: inline-block;
  white-space: nowrap;
}

.sess-qdesc {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 200px;
}

/* Activity block */
.session-activity-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
}

.sess-act-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sess-act-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.sess-act-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.sess-act-bar-wrap {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.sess-act-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}
.sess-act-bar-fill.act-very-high { background: linear-gradient(90deg, #16a34a, #4ade80); }
.sess-act-bar-fill.act-high      { background: linear-gradient(90deg, #1d4ed8, #60a5fa); }
.sess-act-bar-fill.act-medium    { background: linear-gradient(90deg, #92400e, #fbbf24); }
.sess-act-bar-fill.act-low       { background: #374151; }

/* Status block */
.session-status-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
}

.sess-status {
  font-size: 11px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 5px;
  letter-spacing: 0.8px;
  white-space: nowrap;
}
.sess-status.allowed { background: #052e16; color: #4ade80; border: 1px solid #16a34a; }
.sess-status.blocked { background: #450a0a; color: #f87171; border: 1px solid #dc2626; }

.sess-delta {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}
.sess-delta.pos { background: #052e16; color: #4ade80; }
.sess-delta.neg { background: #450a0a; color: #f87171; }

/* Timeline */
.session-timeline {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0 2px;
  border-top: 1px solid var(--border);
}

.sess-tl-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: default;
  transition: opacity 0.2s;
  opacity: 0.45;
  min-width: 0;
  text-align: center;
}
.sess-tl-item.current {
  opacity: 1;
  border-width: 2px;
}

.sess-tl-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

.sess-tl-hours {
  font-size: 8px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sess-tl-arrow {
  color: var(--border);
  font-size: 12px;
  flex-shrink: 0;
}

/* ── Session quality colour system (shared by name badge, quality label, timeline) */
/* VERY HIGH */
.sq-very-high, .sess-tl-item.very_high       { background: #052e16 !important; color: #4ade80 !important; border-color: #16a34a !important; }
/* HIGH */
.sq-high,      .sess-tl-item.high            { background: #1e3a5f !important; color: #93c5fd !important; border-color: #3b82f6 !important; }
/* MEDIUM */
.sq-medium,    .sess-tl-item.medium          { background: #1c1917 !important; color: #fbbf24 !important; border-color: #ca8a04 !important; }
/* LOW */
.sq-low,       .sess-tl-item.low             { background: #1a1d24 !important; color: #64748b !important; border-color: #374151 !important; }
/* BLOCKED */
.sq-blocked,   .sess-tl-item.blocked         { background: #1a0505 !important; color: #7f1d1d !important; border-color: #450a0a !important; }

/* Current highlight overrides colour */
.sess-tl-item.current.very_high  { color: #4ade80 !important; border-color: #4ade80 !important; box-shadow: 0 0 8px rgba(74,222,128,0.25); }
.sess-tl-item.current.high       { color: #93c5fd !important; border-color: #60a5fa !important; box-shadow: 0 0 8px rgba(96,165,250,0.25); }
.sess-tl-item.current.medium     { color: #fbbf24 !important; border-color: #fbbf24 !important; }
.sess-tl-item.current.low        { color: #94a3b8 !important; border-color: #64748b !important; }
.sess-tl-item.current.blocked    { color: #f87171 !important; border-color: #dc2626 !important; }

/* ── Session badge on Live Opportunity and Top Setup cards ───────────────────── */
.sess-card-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.4px;
  border: 1px solid;
  white-space: nowrap;
}

/* ── Inline session badge on signal cards ────────────────────────────────────── */
.sess-inline-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  margin-top: 4px;
  letter-spacing: 0.4px;
  border: 1px solid;
}

.sess-inline-delta {
  font-size: 8px;
  font-weight: 800;
  opacity: 0.9;
}

/* Mobile */
@media (max-width: 700px) {
  .session-main {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .session-name-wrap,
  .session-quality-wrap,
  .session-activity-wrap,
  .session-status-wrap {
    width: 100%;
  }
  .sess-name-badge {
    font-size: 16px;
    padding: 10px 12px;
  }
  .sess-qlabel {
    font-size: 12px;
  }
  .session-status-wrap {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .sess-status {
    flex: 1;
    text-align: center;
  }
  /* Timeline: 3-column grid, hide arrows */
  .session-timeline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .sess-tl-arrow { display: none; }
  .sess-tl-item  {
    padding: 6px 4px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
  }
}

/* ─── AI Modal session row ──────────────────────────────────────────────────── */
.ai-modal-session-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ai-modal-participation {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.8px;
  border: 1px solid;
}
.ai-modal-participation.part-strong   { background: #052e16; color: #4ade80; border-color: #16a34a; }
.ai-modal-participation.part-moderate { background: #1e3a5f; color: #93c5fd; border-color: #3b82f6; }
.ai-modal-participation.part-low      { background: #1a1d24; color: #64748b; border-color: #374151; }

.ai-modal-cont-support {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  border: 1px solid;
}
.ai-modal-cont-support.yes { background: #052e16; color: #4ade80; border-color: #16a34a; }
.ai-modal-cont-support.no  { background: #713f12; color: #fde68a; border-color: #ca8a04; }

.ai-modal-session-text {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 14px;
  padding: 9px 12px;
  background: var(--bg);
  border-radius: 5px;
  border-left: 3px solid #374151;
}

/* ─── AI Counter Pressure badge ────────────────────────────────────────────── */
.ai-cp-badge {
  display: inline-flex;
  align-items: center;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid;
}
.ai-cp-badge.cp-low      { background: #052e16; color: #4ade80; border-color: #16a34a; }
.ai-cp-badge.cp-moderate { background: #713f12; color: #fde68a; border-color: #ca8a04; }
.ai-cp-badge.cp-high     { background: #431407; color: #fb923c; border-color: #c2410c; }
.ai-cp-badge.cp-extreme  { background: #450a0a; color: #f87171; border-color: #dc2626; }

/* ─── AI Cleanliness label badge ───────────────────────────────────────────── */
.ai-cl-badge {
  display: inline-flex;
  align-items: center;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid;
}
.ai-cl-badge.cl-very_clean { background: #083344; color: #22d3ee; border-color: #0e7490; }
.ai-cl-badge.cl-clean      { background: #052e16; color: #4ade80; border-color: #16a34a; }
.ai-cl-badge.cl-moderate   { background: #713f12; color: #fde68a; border-color: #ca8a04; }
.ai-cl-badge.cl-noisy      { background: #450a0a; color: #f87171; border-color: #dc2626; }

/* ─── AI Modal quality row (Counter Pressure + Market Quality blocks) ───────── */
.ai-modal-quality-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ai-modal-quality-item {
  flex: 1;
  min-width: 130px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-modal-quality-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

/* Modal variants — larger, bolder display */
.ai-modal-cp, .ai-modal-cl {
  font-size: 14px !important;
  font-weight: 800 !important;
  padding: 5px 12px !important;
  border-radius: 5px !important;
  letter-spacing: 1px !important;
  align-self: flex-start;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MODERN DESIGN SYSTEM v2 — animations, effects, polish
   ═══════════════════════════════════════════════════════════════════════════════ */

/* --- Custom scrollbar --- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e2533; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #2a3347; }

/* --- Card entrance animation --- */
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.grid > .card:nth-child(1)  { animation-delay: 0.04s; }
.grid > .card:nth-child(2)  { animation-delay: 0.08s; }
.grid > .card:nth-child(3)  { animation-delay: 0.12s; }
.grid > .card:nth-child(4)  { animation-delay: 0.16s; }
.grid > .card:nth-child(5)  { animation-delay: 0.20s; }
.grid > .card:nth-child(6)  { animation-delay: 0.24s; }
.grid > .card:nth-child(7)  { animation-delay: 0.28s; }
.grid > .card:nth-child(8)  { animation-delay: 0.32s; }
.grid > .card:nth-child(9)  { animation-delay: 0.36s; }
.grid > .card:nth-child(10) { animation-delay: 0.40s; }
.grid > .card:nth-child(11) { animation-delay: 0.44s; }
.grid > .card:nth-child(12) { animation-delay: 0.48s; }

/* --- Skeleton loader --- */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #0e1118 25%, #161c28 50%, #0e1118 75%);
  background-size: 600px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 6px;
}
.skeleton-line { height: 10px; margin-bottom: 8px; border-radius: 5px; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }

/* --- Page background micro-grid --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(59,130,246,0.06), transparent);
  pointer-events: none;
}

/* --- Live section glow --- */
#section-live { transition: border-color 0.4s, box-shadow 0.4s; }

/* --- Confidence bars --- */
.conf-bar {
  border-radius: 4px !important;
  height: 4px !important;
  background: rgba(255,255,255,0.06) !important;
}
.conf-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Phase badges --- */
.phase-badge {
  font-size: 8.5px !important;
  letter-spacing: 0.7px !important;
  border-radius: 5px !important;
  padding: 2px 7px !important;
}

/* --- Signal direction badge borders --- */
.signal-dir.buy  { border: 1px solid rgba(74,222,128,0.2) !important; }
.signal-dir.sell { border: 1px solid rgba(248,113,113,0.2) !important; }

/* --- Signal cards hover --- */
.signal-card { transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s !important; }
.signal-card:hover { transform: translateY(-1px); }
.signal-card.buy:hover  { box-shadow: 0 0 16px rgba(74,222,128,0.1); }
.signal-card.sell:hover { box-shadow: 0 0 16px rgba(248,113,113,0.1); }

/* --- Top cards hover --- */
.top-card { transition: box-shadow 0.2s, transform 0.15s !important; }
.top-card:hover { transform: translateY(-1px); }

/* --- Spread / state / action rows hover --- */
.spread-row, .action-row, .state-row-v2 {
  border-radius: 7px;
  transition: background 0.15s;
}
.spread-row:hover, .action-row:hover, .state-row-v2:hover { background: rgba(255,255,255,0.03); }

/* --- Momentum strip --- */
.mom-item { border-radius: 6px !important; transition: transform 0.1s !important; }
.mom-item:hover { transform: scale(1.06); }

/* --- TF buttons --- */
.tf-btn { border-radius: 7px !important; transition: all 0.18s !important; }
.tf-btn.active {
  background: linear-gradient(135deg, #2563eb, #4f46e5) !important;
  border-color: transparent !important;
  box-shadow: 0 2px 12px rgba(37,99,235,0.35) !important;
}

/* --- Session timeline items --- */
.sess-tl-item { border-radius: 8px !important; transition: background 0.15s, transform 0.15s !important; }
.sess-tl-item:hover { transform: scale(1.03); }

/* --- Sentiment badge --- */
.sentiment-badge { border-radius: 10px !important; }

/* --- AI modal entrance --- */
.ai-modal {
  border-radius: 18px !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04) inset !important;
}
.ai-modal-overlay.open { animation: overlay-in 0.2s ease both; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.ai-modal-overlay.open .ai-modal { animation: modal-rise 0.28s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes modal-rise {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Journal entries --- */
.jrn-entry { border-radius: 10px !important; transition: border-color 0.2s, box-shadow 0.2s !important; }
.jrn-entry.open { box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.jrn-header { transition: background 0.15s !important; }
.jrn-outcome-pill { border-radius: 5px !important; transition: opacity 0.15s !important; }
.jrn-outcome-pill:hover { opacity: 0.8; }

/* --- Logout button --- */
.logout-btn {
  background: rgba(255,255,255,0.04) !important;
  border-color: rgba(255,255,255,0.08) !important;
  border-radius: 8px !important;
}
.logout-btn:hover {
  background: rgba(239,68,68,0.1) !important;
  border-color: rgba(239,68,68,0.3) !important;
  color: #f87171 !important;
}

/* --- Empty state --- */
.empty-state { color: var(--text-muted); font-size: 12px; text-align: center; padding: 20px 0; opacity: 0.6; }

/* --- Data update flash --- */
@keyframes data-flash {
  0%   { color: #60a5fa; }
  100% { color: inherit; }
}
.data-updated { animation: data-flash 0.9s ease; }

/* --- Risk neutral block --- */
.risk-neutral-block { border-radius: 10px !important; border: 1px solid rgba(251,191,36,0.2) !important; }

/* --- Sent neutral warn --- */
.sent-neutral-warn { border-radius: 7px !important; }

/* --- Live card subtle glow --- */
.live-card.buy  { box-shadow: 0 0 20px rgba(22,163,74,0.07); }
.live-card.sell { box-shadow: 0 0 20px rgba(220,38,38,0.07); }
.live-card { transition: transform 0.15s, box-shadow 0.2s !important; }
.live-card:hover { transform: translateY(-1px); }


/* --- Lucide icon sizing in card titles --- */
.card-title i[data-lucide] {
  width: 14px;
  height: 14px;
  stroke-width: 2.2px;
  flex-shrink: 0;
  vertical-align: middle;
  color: var(--accent);
  opacity: 0.85;
}

/* --- Notyf overrides --- */
.notyf__toast { border-radius: 10px !important; font-family: Inter, sans-serif !important; font-size: 12.5px !important; font-weight: 600 !important; }
.notyf__wrapper { padding: 12px 16px !important; }

/* --- Disable CSS card-in (GSAP handles it now) --- */
.card { animation: none !important; }


