/* ═══════════════════════════════════════════════════════════════════════════
   ICT SNIPER — Global Styles
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg-primary:    #0A0F1C;
  --bg-secondary:  #0F1629;
  --bg-card:       #111827;
  --bg-card-inner: #161f35;
  --bg-elevated:   #1a2540;

  --accent:        #5B8DEF;
  --accent-dim:    rgba(91, 141, 239, 0.15);
  --accent-glow:   rgba(91, 141, 239, 0.35);

  --bull:          #22C55E;
  --bull-dim:      rgba(34, 197, 94, 0.15);
  --bull-glow:     rgba(34, 197, 94, 0.4);

  --bear:          #EF4444;
  --bear-dim:      rgba(239, 68, 68, 0.15);
  --bear-glow:     rgba(239, 68, 68, 0.4);

  --gold:          #F59E0B;
  --gold-dim:      rgba(245, 158, 11, 0.15);

  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted:     #475569;
  --text-dim:       #334155;

  --border:        rgba(148, 163, 184, 0.08);
  --border-accent: rgba(91, 141, 239, 0.25);

  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-xl:     20px;
  --radius-2xl:    24px;

  --font-sans:  'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.7);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Top Bar ───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 64px;
  background: rgba(15, 22, 41, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.logo-accent {
  color: var(--accent);
}

/* ── Instrument Category Tabs (in topbar) ──────────────────────────────────── */
.topbar__instruments {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.inst-cat-btn {
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.inst-cat-btn:hover {
  border-color: rgba(148,163,184,0.3);
  color: var(--text-secondary);
}

.inst-cat-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ── Instrument Chips Bar (below topbar) ───────────────────────────────────── */
.inst-chips-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 24px;
  background: rgba(11, 17, 32, 0.9);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  backdrop-filter: blur(8px);
}

.inst-chips-bar::-webkit-scrollbar { display: none; }

.inst-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.inst-chip:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-secondary);
  border-color: rgba(148,163,184,0.2);
}

.inst-chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.inst-chip__icon {
  font-size: 10px;
  font-weight: 800;
  opacity: 0.7;
}

/* Legacy .inst-btn kept for compatibility */
.inst-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.inst-icon {
  font-size: 12px;
  font-weight: 700;
}

/* ── Journal Nav Button ────────────────────────────────────────────────────── */
.journal-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s;
  flex-shrink: 0;
  margin-left: auto;
}

.journal-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Journal Toast ─────────────────────────────────────────────────────────── */
.journal-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--bull);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(34,197,94,0.15);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.journal-toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-link {
  color: var(--bull);
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

.toast-link:hover { text-decoration: underline; }

.topbar__price {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.live-dot.connected {
  background: var(--bull);
  box-shadow: 0 0 6px var(--bull-glow);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.3); }
}

.live-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.current-price {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 100px;
  text-align: right;
  transition: color 0.3s;
}

.current-price.up   { color: var(--bull); }
.current-price.down { color: var(--bear); }

/* ── Main Layout ───────────────────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Controls Bar ──────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.capital-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.capital-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.capital-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s;
}

.capital-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.currency-prefix {
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
}

.capital-input {
  width: 100px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}

.capital-input::-webkit-outer-spin-button,
.capital-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 40px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-badge.loading .status-dot {
  background: var(--gold);
  animation: pulse-dot 1s infinite;
}

.status-badge.ready .status-dot {
  background: var(--bull);
}

.status-badge.error .status-dot {
  background: var(--bear);
}

#status-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.analyse-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 10px 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #7C3AED 100%);
  border: none;
  border-radius: 40px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(91, 141, 239, 0.4);
}

.analyse-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(91, 141, 239, 0.6);
}

.analyse-btn:active {
  transform: translateY(0);
}

.analyse-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.analyse-icon {
  font-size: 16px;
}

/* ── Chart Wrapper ─────────────────────────────────────────────────────────── */
.chart-wrapper {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#chart-container {
  width: 100%;
  height: 400px;
}

.chart-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(4px);
  font-size: 14px;
  color: var(--text-secondary);
  transition: opacity 0.3s;
  z-index: 10;
}

.chart-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Card Output ───────────────────────────────────────────────────────────── */
.card-output {
  width: 100%;
}

.card-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 24px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
  text-align: center;
}

.placeholder-icon {
  font-size: 48px;
  opacity: 0.2;
  color: var(--accent);
}

.card-placeholder p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 280px;
}

.card-placeholder strong {
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TRADE CARD COMPONENT
   ══════════════════════════════════════════════════════════════════════════════ */

.trade-card {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(91, 141, 239, 0.05);
  overflow: hidden;
  animation: card-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Card Header ─────────────────────────────────────────────────────────── */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
}

.card-header__left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-mini-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
}

.card-symbol-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-symbol {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.direction-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.direction-pill.long {
  background: var(--bull-dim);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--bull);
}

.direction-pill.short {
  background: var(--bear-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--bear);
}

.card-header__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.lot-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.lot-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ── ICT Grid ────────────────────────────────────────────────────────────── */
.ict-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.ict-cell {
  background: var(--bg-card);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.2s;
}

.ict-cell:hover {
  background: var(--bg-card-inner);
}

.ict-cell__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ict-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  min-width: 18px;
}

.ict-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.ict-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-left: 26px;
  line-height: 1.4;
}

.ict-value .bull { color: var(--bull); }
.ict-value .bear { color: var(--bear); }
.ict-value .gold { color: var(--gold); }
.ict-value .accent { color: var(--accent); }

