/* Observatoire RSM — charte SPEC §8. Lisible en 30 s pour un directeur commercial pressé. */

:root {
  --jaune: #ffcc00;
  --petrole: #2b657b;
  --dark: #215062;
  --texte: #242426;
  --fond: #f5f7fa;
  --gris: #5f6773;
  --succes: #65b32e;
  --danger: #dc3545;
  --info-pale: #d7effa;
  --carte-ombre: 0 1px 3px rgba(33, 80, 98, 0.10), 0 4px 14px rgba(33, 80, 98, 0.06);
  --rayon: 10px;
  --sidebar-l: 232px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  font-size: 15px;
  line-height: 1.45;
}

body.modal-ouverte { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 700; }
button { font: inherit; cursor: pointer; }

/* ------------------------------------------------------------------ layout */

.layout { display: flex; min-height: 100vh; }

.principal {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ----------------------------------------------------------------- sidebar */

.sidebar {
  width: var(--sidebar-l);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e3e8ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid #eef1f5;
}

.logo-hex { display: inline-flex; filter: drop-shadow(0 1px 2px rgba(33, 80, 98, .25)); }

.logo-texte {
  font-size: 13px;
  line-height: 1.2;
  color: var(--gris);
  letter-spacing: .02em;
}
.logo-texte strong { font-size: 17px; color: var(--dark); letter-spacing: .06em; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--texte);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar-nav a svg { flex-shrink: 0; color: var(--petrole); }
.sidebar-nav a:hover { background: var(--fond); }
.sidebar-nav a.actif {
  background: var(--info-pale);
  border-left-color: var(--jaune);
  font-weight: 600;
  color: var(--dark);
}

.sidebar-note {
  margin: 0;
  padding: 12px 16px;
  font-size: 11.5px;
  color: var(--gris);
  border-top: 1px solid #eef1f5;
}

/* ------------------------------------------------------------------ entête */

.entete {
  background: var(--dark);
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  /* motif hexagones discret — clin d'œil au logo RSM */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.07' stroke-width='2'%3E%3Cpath d='M28 17.5l14 8v17l-14 8-14-8v-17z'/%3E%3Cpath d='M0 66.5l14 8v17l-14 8M56 66.5l-14 8v17l14 8'/%3E%3Cpath d='M0 -7.5l14 8v17l-14 8M56 -7.5l-14 8v17l14 8'/%3E%3C/g%3E%3C/svg%3E");
}

.entete h1 { font-size: 21px; letter-spacing: .02em; }
.entete .baseline { margin: 2px 0 0; font-size: 13px; color: rgba(255, 255, 255, .75); }

.btn-burger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  padding: 6px;
  border-radius: 6px;
}
.btn-burger:hover { background: rgba(255, 255, 255, .12); }

/* ----------------------------------------------------------------- filtres */

.barre-filtres {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid #e3e8ee;
}
.barre-filtres:empty { display: none; }

.filtre { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--gris); }
.filtre-label { font-weight: 600; letter-spacing: .02em; }

.filtre select {
  font: inherit;
  font-size: 13.5px;
  color: var(--texte);
  padding: 7px 8px;
  border: 1px solid #cdd6de;
  border-radius: 7px;
  background: #fff;
  max-width: 210px;
}
.filtre select:focus { outline: 2px solid var(--petrole); outline-offset: 1px; }

.filtre-check {
  flex-direction: row;
  align-items: center;
  gap: 7px;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--texte);
  cursor: pointer;
}
.filtre-check input { width: 16px; height: 16px; accent-color: var(--petrole); cursor: pointer; }

/* ----------------------------------------------------------------- boutons */

.btn {
  border: none;
  border-radius: 7px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
}

