/* ==========================================================================
   Market Intelligence (Market Hub) Master Stylesheet
   Matching MacroSpyder Dark/Light High-End Aesthetic
   ========================================================================== */

.market-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--bg);
}

.market-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Indices Summary Strip */
.market-indices-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.index-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

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

.index-price {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.index-change-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-family: var(--font-mono);
}

.index-change-row.pos { color: var(--pos); }
.index-change-row.neg { color: var(--neg); }

.index-breadth-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
  background: var(--border);
}

.breadth-adv { background: var(--pos); }
.breadth-dec { background: var(--neg); }
.breadth-ref { background: #94a3b8; }

/* Sub Navigation Tabs */
.market-nav-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

.market-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.market-tab-btn:hover { color: var(--text); }
.market-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ==================== SQUARIFIED TREEMAP HEATMAP MASTER ==================== */
.heatmap-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.heatmap-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.heatmap-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.heatmap-ctrl-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.heatmap-ctrl-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.heatmap-pill-group {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.heatmap-pill-group .market-range-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 11px;
}

.heatmap-pill-group .market-range-btn.active {
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
}

.heatmap-legend .hl-bound {
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-3);
}

.heatmap-legend-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  width: 140px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.heatmap-legend-bar span {
  flex: 1;
}

/* Treemap Viewport */
.heatmap-viewport {
  position: relative;
  width: 100%;
  min-height: 560px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
}

.tm-sector-container {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.45);
  background: transparent;
  border-radius: 0;
  overflow: hidden;
}

.tm-sector-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 22px;
  background: var(--surface-2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

.tm-sector-title {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
}

.tm-sector-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.tm-sector-weight {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.tm-sector-chg {
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
}

.tm-tile {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.35);
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  z-index: 1;
}

.tm-tile:hover {
  z-index: 10;
  transform: scale(1.02);
  filter: brightness(1.15);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  outline: 2px solid #ffffff;
}

.tm-ticker {
  font-weight: 800;
  color: #ffffff;
  letter-spacing: .02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  line-height: 1.1;
}

.tm-pct {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  line-height: 1.2;
}

.tm-price {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.tm-val {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.7);
}

/* Floating Glassmorphism Tooltip */
.heatmap-tooltip {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  padding: 10px 14px;
  background: rgba(17, 19, 23, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  font-size: 12px;
  color: var(--text);
  min-width: 190px;
  transition: opacity 0.1s ease;
}

.htt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
  font-size: 11.5px;
}

.htt-row span:first-child {
  color: var(--text-3);
}

.htt-row span:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Tables in Market Hub */
.market-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.market-card-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.market-table th {
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 var(--border);
}

.market-table th.num, .market-table td.num {
  text-align: right;
  font-family: var(--font-mono);
}

.market-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

.market-table tr {
  cursor: pointer;
}

.market-table tr:hover td {
  background-color: var(--hover);
}

/* Subtle Price Polling Flash */
@keyframes priceFlashPos {
  0% { background-color: rgba(16, 185, 129, 0.28); }
  100% { background-color: transparent; }
}
@keyframes priceFlashNeg {
  0% { background-color: rgba(239, 68, 68, 0.28); }
  100% { background-color: transparent; }
}
.flash-pos { animation: priceFlashPos 0.6s ease-out; }
.flash-neg { animation: priceFlashNeg 0.6s ease-out; }

/* Multi-Asset Chart Controls & Container */
#marketAssetSelect {
  background-color: var(--surface-2);
  color: var(--text);
  color-scheme: dark;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

#marketAssetSelect option {
  background-color: #16181d;
  color: #f3f4f6;
  padding: 8px 12px;
}

[data-theme="light"] #marketAssetSelect {
  background-color: var(--surface);
  color: var(--text);
  color-scheme: light;
}

[data-theme="light"] #marketAssetSelect option {
  background-color: #ffffff;
  color: #1c1c1f;
}

.market-range-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 4px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}

.market-range-btn:hover {
  color: var(--text);
  border-color: var(--border-focus);
}

.market-range-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ==================== TECHNICAL ANALYSIS CHART CARD ==================== */
.market-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 24px;
}

