/* ==========================================================================
   MARKETSHRI - MARKET INTELLIGENCE DESIGN SYSTEM
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* DARK THEME (DEFAULT) */
  --bg-primary: #070B12;
  --bg-sidebar: #0A0F17;
  --bg-surface: #0D131D;
  --bg-surface-2: #111923;
  --bg-hover: #151F2B;

  --border-subtle: #1C2835;
  --border-active: #243546;

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --positive: #22C55E;
  --negative: #EF4444;
  --warning: #F59E0B;

  --accent-cyan: #00C2D7;
  --accent-ai: #8B5CF6;
  
  --font-ui: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

[data-theme="light"] {
  /* LIGHT THEME */
  --bg-primary: #F4F6F8;
  --bg-sidebar: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F8FAFC;
  --bg-hover: #F1F5F9;

  --border-subtle: #E2E8F0;
  --border-active: #CBD5E1;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;

  --positive: #16A34A;
  --negative: #DC2626;
  --warning: #D97706;

  --accent-cyan: #0891B2;
  --accent-ai: #7C3AED;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: var(--transition);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-2);
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-subtle);
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  transition: var(--transition);
}

.brand-logo {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 16px;
}

.brand-text {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.brand-tag {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
}

.nav-menu {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-section-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 16px 12px 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border-left: 3px solid var(--accent-cyan);
}

.nav-item i {
  font-size: 14px;
  width: 18px;
  text-align: center;
  color: inherit;
}
.nav-item.active i {
  color: var(--accent-cyan);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
}

.engine-status {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-primary);
}

.engine-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Main Wrapper */
.main-wrapper {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Header */
.top-header {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 90;
  transition: var(--transition);
}

.ticker-bar {
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  height: 36px;
  padding: 0;
  white-space: nowrap;
  font-family: var(--font-mono);
  position: relative;
  user-select: none;
}

.ticker-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 16px;
  position: relative;
  z-index: 20;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.ticker-pulse-badge {
  position: relative;
  width: 8px;
  height: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ticker-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 8px var(--positive);
  display: inline-block;
}

.ticker-pulse-ring {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--positive);
  opacity: 0.8;
  animation: ticker-pulse-anim 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

@keyframes ticker-pulse-anim {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

.ticker-label-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 11px;
}

.ticker-ai-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 194, 215, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 194, 215, 0.3);
}

.ticker-viewport {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(to right, transparent 0%, black 20px, black calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 20px, black calc(100% - 24px), transparent 100%);
}

.ticker-content {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-left: 12px;
  animation: ticker-scroll 45s linear infinite;
  will-change: transform;
}

.ticker-content:hover {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  border-right: 1px solid var(--border-subtle);
  padding-right: 18px;
  transition: opacity 0.2s ease;
}
.ticker-item:hover {
  opacity: 0.85;
}
.ticker-item-sym {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.3px;
}
.ticker-item-val {
  color: var(--text-primary);
  font-weight: 500;
}

/* Market Overview AI Auto-Sync Pill */
.mo-sync-pill {
  font-size: 10px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-end;
  background: rgba(0, 194, 215, 0.08);
  border: 1px solid rgba(0, 194, 215, 0.22);
  padding: 3px 10px;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}
.mo-sync-pill:hover {
  background: rgba(0, 194, 215, 0.14);
  border-color: rgba(0, 194, 215, 0.4);
}
.ai-sync-pulse {
  position: relative;
  width: 7px;
  height: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ai-sync-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
  display: inline-block;
}
.ai-sync-ring {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-cyan);
  opacity: 0.8;
  animation: ai-sync-pulse-anim 2.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}
@keyframes ai-sync-pulse-anim {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}
.mo-sync-text {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--accent-cyan);
}
#mo-refresh-btn:hover {
  color: var(--accent-cyan) !important;
  transform: rotate(90deg);
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}

.search-wrapper {
  position: relative;
  width: 400px;
}

.search-wrapper input {
  width: 100%;
  height: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 12px 0 36px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.search-wrapper input:focus {
  border-color: var(--border-active);
  background: var(--bg-surface-2);
}

.search-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}
.search-wrapper .kbd-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

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

