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

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-card: #1a1f2e;
  --bg-card-inner: #141922;
  --border: #30363d;
  --border-subtle: #21262d;
  
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  
  --accent-cyan: #58a6ff;
  --accent-teal: #3fb9a8;
  
  --green: #2ea043;
  --green-bg: #1a3a2a;
  --red: #da3633;
  --red-bg: #3a1a1a;
  --yellow: #d29922;
  --orange: #db6d28;
  
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --radius: 6px;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100dvh;
  font-size: 14px;
}

/* === Dashboard Layout === */
.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === Header === */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.logo {
  color: var(--accent-teal);
  flex-shrink: 0;
}

.header h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  white-space: nowrap;
}

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

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.week-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-teal);
}

.data-source {
  font-size: 11px;
  color: var(--text-muted);
}

/* === Refresh Buttons === */
.refresh-group {
  display: flex;
  gap: 8px;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent-teal);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}

.refresh-btn:hover {
  background: #1e2736;
  border-color: var(--accent-teal);
}

.refresh-btn:active {
  transform: scale(0.97);
}

.refresh-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.refresh-btn.loading .refresh-icon {
  animation: spin 1s linear infinite;
}

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

.refresh-icon {
  flex-shrink: 0;
}

.refresh-static-btn {
  color: #d29922;
  border-color: rgba(210, 153, 34, 0.3);
}

.refresh-static-btn:hover {
  background: #1e2736;
  border-color: #d29922;
}

/* === Last Updated === */
.last-updated {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  padding: 6px 0 12px;
  min-height: 28px;
}

.last-updated.success {
  color: var(--green);
}

.last-updated.error {
  color: var(--red);
}

/* === Tab Navigation === */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  position: relative;
  padding: 10px 24px;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
}

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

.tab-btn.active {
  color: var(--accent-teal);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-teal);
  border-radius: 2px 2px 0 0;
}

/* === Tab Panels === */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* === Sections === */
.section {
  margin-bottom: 16px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-teal);
  margin-bottom: 12px;
}

/* === Table === */
.table-container {
  overflow-x: auto;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
  table-layout: fixed;
}

/* Fixed column widths — keeps all tables perfectly aligned */
.market-table .col-asset { width: 16%; }
.market-table .col-close { width: 10%; }
.market-table .col-day   { width: 7%; }
.market-table .col-week  { width: 7%; }
.market-table .col-ytd   { width: 7%; }
.market-table .col-ath   { width: 10%; }
.market-table .col-dma   { width: 9%; }
.market-table .col-rsi   { width: 8%; }
.market-table .col-pe    { width: 7%; }

.market-table thead th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.market-table thead th.col-asset {
  text-align: left;
  padding-left: 0;
}

.market-table thead th .th-label {
  display: block;
  margin-bottom: 2px;
}

.category-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-teal);
  margin-bottom: 0;
}

