/* Modern Dark-Mode Glassmorphism Design System */
:root {
  --bg-dark: #07090e;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-hover: rgba(30, 41, 59, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(99, 102, 241, 0.3);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-indigo: #6366f1;
  --accent-violet: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;

  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --gradient-glow: radial-gradient(circle at 50% -20%, rgba(99, 102, 241, 0.15), transparent 70%);

  --font-family-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-family-heading: 'Outfit', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Reset & Global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  background-image: var(--gradient-glow);
  color: var(--text-main);
  font-family: var(--font-family-body);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Navigation Bar */
.navbar {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-brand);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.brand-name {
  font-family: var(--font-family-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

.brand-accent {
  color: var(--accent-indigo);
}

.brand-tagline {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ==========================================================================
   Prominent Dual-Engine Mode Switcher
   ========================================================================== */
.mode-switcher-container {
  width: 100%;
  margin-bottom: 8px;
}

.mode-switcher-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 27, 75, 0.4) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-xl);
  padding: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.mode-switcher-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan), var(--accent-emerald));
}

.mode-divider {
  width: 1px;
  background: linear-gradient(180deg, transparent 0%, var(--border-glass) 50%, transparent 100%);
  margin: 8px 0;
}

.mode-tab-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.mode-tab-btn:hover {
  background: rgba(255, 255, 255, 0.03);
}

.mode-tab-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(6, 182, 212, 0.12) 100%);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mode-tab-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.mode-tab-btn:hover .mode-tab-icon {
  transform: scale(1.08);
}

.icon-indigo {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.icon-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.icon-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.mode-tab-btn.active .icon-indigo {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.5);
  border-color: transparent;
}

.mode-tab-btn.active .icon-cyan {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.5);
  border-color: transparent;
}

.mode-tab-btn.active .icon-emerald {
  background: linear-gradient(135deg, var(--accent-emerald), var(--accent-cyan));
  color: #fff;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.5);
  border-color: transparent;
}

.mode-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.mode-tab-title {
  font-family: var(--font-family-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.mode-tab-btn.active .mode-tab-title {
  color: #fff;
}

.mode-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.tag-indigo {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-indigo);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.tag-cyan {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.tag-emerald {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.mode-tab-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.35;
  transition: color 0.2s ease;
}

.mode-tab-btn.active .mode-tab-desc {
  color: var(--text-muted);
}

.active-indicator {
  font-size: 1.25rem;
  color: var(--text-dim);
  opacity: 0.2;
  transition: all 0.25s ease;
}

.mode-tab-btn.active .active-indicator {
  color: var(--accent-cyan);
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.6));
}

@media (max-width: 1100px) {
  .mode-switcher-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .mode-divider {
    display: none;
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-indigo);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  width: fit-content;
}

/* View Transition Animations */
.app-view {
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: viewFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--accent-emerald);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* Main Layout */
.main-content {
  max-width: 1300px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Hero & Input Section */
.hero-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 700px;
  margin-top: 8px;
}

.input-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preset-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.preset-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--border-accent);
  color: #fff;
}

.chip.active {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: #fff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.input-group {
  display: flex;
  gap: 14px;
}

.input-wrapper {
  position: relative;
  flex: 1;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 18px;
  color: var(--text-dim);
}

.ticker-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-family-body);
  font-size: 0.95rem;
  padding: 14px 16px 14px 44px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

.ticker-textarea:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-family-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-accent {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* Loading Container */
.loading-container {
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loading-bar-wrapper {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loading-bar {
  width: 30%;
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  animation: loading-anim 1.5s infinite ease-in-out;
}

@keyframes loading-anim {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
  100% { transform: translateX(300%); }
}

.loading-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.metric-card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.icon-blue { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-violet); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }

.metric-details {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--font-family-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

/* Toolbar Card */
.toolbar-card {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
}

.search-box input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px 14px 8px 36px;
  color: var(--text-main);
  outline: none;
  font-size: 0.9rem;
}

.select-wrapper select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: var(--text-main);
  outline: none;
  font-size: 0.9rem;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Data Table */
.table-card {
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(15, 23, 42, 0.9);
  padding: 14px 18px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-glass);
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--text-main);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-main);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* Ticker Pill & Badges */
.ticker-badge {
  font-weight: 700;
  color: #fff;
  font-family: var(--font-family-heading);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-overbought { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-neutral { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-oversold { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }

/* Custom Checkbox */
.row-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-glass);
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  vertical-align: middle;
  position: relative;
  outline: none;
}

.row-checkbox:hover {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.15);
}

