/* ============================================================================
   KEPHLEX UX IMPROVEMENTS — Layer 2
   Loads AFTER kephlex-premium.css. Adds features that the design system
   does not cover: alternating rows, column priority, risk dots, sticky
   columns, premium expand, skeleton upgrades, empty states, equity curve
   enhancements, mobile patterns, and micro-interactions.
   ============================================================================ */


/* ──────────────────────────────────────────────────────────────────────────────
   1. SIGNALS TABLE — Alternating Rows + Column Priority + Column Chooser
   ────────────────────────────────────────────────────────────────────────────── */

/* Subtle alternating row tint — perceptible but restrained */
.signals-table tbody tr:nth-child(even),
#positions-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.022);
}
[data-theme="light"] .signals-table tbody tr:nth-child(even),
[data-theme="light"] #positions-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.025);
}
.signals-table tbody tr:nth-child(even):hover,
#positions-table tbody tr:nth-child(even):hover {
  background: var(--accent-dim);
}

/* Column priority: data-priority="1" always visible, "2" hides <900px, "3" hides <768px */
@media (max-width: 900px) {
  .signals-table [data-priority="3"] { display: none; }
}
@media (max-width: 768px) {
  .signals-table [data-priority="2"] { display: none; }
}

/* ─── Column chooser — Linear/Vercel premium dropdown ─────────────────────── */
.column-chooser-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 0.75rem;
}
.column-chooser-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.375rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  line-height: 1;
  min-height: 44px;
}
.column-chooser-btn::after {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.column-chooser-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface2);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.column-chooser-wrap.open .column-chooser-btn::after {
  transform: rotate(-135deg) translate(-1px, -1px);
}

.column-chooser-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.375rem;
  z-index: 50;
  min-width: 220px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 16px 48px -8px rgba(0, 0, 0, 0.6),
    0 4px 16px -4px rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition: opacity 0.18s cubic-bezier(.4,0,.2,1), transform 0.18s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
[data-theme="light"] .column-chooser-dropdown {
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.03),
    0 12px 32px -8px rgba(0, 0, 0, 0.12),
    0 2px 8px -2px rgba(0, 0, 0, 0.06);
}
.column-chooser-dropdown.open {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.column-chooser-dropdown::before {
  content: 'Visible Columns';
  display: block;
  padding: 0.5rem 0.75rem 0.375rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}
.column-chooser-dropdown label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
  line-height: 1.2;
}
.column-chooser-dropdown label:hover {
  background: var(--accent-dim);
  color: var(--accent);
}
.column-chooser-dropdown input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.column-chooser-dropdown input[type="checkbox"]:hover {
  border-color: var(--accent);
}
.column-chooser-dropdown input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.column-chooser-dropdown input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.column-chooser-dropdown input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  width: 4px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}


/* ──────────────────────────────────────────────────────────────────────────────
   2. STAT CARDS — Gradient Overlay + Accent Top Border
   kephlex-premium.css handles base styling + tnum. This adds the
   gradient overlay and color-coded top accent line.
   ────────────────────────────────────────────────────────────────────────────── */

.stat-card {
  position: relative;
  overflow: hidden;
}

/* Subtle diagonal gradient overlay — 5% opacity */
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.025) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="light"] .stat-card::before {
  background: linear-gradient(135deg, rgba(0,0,0,0.01) 0%, transparent 55%);
}

/* Top-border accent line — stronger 3px colored bar */
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0.85;
  z-index: 1;
}

/* Color the accent line per card's number color using :has() */
.stat-card:has(.number.green)::after  { background: var(--green); }
.stat-card:has(.number.red)::after    { background: var(--red); }
.stat-card:has(.number.yellow)::after { background: var(--yellow); }
.stat-card:has(.number.accent)::after { background: var(--accent); }

/* Ensure number + label sit above the gradient */
.stat-card .number,
.stat-card .label {
  position: relative;
  z-index: 1;
}


/* ──────────────────────────────────────────────────────────────────────────────
   3. SIGNAL BADGES — STRONG vs BIAS differentiation
   kephlex-premium.css already styles .signal-badge.long/.short/.strong etc.
   This adds the explicit LONG BIAS = border-only, STRONG = filled+glow
   distinction and the hover micro-lift.
   ────────────────────────────────────────────────────────────────────────────── */

/* LONG BIAS (non-strong .long) — border only, transparent fill */
.signal-badge.long:not(.strong) {
  background: transparent;
  box-shadow: none;
}