.market-table tbody td {
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.market-table tbody td.col-asset {
  text-align: left;
  padding-left: 0;
}

.market-table tbody tr:last-child td {
  border-bottom: none;
}

/* Flash animation for updated values */
@keyframes flash-update {
  0% { background: rgba(63, 185, 168, 0.2); }
  100% { background: transparent; }
}

.market-table tbody td.updated {
  animation: flash-update 1.2s ease-out;
}

/* Asset name styling */
.asset-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.asset-ticker {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
  font-weight: 400;
}

/* Close price */
.close-price {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Day % */
.day-change {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.day-change.positive { color: var(--green); }
.day-change.negative { color: var(--red); }

/* Week % */
.week-change {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.week-change.positive { color: var(--green); }
.week-change.negative { color: var(--red); }

/* YTD % */
.ytd-change {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.ytd-change.positive { color: var(--green); }
.ytd-change.negative { color: var(--red); }

/* DMA Pills */
.dma-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  min-width: 60px;
}

.dma-pill.above {
  background: var(--green);
  color: #fff;
}

.dma-pill.below {
  background: var(--red);
  color: #fff;
}

/* % From ATH */
.ath-change {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.ath-change.positive { color: var(--green); }
.ath-change.negative { color: var(--red); }

/* RSI */
.rsi-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.rsi-value.rsi-oversold { color: var(--green); }
.rsi-value.rsi-overbought { color: var(--red); }

/* P/E columns */
.pe-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.rsi-label {
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.rsi-label.os { color: var(--green); }
.rsi-label.ob { color: var(--red); }

/* === Legend === */
.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  margin-bottom: 20px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.legend-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  display: inline-block;
  width: 20px;
  height: 10px;
  border-radius: 2px;
}

.legend-dot.above { background: var(--green); }
.legend-dot.below { background: var(--red); }

.legend-spacer {
  width: 16px;
}

.rsi-os { color: var(--green); font-weight: 500; }
.rsi-ob { color: var(--red); font-weight: 500; }

/* === Clickable Sector Rows === */
.clickable-row {
  cursor: pointer;
  transition: background var(--transition);
}

.clickable-row:hover {
  background: rgba(63, 185, 168, 0.06);
}

.clickable-row:hover .asset-name {
  color: var(--accent-teal);
}

.selected-row {
  background: rgba(63, 185, 168, 0.10);
}

.selected-row .asset-name {
  color: var(--accent-teal);
}

.sector-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

/* === Sub-Sector Panel === */
.sub-sector-panel {
  display: none;
  margin-top: 24px;
  border-top: 2px solid var(--accent-teal);
  padding-top: 16px;
}

.sub-sector-panel.active {
  display: block;
  animation: fadeSlideIn 300ms ease-out;
}

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

/* === Yields Row (US + UK side by side) === */
.yields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 8px;
}

.yields-section {
  margin-top: 0;
  margin-bottom: 0;
}

.yields-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.yield-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  transition: border-color var(--transition);
}

.yield-card.updated {
  animation: flash-update 1.2s ease-out;
}

.yield-tenor {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.yield-rate {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.yield-change {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.yield-change.up { color: var(--red); }
.yield-change.down { color: var(--green); }

.yield-change .arrow {
  font-size: 10px;
}

/* === Commentary === */
.commentary-section {
  margin-top: 16px;
}

.commentary-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* === Inflation Tab === */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px 16px;
  position: relative;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 380px;
}

.chart-legend-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 12px 0 4px;
  flex-wrap: wrap;
}

.chart-legend-custom .legend-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chart-legend-custom .legend-line {
  width: 28px;
  height: 3px;
  border-radius: 2px;
}

.chart-legend-custom .legend-line.dashed {
  background: repeating-linear-gradient(
    to right,
    currentColor 0,
    currentColor 6px,
    transparent 6px,
    transparent 10px
  );
  height: 3px;
}

.consensus-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.consensus-box p {
  margin-bottom: 12px;
}

.consensus-box p:last-child {
  margin-bottom: 0;
}

.consensus-box strong {
  color: var(--text-primary);
  font-weight: 600;
}

.inflation-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

.inflation-table thead th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.inflation-table tbody td {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.inflation-table tbody tr:last-child td {
  border-bottom: none;
}

.inflation-table .inst-name {
  font-weight: 600;
  color: var(--text-primary);
}

.inflation-table .measure-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.inflation-table .forecast-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-teal);
}

.outlook-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.outlook-pill.hawkish {
  background: var(--red-bg);
  color: var(--red);
}

.outlook-pill.neutral {
  background: rgba(210, 153, 34, 0.15);
  color: var(--yellow);
}

.outlook-pill.dovish {
  background: var(--green-bg);
  color: var(--green);
}

/* === Jobs Tab KPI Cards === */
.jobs-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.jobs-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
}

.jobs-kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.jobs-kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.jobs-kpi-delta {
  font-size: 11px;
  font-weight: 600;
}

.jobs-kpi-delta.positive { color: var(--green); }
.jobs-kpi-delta.negative { color: var(--red); }
.jobs-kpi-delta.neutral { color: var(--text-secondary); }

/* === Footer === */
.footer {
  padding: 24px 0;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  margin-top: 24px;
}

.footer a {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer a:hover {
  color: var(--text-secondary);
}

/* === Responsive === */
@media (max-width: 768px) {
  .yields-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .dashboard {
    padding: 0 12px;
  }
  
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-right {
    align-items: flex-start;
    width: 100%;
    justify-content: space-between;
  }
  
  .header-meta {
    align-items: flex-start;
  }
  
  .header h1 {
    font-size: 16px;
  }
  
  .yields-row {
    grid-template-columns: 1fr;
  }
  
  .yields-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .yield-rate {
    font-size: 22px;
  }
  
  .market-table {
    font-size: 12px;
  }
  
  .legend {
    gap: 8px;
  }
}

/* === Stock Ideas Tab === */
.stock-ideas-subtitle {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

#trendingTable th,
#unusualVolumeTable th {
  white-space: nowrap;
}

#trendingTable th:first-child,
#unusualVolumeTable th:first-child {
  width: 120px;
}

#trendingTable th:nth-child(2),
#unusualVolumeTable th:nth-child(2) {
  width: 100px;
}

#trendingTable th:nth-child(3),
#unusualVolumeTable th:nth-child(3) {
  width: 80px;
}

