/* ══════════════════════════════════════════════════════════════════════
   THT Dashboard — Premium Dark Mode Stylesheet
   ══════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg-body: #0b0e14;
  --bg-card: #12151e;
  --bg-card-hover: #171b27;
  --bg-elevated: #1a1e2e;
  --bg-modal: #14182399;

  /* Borders */
  --border: #1e2235;
  --border-subtle: #161a2a;

  /* Text */
  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa3;
  --text-muted: #565a6e;

  /* Accent — Indigo / Violet */
  --accent: #6366f1;
  --accent-glow: #6366f133;
  --accent-hover: #818cf8;

  /* Status colours */
  --green: #22c55e;
  --green-bg: #22c55e14;
  --green-glow: #22c55e33;
  --amber: #f59e0b;
  --amber-bg: #f59e0b14;
  --amber-glow: #f59e0b33;
  --red: #ef4444;
  --red-bg: #ef444414;
  --blue: #3b82f6;

  /* Progress bar track */
  --track-bg: #1a1e2e;

  /* Misc */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px var(--border);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, .6);
  --transition: 180ms ease;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

.hidden {
  display: none !important;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* ── Header ──────────────────────────────────────────────────────────── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: var(--bg-body);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  flex-shrink: 0;
}

#app-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Fixed width to prevent tabs shifting when subtitle text changes */
.header-left>div:nth-child(2) {
  min-width: 190px;
}

.dashboard-toggle {
  display: flex;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-right: 12px;
}

.btn-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  line-height: 1.2;
}

.btn-tab:hover {
  color: var(--text);
}

.btn-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-tab.active:hover {
  background: var(--primary);
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

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

/* ── Search Bar ─────────────────────────────────────────────────────── */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 8px;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

#input-search {
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px 8px 36px;
  font-size: 0.85rem;
  font-family: var(--font);
  width: 180px;
  transition: all var(--transition);
  outline: none;
}

#input-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  width: 240px;
}

#input-search::placeholder {
  color: var(--text-muted);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid transparent;
}

.btn-danger:hover {
  border-color: var(--red);
}

/* ── Summary & Stats ─────────────────────────────────────────────────── */
.stats-row,
#summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
}

#summary-bar {
  padding: 16px 24px;
}

.stat-card {
  flex: 1;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--text-muted);
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.highlight-green .stat-value {
  color: var(--green);
}

.highlight-amber .stat-value {
  color: var(--amber);
}

.highlight-red .stat-value {
  color: var(--red);
}

/* Stat Card Filters */
.stat-card.clickable {
  cursor: pointer;
  user-select: none;
}

.stat-card.clickable:hover {
  background: var(--bg-card-hover);
}

.stat-card.active-filter {
  background: var(--bg-card-hover);
}

.stat-card.active-filter:first-child {
  border-color: var(--text-muted);
}

.stat-card.active-filter.highlight-green {
  border-color: var(--green);
}

.stat-card.active-filter.highlight-amber {
  border-color: var(--amber);
}

.stat-card.active-filter.highlight-red {
  border-color: var(--red);
}

/* ── Trades Grid ─────────────────────────────────────────────────────── */
#trades-grid {
  flex: 1;
  padding: 8px 32px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  align-content: start;
}

/* ── Empty State ─────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  opacity: 0.25;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 380px;
  line-height: 1.6;
}

/* ── CTA "Add Ticker" Card ──────────────────────────────────────────── */
.cta-card {
  border: 2px dashed var(--border) !important;
  background: transparent !important;
  cursor: pointer;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  order: 9999;
  /* Force it to always be the last element visually */
}

.cta-card::before {
  display: none !important;
}

.cta-card:hover {
  border-color: var(--accent) !important;
  background: rgba(99, 102, 241, 0.04) !important;
  transform: translateY(-2px);
  box-shadow: 0 0 24px var(--accent-glow);
}

.cta-card:hover .cta-title {
  color: var(--accent-hover);
}

.cta-card:hover svg {
  stroke: var(--accent);
}

.cta-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.cta-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.cta-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 200px;
  text-align: center;
  line-height: 1.4;
}

/* ── Trade Card ──────────────────────────────────────────────────────── */
.trade-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.trade-card.pinned {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), var(--bg-card));
  border-left: 4px solid var(--primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 24px;
}