.market-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.mct-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mct-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mct-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

/* Enhanced Asset Search Combobox */
.mct-search-box {
  position: relative;
  display: inline-block;
}

.mct-search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 32px;
  box-sizing: border-box;
}

.mct-search-trigger:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.mct-search-trigger.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.mct-search-icon {
  color: var(--text-3);
  flex-shrink: 0;
}

.mct-caret-icon {
  color: var(--text-3);
  flex-shrink: 0;
  margin-left: 4px;
  transition: transform 0.2s ease;
}

.mct-search-trigger.active .mct-caret-icon {
  transform: rotate(180deg);
}

.mct-selected-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.mct-selected-label {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

/* Floating Dropdown Popover */
.mct-dropdown-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 360px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: mctFadeDown 0.15s ease-out;
}

@keyframes mctFadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mct-popover-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.mct-popover-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}

.mct-popover-search input::placeholder {
  color: var(--text-3);
}

.mct-search-clear {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}

.mct-popover-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: none;
}

.mct-popover-filter-tabs::-webkit-scrollbar {
  display: none;
}

.mct-tab-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.mct-tab-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.mct-tab-btn.active {
  background: var(--accent, #3b82f6);
  color: #fff;
  border-color: var(--accent, #3b82f6);
  font-weight: 600;
}

.mct-popover-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
}

.mct-asset-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.mct-asset-option:hover,
.mct-asset-option.highlighted {
  background: var(--surface-2);
}

.mct-asset-option.selected {
  background: rgba(59, 130, 246, 0.1);
}

.mct-opt-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mct-opt-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.mct-opt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mct-opt-sym {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-3);
  font-weight: 600;
  flex-shrink: 0;
}

/* Category badge color utility */
.badge-cat-index     { background: rgba(34, 197, 94, 0.14); color: #22c55e; }
.badge-cat-vn30      { background: rgba(168, 85, 247, 0.14); color: #a855f7; }
.badge-cat-stock     { background: rgba(168, 85, 247, 0.14); color: #a855f7; }
.badge-cat-commodity { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.badge-cat-crypto    { background: rgba(249, 115, 22, 0.14); color: #f97316; }
.badge-cat-fx        { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.badge-cat-yield     { background: rgba(236, 72, 153, 0.14); color: #ec4899; }

/* Quick Chips */
.mct-quick-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mct-chip-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mct-chip-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface);
}

.mct-chip-btn.active {
  background: rgba(59, 130, 246, 0.14);
  color: #3b82f6;
  border-color: #3b82f6;
  font-weight: 700;
}

.mct-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.mct-asset-name {
  font-weight: 700;
  color: var(--text);
}

.mct-asset-price {
  font-weight: 800;
  color: var(--text);
}

.mct-asset-change {
  font-weight: 700;
  font-size: 12px;
}

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

.market-chart-viewport {
  width: 100%;
  height: 520px;
  min-height: 520px;
  position: relative;
  box-sizing: border-box;
}

.chart-svg-wrap {
  width: 100%;
  height: 380px;
  position: relative;
}

.chart-stats-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 8px;
}

.chart-stat-item {
  display: flex;
  gap: 6px;
}

.chart-stat-item span:first-child {
  color: var(--text-3);
}

.chart-stat-item span:last-child {
  font-weight: 700;
  color: var(--text);
}

/* Category Badges */
.mb-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .04em;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-transform: uppercase;
}

.mb-badge.index {
  background: rgba(6, 182, 212, 0.12);
  color: #0891b2;
  border: 1px solid rgba(6, 182, 212, 0.25);
}
[data-theme="dark"] .mb-badge.index {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
}

.mb-badge.vn30 {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.25);
}
[data-theme="dark"] .mb-badge.vn30 {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.25);
}

.mb-badge.commodity {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
[data-theme="dark"] .mb-badge.commodity {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.25);
}

.mb-badge.fx {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
[data-theme="dark"] .mb-badge.fx {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.25);
}

.mb-badge.yield {
  background: rgba(236, 72, 153, 0.12);
  color: #db2777;
  border: 1px solid rgba(236, 72, 153, 0.25);
}
[data-theme="dark"] .mb-badge.yield {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.25);
}

