:root {
  --bg: #0e1117;
  --bg-alt: #161b22;
  --border: #2a2f3a;
  --text: #e6e6e6;
  --text-muted: #9aa4b2;
  --accent: #4f8bf9;
  --green: #2ca02c;
  --red: #d62728;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

h1 { font-size: 1.6rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 24px 0 10px; color: var(--text); }
.section-title { margin-top: 40px; }

.caption { color: var(--text-muted); font-size: 0.9rem; margin: 4px 0 12px; }

hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }

.refresh-block { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.last-updated { margin: 0; text-align: right; }

.regime-badge {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}
.regime-factors { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }

.error-box {
  background: rgba(214, 39, 40, 0.15);
  border: 1px solid var(--red);
  color: #f5b5b5;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.hidden { display: none !important; }

.controls-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 8px;
}
.control { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.control-grow { flex: 1; }
.control label { font-size: 0.85rem; color: var(--text-muted); }

select, input[type="range"] {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.9rem;
}
input[type="range"] { padding: 0; }

.sector-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.sector-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chart { width: 100%; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-muted); font-weight: 500; }

.insight {
  background: rgba(79, 139, 249, 0.1);
  border: 1px solid rgba(79, 139, 249, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.metrics-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.metric {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  min-width: 180px;
}
.metric .metric-label { font-size: 0.8rem; color: var(--text-muted); }
.metric .metric-value { font-size: 1.4rem; font-weight: 600; margin-top: 4px; }
.metric .metric-delta { font-size: 0.85rem; margin-top: 2px; }
.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red); }

.columns-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 900px) { .columns-3 { grid-template-columns: 1fr; } }

.note { font-size: 0.92rem; }
.note-asof { color: var(--text-muted); font-size: 0.78rem; margin: 0 0 6px; }
.note-bullets { margin: 0 0 10px; padding-left: 20px; }
.note-bullets li { margin-bottom: 4px; }
.note-analysis { color: var(--text-muted); font-size: 0.88rem; margin: 0; }

.headline-time { color: var(--text-muted); font-size: 0.78rem; margin-left: 4px; }

.sentiment-trend { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
.sentiment-trend-note { color: var(--text-muted); font-size: 0.78rem; }

.sentiment-col .headline { margin: 4px 0; font-size: 0.88rem; }
.sentiment-score { font-size: 1.3rem; font-weight: 600; }
.sentiment-meta { color: var(--text-muted); font-size: 0.82rem; margin: 2px 0 10px; }

.highlight-indicator {
  background: rgba(79, 139, 249, 0.1);
  border: 1px solid rgba(79, 139, 249, 0.35);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.88rem;
  margin-bottom: 12px;
}
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: 8px;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }

.trend-Haussière { background: #1e4620; color: #b6f0b6; }
.trend-Baissière { background: #4a1c1c; color: #f5b5b5; }
.trend-Retournement-haussier { background: #2e3d1e; color: #d9f0b6; }
.trend-Retournement-baissier { background: #4a3a1c; color: #f0dcb5; }
.trend-Données-insuffisantes { color: var(--text-muted); }