/* ── SVG Chart Area ──────────────────────────────────────────────────────── */
.card-chart-wrap {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.card-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ── Outcome Cards ───────────────────────────────────────────────────────── */
.outcome-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.outcome-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.outcome-card.tp {
  background: var(--bull-dim);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.outcome-card.sl {
  background: var(--bear-dim);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.outcome-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.outcome-card.tp .outcome-label { color: var(--bull); }
.outcome-card.sl .outcome-label { color: var(--bear); }

.outcome-amount {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.outcome-card.tp .outcome-amount { color: var(--bull); }
.outcome-card.sl .outcome-amount { color: var(--bear); }

.outcome-pts {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ── RR Bar ──────────────────────────────────────────────────────────────── */
.rr-section {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rr-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rr-label-risk {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bear);
  font-weight: 500;
}

.rr-label-center {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.rr-label-reward {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bull);
  font-weight: 500;
}

.rr-bar-track {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 40px;
  overflow: hidden;
  display: flex;
}

.rr-bar-risk {
  height: 100%;
  background: linear-gradient(90deg, var(--bear), rgba(239,68,68,0.6));
  border-radius: 40px 0 0 40px;
  transition: width 0.8s ease;
}

.rr-bar-reward {
  height: 100%;
  background: linear-gradient(90deg, rgba(34,197,94,0.6), var(--bull));
  border-radius: 0 40px 40px 0;
  flex: 1;
  transition: width 0.8s ease;
}

/* ── Capital Footer ──────────────────────────────────────────────────────── */
.card-footer {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.footer-capital {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.footer-arrow {
  color: var(--text-muted);
  font-size: 12px;
}

.footer-win {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--bull);
}

.footer-sep {
  color: var(--text-dim);
}

.footer-loss {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--bear);
}

/* ── AI Commentary Panel ─────────────────────────────────────────────────── */
.ai-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.ai-panel__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.ai-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.ai-panel__icon {
  font-size: 16px;
}

.ai-provider-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.ai-provider-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 40px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.ai-provider-chip:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-secondary);
}

.ai-provider-chip.active {
  background: color-mix(in srgb, var(--chip-color, #888) 15%, transparent);
  border-color: var(--chip-color, #888);
  color: var(--chip-color, #888);
  box-shadow: 0 0 10px color-mix(in srgb, var(--chip-color, #888) 30%, transparent);
}

.ai-chip-icon {
  font-size: 11px;
}

.ai-chip-model {
  font-size: 10px;
  font-family: var(--font-mono);
  opacity: 0.6;
  letter-spacing: 0;
}

.ai-ask-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 40px;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

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

.ai-ask-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-ask-icon { font-size: 13px; }

/* ── AI Output Area ──────────────────────────────────────────────────────── */
.ai-output {
  padding: 20px 24px;
  min-height: 80px;
}

.ai-placeholder {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 12px 0;
}

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

.ai-provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: color-mix(in srgb, var(--badge-color, #888) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color, #888) 35%, transparent);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--badge-color, #888);
  letter-spacing: 0.5px;
  width: fit-content;
}

.ai-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.ai-text p { margin: 0 0 10px; }
.ai-text p:last-child { margin-bottom: 0; }

.ai-text strong {
  color: var(--text-primary);
  font-weight: 700;
}

.ai-heading {
  display: block;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.ai-bull { color: var(--bull); font-weight: 700; }
.ai-bear { color: var(--bear); font-weight: 700; }
.ai-warn { color: var(--gold); font-weight: 700; }

.ai-cursor {
  display: inline-block;
  color: var(--accent);
  animation: blink 1s step-end infinite;
  margin-left: 1px;
  font-size: 13px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.ai-error {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 0;
}

/* ── Entry Point Animation ───────────────────────────────────────────────── */
@keyframes pulse-entry {
  0%   { r: 5; opacity: 1; }
  50%  { r: 9; opacity: 0.4; }
  100% { r: 5; opacity: 1; }
}

.entry-pulse {
  animation: pulse-entry 2s ease-in-out infinite;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar__price { display: none; }

  .main { padding: 16px 16px 48px; gap: 16px; }

  .controls {
    flex-wrap: wrap;
    gap: 10px;
  }

  .analyse-btn { margin-left: 0; width: 100%; justify-content: center; }

  .ict-grid { grid-template-columns: 1fr; }

  .outcome-row { grid-template-columns: 1fr; }

  #chart-container { height: 280px; }
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── TradeMonitor Auto-Close Notification ──────────────────────────────────── */
.tm-notif {
  position: fixed;
  bottom: calc(28px + var(--notif-offset, 0px));
  left: 28px;
  z-index: 9998;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  max-width: 380px;
  min-width: 300px;
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.tm-notif.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.tm-notif.win  { border-left: 3px solid var(--bull); }
.tm-notif.loss { border-left: 3px solid var(--bear); }

.tm-notif__icon {
  font-size: 26px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

.tm-notif__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tm-notif__title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.tm-notif__symbol {
  font-size: 15px;
  font-weight: 800;
}

.tm-notif__dir {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.tm-notif__verdict {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.tm-notif__verdict.win  { background: var(--bull-dim); color: var(--bull); }
.tm-notif__verdict.loss { background: var(--bear-dim); color: var(--bear); }

.tm-notif__prices {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.tm-notif__pnl {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.tm-notif__pnl.win  { color: var(--bull); }
.tm-notif__pnl.loss { color: var(--bear); }

.tm-notif__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.tm-notif__link {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.tm-notif__link:hover { text-decoration: underline; }

.tm-notif__close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}

.tm-notif__close:hover { color: var(--text-primary); }