/* Theme Switcher */
.theme-switcher {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  padding: 2px;
}
.theme-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  outline: none;
}
.theme-btn:hover {
  color: var(--text-primary);
}
.theme-btn.active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.hud-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.hud-btn:hover {
  background: var(--bg-hover);
}

.hud-btn.active {
  background: var(--bg-surface-2);
  border-color: var(--border-active);
}

.btn-primary {
  background: var(--accent-cyan);
  color: #FFFFFF;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  outline: none;
}

.btn-primary:hover {
  opacity: 0.9;
}

.form-select {
  height: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0 32px 0 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: var(--transition);
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394A3B8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px top 50%;
  background-size: 10px auto;
}

.form-select:focus {
  border-color: var(--border-active);
  background-color: var(--bg-surface-2);
}

/* Page Views Container */
.content-body {
  padding: 24px;
  flex: 1;
}

.page-view {
  display: none;
}

.page-view.active-page {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title-text {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title-text i {
  color: var(--text-muted);
}

/* Professional Card */
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  transition: var(--transition);
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--text-muted);
}

/* HIGH-LEVEL MARKET SENTIMENT & AI INTELLIGENCE */
.sentiment-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.sentiment-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 960px) {
  .sentiment-grid {
    grid-template-columns: 1fr;
  }
}

