/* =========================================================
   COMPARATIF MATERIEL — thème DIGIDOM
   Rouge brique / blanc / bandes diagonales anthracite.
   Même charte que themes/digidom.css (tableau de bord intergest).
   ========================================================= */

:root {
  --rouge: #B83A2B;
  --rouge-fonce: #8F2B1F;
  --rouge-soft: #F8E7E4;
  --noir: #1B1B1D;
  --anthracite: #3A3B3F;

  --ok: #1F9D6B;
  --ok-dark: #15774F;
  --ok-soft: #E4F4EC;
  --warn: #E39B1B;
  --warn-dark: #9A6410;
  --warn-soft: #FDF3DF;
  --vide: #C9CACF;

  --fond: #F3F3F4;
  --surface: #FFFFFF;
  --surface-2: #F7F7F8;
  --trait: #ECECEE;
  --texte: #1B1B1D;
  --texte-2: #6A6B70;
  --rayon: 6px;
  --ombre: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 18px rgba(0, 0, 0, .06);

  /* Réglages repris par les autres thèmes (fin de fichier) */
  --police: "Montserrat", system-ui, "Segoe UI", Arial, sans-serif;
  --police-titre: "Montserrat", system-ui, "Segoe UI", Arial, sans-serif;
  --bord-champ: var(--bord-champ);
  --barre-fond: var(--noir);
  --barre-texte: #fff;
  --barre-texte-2: #B9BAC0;
  --entete-fond: var(--noir);
  --entete-texte: #fff;
  --entete-trie: var(--anthracite);
  --entete-survol: #F2B7AE;
  --rayon-btn: var(--rayon);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--police);
  font-size: 14px;
  color: var(--texte);
  background: var(--fond);
}

/* ---------- Bandeau digidom ---------- */
.digi-tete {
  position: relative;
  height: 130px;
  background: #fff;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 4px solid var(--noir);
}
.digi-tete::before,
.digi-tete::after {
  content: "";
  position: absolute; top: 0; bottom: 0;
  width: 30%;
  background: var(--rouge);
  z-index: 2;
}
.digi-tete::before,
.digi-tete .trait-g { left: 0; clip-path: polygon(0 0, 100% 0, 62% 100%, 0 100%); }
.digi-tete::after,
.digi-tete .trait-d { right: 0; clip-path: polygon(38% 0, 100% 0, 100% 100%, 0 100%); }
.digi-tete .trait {
  position: absolute; top: 0; bottom: 0;
  width: 30%;
  background: var(--anthracite);
  z-index: 1;
}
.digi-tete .trait-g { left: 14px; }
.digi-tete .trait-d { right: 14px; }
.digi-titre { position: relative; z-index: 3; text-align: center; }
.digi-titre h1 { font-family: var(--police-titre); font-size: 28px; font-weight: 800; letter-spacing: .3px; }
.digi-titre small { display: block; font-size: 13px; font-weight: 600; color: var(--texte-2); margin-top: 4px; }