.trade-card.pinned::after {
  content: 'Pinned';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.1em;
  opacity: 0.8;
}

.vip-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.market-open-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  font-weight: 500;
  white-space: nowrap;
  gap: 0;
}

.market-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.market-dot-open {
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}

.market-dot-closed {
  background: var(--red);
  box-shadow: 0 0 6px var(--red-bg);
}

.vip-chart-container {
  height: 300px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}

.mtf-movements {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mtf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.mtf-label {
  color: var(--text-muted);
  font-weight: 500;
}

.mtf-value {
  font-weight: 700;
}

.mtf-value.positive {
  color: var(--green);
}

.mtf-value.negative {
  color: var(--red);
}

.robotaxi-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.robotaxi-stat {
  padding: 12px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.robotaxi-stat .label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--primary);
  opacity: 0.8;
  margin-bottom: 4px;
}

.robotaxi-stat .value {
  font-size: 1.1rem;
  font-weight: 700;
}

.trade-card:hover {
  border-color: var(--text-muted);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
}

/* Glow stripe at top of card based on status */
.trade-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.6;
}

.trade-card.status-TAKE_PROFIT::before,
.trade-card.status-TAKE_PROFIT_WANING::before {
  background: var(--green);
  opacity: 1;
  box-shadow: 0 0 16px var(--green-glow);
}

.trade-card.status-TAKE_PROFIT_WANING::before {
  background: var(--amber);
  /* Overriding to amber for waning */
  box-shadow: 0 0 16px var(--amber-glow);
}

.trade-card.status-BELOW_33W_FVB::before {
  background: var(--amber);
  opacity: 1;
}

.trade-card.status-STOP_LOSS_EXIT::before,
.trade-card.status-STOP_LOSS::before,
.trade-card.status-BEARISH_1M::before {
  background: var(--red);
  opacity: 1;
  box-shadow: 0 0 16px var(--red-bg);
}

.trade-card.status-STOP_LOSS_EXIT,
.trade-card.status-STOP_LOSS {
  border: 2px solid var(--red);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--red-bg) 80%);
  box-shadow: 0 0 15px var(--red-bg);
  animation: pulseRed 2s ease-in-out infinite;
}

.badge-stoploss {
  background: var(--red);
  color: #fff;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--red);
  box-shadow: 0 0 12px var(--red-bg);
}

@keyframes pulseRed {

  0%,
  100% {
    box-shadow: 0 0 8px var(--red-bg);
  }

  50% {
    box-shadow: 0 0 24px var(--red-bg);
  }
}

.trade-card.status-ERROR::before {
  background: var(--red);
}

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

.ticker-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticker-group .status-badge {
  margin-right: -2px;
  /* Pull them slightly closer */
}