.sentiment-box {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.sentiment-hero-value {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.sentiment-score-num {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.sentiment-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sentiment-status-tag {
  font-size: 14px;
  font-weight: 600;
  color: var(--positive);
  text-transform: uppercase;
}

.sentiment-shift-tag {
  font-size: 12px;
  color: var(--text-muted);
}

.sentiment-supporting {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.support-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.support-metric strong {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* AI Forecast Console */
.forecast-console {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.console-terminal-box {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  flex: 1;
}



.console-terminal-box p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.telemetry-pills-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.telemetry-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.telemetry-pill span {
  font-size: 11px;
  text-transform: uppercase;
}

.telemetry-pill strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* SECTORAL INDICES HEATMAP */
.sector-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.sector-heatmap-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.sector-heatmap-card:hover {
  border-color: rgba(0, 194, 215, 0.45);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.4), 0 0 16px rgba(0, 194, 215, 0.12);
}

.sector-heatmap-card:hover .sector-card-link-icon {
  opacity: 0.95 !important;
  transform: translate(2px, -2px);
}

.sector-heatmap-card:active {
  transform: translateY(0);
}

.sector-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.sector-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.sector-card-pchange {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}



/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }

@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Index Cards */
.index-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.index-card:hover {
  border-color: var(--border-active);
}

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

.index-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.index-price {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 12px 0 4px 0;
}

.index-change-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.index-change-abs {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.index-change {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.val-up { color: var(--positive); background: rgba(34, 197, 94, 0.1); }
.val-down { color: var(--negative); background: rgba(239, 68, 68, 0.1); }
.val-neutral { color: var(--warning); background: rgba(245, 158, 11, 0.1); }

.text-up { color: var(--positive); }
.text-down { color: var(--negative); }
.text-neutral { color: var(--warning); }

.sparkline-svg {
  width: 100%;
  height: 40px;
  margin-top: 12px;
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table th:not(:first-child),
.data-table td:not(:first-child) {
  text-align: right;
}

.data-table td:first-child {
  font-weight: 600;
}

.data-table td:nth-child(2),
.data-table td:nth-child(3),
.data-table td:nth-child(4) {
  font-family: var(--font-mono);
}

.data-table tbody tr {
  transition: var(--transition);
}

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

/* Badges */
.badge {
  padding: 4px 8px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
  line-height: 1;
}

.badge-ai { background: rgba(139, 92, 246, 0.1); color: var(--accent-ai); }
.badge-cyan { background: rgba(0, 194, 215, 0.1); color: var(--accent-cyan); }
.badge-neutral { background: var(--bg-surface-2); color: var(--text-secondary); border: 1px solid var(--border-subtle); }

.shark-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}

.shark-card:hover {
  border-color: var(--border-active);
}

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

.shark-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.shark-networth {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.holding-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 650px;
  padding: 24px;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .main-wrapper { margin-left: 0; width: 100%; max-width: 100vw; }
  .content-body { padding: 16px; }
  .header-nav { flex-wrap: wrap; gap: 16px; }
  .search-wrapper { width: 100%; }
}

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

/* ==================== MARKET OVERVIEW SECTION ==================== */
.mo-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.mo-tabs::-webkit-scrollbar {
  display: none;
}
.mo-tab {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mo-tab.active {
  border-bottom-color: var(--accent-cyan);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03); /* subtle highlight */
}
.mo-content-grid {
  display: grid;
  grid-template-columns: 35% calc(65% - 24px);
  gap: 24px;
  margin-bottom: 24px;
}
.mo-sentiment-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mo-right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mo-ohlc-panel {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
}
.mo-ohlc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.mo-val-primary { font-size: 16px; font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); }
.mo-val-negative { font-size: 16px; font-family: var(--font-mono); font-weight: 600; color: var(--negative); }
.mo-val-positive { font-size: 16px; font-family: var(--font-mono); font-weight: 600; color: var(--positive); }
.mo-val-cyan { font-size: 16px; font-family: var(--font-mono); font-weight: 600; color: var(--accent-cyan); }

.mo-secondary-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}
.mo-metric-lbl { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.mo-metric-val { font-size: 12px; font-family: var(--font-mono); font-weight: 600; }

.mo-chart-panel {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.mo-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.mo-footer-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
}
.mo-sector-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.mo-sector-row:last-child {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 1024px) {
  .mo-content-grid {
    grid-template-columns: 40% calc(60% - 16px);
    gap: 16px;
  }
  .mo-footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .mo-content-grid {
    grid-template-columns: 1fr;
  }
  .mo-footer-grid {
    grid-template-columns: 1fr;
  }
  .mo-secondary-metrics {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 16px;
  }
}

option { background-color: var(--bg-surface); color: var(--text-primary); }


.breadcrumb-back { font-size: 12px; color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: color 0.2s ease; }
.breadcrumb-back:hover { color: #ffffff; }

/* ==================== SECTOR PERFORMANCE WORKSPACE ==================== */
.sector-performance-page {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.sector-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.sector-page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sector-page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

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

.header-metric {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Compact Headers for Sections */
.section-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header-compact h3.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header-compact .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Summary Grid */
.sector-market-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-label {
  font-size: 12px;
  font-family: var(--font-ui);
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.kpi-value {
  font-size: 20px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.kpi-subvalue {
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-muted);
}

/* Hero Section */
.selected-sector-section {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.sector-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 24px;
  align-items: center;
  gap: 24px;
}

.hero-main .hero-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.hero-main .hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.hero-main .hero-stats {
  font-family: var(--font-mono);
  font-size: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.hero-center {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  padding: 0 24px;
}

.hero-center-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.hero-center-row strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.hero-right {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.timeframe-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
}

.timeframe-btn:hover {
  background: var(--bg-hover);
}

.timeframe-btn.active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border-color: var(--border-active);
}

/* Analytics */
.sector-analytics-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Stock Discovery */
.stock-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stock-filters {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.filter-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:last-child {
  border-right: none;
}

.filter-btn:hover {
  background: var(--bg-hover);
}

.filter-btn.active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.search-compact {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1279px) {
  .sector-market-summary { grid-template-columns: repeat(3, 1fr); }
  .sector-hero-grid { grid-template-columns: 1fr; }
  .hero-center { border: none; padding: 16px 0; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
  .hero-right { justify-content: flex-start; }
}

@media (max-width: 767px) {
  .sector-market-summary { grid-template-columns: repeat(2, 1fr); }
  .sector-analytics-section { grid-template-columns: 1fr; }
  .stock-controls { flex-direction: column; align-items: flex-start; margin-top: 12px; }
  .stock-filters { flex-wrap: wrap; }
}

/* Sector Performance Workspace Specific Grid */
.sector-grid-row-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.sector-grid-row-2col {
  display: grid;
  grid-template-columns: 2.5fr 1fr;
  gap: 16px;
}

.p-16 {
  padding: 16px;
}

.mt-16 {
  margin-top: 16px;
}

@media (max-width: 1279px) {
  .sector-grid-row-3col {
    grid-template-columns: repeat(2, 1fr);
  }
  .sector-grid-row-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .sector-grid-row-3col {
    grid-template-columns: 1fr;
  }
}
/* ==================== SECTOR PERFORMANCE WORKSPACE ==================== */
.sector-performance-page {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.sector-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.sector-page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sector-page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

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

.header-metric {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Compact Headers for Sections */
.section-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header-compact h3.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header-compact .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Summary Grid */
.sector-market-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-label {
  font-size: 12px;
  font-family: var(--font-ui);
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.kpi-value {
  font-size: 20px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.kpi-subvalue {
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-muted);
}

/* Hero Section */
.selected-sector-section {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.sector-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 24px;
  align-items: center;
  gap: 24px;
}

.hero-main .hero-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.hero-main .hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.hero-main .hero-stats {
  font-family: var(--font-mono);
  font-size: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.hero-center {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  padding: 0 24px;
}

.hero-center-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.hero-center-row strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.hero-right {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.timeframe-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
}

.timeframe-btn:hover {
  background: var(--bg-hover);
}

.timeframe-btn.active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border-color: var(--border-active);
}

/* Analytics */
.sector-analytics-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Stock Discovery */
.stock-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stock-filters {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.filter-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:last-child {
  border-right: none;
}

.filter-btn:hover {
  background: var(--bg-hover);
}

.filter-btn.active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.search-compact {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1279px) {
  .sector-market-summary { grid-template-columns: repeat(3, 1fr); }
  .sector-hero-grid { grid-template-columns: 1fr; }
  .hero-center { border: none; padding: 16px 0; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
  .hero-right { justify-content: flex-start; }
}

@media (max-width: 767px) {
  .sector-market-summary { grid-template-columns: repeat(2, 1fr); }
  .sector-analytics-section { grid-template-columns: 1fr; }
  .stock-controls { flex-direction: column; align-items: flex-start; margin-top: 12px; }
  .stock-filters { flex-wrap: wrap; }
}



/* Collapsed Sidebar Styles */
body.sidebar-collapsed .sidebar {
  width: 72px;
}
body.sidebar-collapsed .main-wrapper {
  margin-left: 72px;
}
body.sidebar-collapsed .brand-text-wrapper,
body.sidebar-collapsed .nav-section-title span,
body.sidebar-collapsed .nav-section-title i.fa-chevron-down,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .engine-status span,
body.sidebar-collapsed .engine-status .engine-meta {
  display: none !important;
}
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px;
}
body.sidebar-collapsed .nav-item i {
  font-size: 18px;
}
body.sidebar-collapsed .nav-section-title {
  justify-content: center;
  padding: 16px 0 8px 0;
}
body.sidebar-collapsed .nav-section-title::after {
  content: '•••';
  font-size: 10px;
  color: var(--text-muted);
}

body.sidebar-collapsed .engine-status {
  padding: 8px 0;
  justify-content: center;
}
body.sidebar-collapsed .engine-status > div:first-child {
  font-size: 0; /* Hides " AURA ENGINE" text but keeps child spans if we adjust */
}
body.sidebar-collapsed .engine-status > div:first-child span {
  font-size: 10px; /* Bring back the dot */
  display: inline-block !important;
}

body.sidebar-collapsed .sidebar-footer {
  padding: 16px 8px;
}
body.sidebar-collapsed .brand-logo {
  padding: 24px 0;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

/* ==================== MARKET STATUS PILL ==================== */
.market-status-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  user-select: none;
}

.market-status-pill.status-open {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: var(--positive);
}
.market-status-pill.status-open #market-status-dot {
  background: #22c55e !important;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse-green 2s infinite ease-in-out;
}

.market-status-pill.status-closed {
  border-color: var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-muted);
}
.market-status-pill.status-closed #market-status-dot {
  background: #64748b !important;
  box-shadow: none;
}

.market-status-pill.status-disconnected {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: var(--negative);
}
.market-status-pill.status-disconnected #market-status-dot {
  background: #ef4444 !important;
  box-shadow: 0 0 8px #ef4444;
  animation: pulse-red 1.5s infinite ease-in-out;
}

.market-status-pill.status-stale {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  color: var(--warning);
}
.market-status-pill.status-stale #market-status-dot {
  background: #f59e0b !important;
  box-shadow: 0 0 8px #f59e0b;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