.btn-primaire { background: var(--jaune); color: var(--dark); }
.btn-primaire:hover { background: #e6b800; }

.btn-secondaire { background: var(--petrole); color: #fff; }
.btn-secondaire:hover { background: var(--dark); }

.btn-export {
  background: none;
  border: 1px solid #cdd6de;
  color: var(--gris);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
}
.btn-export:hover { border-color: var(--petrole); color: var(--petrole); }

/* ----------------------------------------------------------------- contenu */

.contenu { flex: 1; padding: 22px 28px 60px; min-width: 0; }

.vue-titre h2 { font-size: 19px; color: var(--dark); }
.sous-titre { margin: 3px 0 0; font-size: 13.5px; color: var(--gris); }
.vue-titre { margin-bottom: 14px; }

/* bandeau ambre discret des caveats */
.bandeau-caveats {
  background: #fff8e1;
  border: 1px solid #f0dea3;
  border-left: 4px solid var(--jaune);
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: #6b5b18;
}
.bandeau-caveats ul { margin: 0; padding-left: 16px; }
.bandeau-caveats li { margin: 2px 0; }
.bandeau-caveats li.avert {
  list-style: none;
  margin-left: -16px;
  font-weight: 700;
  color: #9a3412;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 4px 8px;
}

/* --------------------------------------------------------------------- KPI */

.grille-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: #fff;
  border-radius: var(--rayon);
  box-shadow: var(--carte-ombre);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 12px;
  color: var(--gris);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.kpi-valeur { font-size: 24px; font-weight: 700; color: var(--dark); }
.kpi-delta { font-size: 13px; font-weight: 600; }
.delta-up { color: var(--succes); }
.delta-down { color: var(--danger); }
.delta-flat { color: var(--gris); }
.kpi-note { font-size: 11.5px; color: var(--gris); }
.kpi-badge {
  align-self: flex-start;
  background: var(--jaune);
  color: var(--dark);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  letter-spacing: .03em;
}

/* ------------------------------------------------------------------ cartes */

.grille-cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr));
  gap: 16px;
}
.grille-cartes.compact { grid-template-columns: 1fr; gap: 10px; }