.row-checkbox:checked {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.row-checkbox:checked::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 11px;
  color: #fff;
  line-height: 1;
}

.row-checkbox:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.selected-count-badge {
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 6px;
  border: 1px solid rgba(99, 102, 241, 0.5);
  transition: all 0.2s ease;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: rgba(15, 23, 42, 0.96);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-glass);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.modal-large {
  max-width: 980px;
  width: 92vw;
  height: 88vh;
  max-height: 88vh;
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  overflow-x: hidden;
  display: block;
  flex: 1;
  scroll-behavior: smooth;
}

.ai-report-modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 32px;
  display: block;
}

.modal-body::-webkit-scrollbar,
.ai-report-modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track,
.ai-report-modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb,
.ai-report-modal-body::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.35);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.ai-report-modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.65);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-group input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  border-color: var(--accent-indigo);
}

.form-group small {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

/* Enhanced Markdown Body for AI Reports */
.markdown-body {
  line-height: 1.75;
  color: #cbd5e1;
  font-size: 0.95rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: normal;
  max-width: 100%;
}

.markdown-body h1 {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  margin-top: 20px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  letter-spacing: -0.01em;
}

.markdown-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 20px;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.markdown-body h3 {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--accent-indigo);
  margin-top: 16px;
  margin-bottom: 8px;
}

.markdown-body h4, .markdown-body h5 {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 12px;
  margin-bottom: 6px;
}

.markdown-body p {
  margin-bottom: 14px;
  color: #cbd5e1;
  line-height: 1.75;
}

.markdown-body ul, .markdown-body ol {
  margin-left: 22px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.markdown-body li {
  color: #cbd5e1;
  line-height: 1.65;
}

.markdown-body strong {
  color: #fff;
  font-weight: 700;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent-indigo);
  padding: 10px 16px;
  margin: 14px 0;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-muted);
}

.markdown-body table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.markdown-body th {
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  font-weight: 700;
  border: 1px solid var(--border-glass);
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

.markdown-body td {
  border: 1px solid var(--border-glass);
  padding: 10px 14px;
  color: #cbd5e1;
}

.markdown-body pre {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 14px 0;
}

.markdown-body code {
  font-family: monospace;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
}

.markdown-body hr {
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 20px 0;
}

.hidden {
  display: none !important;
}

.telegram-tag {
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ==========================================================================
   Thematic Value Chain & Ontology Explorer Styles
   ========================================================================== */
.theme-card {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.7) 0%, rgba(30, 27, 75, 0.3) 100%);
  position: relative;
  overflow: hidden;
}

.theme-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan), var(--accent-purple));
}

.theme-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-indigo);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.theme-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.theme-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

.theme-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 16px 14px 44px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.theme-input:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
}

.theme-loading {
  text-align: center;
  padding: 36px 0;
}

.theme-loading i {
  font-size: 2.4rem;
  color: var(--accent-indigo);
}

.theme-loading p {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Thesis Summary Box */
.thesis-box {
  padding: 18px 22px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  margin-bottom: 24px;
}

.thesis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.thesis-tag {
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.thesis-actions {
  display: flex;
  gap: 8px;
}

.thesis-text {
  color: var(--text-main);
  line-height: 1.65;
  font-size: 0.95rem;
}

/* ==========================================================================
   The Three Market Stages (The Fish Model) UI Components
   ========================================================================== */
.fish-model-banner {
  margin-top: 14px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fish-model-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.fish-model-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-indigo);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fish-stage-pill-hero {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.fish-stage-head {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.fish-stage-body {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(6, 182, 212, 0.5);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

.fish-stage-tail {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(244, 63, 94, 0.15));
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

/* 3-Stage Progress Visualizer */
.fish-timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 768px) {
  .fish-timeline {
    grid-template-columns: 1fr;
  }
}

.fish-timeline-step {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0.45;
  transition: all 0.2s ease;
}

.fish-timeline-step.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fish-timeline-step.active.step-head {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.08);
}

.fish-timeline-step.active.step-body {
  border-color: rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.08);
}

.fish-timeline-step.active.step-tail {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
}

.step-label {
  font-size: 0.76rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

.step-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.fish-traits-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.fish-trait-chip {
  font-size: 0.72rem;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--text-muted);
}

.fish-rationale-box {
  font-size: 0.85rem;
  color: #e2e8f0;
  line-height: 1.5;
  background: rgba(15, 23, 42, 0.5);
  border-left: 3px solid var(--accent-indigo);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Subsegment Fish Stage Pill */
.fish-sub-stage-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 4-Tier Hierarchical Grid */
.value-chain-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  position: relative;
}

@media (max-width: 1200px) {
  .value-chain-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .value-chain-grid {
    grid-template-columns: 1fr;
  }
}

.tier-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.25s ease;
  position: relative;
}

.tier-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.tier-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 12px;
}

