/* Palette : couleurs franches (pas de dégradé violet cliché), sobre mais vivant.
   Thème clair par défaut, sombre via prefers-color-scheme, bascule manuelle via [data-theme]
   (même pattern que vps-dashboard.archived/output/dashboard.html, déjà en place sur ce serveur). */
:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --border: #e1e4ea;
  --text: #16181d;
  --muted: #5c6472;
  --accent: #2563eb;
  --accent-2: #d97706;
  --good: #16a34a;
  --bad: #dc2626;
  --unknown: #9aa2af;
  --shadow: 0 1px 2px rgba(16, 20, 30, 0.06), 0 1px 1px rgba(16, 20, 30, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0e1015;
    --panel: #171a21;
    --panel-2: #1c1f27;
    --border: #2a2f3a;
    --text: #e9eaee;
    --muted: #9aa2af;
    --accent: #5b8cff;
    --accent-2: #f0a83e;
    --good: #34c667;
    --bad: #f0553f;
    --unknown: #6a7180;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0e1015; --panel: #171a21; --panel-2: #1c1f27; --border: #2a2f3a; --text: #e9eaee;
  --muted: #9aa2af; --accent: #5b8cff; --accent-2: #f0a83e; --good: #34c667; --bad: #f0553f;
  --unknown: #6a7180; --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
:root[data-theme="light"] {
  --bg: #f5f6f8; --panel: #ffffff; --panel-2: #fbfbfd; --border: #e1e4ea; --text: #16181d;
  --muted: #5c6472; --accent: #2563eb; --accent-2: #d97706; --good: #16a34a; --bad: #dc2626;
  --unknown: #9aa2af; --shadow: 0 1px 2px rgba(16, 20, 30, 0.06), 0 1px 1px rgba(16, 20, 30, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  transition: background 0.15s ease, color 0.15s ease;
}

main { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem 3rem; }

/* ---------- En-tête ---------- */
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 1.25rem 1.25rem;
  margin-bottom: 2rem;
}
.header-top {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
h1 { font-size: 1.6rem; margin: 0 0 0.35rem; }
.subtitle { color: var(--muted); margin: 0; font-size: 0.95rem; }
.theme-toggle {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); }

.statuts-bandeau {
  max-width: 1180px;
  margin: 1.1rem auto 0;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.statut-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}
.statut-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; flex-shrink: 0; }
.statut-dot.operationnel { background: var(--good); }
.statut-dot.degrade { background: var(--accent-2); }
.statut-dot.panne { background: var(--bad); }
.statut-dot.inconnu { background: var(--unknown); }

.generated-at {
  max-width: 1180px;
  margin: 0.75rem auto 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.chargement { color: var(--muted); font-size: 0.9rem; }

/* ---------- Section coûts (la plus mise en avant) ---------- */
.section-couts h2 { font-size: 1.35rem; margin-bottom: 0.25rem; }
.section-intro { color: var(--muted); margin-top: 0; margin-bottom: 1.5rem; max-width: 62ch; }

.projets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.1rem;
}

.carte-projet {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.carte-projet-header { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.15rem; }
.carte-projet-emoji { font-size: 1.4rem; }
.carte-projet-nom { font-size: 1.05rem; font-weight: 700; margin: 0; }
.carte-projet-hypothese { color: var(--muted); font-size: 0.8rem; margin: 0 0 0.9rem; }

.ecart-badge {
  display: inline-block;
  background: var(--bad);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
}

.barre-cout { margin-bottom: 0.55rem; }
.barre-cout-info {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.76rem;
  margin-bottom: 0.2rem;
}
.barre-cout-nom { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-cout-valeur { font-weight: 700; flex-shrink: 0; }
.barre-track { background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; height: 10px; overflow: hidden; }
.barre-fill { height: 100%; border-radius: 5px; }
.barre-fill.cheapest { background: var(--good); }
.barre-fill.priciest { background: var(--bad); }
.barre-fill.milieu { background: var(--unknown); }

/* ---------- "Qui est le meilleur ?" (classements) ---------- */
.section-classements { margin-top: 2.75rem; }
.section-classements h2 { font-size: 1.35rem; margin-bottom: 0.25rem; }
.section-classements .tabs { margin: 1rem 0; }

.classement-liste {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.3rem 1.1rem;
  box-shadow: var(--shadow);
}
.classement-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.classement-item:last-child { border-bottom: none; }

.classement-rang {
  flex-shrink: 0;
  width: 1.8rem;
  height: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
}
/* Le rang 1 reprend le vert "moins cher" du reste du site : même code couleur pour "meilleur choix". */
.classement-item--top .classement-rang { background: var(--good); border-color: var(--good); color: #fff; }

.classement-corps { flex: 1; min-width: 0; }
.classement-info {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.classement-nom { font-weight: 600; }
.classement-editeur { font-size: 0.8rem; }
.classement-score { margin-left: auto; font-size: 0.82rem; font-weight: 700; }

.badge-ouvert { background: var(--accent-2); color: #fff; }

.classement-explication { color: var(--muted); font-size: 0.8rem; margin-top: 0.85rem; max-width: 68ch; }

/* ---------- Comparateur ---------- */
.section-comparateur { margin-top: 2.75rem; }
.section-comparateur h2 { font-size: 1.35rem; margin-bottom: 1rem; }

.comparateur-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tab-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.tab-btn:hover { border-color: var(--accent); color: var(--text); }
.tab-btn[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.recherche {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  min-width: 220px;
  flex: 1;
  max-width: 340px;
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; white-space: nowrap; }
th, td { text-align: left; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
}
th.sort-actif { color: var(--accent); }
th .fleche { font-size: 0.65rem; margin-left: 0.2rem; }
td.col-nom { white-space: normal; min-width: 180px; }
td.muted, .muted { color: var(--muted); }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  margin-right: 0.3rem;
  white-space: nowrap;
}
.badge-gratuit { background: var(--good); color: #fff; }
.badge-vision { background: var(--accent); color: #fff; }
.badge-raisonnement { background: var(--accent-2); color: #fff; }

.table-count { color: var(--muted); font-size: 0.8rem; margin-top: 0.6rem; }

/* ---------- Pied de page ---------- */
.site-footer {
  max-width: 1180px;
  margin: 3rem auto 0;
  padding: 1.25rem 1.25rem 2.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}
.site-footer p { margin: 0 0 0.5rem; }
.site-footer strong { color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  main { padding: 0 0.85rem 2rem; }
  .header-top { flex-direction: column; }
  .theme-toggle { align-self: flex-start; }
  .comparateur-controls { flex-direction: column; align-items: stretch; }
  .recherche { max-width: none; }
  h1 { font-size: 1.3rem; }
  .classement-score { margin-left: 0; }
}