.carte {
  background: #fff;
  border-radius: var(--rayon);
  box-shadow: var(--carte-ombre);
  padding: 16px 18px;
  min-width: 0;
}
.carte-table { grid-column: 1 / -1; }
.grille-cartes.compact .carte { padding: 10px 12px; box-shadow: none; border: 1px solid #e3e8ee; }

.carte-entete {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.carte-entete h3 { font-size: 14.5px; color: var(--texte); }

.chart-boite { position: relative; height: 330px; }
.chart-boite.mini { height: 220px; }

.footnote { margin: 8px 0 0; font-size: 11.5px; color: var(--gris); }

/* ------------------------------------------------------------------ tables */

.table-scroll { overflow-x: auto; }

.tableau { border-collapse: collapse; width: 100%; font-size: 13.5px; }

.tableau th {
  text-align: left;
  padding: 8px 10px;
  background: var(--fond);
  color: var(--gris);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 2px solid #e3e8ee;
}
.tableau th:hover { color: var(--petrole); }
.tableau th.tri-asc::after { content: ' ▲'; font-size: 10px; color: var(--petrole); }
.tableau th.tri-desc::after { content: ' ▼'; font-size: 10px; color: var(--petrole); }

.tableau td { padding: 7px 10px; border-bottom: 1px solid #eef1f5; }
.tableau tbody tr:hover { background: #f8fafc; }

.tableau tr.cliquable { cursor: pointer; }
.tableau tr.cliquable:hover { background: var(--info-pale); }

.align-left { text-align: left; }
.align-right { text-align: right; }
.align-center { text-align: center; }
th.align-right { text-align: right; }
th.align-center { text-align: center; }

/* ------------------------------------------------------------------- états */

.etat-chargement { text-align: center; padding: 60px 0; color: var(--gris); }

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border: 4px solid #e3e8ee;
  border-top-color: var(--petrole);
  border-radius: 50%;
  animation: rotation .8s linear infinite;
}
@keyframes rotation { to { transform: rotate(360deg); } }

.bandeau-erreur {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fdecee;
  border: 1px solid #f2b8be;
  border-left: 4px solid var(--danger);
  color: #842029;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
}

.etat-vide {
  padding: 34px 10px;
  text-align: center;
  color: var(--gris);
  font-size: 14px;
  font-style: italic;
}

/* ------------------------------------------------------------------- modal */

.modal { position: fixed; inset: 0; z-index: 50; }
.modal[hidden] { display: none; }

.modal-fond { position: absolute; inset: 0; background: rgba(33, 80, 98, .55); }

.modal-boite {
  position: absolute;
  inset: 3vh 4vw;
  background: var(--fond);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-fermer {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 2;
  background: #fff;
  border: 1px solid #cdd6de;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 20px;
  line-height: 1;
  color: var(--gris);
}
.modal-fermer:hover { color: var(--danger); border-color: var(--danger); }

.modal-corps { flex: 1; overflow-y: auto; padding: 22px 26px; }

/* -------------------------------------------------------------------- chat */

.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--jaune);
  color: var(--dark);
  border: none;
  border-radius: 28px;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(33, 80, 98, .3);
}
.chat-fab:hover { background: #e6b800; transform: translateY(-1px); }

.chat {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  z-index: 45;
  background: #fff;
  border-left: 1px solid #e3e8ee;
  box-shadow: -6px 0 24px rgba(33, 80, 98, .15);
  display: flex;
  flex-direction: column;
}
.chat[hidden] { display: none; }

.chat-entete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--dark);
  color: #fff;
  font-size: 15px;
}

.chat-fermer {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  padding: 2px 6px;
}
.chat-fermer:hover { color: var(--jaune); }

.chat-fil { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.bulle {
  max-width: 92%;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13.5px;
}
.bulle-user { align-self: flex-end; background: var(--info-pale); color: var(--dark); }
.bulle-ia { align-self: flex-start; background: var(--fond); width: 92%; }
.bulle-attente { color: var(--gris); font-style: italic; }
.bulle-erreur { background: #fdecee; color: #842029; }

.chat-commentaire { margin: 0 0 6px; }
.chat-payload { margin-top: 4px; }
.chat-payload .bandeau-caveats { font-size: 11.5px; padding: 6px 10px; }
.chat-payload .tableau { font-size: 12px; }
.chat-payload .kpi-valeur { font-size: 19px; }

.chat-sql { margin-top: 8px; font-size: 12px; }
.chat-sql summary { cursor: pointer; color: var(--petrole); font-weight: 600; }
.chat-sql pre {
  background: var(--dark);
  color: #d7effa;
  border-radius: 8px;
  padding: 10px;
  overflow-x: auto;
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-suggestions { padding: 0 14px 8px; display: flex; flex-direction: column; gap: 6px; }
.chat-suggestions[hidden] { display: none; }

.chat-suggestion {
  background: #fff;
  border: 1px solid #cdd6de;
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 12.5px;
  text-align: left;
  color: var(--petrole);
}
.chat-suggestion:hover { border-color: var(--jaune); background: #fffbeb; }

.chat-saisie {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e3e8ee;
}
.chat-saisie input {
  flex: 1;
  font: inherit;
  font-size: 13.5px;
  padding: 9px 11px;
  border: 1px solid #cdd6de;
  border-radius: 8px;
  min-width: 0;
}
.chat-saisie input:focus { outline: 2px solid var(--petrole); outline-offset: 1px; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 6px 0 24px rgba(33, 80, 98, .2);
  }
  body.nav-ouverte .sidebar { transform: translateX(0); }

  .btn-burger { display: inline-flex; }

  .entete { padding: 14px 16px; }
  .barre-filtres { padding: 12px 16px; }
  .contenu { padding: 16px 14px 80px; }

  .grille-cartes { grid-template-columns: 1fr; }
  .modal-boite { inset: 0; border-radius: 0; }
  .chat-fab span { display: none; }
  .chat-fab { padding: 14px; border-radius: 50%; }
}

/* ------------------------------------------------- studio « sur-mesure » */
.studio-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; padding: 18px; }
.studio-form h2 { margin: 0; }
.studio-form .sous-titre { margin: 0; color: var(--gris); }
.studio-form textarea {
  width: 100%; min-height: 74px; resize: vertical; padding: 10px 12px;
  border: 1px solid #d5dbe0; border-radius: 8px; font: inherit; color: var(--texte);
}
.studio-form textarea:focus { outline: 2px solid var(--petrole); outline-offset: 1px; }
.studio-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.studio-barre-save { margin-bottom: 14px; }
.studio-nom-input { padding: 9px 12px; border: 1px solid #d5dbe0; border-radius: 8px; font: inherit; min-width: 240px; }
.studio-commentaire { margin: 0 0 16px; color: var(--gris); max-width: 72em; }
.studio-titre-liste { margin: 26px 0 10px; }
.studio-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.studio-item { display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.studio-meta { font-size: 0.8rem; color: var(--gris); }
.studio-prompt-extrait {
  font-size: 0.85rem; color: var(--texte); display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.chat-badge-filtres { display: inline-block; margin-top: 6px; font-size: 0.78rem; color: var(--succes); font-weight: 600; }
.studio-fermer { margin-left: auto; }

/* Mode « cadrer » : brief + question ciblée avant toute génération. */
.studio-cadrage { display: flex; flex-direction: column; gap: 10px; padding: 18px; margin-bottom: 18px; border-left: 4px solid var(--petrole); }
.studio-cadrage-titre { margin: 0; }
.studio-cadrage-intro { margin: 4px 0 0; font-weight: 600; color: var(--texte); }
.studio-cadrage-liste { margin: 2px 0 4px; padding-left: 22px; color: var(--gris); }
.studio-cadrage-liste li { margin: 2px 0; }
.studio-cadrage-question { margin: 8px 0 2px; font-size: 1.05rem; font-weight: 600; color: var(--petrole); }
.studio-cadrage-reponse { flex: 1 1 320px; min-width: 220px; padding: 9px 12px; border: 1px solid #d5dbe0; border-radius: 8px; font: inherit; }
.studio-cadrage-reponse:focus { outline: 2px solid var(--petrole); outline-offset: 1px; }

/* Encart « Hypothèses retenues » affiché au-dessus d'une page générée. */
.studio-hypotheses { padding: 14px 16px; margin-bottom: 16px; border: 1px solid #d5dbe0; border-left: 4px solid var(--petrole); border-radius: 8px; background: rgba(33, 80, 98, 0.04); }
.studio-hypotheses h3 { margin: 0 0 4px; font-size: 1rem; }
.studio-hypotheses-intro { margin: 0 0 8px; font-size: 0.85rem; color: var(--gris); }
.studio-hypotheses ul { margin: 0 0 10px; padding-left: 22px; }
.studio-hypotheses li { margin: 3px 0; }
.chart-carte-france { min-height: 420px; }
.import-rapport { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.import-rapport p { margin: 0; }
.import-avertissement { color: #a05a00; font-weight: 600; }
.import-ok { color: var(--succes); font-weight: 600; }
#import-fichier { font: inherit; }

/* ================= Ajouts Suivi SAV RSM ================= */

.login-ecran { position: fixed; inset: 0; background: var(--fond); display: flex; align-items: center; justify-content: center; z-index: 50; }
.login-boite { background: #fff; border-radius: var(--rayon); box-shadow: var(--carte-ombre); padding: 30px 34px; width: 340px; display: flex; flex-direction: column; gap: 14px; }
.login-logo { display: flex; gap: 12px; align-items: center; color: var(--dark); margin-bottom: 6px; font-size: 14px; }
.login-logo strong { font-size: 18px; letter-spacing: .04em; }
.login-boite label { font-size: 13px; color: var(--gris); display: flex; flex-direction: column; gap: 5px; }
.login-boite input { padding: 9px 11px; border: 1px solid #d6dde6; border-radius: 7px; font: inherit; }
.login-erreur { color: var(--danger); font-size: 13px; margin: 0; }

.btn-nouvelle { margin-left: auto; background: var(--jaune); color: var(--dark); border: none; border-radius: 8px; padding: 9px 16px; font-weight: 700; box-shadow: var(--carte-ombre); }
.btn-nouvelle:hover { filter: brightness(1.05); }

.sidebar-user { padding: 10px 16px; border-top: 1px solid #eef1f5; font-size: 13px; color: var(--gris); display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.sidebar-user .who strong { color: var(--dark); display: block; }
.sidebar-user button { background: none; border: 1px solid #d6dde6; border-radius: 6px; padding: 4px 8px; font-size: 12px; color: var(--gris); }

/* formulaire de fiche */
.modal-fiche { max-width: 780px; width: min(780px, 94vw); }
.fiche-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.fiche-form .plein { grid-column: 1 / -1; }
.fiche-form label { font-size: 12.5px; color: var(--gris); display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.fiche-form input, .fiche-form select, .fiche-form textarea { padding: 8px 10px; border: 1px solid #d6dde6; border-radius: 7px; font: inherit; background: #fff; }
.fiche-form textarea { min-height: 64px; resize: vertical; }
.fiche-form input:focus, .fiche-form select:focus, .fiche-form textarea:focus { outline: 2px solid var(--petrole); outline-offset: 1px; }
.champ-obligatoire::after { content: " *"; color: var(--danger); }

.sav-boutons { display: flex; flex-wrap: wrap; gap: 6px; }
.sav-boutons button { border: 1px solid #d6dde6; background: #fff; border-radius: 7px; padding: 7px 10px; font-size: 12.5px; font-weight: 600; color: var(--texte); }
.sav-boutons button.actif { background: var(--dark); border-color: var(--dark); color: #fff; }
.sav-boutons button:hover:not(.actif) { border-color: var(--petrole); }

.autocomplete { position: relative; }
.autocomplete-liste { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #d6dde6; border-radius: 0 0 8px 8px; box-shadow: var(--carte-ombre); max-height: 220px; overflow-y: auto; z-index: 30; }
.autocomplete-liste div { padding: 7px 11px; cursor: pointer; font-size: 13.5px; }
.autocomplete-liste div:hover, .autocomplete-liste div.focus { background: var(--info-pale); }
.autocomplete-liste .nouveau { color: var(--petrole); font-style: italic; }
/* Suggestions client groupées par site (01/09/2026) : l'en-tête n'est pas cliquable —
   il ne doit ni réagir au survol ni ressembler à une option. */
.autocomplete-liste .ac-groupe {
  cursor: default; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--gris); background: var(--info-pale); padding: 5px 11px; font-weight: 700;
}
.autocomplete-liste .ac-groupe:hover { background: var(--info-pale); }
.autocomplete-liste .ac-nb { color: var(--gris); font-weight: 600; }

.bandeau-150 { grid-column: 1 / -1; background: #fff7df; border: 1px solid #f0d98c; border-radius: 8px; padding: 10px 14px; font-size: 13.5px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bandeau-150 button { background: var(--dark); color: #fff; border: none; border-radius: 7px; padding: 6px 12px; }
.bandeau-150.transmis { background: #e8f6e0; border-color: #bfe3a8; }
/* Sous le seuil : offre d'appui, pas alerte — le bandeau doit se voir sans crier. */
.bandeau-150.appui { background: var(--info-pale); border-color: #d6dde6; color: var(--gris); }
.bandeau-150.appui button { background: #fff; color: var(--dark); border: 1px solid #d6dde6; }

.total-calcule { font-size: 20px; font-weight: 700; color: var(--dark); align-self: end; padding-bottom: 6px; }
.regle-comptage { font-size: 12px; color: var(--gris); background: var(--info-pale); border-radius: 7px; padding: 8px 11px; }

.fiche-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; border-top: 1px solid #eef1f5; padding-top: 14px; }
.fiche-actions .btn-secondaire { background: #fff; border: 1px solid #d6dde6; color: var(--texte); border-radius: 8px; padding: 9px 14px; }
.fiche-alertes { grid-column: 1 / -1; }
.fiche-alertes p { margin: 4px 0; color: #8a6d00; background: #fff7df; border-radius: 7px; padding: 7px 11px; font-size: 13px; }

/* liste NC */
.table-nc { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; border-radius: var(--rayon); overflow: hidden; box-shadow: var(--carte-ombre); }
.table-nc th { text-align: left; padding: 9px 10px; background: var(--dark); color: #fff; font-size: 12px; white-space: nowrap; position: sticky; top: 0; }
.table-nc td { padding: 7px 10px; border-top: 1px solid #eef1f5; vertical-align: top; }
.table-nc tr:hover td { background: #f2f7fa; cursor: pointer; }
.table-nc .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; border-radius: 20px; padding: 1px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-brouillon { background: #fff1c9; color: #8a6d00; }
.badge-saisie { background: var(--info-pale); color: var(--dark); }
.badge-revue { background: #e2e6f7; color: #33418f; }
.badge-clos { background: #e8f6e0; color: #3c7317; }
.badge-sav { background: #eef1f5; color: var(--texte); }
.badge-qualite { background: #fde3e5; color: #a3242e; }
.badge-flag { background: #fbe9d0; color: #8a5200; }
.pagination { display: flex; gap: 8px; align-items: center; margin: 14px 0; font-size: 13.5px; }
.pagination button { border: 1px solid #d6dde6; background: #fff; border-radius: 7px; padding: 5px 11px; }
.pagination button:disabled { opacity: .4; cursor: default; }

/* revue */
.revue-inline input { width: 64px; padding: 4px 7px; border: 1px solid #d6dde6; border-radius: 6px; }
.revue-cloture { background: #fff; border-radius: var(--rayon); box-shadow: var(--carte-ombre); padding: 18px; margin-top: 18px; }
.revue-cloture textarea, .revue-cloture input[type=text] { width: 100%; padding: 8px 10px; border: 1px solid #d6dde6; border-radius: 7px; font: inherit; margin-top: 4px; }
.mois-clos { background: #e8f6e0; border: 1px solid #bfe3a8; border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; }

/* volumes */
.table-volumes input { width: 62px; padding: 4px 5px; border: 1px solid #d6dde6; border-radius: 6px; text-align: right; }
.table-volumes .demo { background: #fff7df; }

/* divers */
.avert { color: #a3242e; font-weight: 600; }
.note-vide { color: var(--gris); font-style: italic; padding: 30px 0; text-align: center; }
.zone-import { background: #fff; border: 2px dashed #d6dde6; border-radius: var(--rayon); padding: 18px; margin: 14px 0; font-size: 13.5px; }
.chat-page { display: flex; flex-direction: column; gap: 14px; max-width: 900px; }
.chat-question { display: flex; gap: 10px; }
.chat-question input { flex: 1; padding: 10px 13px; border: 1px solid #d6dde6; border-radius: 8px; font: inherit; }
.chat-reponses > div { margin-bottom: 16px; }

/* l'attribut hidden doit TOUJOURS gagner sur les display des classes */
[hidden] { display: none !important; }
.req { color: var(--danger); font-weight: 700; }

/* --- Zonage de la fiche + photos (29/07/2026) --- */
.fiche-section-titre {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--petrole); border-bottom: 2px solid var(--info-pale);
  padding: 2px 0 5px; margin-top: 4px;
}
.fiche-section-titre small { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--gris); }
.fiche-section-titre.qualite { color: var(--dark); margin-top: 10px; }

.photos-bloc { display: flex; flex-direction: column; gap: 8px; }
.photos-bloc .filtre-label { font-size: 12.5px; color: var(--gris); font-weight: 600; }
.photos-bloc .filtre-label small { font-weight: 400; }
.photos-drop {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1.5px dashed #c5cfda; border-radius: 9px; padding: 12px 14px; background: #fafbfc;
  transition: background .12s, border-color .12s;
}
.photos-drop.survol { border-color: var(--petrole); background: var(--info-pale); }
.photos-drop .photos-hint { font-size: 12.5px; color: var(--gris); }
.photos-grille { display: flex; flex-wrap: wrap; gap: 10px; }
.photos-grille .photos-vide { font-size: 12.5px; color: var(--gris); font-style: italic; }
.photo-vig {
  position: relative; width: 92px; height: 92px; margin: 0; border-radius: 8px;
  overflow: hidden; border: 1px solid #d6dde6; background: #eef1f5;
}
.photo-vig img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo-vig.en-attente { border-style: dashed; border-color: var(--petrole); opacity: .85; }
.photo-vig figcaption {
  position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; text-align: center;
  background: rgba(33,80,98,.82); color: #fff; padding: 1px 0;
}
.photo-suppr {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: none;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 15px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.photo-suppr:hover { background: #a3242e; }

/* --- Colonne « Photos » du tableau + carrousel plein écran (29/07/2026) --- */
.btn-photos {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  border: 1px solid #c9d4dd; background: #fff; color: var(--petrole);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.btn-photos:hover { background: var(--info-pale); border-color: var(--petrole); }
.photos-zero { color: #c2cbd4; }

.carrousel-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 26, 33, .82);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 48px 16px; animation: carr-fade .12s ease-out;
}
.carrousel-overlay[hidden] { display: none; }
@keyframes carr-fade { from { opacity: 0; } to { opacity: 1; } }
.carrousel-scene { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 92vw; max-height: 88vh; }
.carrousel-img {
  max-width: 92vw; max-height: 82vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 12px 48px rgba(0,0,0,.5); background: #fff;
}
.carrousel-legende { color: #dfe6ec; font-size: 12.5px; text-align: center; max-width: 80vw; }
.carrousel-fermer {
  position: fixed; top: 16px; right: 20px; width: 46px; height: 46px;
  border: none; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff;
  font-size: 30px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.carrousel-fermer:hover { background: #a3242e; }
.carrousel-nav {
  flex: 0 0 auto; width: 52px; height: 52px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; font-size: 34px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .12s;
}
.carrousel-nav:hover { background: rgba(255,255,255,.3); }
.carrousel-compteur {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: #dfe6ec; font-size: 13px; font-weight: 600; background: rgba(0,0,0,.35);
  padding: 4px 12px; border-radius: 999px;
}
@media (max-width: 640px) {
  .carrousel-nav { width: 40px; height: 40px; font-size: 26px; }
  .carrousel-img { max-height: 74vh; }
}

/* Fiche en 2 colonnes ADV / Analyse (CDC Yoann 24/08/2026, AC-6) */
.fiche-form.fiche-2col { grid-template-columns: 1fr 1fr; gap: 12px 28px; align-items: start; }
.fiche-2col .fiche-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; align-content: start; }
.fiche-2col .fiche-col .plein { grid-column: 1 / -1; }
.fiche-2col .fiche-pied { grid-column: 1 / -1; }
.fiche-2col .fiche-col:last-of-type { border-left: 1px solid #eef1f5; padding-left: 24px; }
.modal-fiche { max-width: 1180px; width: min(1180px, 96vw); }
@media (max-width: 980px) {
  .fiche-form.fiche-2col { grid-template-columns: 1fr; }
  .fiche-2col .fiche-col:last-of-type { border-left: none; padding-left: 0; }
}
.btn-clore { background: var(--dark, #16323d); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-weight: 700; }
.btn-clore:disabled { opacity: .45; cursor: not-allowed; }

/* Légende commune des causes SAV (AC-9) */
.legende-sav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 14px; font-size: 12.5px; color: var(--gris, #5a6771); }
.legende-item { display: inline-flex; align-items: center; gap: 6px; }
.legende-puce { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---- Retours Yoann 25/08/2026 ---- */

/* Infobulles d'aide (pt 4) : pastille « ? » au survol/focus, pour les occasionnels */
.aide {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--petrole); color: #fff; font-size: 11px; font-weight: 700;
  cursor: help; position: relative; vertical-align: middle; margin-left: 4px;
  user-select: none;
}
.aide::after {
  content: attr(data-aide);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 280px; max-width: 74vw; background: var(--dark); color: #fff;
  font-size: 12.5px; font-weight: 400; line-height: 1.45; text-align: left;
  padding: 9px 12px; border-radius: 8px; box-shadow: var(--carte-ombre);
  opacity: 0; visibility: hidden; transition: opacity .12s ease; z-index: 60;
  pointer-events: none; white-space: normal;
}
.aide:hover::after, .aide:focus::after { opacity: 1; visibility: visible; }
/* dans la barre de filtres (proche du bord haut) : bulle en dessous */
.barre-filtres .aide::after { bottom: auto; top: calc(100% + 8px); left: auto; right: -20px; transform: none; }

/* Libellé d'aide sous la barre de recherche (pt 7) */
.aide-recherche { flex-basis: 100%; font-size: 12px; color: var(--gris); margin-top: -4px; }

/* Bandeau pédagogique d'un dossier clos (pt 2) */
.bandeau-dossier-clos {
  background: var(--info-pale); border: 1px solid #a8d4ea; border-radius: 8px;
  padding: 10px 14px; font-size: 13.5px; line-height: 1.5; margin: 0 0 14px;
}

/* Bandeau « Dupliquer la NCC » (pt 3, Yoann 31/08/2026) : dit à l'écran ce que le
   code garantit — le défaut est repris, le client et la commande ne le sont pas. */
.bandeau-duplication {
  background: #fdf6e3; border: 1px solid #e6cf90; border-radius: 8px;
  padding: 10px 14px; font-size: 13.5px; line-height: 1.5; margin: 0 0 14px;
}

/* Zone Historique / Traçabilité de la fiche (pt 11) */
.historique-titre { font-size: 15px; margin: 6px 0 8px; }
.historique-table td { font-size: 12.5px; vertical-align: top; }

/* Bloc « NCC liées à la commande » (pt 3, maquette validée 25/08/2026) */
.liees-bloc {
  border: 1px solid #cfe3ee; background: #f4fafd; border-radius: 10px;
  padding: 10px 14px 12px;
}
/* Bloc « Même défaut sur n NCC » (Yoann 01/09/2026) — teinte distincte du bloc
   « NCC liées à la commande » : ce sont deux regroupements différents (le DÉFAUT
   d'un côté, la COMMANDE de l'autre) et les confondre à l'écran serait un contresens. */
.duplication-bloc { border-color: #e6cf90; background: #fdf6e3; margin-bottom: 14px; }
.duplication-bloc .liees-table tr.liee-courante td { background: #fff4d0; }
.duplication-bloc .liees-table tr.liee-cliquable:hover td { background: #f7edd6; }
.liees-titre { font-weight: 700; color: var(--dark); font-size: 13.5px; margin-bottom: 6px; }
.liees-table td { font-size: 12.5px; }
.liees-table tr.liee-courante td { background: #fffbe8; }
.liees-table tr.liee-cliquable { cursor: pointer; }
.liees-table tr.liee-cliquable:hover td { background: #eaf4fa; }

/* Photos des autres NCC de la même commande : visibles, lecture seule (pt 3) */
.photo-vig.photo-liee { opacity: .92; }
.photo-vig.photo-liee figcaption {
  font-size: 10.5px; color: var(--petrole); font-weight: 600; text-align: center;
}

/* Fonction de l'utilisateur dans l'Historique (pt 11) */
.fonction-audit { color: var(--gris); font-weight: 400; }

/* ===== Lot 26/08/2026 — volumes par famille, taux %, QCD, revue hebdo, clics TDB ===== */

/* Grille des volumes par famille (pt 1) */
.vol-groupe td {
  background: var(--petrole, #2b657b); color: #fff; font-weight: 700;
  font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; padding: 6px 10px;
}
.vol-total td { background: #eef4f7; font-weight: 700; border-top: 2px solid #cfe0e9; }
.vol-total td small { display: block; font-weight: 400; color: var(--gris, #6c757d); font-size: 10.5px; }
.vol-acier {
  background: #5b6770; color: #fff; border-radius: 4px; padding: 1px 5px;
  font-size: 10px; vertical-align: middle;
}

/* Bloc « Taux de NC — % des produits vendus » (pt 2) */
.carte-taux { margin-bottom: 16px; }
.taux-vendus { font-size: 15px; margin: 4px 0 10px; }
.taux-grille {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px;
}
.taux-item { background: #f4f8fa; border: 1px solid #dde8ee; border-radius: 8px; padding: 8px 10px; }
.taux-item .taux-libelle { font-size: 12px; color: var(--gris, #6c757d); }
.taux-item .taux-detail { font-size: 15px; margin-top: 2px; }
.taux-item .taux-detail strong { font-size: 17px; color: var(--petrole, #2b657b); }
.grille-cartes-taux { margin-bottom: 16px; }
tr.niv-total td { background: #eef4f7; border-bottom: 2px solid #cfe0e9; }
tr.niv-groupe td { background: #f6fafc; }
.note-clic { margin: 2px 0 10px; }

/* Puces des filtres posés par un clic sur un graphe (pt 4) */
.puces-filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; width: 100%; }
.puce-filtre {
  display: inline-flex; align-items: center; gap: 6px; background: var(--petrole, #2b657b);
  color: #fff; border-radius: 14px; padding: 3px 6px 3px 12px; font-size: 12.5px;
}
.puce-filtre button {
  background: rgba(255,255,255,.25); border: 0; color: #fff; border-radius: 50%;
  width: 18px; height: 18px; line-height: 1; cursor: pointer; font-size: 13px;
}
.puce-filtre button:hover { background: rgba(255,255,255,.45); }

/* Revue SAV hebdomadaire (pt 5) */
.badge-anterieur { background: #e8e2f4; color: #4b3d78; }
.badge-incomplet { background: #fdecec; color: #a3242e; cursor: help; }
tr.ligne-incomplete td { background: #fffcf3; }
.kpi-alerte .kpi-valeur { color: #a3242e; }

/* 01/09/2026 — les cinq lectures de la revue (Yoann). Ce sont des FILTRES du tableau
   déjà présent, pas un écran de plus : d'où des tuiles cliquables et non des cartes. */
.revue-lectures .kpi-cliquable {
  cursor: pointer; text-align: left; border: 1px solid transparent; font: inherit;
}
.revue-lectures .kpi-cliquable:hover { border-color: #cfe3ee; }
.revue-lectures .kpi-actif { border-color: var(--petrole, #2b657b); background: var(--info-pale); }
.badge-cause { background: #fff3e0; color: #8a5200; cursor: help; }
.badge-verifier { background: #ede4f7; color: #5a3b8c; cursor: help; }
.badge-recurrent { background: #fdf6e3; color: #7a5c14; cursor: help; }
.age-retard { color: #a3242e; font-weight: 700; }

/* QCD par site (répartition définitive 26/08) */
.qcd-site {
  font-weight: 700; color: var(--petrole, #2b657b); font-size: 13px;
  margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em;
}

/* Vidéos de NCC (31/08/2026) — même vignette que les photos, mais le lecteur doit
   rester visible en entier : pas de object-fit: cover qui rognerait les commandes. */
.photo-vig.video-vig { width: 220px; height: auto; cursor: default; }
.photo-vig.video-vig video { width: 100%; display: block; background: #000; border-radius: 4px; }
.photo-vig.video-vig figcaption {
  position: static; padding: .2rem .35rem; font-size: .78rem; color: var(--gris-txt);
  background: none; text-align: center;
}
.photo-vig.video-vig.en-attente { min-height: 58px; display: flex; align-items: center; justify-content: center; }
.photo-vig.video-vig.video-echec { border-color: var(--rouge, #b3261e); }
.photo-vig.video-vig.video-echec figcaption { color: var(--rouge, #b3261e); }