/* SHORT BIAS (non-strong .short) — border only, transparent fill */
.signal-badge.short:not(.strong) {
  background: transparent;
  box-shadow: none;
}

/* WAIT / SETUP — fully neutral muted */
.signal-badge.setup,
.signal-badge.wait {
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-dim);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}
[data-theme="light"] .signal-badge.setup,
[data-theme="light"] .signal-badge.wait {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

/* Hover — border-only, no transform (institutional) */
.signal-badge {
  transition: border-color 0.15s ease;
}
.signal-badge:hover {
  border-color: var(--accent);
}


/* ──────────────────────────────────────────────────────────────────────────────
   4. RISK DASHBOARD — Indicator Dots + Value-Loaded Animation
   ────────────────────────────────────────────────────────────────────────────── */

/* Extra left padding for indicator dot */
#risk-grid-top .stat-card,
#risk-grid-bottom .stat-card {
  padding-left: 1.85rem;
}

/* Colored indicator dot (overrides the gradient ::before) */
#risk-grid-top .stat-card::before,
#risk-grid-bottom .stat-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 2;
  /* Remove the gradient — dot takes its place */
  inset: auto;
}

/* Green dots for long metrics */
/* rd-open-long = top:2, rd-long-wr = bottom:1, rd-grade-a-wr = bottom:3 */
#risk-grid-top .stat-card:nth-child(2)::before,
#risk-grid-bottom .stat-card:nth-child(1)::before,
#risk-grid-bottom .stat-card:nth-child(3)::before {
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}

/* Red dots for short metrics */
/* rd-open-short = top:3, rd-short-wr = bottom:2 */
#risk-grid-top .stat-card:nth-child(3)::before,
#risk-grid-bottom .stat-card:nth-child(2)::before {
  background: var(--red);
  box-shadow: 0 0 6px var(--red-glow);
}

/* Blue dots for neutral metrics */
/* rd-open-total = top:1, rd-avg-rr = top:4, rd-grade-b-wr = bottom:4 */
#risk-grid-top .stat-card:nth-child(1)::before,
#risk-grid-top .stat-card:nth-child(4)::before,
#risk-grid-bottom .stat-card:nth-child(4)::before {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* Value-loaded animation — slides in when number populates */
@keyframes value-loaded {
  from { opacity: 0.3; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
#risk-grid-top .stat-card .number,
#risk-grid-bottom .stat-card .number {
  animation: value-loaded 0.35s ease-out;
}


/* ──────────────────────────────────────────────────────────────────────────────
   5. UNIVERSE TABLE — Sticky Ticker + Premium Expand + Improved Conf Bar
   ────────────────────────────────────────────────────────────────────────────── */

/* Sticky first column (ticker) */
#universe-table th:first-child,
#universe-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg);
  transition: background 0.15s ease;
}
#universe-table thead th:first-child {
  background: var(--surface2);
  z-index: 11;
}
.ticker-row:hover td:first-child,
.ticker-row.expanded td:first-child {
  background: var(--surface) !important;
}

/* Alternating universe rows — uses 4n because ticker+expand = 2 rows per item */
#universe-table tbody tr.ticker-row:nth-child(4n+1) {
  background: rgba(255, 255, 255, 0.012);
}
[data-theme="light"] #universe-table tbody tr.ticker-row:nth-child(4n+1) {
  background: rgba(0, 0, 0, 0.012);
}

/* Premium expand card */
.expand-row td {
  padding: 0 !important;
}
.expand-detail-card {
  margin: 0.5rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}
.expand-detail-card .expand-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.expand-detail-card .expand-section:last-child {
  border-bottom: none;
}
.expand-section-header {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.expand-section-header::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* CSS-based confidence bar — unified 6px/3px spec across signals + universe + positions */
.conf-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.conf-bar {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
[data-theme="light"] .conf-bar {
  background: rgba(0, 0, 0, 0.06);
}
.conf-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.35s cubic-bezier(.4, 0, .2, 1);
}
.conf-bar-fill.high { background: var(--green); }
.conf-bar-fill.mid  { background: var(--accent); }
.conf-bar-fill.low  { background: var(--text-dim); }
.conf-bar-num {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 2.5ch;
  text-align: right;
}


/* ──────────────────────────────────────────────────────────────────────────────
   6. SKELETON LOADING — Upgraded Shimmer
   ────────────────────────────────────────────────────────────────────────────── */

/* Override existing shimmer with a smoother multi-stop gradient */
.skeleton-bar {
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    rgba(255, 255, 255, 0.035) 25%,
    rgba(255, 255, 255, 0.055) 50%,
    rgba(255, 255, 255, 0.035) 75%,
    var(--surface) 100%
  ) !important;
  background-size: 200% 100% !important;
  animation: premium-shimmer 1.8s ease-in-out infinite !important;
}
[data-theme="light"] .skeleton-bar {
  background: linear-gradient(
    90deg,
    var(--surface2) 0%,
    rgba(0, 0, 0, 0.03) 25%,
    rgba(0, 0, 0, 0.05) 50%,
    rgba(0, 0, 0, 0.03) 75%,
    var(--surface2) 100%
  ) !important;
}