.tier-badge-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tier-number-tag {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-indigo);
  text-transform: uppercase;
}

.tier-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}

.tier-description {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Subsegments inside tier */
.subsegment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subsegment-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subsegment-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.meta-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.conc-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.moat-tag-wide {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.moat-tag-moderate {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.moat-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.35;
}

/* Ticker Pills */
.ticker-chips-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.ticker-play-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.ticker-symbol-pill {
  font-weight: 800;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-indigo);
  color: #fff;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.ticker-symbol-pill:hover {
  transform: scale(1.05);
}

.ticker-company-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ticker-company-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
}

.ticker-play-badge-pure {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.ticker-play-badge-high {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-purple);
  text-transform: uppercase;
}

.ticker-thesis-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
}

/* ==========================================================================
   Macroeconomic & Monetary Liquidity Dashboard Styles
   ========================================================================== */
.net-liq-card {
  padding: 26px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(6, 78, 59, 0.25) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  position: relative;
  overflow: hidden;
}

.net-liq-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan), var(--accent-indigo));
}

.net-liq-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.net-liq-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-emerald);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.net-liq-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
}

.net-liq-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.net-liq-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Net Liquidity Hero Grid */
.net-liq-hero-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: center;
}

@media (max-width: 1024px) {
  .net-liq-hero-grid {
    grid-template-columns: 1fr;
  }
}

.net-liq-main-kpi {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.net-liq-kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.net-liq-value-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.net-liq-value {
  font-size: 2.3rem;
  font-weight: 900;
  color: #fff;
  font-family: var(--font-family-heading);
  letter-spacing: -0.02em;
}

.net-liq-delta-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.net-liq-timestamp {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Formula components */
.net-liq-components {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.comp-box {
  flex: 1;
  min-width: 170px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comp-name {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.comp-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-family-heading);
}

.comp-date {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.comp-operator {
  color: var(--text-dim);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Section Header */
.macro-section-header {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.macro-section-header .section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.macro-section-header .section-title i {
  color: var(--accent-cyan);
}

.macro-section-header .section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* 10-Indicator Grid */
.macro-indicators-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1200px) {
  .macro-indicators-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .macro-indicators-grid {
    grid-template-columns: 1fr;
  }
}

.macro-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.macro-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.macro-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.macro-card-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.macro-card-cat-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.cat-inflation { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.3); }
.cat-labor { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); border: 1px solid rgba(99, 102, 241, 0.3); }
.cat-rates { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.cat-growth { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.cat-consumer { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.3); }
.cat-housing { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); border: 1px solid rgba(168, 85, 247, 0.3); }

.macro-card-val-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.macro-card-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-family-heading);
}

.macro-card-unit {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.macro-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
  font-size: 0.72rem;
}

.macro-delta-pill {
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.delta-pos {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.delta-neg {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

.delta-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.macro-card-date {
  color: var(--text-dim);
}

/* ==========================================================================
   Access Code Security Badge & Modal
   ========================================================================== */
.access-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.badge-locked {
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.2);
}

.badge-locked:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--accent-rose);
  transform: translateY(-1px);
}

.badge-unlocked {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.badge-unlocked:hover {
  background: rgba(16, 185, 129, 0.25);
  transform: translateY(-1px);
}

/* Hotkey hint chip */
.hotkey-badge {
  font-size: 0.65rem;
  font-weight: 800;
  font-family: monospace;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-left: auto;
}

.mode-tab-btn.active .hotkey-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Grouped Macro Category Panels
   ========================================================================== */
.macro-grouped-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}

.macro-category-panel {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.category-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.category-badge-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}