.digi-barre {
  background: var(--barre-fond); color: var(--barre-texte);
  padding: 11px 24px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13px; font-weight: 600;
}
.digi-barre #maj { color: var(--barre-texte-2); }
.barre-droite { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.choix-theme { display: flex; align-items: center; gap: 6px; color: var(--barre-texte-2); }
.choix-theme select { height: 30px; font-size: 12px; font-weight: 700; }

/* ---------- Page ---------- */
.wrap { max-width: 1440px; margin: 0 auto; padding: 26px 24px 40px; }

/* ---------- Catégories (boutons) ---------- */
.cats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 1200px) { .cats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cat {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); border: 0; border-left: 4px solid var(--noir);
  border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: 14px 14px; cursor: pointer; font: inherit; color: var(--texte);
  transition: border-color .15s, transform .15s;
}
.cat:hover { border-left-color: var(--rouge); transform: translateY(-2px); }
.cat .ico {
  flex: none; width: 42px; height: 42px; border-radius: var(--rayon);
  display: grid; place-items: center;
  background: var(--fond); color: var(--anthracite);
}
.cat .txt { min-width: 0; }
.cat .name { display: block; font-weight: 800; font-size: 15px; }
.cat .desc { display: block; color: var(--texte-2); font-size: 12px; margin-top: 2px; }
.cat .count {
  margin-left: auto; align-self: flex-start;
  font-size: 12px; font-weight: 700;
  background: var(--noir); color: #fff;
  padding: 1px 8px; border-radius: 10px;
}
.cat[aria-selected="true"] { border-left-color: var(--rouge); background: #fff; box-shadow: 0 0 0 2px var(--rouge), var(--ombre); }
.cat[aria-selected="true"] .ico { background: var(--rouge); color: #fff; }
.cat[aria-selected="true"] .count { background: var(--rouge); }
@media (max-width: 480px) {
  .cats { gap: 8px; }
  .cat { padding: 10px; gap: 8px; }
  .cat .ico { width: 32px; height: 32px; }
  .cat .ico svg { width: 18px; height: 18px; }
  .cat .name { font-size: 13px; }
  .cat .desc { display: none; }
}

/* ---------- Barre d'outils ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--bord-champ); border-radius: var(--rayon);
  padding: 0 12px; height: 38px; flex: 1 1 220px; max-width: 320px;
  color: var(--texte-2);
}
.search input { border: 0; outline: 0; background: none; font: inherit; color: var(--texte); width: 100%; }
.search:focus-within { border-color: var(--rouge); box-shadow: 0 0 0 3px var(--rouge-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
select {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--texte);
  background: var(--surface); border: 1px solid var(--bord-champ); border-radius: var(--rayon);
  height: 38px; padding: 0 30px 0 10px; cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--texte-2) 50%), linear-gradient(135deg, var(--texte-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
select.active { border-color: var(--rouge); color: var(--rouge); font-weight: 700; }
.btn {
  font: inherit; font-weight: 700; height: 38px; padding: 0 14px;
  border-radius: var(--rayon-btn); cursor: pointer; border: 1px solid var(--bord-champ);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn.ghost { background: var(--surface); color: var(--texte); }
.btn.ghost:hover { border-color: var(--noir); }
.btn.primary { background: var(--rouge); border-color: var(--rouge); color: #fff; margin-left: auto; }
.btn.primary:hover:not(:disabled) { background: var(--rouge-fonce); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.pill { background: rgba(255, 255, 255, .25); border-radius: 10px; padding: 0 7px; font-size: 12px; }

.note { color: var(--texte-2); font-size: 13px; margin: 14px 2px 12px; line-height: 1.55; }
.hint { color: var(--texte-2); font-size: 12px; margin: 10px 2px 0; }

/* ---------- Tableau ---------- */
.table-card {
  background: var(--surface); border-radius: var(--rayon);
  box-shadow: var(--ombre); overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--trait); }
thead th {
  background: var(--entete-fond); color: var(--entete-texte);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  cursor: pointer; user-select: none;
  border-bottom: 3px solid var(--rouge);
}
thead th:hover { color: var(--entete-survol); }
thead th.sorted { color: var(--entete-texte); background: var(--entete-trie); }
thead th .arrow { display: inline-block; width: 10px; margin-left: 3px; color: var(--rouge); }
thead th.sorted .arrow { color: var(--entete-survol); }
th.num, td.num { text-align: right; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.sel { background: var(--rouge-soft); }
tbody tr:last-child td { border-bottom: 0; }
td.check, th.check { width: 36px; padding-right: 0; cursor: default; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--rouge); cursor: pointer; }
td.main { font-weight: 700; }
td.main .rem { display: inline-block; margin-left: 6px; color: var(--rouge); cursor: help; font-size: 14px; }
td.muted { color: var(--texte-2); }

.val { font-variant-numeric: tabular-nums; font-weight: 600; }
.unit { color: var(--texte-2); font-size: 11px; margin-left: 2px; font-weight: 500; }
.det { display: block; color: var(--texte-2); font-size: 11px; font-weight: 500; }
.barcell { min-width: 120px; }
.barwrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bar { width: 100%; height: 6px; background: var(--trait); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--anthracite); border-radius: 3px; opacity: .55; }
tr:hover .bar i, tr.sel .bar i { background: var(--rouge); opacity: 1; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 12px; }
.badge.good { color: var(--ok-dark); background: var(--ok-soft); }
.badge.warn { color: var(--warn-dark); background: var(--warn-soft); }
.badge.neutral { color: var(--texte-2); background: var(--surface-2); }
.empty { padding: 40px; text-align: center; color: var(--texte-2); }

