/* ==========================================================================
   holy-invest — feuille de style du dashboard

   Identité « holy » : graphite profond, argent, Cinzel pour les titres, croix
   discrètes. Les couleurs de séries, elles, ne sont PAS décoratives : ce sont
   quatre teintes validées (bande de luminosité, chroma, séparation daltonisme
   ΔE ≥ 8, contraste ≥ 3:1 sur le fond) — un gris argent ne passait aucun de
   ces tests comme couleur de courbe, donc l'identité passe par le cadre et la
   typographie, pas par les traits de données.
   ========================================================================== */

:root {
  --bg: #08080a;
  --surface-1: #101013;   /* fond des graphiques (celui validé) */
  --surface-2: #16161b;
  --surface-3: #1d1d23;
  --border: #26262e;
  --border-soft: #1b1b21;

  --text-primary: #f2f2f5;
  --text-secondary: #a9a9b4;
  --text-muted: #70707c;

  --silver: #d8d8de;

  /* Séries catégorielles, ordre fixe — jamais recyclé, jamais réattribué. */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --benchmark: #7a7a86;

  /* Statuts, réservés : jamais utilisés comme couleur de série. */
  --good: #3fb950;
  --bad: #f0655f;
  --warn: #d9a441;

  --radius: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 28px rgba(0, 0, 0, 0.45);
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Rais de lumière de cathédrale, très discrets. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(216, 216, 222, 0.07), transparent 60%),
    radial-gradient(60% 40% at 85% 0%, rgba(216, 216, 222, 0.04), transparent 70%);
  z-index: 0;
}

.page { position: relative; z-index: 1; max-width: 1560px; margin: 0 auto; padding: 22px 24px 64px; }

/* ── En-tête ─────────────────────────────────────────────────────────────── */

.masthead {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .cross { font-size: 20px; color: var(--silver); opacity: 0.85; }
.brand h1 {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
  font-weight: 600;
}
.brand .tagline { color: var(--text-muted); font-size: 12px; letter-spacing: 0.08em; }

.masthead .spacer { flex: 1 1 auto; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge.paper { border-color: #34343f; color: var(--silver); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.dot.live { background: var(--good); box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.16); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 3px rgba(240, 101, 95, 0.16); }

button, .btn {
  font: inherit;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
button:hover, .btn:hover { color: var(--text-primary); border-color: #3a3a46; }
button.active { color: var(--bg); background: var(--silver); border-color: var(--silver); font-weight: 600; }

select, input[type="text"], input[type="password"], input[type="date"] {
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
}
select:focus, input:focus, button:focus-visible {
  outline: 2px solid #4a4a58;
  outline-offset: 1px;
}

/* ── Cartes ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.card > header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card h2 {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--silver);
  margin: 0;
  font-weight: 600;
}
.card .hint { color: var(--text-muted); font-size: 12px; }
.card header .spacer { flex: 1 1 auto; }

/* ── Indicateurs clés ────────────────────────────────────────────────────── */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.kpi { background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { color: var(--text-muted); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.kpi .value { font-family: var(--mono); font-size: 25px; font-variant-numeric: tabular-nums; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .sub { color: var(--text-secondary); font-size: 12px; margin-top: 3px; font-variant-numeric: tabular-nums; }

.good { color: var(--good); }
.bad { color: var(--bad); }
.muted { color: var(--text-muted); }

/* ── Grille principale ───────────────────────────────────────────────────── */

.layout { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.column { display: grid; gap: 16px; min-width: 0; }

.chart-wrap { position: relative; height: 330px; }
canvas { max-width: 100%; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.legend .item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12.5px;
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
}
.legend .item.off { color: var(--text-muted); text-decoration: line-through; }
.legend .item.off .key { opacity: 0.35; }
.legend .key { width: 16px; height: 3px; border-radius: 2px; flex: none; }
.legend .key.dashed { background: repeating-linear-gradient(90deg, var(--benchmark) 0 5px, transparent 5px 9px); }

/* ── Tableaux ────────────────────────────────────────────────────────────── */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.reason { color: var(--text-secondary); max-width: 460px; }
.sym { font-family: var(--mono); font-weight: 600; letter-spacing: 0.02em; }
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface-2);
  white-space: nowrap;
}
.pill.buy { color: var(--good); border-color: rgba(63, 185, 80, 0.35); }
.pill.sell { color: var(--bad); border-color: rgba(240, 101, 95, 0.35); }
.pill.skip { color: var(--warn); border-color: rgba(217, 164, 65, 0.35); }

.series-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }

.empty { color: var(--text-muted); padding: 26px 8px; text-align: center; font-size: 13px; }

/* ── Flux en direct ──────────────────────────────────────────────────────── */

.feed { max-height: 560px; overflow-y: auto; margin: -4px -6px 0; padding: 4px 6px; }
.feed .line {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-soft);
  animation: appear 0.35s ease-out;
}
.feed .time { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); padding-top: 1px; }
.feed .action { font-size: 13px; }
.feed .detail { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.feed .module {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 7px;
}
.feed .line.warn .action { color: var(--warn); }
.feed .line.error .action { color: var(--bad); }
.feed .line.engine .action { color: var(--silver); font-weight: 600; }

@keyframes appear { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ── Connexion ───────────────────────────────────────────────────────────── */

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card .cross { font-size: 30px; color: var(--silver); opacity: 0.9; }
.login-card h1 { font-family: var(--display); font-size: 20px; letter-spacing: 0.18em; text-transform: uppercase; margin: 10px 0 4px; }
.login-card p { color: var(--text-muted); font-size: 12.5px; margin: 0 0 22px; }
.login-card form { display: grid; gap: 10px; }
.login-card input { text-align: center; padding: 10px; }
.login-card .submit { background: var(--silver); color: var(--bg); border-color: var(--silver); font-weight: 600; padding: 10px; }
.login-card .error { color: var(--bad); font-size: 12.5px; min-height: 18px; }

footer.page-footer { color: var(--text-muted); font-size: 11.5px; margin-top: 26px; text-align: center; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .feed { max-height: 360px; }
}
@media (max-width: 620px) {
  .page { padding: 16px 12px 40px; }
  .kpi .value { font-size: 21px; }
  .chart-wrap { height: 260px; }
}