@keyframes premium-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Staggered fade for multiple skeleton rows */
.skeleton-row:nth-child(2) .skeleton-bar { animation-delay: 0.15s; opacity: 0.8; }
.skeleton-row:nth-child(3) .skeleton-bar { animation-delay: 0.3s;  opacity: 0.6; }
.skeleton-row:nth-child(4) .skeleton-bar { animation-delay: 0.45s; opacity: 0.45; }

/* Skeleton for equity curve area */
.skeleton-curve {
  width: 100%;
  height: 80px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 0%, rgba(255,255,255,0.03) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: premium-shimmer 2s ease-in-out infinite;
}


/* ──────────────────────────────────────────────────────────────────────────────
   7. EMPTY / ZERO STATES — Premium Empty Containers
   ────────────────────────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}
.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  color: var(--text-dim);
}
.empty-state-title {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-heading, var(--text));
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
.empty-state-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  max-width: 340px;
  line-height: 1.6;
}
.empty-state-hint {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}


/* ──────────────────────────────────────────────────────────────────────────────
   8. EQUITY CURVE — Bloomberg-Style Container + Callout
   ────────────────────────────────────────────────────────────────────────────── */

#equity-curve-container {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.25rem 1rem;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin-bottom: 1.5rem;
}

/* Subtle grid background inside container */
#equity-curve-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border-subtle, rgba(255,255,255,0.03)) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle, rgba(255,255,255,0.03)) 1px, transparent 1px);
  background-size: 48px 32px;
  pointer-events: none;
  opacity: 0.5;
}
[data-theme="light"] #equity-curve-container::before {
  background-image:
    linear-gradient(rgba(0,0,0,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.025) 1px, transparent 1px);
}

/* Equity header row — label on top, value callout top-right */
.equity-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 2;
}
.equity-header-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-heading, var(--text));
}
.equity-header-sub {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Increase SVG height for readability — override inline height attr */
#equity-curve {
  height: 160px !important;
  min-height: 120px;
  position: relative;
  z-index: 1;
}

/* Current value callout overlay (top-right) */
.equity-callout {
  position: absolute;
  top: 0.6rem;
  right: 0.85rem;
  text-align: right;
  z-index: 2;
}
.equity-callout-value {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.02em;
}
.equity-callout-value.pos { color: var(--green); }
.equity-callout-value.neg { color: var(--red); }
.equity-callout-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* ──────────────────────────────────────────────────────────────────────────────
   9. MOBILE — Three Premium Improvements
   ────────────────────────────────────────────────────────────────────────────── */

/*
 * Improvement 1: Signals table -> stacked cards on narrow screens.
 * Activated by adding class "signals-mobile-cards" to the table wrapper.
 * This is the best pattern for showing 10+ columns on 375px.
 */
@media (max-width: 600px) {
  .signals-mobile-cards .signals-table thead {
    display: none;
  }
  .signals-mobile-cards .signals-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2rem 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    margin-bottom: 2px;
    border-radius: 6px;
  }
  .signals-mobile-cards .signals-table tbody td {
    border: none !important;
    padding: 0.15rem 0 !important;
    font-size: 0.75rem;
  }
  /* Ticker spans full width as card header */
  .signals-mobile-cards .signals-table tbody td:first-child {
    grid-column: 1 / -1;
    font-size: 0.9rem;
    padding-bottom: 0.4rem !important;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04)) !important;
    margin-bottom: 0.2rem;
  }
  /* Inline label per cell */
  .signals-mobile-cards .signals-table tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-family: var(--mono);
    margin-bottom: 0.1rem;
  }
  .signals-mobile-cards .signals-table tbody td:first-child::before {
    display: none;
  }
}

/* Bottom nav CSS removed — no corresponding JS injection code */

/*
 * Improvement 3: Horizontal-swipe stat cards on mobile.
 */