/* ---------- Sections dans le tableau ---------- */
tr.group td {
  background: var(--surface); padding: 18px 12px 8px;
  white-space: normal; cursor: default; border-bottom: 2px solid var(--trait);
}
tr.group:hover { background: none; }
tr.group td > span { vertical-align: middle; }
.g-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
  padding-left: 12px; border-left: 4px solid var(--rouge);
}
.g-desc { color: var(--texte-2); font-size: 12px; margin-left: 10px; }
.g-count {
  margin-left: 10px; font-size: 12px; font-weight: 700; color: #fff;
  background: var(--rouge); padding: 1px 8px; border-radius: 10px;
}

/* ---------- Vue fiches (téléphone) ---------- */
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}
.cards[hidden] { display: none; }
.c-group { grid-column: 1 / -1; padding: 14px 0 2px; }
.c-group:first-child { padding-top: 0; }
.c-group .g-desc { display: block; margin: 6px 0 0 16px; }
.fiche {
  background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre);
  border-left: 4px solid var(--noir); padding: 12px 14px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fiche.sel { border-left-color: var(--rouge); box-shadow: 0 0 0 2px var(--rouge), var(--ombre); }
.fiche header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.fiche header input { margin-top: 3px; flex: none; }
.fiche header b { display: block; font-size: 15px; font-weight: 800; }
.fiche header small { color: var(--texte-2); font-size: 12px; }
.fiche dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.fiche dt { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--texte-2); }
.fiche dd { font-size: 13px; margin-top: 1px; }
.fiche dd .det { display: inline; margin-left: 4px; }
.fiche dd .bar { display: block; margin-top: 4px; height: 4px; }
.fiche .f-rem { margin-top: 10px; font-size: 12px; color: var(--rouge-fonce); line-height: 1.4; }
#emptyCards { background: var(--surface); border-radius: var(--rayon); }

/* ---------- Comparaison ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(27, 27, 29, .6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.overlay[hidden] { display: none; }
.panel {
  background: var(--surface); border-radius: var(--rayon); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  width: min(1000px, 100%); max-height: 90vh; overflow: auto;
  border-top: 5px solid var(--rouge);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; margin-bottom: 6px;
}
.panel-head h2 { font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.panel .table-scroll, .panel .hint { margin: 0 20px; }
.panel .hint { padding-bottom: 18px; }
.cmp th { background: none; color: var(--texte-2); cursor: default; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--trait); }
.cmp thead th { background: var(--entete-fond); color: var(--entete-texte); font-size: 14px; font-weight: 800; text-align: center; border-bottom: 3px solid var(--rouge); }
.cmp thead th:first-child { background: var(--surface); border-bottom-color: var(--surface); }
.cmp td { text-align: center; }
.cmp td.best { background: var(--ok-soft); color: var(--ok-dark); font-weight: 800; }
.cmp td.best .unit { color: inherit; }
.best-chip { background: var(--ok-soft); color: var(--ok-dark); font-weight: 700; padding: 1px 6px; border-radius: 4px; }

/* ---------- Sources ---------- */
.sources { margin-top: 28px; color: var(--texte-2); font-size: 12px; line-height: 1.8; }
.sources h3 {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--texte);
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.sources h3::after {
  content: ""; flex: 1; height: 2px;
  background: linear-gradient(90deg, var(--rouge) 0 60px, var(--trait) 60px);
}
.sources a { color: var(--rouge); text-decoration: none; font-weight: 600; margin-right: 14px; }
.sources a:hover { text-decoration: underline; }

/* =========================================================
   THÈMES AU CHOIX (liste « Thème » dans la barre noire)
   digidom = valeurs ci-dessus (par défaut). Les autres thèmes
   redéfinissent les variables sous html[data-theme="…"].
   ========================================================= */