.ticker-name {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.current-price {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.daily-shift-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.daily-shift-badge.positive {
  color: var(--green);
  background: rgba(16, 185, 129, 0.1);
}

.daily-shift-badge.negative {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.market-state-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--amber);
  border: 1px solid var(--amber-glow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 2px;
  vertical-align: middle;
  box-shadow: 0 0 8px var(--amber-glow);
}

.trade-card-remove {
  opacity: 0;
  transition: opacity var(--transition);
}

.trade-card:hover .trade-card-remove {
  opacity: 1;
}

/* ── Progress Section ────────────────────────────────────────────────── */
.progress-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.progress-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Color Utilities */
.positive {
  color: var(--green) !important;
}

.warning {
  color: var(--amber) !important;
}

.complete {
  color: var(--green) !important;
  text-shadow: 0 0 12px var(--green-glow);
}

.negative {
  color: var(--red) !important;
}

/* Track */
.progress-track {
  height: 8px;
  background: var(--track-bg);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 600ms cubic-bezier(.22, 1, .36, 1);
  position: relative;
  min-width: 0;
}

.progress-fill.complete {
  background: linear-gradient(90deg, var(--green), #4ade80);
  box-shadow: 0 0 12px var(--green-glow);
}

.progress-fill.warning {
  background: linear-gradient(90deg, var(--amber), #fbbf24);
}

.progress-fill.negative {
  background: linear-gradient(90deg, var(--red), #f87171);
}

/* Markers on the track */
.progress-markers {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.marker {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Levels Row ──────────────────────────────────────────────────────── */
.levels-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.level-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.level-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.level-value.green {
  color: var(--green);
}

.level-value.red {
  color: var(--red);
}

.pending-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-top: -1px;
}

/* ── Status Badge ────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 100px;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.badge-tp {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green);
}

.badge-waning {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber);
  box-shadow: 0 0 8px var(--amber-glow);
}

.badge-rotation {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
  box-shadow: 0 0 8px var(--red-bg);
}

.badge-bullish {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

.badge-progress {
  background: var(--accent-glow);
  color: var(--accent-hover);
  border: 1px solid var(--accent);
}

.badge-below {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber);
}

.badge-bearish {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
}

.badge-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
}

.badge-reentry {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.badge-stoploss {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.badge-pending-stop {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.badge-lightred {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-darkred {
  background: rgba(153, 27, 27, 0.2);
  color: #f87171;
  border: 1px solid rgba(153, 27, 27, 0.4);
}

.badge-darkgreen {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.badge-lime {
  background: rgba(132, 204, 22, 0.15);
  color: #a3e635;
  border: 1px solid rgba(132, 204, 22, 0.4);
}

.tht-status-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.tht-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tht-status-row:last-child {
  opacity: 0.45;
}

.badge-marker {
  font-size: 0.6rem !important;
  padding: 2px 6px !important;
  box-shadow: none !important;
}

.badge-pending-marker {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid #f59e0b;
  font-size: 0.6rem !important;
  padding: 2px 6px !important;
}

/* ── Card Meta ───────────────────────────────────────────────────────── */
.trade-meta {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Card Actions ────────────────────────────────────────────────────── */
.card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.trade-card:hover .card-actions {
  opacity: 1;
}

/* ── Data Source Toggle Button ───────────────────────────────────────── */
.btn-source {
  font-size: 0.6rem;
  font-weight: 800;
  font-family: var(--font);
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.04em;
}

.btn-source:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.btn-source.active {
  background: rgba(59, 130, 246, .15);
  color: var(--blue);
  border-color: var(--blue);
}

/* ── Twelve Data Badge ──────────────────────────────────────────────── */
.badge-tv {
  background: rgba(59, 130, 246, .12);
  color: var(--blue);
  border: 1px solid var(--blue);
}

/* ── Override Form ───────────────────────────────────────────────────── */
.override-form {
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.override-form.hidden {
  display: none;
}

.override-form input[type="number"] {
  padding: 7px 10px;
  font-size: 0.8rem;
  font-family: var(--font);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.override-form input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.override-form input[type="number"]::placeholder {
  color: var(--text-muted);
}

.override-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.override-field label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.override-field input {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-family: var(--font);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.override-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.override-field input::placeholder {
  color: var(--text-muted);
}

.override-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-small {
  padding: 5px 12px;
  font-size: 0.75rem;
}

/* ── Override Badge ──────────────────────────────────────────────────── */
.badge-override {
  background: rgba(59, 130, 246, .12);
  color: var(--blue);
  border: 1px solid var(--blue);
}

/* ── Autocomplete Dropdown ───────────────────────────────────────────── */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 2000;
  box-shadow: var(--shadow-modal);
  list-style: none;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--bg-card-hover);
}

.autocomplete-symbol {
  font-weight: 600;
  color: var(--text-primary);
}

.autocomplete-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
  text-align: right;
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 200ms ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  width: 440px;
  max-width: 92vw;
  padding: 28px;
  animation: slideUp 250ms cubic-bezier(.22, 1, .36, 1);
}

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

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.required {
  color: var(--red);
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ── Toast ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 2000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
  animation: slideUpToast 300ms ease;
}

.toast.hidden {
  display: none;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
#app-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.legend {
  display: flex;
  gap: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-entry {
  background: var(--accent);
}

.dot-tp {
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}

.footer-note {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Loading Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 20, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  z-index: 10;
}

/* ── Shimmer / Skeleton ──────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Animations ──────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUpToast {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

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

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

@keyframes pulseGreen {

  0%,
  100% {
    box-shadow: 0 0 8px var(--green-glow);
  }

  50% {
    box-shadow: 0 0 20px var(--green-glow);
  }
}

.trade-card.status-TAKE_PROFIT,
.trade-card.status-BULLISH_ENTRY,
.trade-card.status-BULLISH_RE_ENTRY {
  animation: pulseGreen 3s ease-in-out infinite;
}

.trade-card.status-BULLISH_ENTRY {
  border: 2px solid var(--green);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--green-bg) 80%);
  box-shadow: 0 0 15px var(--green-glow);
}

.status-badge.badge-bullish {
  background: var(--green);
  color: #0b0e14;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-reentry {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.trade-card.status-BULLISH_RE_ENTRY {
  border: 2px solid rgba(59, 130, 246, 0.6);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(59, 130, 246, 0.08) 80%);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* ── Header ── */
  #app-header {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .header-left {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  #app-header h1 {
    font-size: 1.05rem;
  }

  .subtitle {
    font-size: 0.7rem;
  }

  /* ── Tabs: 2x2 grid on mobile ── */
  .dashboard-toggle {
    width: 100%;
    margin-right: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    text-align: center;
  }

  .btn-tab {
    padding: 8px 6px;
    font-size: 0.72rem;
  }

  /* ── Header Right: compact icon buttons ── */
  .header-right {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
  }

  /* Hide button text labels on mobile, keep icons */
  .header-right .btn span {
    display: none;
  }

  .header-right .btn {
    padding: 8px 10px;
    gap: 0;
  }

  /* Search fills remaining space */
  .search-container {
    flex: 1;
    min-width: 120px;
    margin-right: 0;
  }

  #input-search {
    width: 100%;
    font-size: 0.85rem;
    padding: 8px 12px 8px 32px;
  }

  #input-search:focus {
    width: 100%;
  }

  /* Form inputs in Modal */
  .form-group input {
    font-size: 0.85rem;
  }

  /* Override inputs */
  .override-field input {
    font-size: 0.85rem;
  }

  /* ── Market label ── */
  .market-open-label {
    font-size: 0.65rem;
    order: -1;
    width: 100%;
  }

  /* ── Summary Bar ── */
  #summary-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 12px 16px;
    gap: 6px;
  }

  #summary-bar .stat-card {
    padding: 8px 10px;
  }

  #summary-bar .stat-card:first-child {
    grid-column: span 2;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  .stat-label {
    font-size: 0.6rem;
  }

  /* ── Grid ── */
  #trades-grid {
    padding: 8px 16px 24px;
    display: flex;
    flex-direction: column;
  }

  /* ── Pinned Cards ── */
  .trade-card.pinned {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-left: 4px solid var(--primary);
  }

  .trade-card.pinned::after {
    top: 8px;
    right: 8px;
    font-size: 0.55rem;
  }

  .vip-chart-container {
    display: none;
  }

  /* ── CTA Card ── */
  .cta-card {
    min-height: 100px !important;
  }

  /* ── Footer ── */
  #app-footer {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ── Upgrade Page ────────────────────────────────────────────────────── */
.pricing-container {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pricing-header {
  text-align: center;
  margin-bottom: 48px;
}

.pricing-header h2 {
  font-size: 2.5rem;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pricing-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
  width: 100%;
}

.pricing-card {
  background: rgba(30, 30, 38, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pricing-card:hover {
  transform: translateY(-4px);
}

.pricing-card.pro-tier {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.1) 0%, rgba(30, 30, 38, 0.6) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
}

.pro-glow {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
  filter: blur(30px);
  z-index: -1;
}

.tier-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 14px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tier-badge.premium {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border: none;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.pricing-card h3 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  font-weight: 500;
}

.pricing-card .price {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.pricing-card .price span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.tier-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
  line-height: 1.5;
  min-height: 44px;
}

.feature-list {
  list-style: none;
  margin-bottom: 40px;
  flex: 1;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.feature-list li strong {
  color: var(--text-primary);
}

.check-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.pro-check {
  color: var(--primary);
}

/* ── Ticker Chips (Add Modal) ────────────────────────────────────────── */
.ticker-chips {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.ticker-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.ticker-chip button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.ticker-chip button:hover {
  color: var(--red);
}

/* ── Onboarding Wizard ────────────────────────────────────────────── */
.onboarding-card {
  max-width: 520px;
  padding: 2rem;
  text-align: center;
}

.onboarding-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.ob-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.ob-step-indicator {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 12px;
}

.ob-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.ob-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 80px;
}

.ob-chip:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
}

.ob-chip.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.ob-chip-ticker {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.ob-chip-name {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.ob-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ob-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ob-buttons {
  display: flex;
  gap: 8px;
}