@media (max-width: 600px) {
  .stats-bar {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    /* -webkit-overflow-scrolling removed — deprecated, momentum scrolling is default */
    scrollbar-width: none;
    gap: 0 !important;
  }
  .stats-bar::-webkit-scrollbar { display: none; }
  .stats-bar .stat-card {
    min-width: 65vw;
    scroll-snap-align: center;
    flex-shrink: 0;
  }
}

/* Risk grid: 5th column (Portfolio Heat) stacks full-width on mobile */
@media (max-width: 600px) {
  #risk-grid-top {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  #risk-grid-top #rd-heat-card {
    grid-column: 1 / -1;
  }
}

/* Filter buttons: 44px min touch targets on mobile */
@media (max-width: 600px) {
  .filter-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* iOS Safari: prevent zoom on input/select focus */
@media (max-width: 600px) {
  #search-input,
  input[type="search"],
  input[type="text"],
  select,
  #grade-filter,
  #sort-select {
    font-size: 16px;
  }
}


/* ──────────────────────────────────────────────────────────────────────────────
   10. MICRO-INTERACTIONS — Five Polish Transitions
   ────────────────────────────────────────────────────────────────────────────── */

/* 1. Feature cards — border-only hover (institutional, no bouncing) */
.feature-card {
  transition: border-color 0.2s ease, background 0.2s ease !important;
  border-radius: 4px !important;
}
.feature-card:hover {
  border-color: var(--accent);
}
[data-theme="light"] .feature-card:hover {
  border-color: var(--accent);
}

/* 2. Ticker links — underline slides in from left */
.ticker-link {
  position: relative;
}
.ticker-link::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.2s ease;
}
.ticker-link:hover::after {
  width: 100%;
}

/* 3. CTA button — subtle glow, no transform (institutional) */
.cta-btn {
  transition: opacity 0.15s ease, box-shadow 0.3s ease !important;
}
.cta-btn:hover {
  box-shadow: 0 0 24px var(--accent-glow), 0 0 60px rgba(79,142,247,0.08) !important;
}

/* 4. Grade badges — static, no transform (institutional) */
.grade-badge {
  transition: border-color 0.15s ease !important;
  cursor: default;
}
.grade-badge:hover {
  border-color: var(--accent);
}

/* 5. Table row staggered slide-in on data load */
/* NOTE: row-slide-in CSS animation removed — index.html uses its own row-enter
   JS-driven animation. CSS `backwards` fill-mode held dynamically-injected rows
   at opacity:0 permanently (two competing animation systems conflicting).
   The row-enter class in index.html handles entrance animation correctly. */
@keyframes row-slide-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Closed trades — stagger reveals (kept — these are static, not dynamically injected) */
.perf-grid .perf-row {
  animation: row-slide-in 0.28s ease-out both;
}
.perf-grid .perf-row:nth-child(1) { animation-delay: 0.04s; }
.perf-grid .perf-row:nth-child(2) { animation-delay: 0.08s; }
.perf-grid .perf-row:nth-child(3) { animation-delay: 0.12s; }
.perf-grid .perf-row:nth-child(4) { animation-delay: 0.16s; }
.perf-grid .perf-row:nth-child(5) { animation-delay: 0.20s; }
.perf-grid .perf-row:nth-child(6) { animation-delay: 0.24s; }

/* Scroll-to-top — smooth entrance with transform */
#scroll-top-btn {
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
#scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}


/* ──────────────────────────────────────────────────────────────────────────────
   11. SIGNALS TABLE — Column Priority Weight Hierarchy + Top Signal Row
   ────────────────────────────────────────────────────────────────────────────── */

/* Column priority weight hierarchy */
.signals-table th[data-priority="1"] { font-weight: 700; color: var(--text); }
.signals-table th[data-priority="2"] { font-weight: 500; opacity: 0.75; }
.signals-table th[data-priority="3"] { font-weight: 400; opacity: 0.7; }

/* Top signal row highlight */
.top-signal-row td:first-child { border-left: 2px solid var(--accent); }

/* ── Equity curve mobile adjustments ── */
@media (max-width: 600px) {
  #equity-expanded { padding: 0.75rem !important; }
  .closed-grid-cards { grid-template-columns: 1fr !important; }
}

/* ── Reduced motion — override !important animations ── */
@media (prefers-reduced-motion: reduce) {
  .skeleton-bar,
  .skeleton-curve,
  #risk-grid-top .stat-card .number,
  #risk-grid-bottom .stat-card .number,
  .perf-grid .perf-row,
  #scroll-top-btn,
  .conf-bar-fill {
    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
  }
}