/* ---------- Casimir (page d'accueil) ---------- */
html[data-theme="casimir"] {
  --rouge: #f5821f;
  --rouge-fonce: #d9630a;
  --rouge-soft: #ffe9d2;
  --noir: #5a3a1b;
  --anthracite: #8a6a4b;
  --fond: #fff6e3;
  --surface-2: #fff9ee;
  --trait: #f1e2c6;
  --texte: #5a3a1b;
  --texte-2: #8a6a4b;
  --rayon: 16px;
  --rayon-btn: 999px;
  --ombre: 0 5px 0 #f1e2c6;
  --police: "Nunito", system-ui, sans-serif;
  --police-titre: "Fredoka", sans-serif;
  --bord-champ: #f1e2c6;
  --barre-fond: #f5821f;
  --barre-texte: #fff;
  --barre-texte-2: #fff3e0;
  --entete-fond: #2fa7d6;
  --entete-trie: #1f8fbe;
  --entete-survol: #ffd23f;
}
html[data-theme="casimir"] body {
  background:
    radial-gradient(circle, rgba(245,130,31,.12) 12px, transparent 13px) 0 0 / 70px 70px,
    radial-gradient(circle, rgba(232,69,44,.10) 8px, transparent 9px) 35px 35px / 70px 70px,
    var(--fond);
}
html[data-theme="casimir"] .digi-tete {
  background: linear-gradient(180deg, #7fd3f0 0%, #c9efff 100%);
  border-bottom: 6px solid #2fa7d6;
}
html[data-theme="casimir"] .digi-tete::before,
html[data-theme="casimir"] .digi-tete::after,
html[data-theme="casimir"] .digi-tete .trait { display: none; }
html[data-theme="casimir"] .digi-titre h1 {
  font-weight: 700; font-size: 38px; color: #f5821f;
  -webkit-text-stroke: 3px #fff; paint-order: stroke fill;
  text-shadow: 0 5px 0 #d9630a, 0 10px 18px rgba(90,58,27,.2);
}
html[data-theme="casimir"] .digi-titre small { color: #5a3a1b; font-weight: 700; margin-top: 8px; }
html[data-theme="casimir"] .digi-barre { box-shadow: 0 4px 0 #d9630a; position: relative; z-index: 1; }
html[data-theme="casimir"] .cat,
html[data-theme="casimir"] .fiche { border: 3px solid #f1e2c6; border-left-width: 6px; }
html[data-theme="casimir"] .cat:hover,
html[data-theme="casimir"] .cat[aria-selected="true"] { border-color: #f5821f; }
html[data-theme="casimir"] .table-card { border: 4px solid #2fa7d6; box-shadow: 0 7px 0 #2fa7d6; }
html[data-theme="casimir"] .btn,
html[data-theme="casimir"] .cat .name,
html[data-theme="casimir"] .g-title,
html[data-theme="casimir"] .panel-head h2 { font-family: var(--police-titre); font-weight: 600; }
html[data-theme="casimir"] .btn.ghost { background: #ffd23f; border-color: #ffd23f; box-shadow: 0 4px 0 #e0a800; }
html[data-theme="casimir"] .btn.primary { box-shadow: 0 4px 0 #d9630a; }
html[data-theme="casimir"] .panel { border-top: 0; border: 4px solid #f5821f; box-shadow: 0 8px 0 #d9630a; }

/* ---------- Red Hat (comme /taches2/) ---------- */
html[data-theme="redhat"] {
  --rouge: #ee0000;
  --rouge-fonce: #a60000;
  --rouge-soft: #fde8e8;
  --noir: #151515;
  --anthracite: #4d4d4d;
  --fond: #f2f2f2;
  --surface-2: #f8f8f8;
  --trait: #e0e0e0;
  --texte: #151515;
  --texte-2: #6a6e73;
  --rayon: 4px;
  --ombre: 0 1px 2px rgba(3,3,3,.12), 0 0 2px rgba(3,3,3,.06);
  --police: "Red Hat Text", system-ui, sans-serif;
  --police-titre: "Red Hat Display", system-ui, sans-serif;
  --bord-champ: #d2d2d2;
  --barre-texte-2: #c7c7c7;
  --entete-survol: #ff8080;
  --entete-trie: #1f1f1f;
}
html[data-theme="redhat"] .digi-tete {
  height: auto; justify-content: flex-start; padding: 24px 32px 20px;
  border-bottom: 1px solid #e0e0e0;
}
html[data-theme="redhat"] .digi-tete::before,
html[data-theme="redhat"] .digi-tete::after,
html[data-theme="redhat"] .digi-tete .trait { display: none; }
html[data-theme="redhat"] .digi-titre { text-align: left; }
html[data-theme="redhat"] .digi-titre h1 { font-weight: 500; font-size: 28px; }
html[data-theme="redhat"] .digi-titre small { font-weight: 400; font-size: 14px; }
html[data-theme="redhat"] .digi-barre { box-shadow: inset 0 -3px 0 #ee0000; padding-bottom: 14px; }
html[data-theme="redhat"] .cat .name,
html[data-theme="redhat"] .g-title,
html[data-theme="redhat"] .panel-head h2 { font-family: var(--police-titre); font-weight: 600; }
html[data-theme="redhat"] .btn { font-weight: 500; }
html[data-theme="redhat"] .btn.ghost { color: #0066cc; border-color: #0066cc; }
html[data-theme="redhat"] .btn.ghost:hover { box-shadow: inset 0 0 0 1px #0066cc; border-color: #0066cc; }
html[data-theme="redhat"] .search, html[data-theme="redhat"] select { border-bottom-color: #6a6e73; border-radius: 0; }

/* ---------- Classique (blanc et bleu épuré) ---------- */
html[data-theme="classique"] {
  --rouge: #1a73e8;
  --rouge-fonce: #1557b0;
  --rouge-soft: #e8f0fe;
  --noir: #1f2937;
  --anthracite: #6b7280;
  --fond: #f6f8fb;
  --surface-2: #f3f6fb;
  --trait: #e5e7eb;
  --texte: #1f2937;
  --texte-2: #6b7280;
  --rayon: 10px;
  --rayon-btn: 8px;
  --ombre: 0 1px 3px rgba(60,64,67,.12);
  --police: "Inter", system-ui, "Segoe UI", sans-serif;
  --police-titre: "Inter", system-ui, "Segoe UI", sans-serif;
  --bord-champ: #dadce0;
  --barre-fond: #fff;
  --barre-texte: #1f2937;
  --barre-texte-2: #6b7280;
  --entete-fond: #f3f6fb;
  --entete-texte: #1f2937;
  --entete-trie: #e8f0fe;
  --entete-survol: #1a73e8;
}
html[data-theme="classique"] .digi-tete { height: 110px; border-bottom: 1px solid #e5e7eb; }
html[data-theme="classique"] .digi-tete::before,
html[data-theme="classique"] .digi-tete::after,
html[data-theme="classique"] .digi-tete .trait { display: none; }
html[data-theme="classique"] .digi-titre h1 { font-weight: 600; letter-spacing: -.02em; }
html[data-theme="classique"] .digi-barre { border-bottom: 1px solid #e5e7eb; }
html[data-theme="classique"] thead th { border-bottom-width: 2px; }
html[data-theme="classique"] .cat { border-left-color: #e5e7eb; }
html[data-theme="classique"] .fiche { border-left-color: #e5e7eb; }
html[data-theme="classique"] .btn { font-weight: 600; }
html[data-theme="classique"] .btn.ghost { color: #1a73e8; }
html[data-theme="classique"] .btn.ghost:hover { border-color: #1a73e8; }
html[data-theme="classique"] .g-count,
html[data-theme="classique"] .cat .count { background: #e8f0fe; color: #1a73e8; }
html[data-theme="classique"] .cat[aria-selected="true"] .count { background: #1a73e8; color: #fff; }

@media (max-width: 700px) {
  html[data-theme="redhat"] .digi-tete { padding: 18px 16px; }
  html[data-theme="casimir"] .digi-titre h1 { font-size: 26px; }
}

@media (max-width: 700px) {
  .digi-tete { height: 105px; }
  .digi-tete::before, .digi-tete::after, .digi-tete .trait { width: 22%; }
  .digi-titre h1 { font-size: 20px; }
  .digi-barre { padding: 10px 16px; }
  .wrap { padding: 20px 16px 32px; }
  .search { max-width: none; flex-basis: 100%; }
  .btn.primary { margin-left: 0; }
  th, td { padding: 8px 10px; }
  /* comparaison en plein écran sur téléphone */
  .overlay { padding: 0; align-items: stretch; }
  .panel { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  .panel .table-scroll, .panel .hint { margin: 0 12px; }
  .panel-head { padding: 14px 12px; }
}