.mb-badge.crypto {
  background: rgba(234, 179, 8, 0.12);
  color: #ca8a04;
  border: 1px solid rgba(234, 179, 8, 0.25);
}
[data-theme="dark"] .mb-badge.crypto {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.25);
}

/* ==========================================================================
   MACROSPYDER COMMAND TERMINAL LAYOUT SYSTEM
   ========================================================================== */

.macro-terminal {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* 1. TOP 4 INDEX CANDLESTICK MINI-CARDS */
.macro-indices-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

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

.f-index-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.f-index-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.f-index-title-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.f-index-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: .02em;
}

.f-index-sub {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.f-index-val-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.f-index-price {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.f-index-change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}
.f-index-change.pos { color: var(--pos); }
.f-index-change.neg { color: var(--neg); }

.f-index-chart-wrap {
  width: 100%;
  height: 88px;
  position: relative;
}

.f-index-vol-legend {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  text-transform: uppercase;
  margin-top: 2px;
}

/* 2. MARKET BREADTH & SENTIMENT STRIP */
.macro-breadth-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

@media (max-width: 1200px) {
  .macro-breadth-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .macro-breadth-strip { grid-template-columns: 1fr; }
}

.breadth-capsule {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breadth-capsule-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
}

.breadth-bar-track {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}

.breadth-bar-fill-pos { background: var(--pos); height: 100%; }
.breadth-bar-fill-neg { background: var(--neg); height: 100%; }
.breadth-bar-fill-neutral { background: #94a3b8; height: 100%; }

.breadth-capsule-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
}

/* 3. MAIN CENTRAL PRO GRID (BALANCED 3-COLUMN MASTER SCREEN) */
.macro-pro-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(420px, 1.45fr) minmax(300px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.macro-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.macro-col-equities,
.macro-col-commodities,
.macro-col-heatmap {
  min-width: 0;
}

.macro-panel-hero {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.macro-panel-hero .macro-heatmap-container {
  flex: 1 1 auto;
  height: 100%;
  min-height: 520px;
  box-sizing: border-box;
}

@media (max-width: 1360px) {
  .macro-pro-grid {
    grid-template-columns: 1fr 1.35fr;
  }
  .macro-col-commodities {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

@media (max-width: 960px) {
  .macro-pro-grid {
    grid-template-columns: 1fr;
  }
  .macro-col-commodities {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }
}

.macro-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.macro-col-equities .macro-panel,
.macro-col-commodities .macro-panel {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.macro-panel > div {
  overflow-x: auto;
  flex: 1 1 auto;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.macro-panel > div::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.macro-panel-header {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  line-height: 32px !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  box-sizing: border-box;
  flex: 0 0 32px !important;
  white-space: nowrap;
  overflow: hidden;
}

.macro-panel-header span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.macro-panel-header .f-subtitle {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.f-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.f-mini-table th {
  background: var(--surface);
  color: var(--text-3);
  font-weight: 700;
  font-size: 9.5px;
  text-transform: uppercase;
  padding: 0 8px;
  height: 26px;
  line-height: 26px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  box-sizing: border-box;
  white-space: nowrap;
}

.f-mini-table th.num, .f-mini-table td.num {
  text-align: right;
  font-family: var(--font-mono);
}

.f-mini-table tr {
  height: 28px;
  box-sizing: border-box;
}

.f-mini-table td {
  padding: 0 8px;
  height: 28px;
  line-height: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

.f-mini-table tr.empty-row td {
  color: rgba(255, 255, 255, 0.18);
  user-select: none;
}

[data-theme="light"] .f-mini-table tr.empty-row td {
  color: rgba(0, 0, 0, 0.18);
}

.f-mini-table tr.empty-row:hover td {
  background: transparent !important;
  cursor: default !important;
}

[data-theme="light"] .f-mini-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.f-mini-table tr:hover td {
  background: var(--hover);
  cursor: pointer;
}

.f-ticker-link {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  text-decoration: none;
}

.f-tag-pill {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-block;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

/* Technical Screener Chip List */
.f-pattern-list {
  display: flex;
  flex-direction: column;
}

.f-pattern-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

.f-pattern-row:hover {
  background: var(--hover);
}

.f-pattern-tickers {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10.5px;
}

.f-pattern-tickers span {
  color: var(--accent);
  cursor: pointer;
}
.f-pattern-tickers span:hover {
  text-decoration: underline;
}

.f-pattern-label {
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Headlines Feed Box */
.f-headlines-list {
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow-y: auto;
}

.f-headline-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  text-decoration: none;
  color: var(--text-2);
  transition: all 0.12s ease;
}

.f-headline-item:hover {
  background: var(--hover);
  color: var(--text);
}

.f-headline-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

.f-headline-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-3);
  text-transform: uppercase;
}

/* Right Treemap Widget Container */
.macro-heatmap-container {
  flex: 1 1 auto;
  height: 100%;
  min-height: 520px;
  position: relative;
  background: var(--bg);
  border: none;
  border-radius: 0;
  overflow: hidden;
  box-sizing: border-box;
}

/* 4. BOTTOM GLOBAL MARKETS & MACRO ASSETS (BALANCED 50% / 50%) */
.macro-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

/* Quick Chart Modal Overlay */
.market-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.market-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 840px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.market-modal-header {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.market-modal-close {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

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

/* Live Flash Animation for WebSocket Updates */
@keyframes livePulse {
  0% { background-color: rgba(16, 185, 129, 0.35); }
  100% { background-color: transparent; }
}

@keyframes livePulseUp {
  0% { background-color: rgba(0, 180, 90, 0.35); }
  100% { background-color: transparent; }
}

@keyframes livePulseDown {
  0% { background-color: rgba(255, 59, 48, 0.35); }
  100% { background-color: transparent; }
}

.flash-update {
  animation: livePulse 0.8s ease-out;
}

.flash-up {
  animation: livePulseUp 0.8s ease-out;
}

.flash-down {
  animation: livePulseDown 0.8s ease-out;
}

/* ==========================================================================
   LIVE MARKET BOARD & DATA TABLE STYLES
   ========================================================================== */

.market-board-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.market-board-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.market-board-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.market-board-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
}

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

.market-search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px 6px 32px;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  font-family: inherit;
}

.market-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 180, 90, 0.15);
}

.market-search-input::placeholder {
  color: var(--text-3);
}

/* Data Table Component */
.market-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.market-data-table thead th {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.market-data-table thead th.num {
  text-align: right;
}

.market-data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color .12s ease;
  cursor: pointer;
}

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

.market-data-table tbody td {
  padding: 9px 14px;
  vertical-align: middle;
  color: var(--text);
  white-space: nowrap;
}

.market-data-table tbody td.num {
  text-align: right;
  font-family: var(--font-mono);
}

.watchlist-star-btn {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--text-3);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.watchlist-star-btn:hover {
  transform: scale(1.25);
  color: #facc15;
  background: rgba(250, 204, 21, 0.1);
}

.watchlist-star-btn.starred {
  color: #facc15;
}

/* Real-time Status Indicator Strip */
.market-live-status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  margin-bottom: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.live-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  animation: pulseLiveDot 2s infinite ease-in-out;
}

.live-status-dot.connecting {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
}

.live-status-dot.disconnected {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

@keyframes pulseLiveDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.35); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

@keyframes flashGreen {
  0% { background-color: rgba(16, 185, 129, 0.35); }
  100% { background-color: transparent; }
}
@keyframes flashRed {
  0% { background-color: rgba(239, 68, 68, 0.35); }
  100% { background-color: transparent; }
}
@keyframes flashNeutral {
  0% { background-color: rgba(148, 163, 184, 0.25); }
  100% { background-color: transparent; }
}

.flash-up {
  animation: flashGreen 0.8s ease-out;
}
.flash-down {
  animation: flashRed 0.8s ease-out;
}
.flash-update {
  animation: flashNeutral 0.8s ease-out;
}