#trendingTable th:nth-child(4),
#unusualVolumeTable th:nth-child(4) {
  width: 120px;
}

#trendingTable th:nth-child(5),
#unusualVolumeTable th:nth-child(5) {
  width: auto;
}

.stock-ticker-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stock-ticker-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-cyan);
}

.stock-ticker-name {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.volume-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.volume-badge.up {
  background: var(--green-bg);
  color: var(--green);
}

.volume-badge.down {
  background: var(--red-bg);
  color: var(--red);
}

.volume-badge.neutral {
  background: rgba(139, 148, 158, 0.12);
  color: var(--text-secondary);
}

.stock-commentary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 500px;
}

.relvol-badge {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--yellow);
}

/* === Credit Risk Tab === */
.cr-category {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.cr-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.cr-category-header:hover {
  background: var(--bg-tertiary);
}

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

.cr-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.cr-icon.consumer { background: rgba(88, 166, 255, 0.12); color: var(--accent-cyan); }
.cr-icon.corporate { background: rgba(63, 185, 168, 0.12); color: var(--accent-teal); }
.cr-icon.macro { background: rgba(210, 153, 34, 0.12); color: var(--yellow); }
.cr-icon.alternative { background: rgba(219, 109, 40, 0.12); color: var(--orange); }
.cr-icon.private { background: rgba(218, 54, 51, 0.12); color: #e85d5d; }

.cr-category-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.cr-category-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

.cr-risk-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
}

.cr-risk-badge.low {
  background: var(--green-bg);
  color: var(--green);
}

.cr-risk-badge.moderate {
  background: rgba(210, 153, 34, 0.15);
  color: var(--yellow);
}

.cr-risk-badge.elevated {
  background: rgba(219, 109, 40, 0.15);
  color: var(--orange);
}

.cr-risk-badge.high {
  background: var(--red-bg);
  color: var(--red);
}

.cr-chevron {
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.cr-category.expanded .cr-chevron {
  transform: rotate(180deg);
}

/* Summary KPIs row */
.cr-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 0 18px 14px;
}

.cr-kpi {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.cr-kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

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

.cr-kpi-delta {
  font-size: 10px;
  font-family: var(--font-mono);
  margin-top: 2px;
}

.cr-kpi-delta.positive { color: var(--green); }
.cr-kpi-delta.negative { color: var(--red); }
.cr-kpi-delta.neutral { color: var(--text-secondary); }

/* Expandable details */
.cr-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cr-category.expanded .cr-details {
  max-height: 4000px;
}

.cr-details-inner {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border-subtle);
}

.cr-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.cr-detail-card {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.cr-detail-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-teal);
  margin-bottom: 8px;
}

.cr-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.cr-detail-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.cr-detail-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.cr-detail-value.warn { color: var(--yellow); }
.cr-detail-value.danger { color: var(--red); }
.cr-detail-value.good { color: var(--green); }

.cr-source {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

.cr-commentary {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.cr-commentary strong {
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .cr-detail-grid {
    grid-template-columns: 1fr;
  }
  .cr-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === Real-time Streaming === */
@keyframes flash-green {
  0% { background-color: rgba(46, 160, 67, 0.25); }
  100% { background-color: transparent; }
}
@keyframes flash-red {
  0% { background-color: rgba(218, 54, 51, 0.25); }
  100% { background-color: transparent; }
}
.cell-flash-up {
  animation: flash-green 1.2s ease-out;
}
.cell-flash-down {
  animation: flash-red 1.2s ease-out;
}

/* Live indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 12px;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(46, 160, 67, 0.6); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(46, 160, 67, 0); }
}
.live-indicator.paused {
  color: var(--text-muted);
}
.live-indicator.paused .live-dot {
  background-color: var(--text-muted);
  animation: none;
}
.live-indicator.error {
  color: var(--red);
}
.live-indicator.error .live-dot {
  background-color: var(--red);
  animation: none;
}
