/* === Design Tokens === */
:root {
  --bg: #0b0f1a;
  --bg-card: #111827;
  --bg-card-hover: #1a2235;
  --bg-elevated: #1e293b;
  --border: #1e293b;
  --border-subtle: rgba(255, 255, 255, 0.06);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #0ea5e9;
  --accent-dim: rgba(14, 165, 233, 0.15);

  --gain: #22c55e;
  --gain-bg: rgba(34, 197, 94, 0.1);
  --loss: #ef4444;
  --loss-bg: rgba(239, 68, 68, 0.1);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);

  --font-body: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === Header === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

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

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.update-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 500;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

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

.date-display {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 400;
}

/* === Sentiment Banner === */
.sentiment-banner {
  background: linear-gradient(135deg, #1a0a0a 0%, #0b0f1a 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 0;
}

.sentiment-banner.bearish {
  background: linear-gradient(135deg, #1a0a0a 0%, #0b0f1a 100%);
}

.sentiment-banner.bullish {
  background: linear-gradient(135deg, #0a1a0a 0%, #0b0f1a 100%);
}

.sentiment-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.sentiment-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.sentiment-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--loss);
  padding: 2px 12px;
  background: var(--loss-bg);
  border-radius: 100px;
}

.sentiment-value.bullish {
  color: var(--gain);
  background: var(--gain-bg);
}

.sentiment-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* === Main === */
.main {
  padding: 32px 0 64px;
}

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

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

.title-gain svg { color: var(--gain); }
.title-loss svg { color: var(--loss); }

/* === Headlines === */
.headlines-grid {
  display: grid;
  gap: 12px;
}

.headline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: background 0.2s;
}

.headline-card:hover {
  background: var(--bg-card-hover);
}

.headline-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.headline-tag.geopolitics { background: var(--loss-bg); color: var(--loss); }
.headline-tag.fed { background: var(--accent-dim); color: var(--accent); }
.headline-tag.oil { background: var(--warning-bg); color: var(--warning); }
.headline-tag.tech { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.headline-tag.market { background: rgba(34, 197, 94, 0.1); color: var(--gain); }

.headline-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 4px;
}

.headline-summary {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* === Indices Grid === */
.indices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.index-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.index-card:hover {
  background: var(--bg-card-hover);
}

.index-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.index-card.up::before { background: var(--gain); }
.index-card.down::before { background: var(--loss); }

.index-region {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.index-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.index-price {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.index-change {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
}

.index-change.up { color: var(--gain); }
.index-change.down { color: var(--loss); }

/* === Data Table === */
.tech-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

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

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

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

.stock-name {
  display: flex;
  flex-direction: column;
}

.stock-symbol {
  font-weight: 600;
  color: var(--text-primary);
}

.stock-company {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.td-mono {
  font-family: var(--font-mono);
  font-weight: 500;
}

.td-gain { color: var(--gain); }
.td-loss { color: var(--loss); }

.market-cap {
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* === Two Column Layout === */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* === Commodity & Crypto List === */
.commodity-list,
.crypto-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.commodity-item,
.crypto-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: background 0.15s;
}

.commodity-item:hover,
.crypto-item:hover {
  background: var(--bg-card-hover);
}

.commodity-name,
.crypto-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.commodity-name span,
.crypto-name span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.commodity-data,
.crypto-data {
  text-align: right;
}

.commodity-price,
.crypto-price {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.commodity-change,
.crypto-change {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
}

/* === Movers List === */
.movers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.mover-rank {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.mover-info {
  flex: 1;
  margin: 0 12px;
  min-width: 0;
}

.mover-symbol {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mover-name {
  font-size: 0.68rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mover-change {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.mover-change.gain {
  color: var(--gain);
  background: var(--gain-bg);
}

.mover-change.loss {
  color: var(--loss);
  background: var(--loss-bg);
}

/* === Macro Grid === */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.macro-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.macro-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.macro-card-title::before {
  content: '';
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

.macro-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.macro-item-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.macro-item-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* === Week Ahead === */
.week-ahead-content {
  display: grid;
  gap: 12px;
}

.week-day-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.week-day-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}

.week-day-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.week-event {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}

.week-event::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}

.week-event.important::before {
  background: var(--accent);
}

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

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

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer-credit a {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-credit a:hover {
  color: var(--accent);
}

/* === Responsive === */
@media (max-width: 768px) {
  html { font-size: 14px; }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 12px 0;
    gap: 8px;
  }

  .header-meta {
    width: 100%;
    justify-content: space-between;
  }

  .indices-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .two-col {
    grid-template-columns: 1fr;
  }

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

  .sentiment-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .data-table th, .data-table td {
    padding: 10px 12px;
  }
}

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