:root {
--accent: #00b82e;
--accent2: #056e0e;
  --bg: #0f1117;
  --bg2: #171a23;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef0f6;
  --muted: #8b90a3;
  --green: #00b894;
  --orange: #fdcb6e;
  --red: #ff7675;
  --blue: #74b9ff;
  --tag-text: #a9ffb7;
  --radius: 16px;
}

body.light {
  --bg: #f3f4f9;
  --bg2: #ffffff;
  --card: rgba(255, 255, 255, 0.85);
  --border: rgba(0, 0, 0, 0.09);
  --text: #1c1f2b;
  --muted: #6b7086;
  --tag-text: #096324;
  --blue: #157209;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

button { font-family: inherit; cursor: pointer; border: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
button:focus-visible,
.btn:focus-within,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Glow de fond */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.g1 {
  width: 480px;
  height: 480px;
background: var(--accent2);
  top: -150px;
  left: -100px;
}

.g2 {
  width: 420px;
  height: 420px;
  background: var(--accent2);
  bottom: -150px;
  right: -100px;
  opacity: 0.22;
}

.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ===== AUTH ===== */
.auth {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.auth-box .field { text-align: left; }
.brand-logo.big { width: 64px; height: 64px; font-size: 32px; margin: 0 auto; }
.auth-error { color: var(--red); font-size: 13px; min-height: 18px; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 250px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  transition: transform 0.3s;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #00b82e, #056e0e);
  display: grid; place-items: center;
  font-size: 22px;
  box-shadow: 0 8px 24px rgba(0, 184, 46, 0.35);
}
.brand h1 { font-size: 18px; }
.brand span { font-size: 12px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; overflow-y: auto; }
.nav-btn {
  display: flex; align-items: center; gap: 12px;
  background: transparent;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14.5px;
  color: var(--muted);
  text-align: left;
  transition: all 0.2s;
}
.nav-btn:hover { background: var(--card); color: var(--text); }
.nav-btn.active {
  background: linear-gradient(135deg, #00b82e, #056e0e);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 184, 46, 0.35);
}
.logout { width: 100%; }

/* ===== MAIN ===== */
.main { flex: 1; padding: 22px 28px 40px; min-width: 0; }

.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.burger {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  width: 42px; height: 42px;
  border-radius: 12px;
  font-size: 18px;
}
.search {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 16px;
  height: 46px;
  min-width: 0;
}
.search input { flex: 1; min-width: 0; background: none; border: none; outline: none; font-size: 14px; }
.search:focus-within { border-color: var(--accent); }

.view { display: none; animation: fade 0.35s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.view-head h2 { font-size: 26px; }
.muted { color: var(--muted); font-size: 14px; }

/* ===== BOUTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  transition: all 0.2s;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn.primary:hover { transform: translateY(-2px); }
.btn.ghost { background: var(--card); border: 1px solid var(--border); cursor: pointer; }
.btn.ghost:hover { border-color: var(--accent); }
.btn.danger {
  background: rgba(255, 118, 117, 0.15);
  color: var(--red);
  border: 1px solid rgba(255, 118, 117, 0.3);
}
.btn.danger:hover { background: rgba(255, 118, 117, 0.25); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 17px;
  flex-shrink: 0;
}
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ===== STATS ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
  backdrop-filter: blur(10px);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 22px;
}
.stat-icon.blue { background: rgba(116, 185, 255, 0.15); }
.stat-icon.green { background: rgba(0, 184, 148, 0.15); }
.stat-icon.orange { background: rgba(253, 203, 110, 0.15); }
.stat-icon.purple { background: rgba(108, 92, 231, 0.18); }
.stat-card h3 { font-size: 26px; }
.stat-card p { font-size: 13px; color: var(--muted); }

/* ===== CARTES ===== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
}
.card h3 { margin-bottom: 14px; font-size: 16px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
}
.list-item small { display: block; color: var(--muted); margin-top: 3px; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 0; text-align: center; grid-column: 1 / -1; }
.empty.small { padding: 6px 0; font-size: 13px; }

/* ===== FILTRES ===== */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.2s;
}
.chip:hover { color: var(--text); }

/* Filtres Réceptions : bouton sélectionné */
.chip.active {
  background: linear-gradient(135deg, #00b82e, #056e0e);
  color: #ffffff;
  border-color: #00b82e;
}


/* ===== NOTES ===== */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.note {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  border-left: 4px solid var(--accent);
  transition: transform 0.2s;
}
.note:hover { transform: translateY(-3px); }
.note.p-Haute { border-left-color: var(--red); }
.note.p-Moyenne { border-left-color: var(--orange); }
.note.p-Basse { border-left-color: var(--green); }
.note.done { opacity: 0.55; }
.note.done h4 { text-decoration: line-through; }
.note-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.note h4 { font-size: 16px; word-break: break-word; }
.note p { font-size: 14px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.note-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(108, 92, 231, 0.18);
  color: var(--tag-text);
  white-space: nowrap;
}
.note-actions { display: flex; gap: 6px; margin-top: auto; }

.act {
  background: var(--card);
  border: 1px solid var(--border);
  width: 34px; height: 34px;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.2s;
}
.act:hover { border-color: var(--accent); }
.act.small { width: 28px; height: 28px; font-size: 12px; flex-shrink: 0; }

.file-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px;
  color: var(--blue);
  background: none;
  border: none;
  text-align: left;
}
.file-link:hover { text-decoration: underline; }
.file-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ===== VÉRIF SUR PLAN ===== */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.plan-folder {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  border-left: 4px solid var(--blue);
  transition: transform 0.2s;
}
.plan-folder:hover { transform: translateY(-3px); }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-head h4 { font-size: 16px; word-break: break-word; }
.plan-files { display: flex; flex-direction: column; gap: 6px; }
.plan-file {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.plan-file .file-link { word-break: break-all; }

/* ===== CONTACTS ===== */
.contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  border-left: 4px solid var(--accent2);
  transition: transform 0.2s;
}
.contact-card:hover { transform: translateY(-3px); }
.contact-card h4 { font-size: 16px; word-break: break-word; }
.contact-lines { display: flex; flex-direction: column; gap: 8px; }
.contact-line {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
  transition: border-color 0.2s;
}
a.contact-line:hover { border-color: var(--accent2); color: var(--blue); }
.contact-line.none { color: var(--muted); font-size: 13px; }

/* ===== TABLE ===== */
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th {
  text-align: left; padding: 14px 16px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.table td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(128, 128, 128, 0.06); }
.badge { padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.Attendue { background: rgba(116, 185, 255, 0.15); color: var(--blue); }
.badge.En-contrôle { background: rgba(253, 203, 110, 0.15); color: var(--orange); }
.badge.Litige { background: rgba(255, 118, 117, 0.15); color: var(--red); }
.badge.En-stock { background: rgba(0, 184, 148, 0.15); color: var(--green); }

/* ===== CHECKLIST ===== */
.progress { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.4s;
}
.checklist { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.check-item input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.check-item span { flex: 1; font-size: 14.5px; }
.check-item.done span { text-decoration: line-through; color: var(--muted); }
.inline-form { display: flex; gap: 10px; }
.inline-form input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  height: 44px;
  outline: none;
}
.inline-form input:focus { border-color: var(--accent); }

/* ===== FORMULAIRES ===== */
.field, #modalForm label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--muted);
  margin-bottom: 14px;
}
.field input, #modalForm input, #modalForm select, #modalForm textarea {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  color: var(--text);
}
.field input:focus, #modalForm input:focus, #modalForm select:focus, #modalForm textarea:focus {
  border-color: var(--accent);
}
#modalForm select option { background: var(--bg2); color: var(--text); }
#modalForm textarea { min-height: 110px; resize: vertical; }
input[type="color"] { padding: 4px; height: 44px; cursor: pointer; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== MODAL ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: pop 0.25s ease;
}
@keyframes pop { from { transform: scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }

/* ===== MODALE RÉCEPTION EN PAYSAGE ===== */
.modal-box.wide {
  max-width: 1150px;
}

.modal-box.wide #modalForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 28px;
  align-items: start;
}

/* Colonne gauche : infos */
.modal-box.wide #modalForm > .row:nth-of-type(1),   /* date + statut */
.modal-box.wide #modalForm > label:nth-of-type(1),  /* titre Fournisseur */
.modal-box.wide #modalForm > .supplier-picker,
.modal-box.wide #modalForm > #newSupplierRow,
.modal-box.wide #modalForm > .row:nth-of-type(3),   /* CF + BL */
.modal-box.wide #modalForm > .row:nth-of-type(4) {  /* article + colis */
  grid-column: 1;
}

/* Colonne droite : photos, pièces jointes, commentaire */
.modal-box.wide #modalForm > label:nth-of-type(2),  /* titre Photos */
.modal-box.wide #modalForm > .photo-slots,
.modal-box.wide #modalForm > label:nth-of-type(3),  /* pièces jointes */
.modal-box.wide #modalForm > label:nth-of-type(4) { /* commentaire */
  grid-column: 2;
}

/* Boutons Enregistrer : toute la largeur, collés en bas */
.modal-box.wide #modalForm > .row:last-of-type {
  grid-column: 1 / -1;
  position: sticky;
  bottom: -24px;
  background: var(--bg2);
  padding: 14px 0 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* Pastilles fournisseur : compactes, avec défilement interne */
.modal-box.wide .supplier-picker {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 6px;
}

/* Commentaire plus haut pour remplir la colonne droite */
.modal-box.wide textarea {
  min-height: 130px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translate(-50%, 30px);
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: all 0.3s;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 70;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: none; }
  .burger { display: block; }
  .main { padding: 16px; }
  .row { grid-template-columns: 1fr; }
  .topbar { gap: 8px; }
  #quickAdd { padding: 11px 12px; }

  /* Modale réception : retour à une colonne sur mobile */
  .modal-box.wide { max-width: 520px; }
  .modal-box.wide #modalForm { display: block; }
  .modal-box.wide #modalForm > * { grid-column: auto !important; }
}

/* =========================================================
   📦 FORMULAIRE RÉCEPTION : fournisseurs + photos
   ========================================================= */

/* ----- Choix du fournisseur en gros boutons ----- */
.supplier-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.supplier-btn {
  flex: 1 1 calc(33% - 8px);
  min-width: 90px;
  padding: 12px 10px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}
.supplier-btn:hover { color: var(--text); border-color: var(--accent); }
.supplier-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ----- 3 cases photo ----- */
.photo-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.photo-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 110px;
  padding: 10px;
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, color 0.2s;
}
.photo-slot:hover { border-color: var(--accent); color: var(--text); }
.photo-slot .ico { font-size: 26px; }
.photo-slot input[type="file"] { display: none; }
.photo-slot.filled { border-style: solid; padding: 0; }
.photo-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-slot .remove {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
}

/* ----- Boutons du formulaire ----- */
.btn-row-form { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row-form .btn { flex: 1; min-width: 150px; }

/* ----- Tableau réceptions (9 colonnes) ----- */
#view-receptions .table { min-width: 860px; }

/* =========================================================
   📱 MOBILE
   ========================================================= */
@media (max-width: 700px) {
  /* Modale en "tiroir" plein bas d'écran */
  .modal { padding: 0; align-items: flex-end; }
  .modal-box {
    max-width: 100%;
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
    padding: 20px 18px 28px;
  }

  /* Photos : une par ligne, plus faciles à toucher */
  .photo-slots { grid-template-columns: 1fr; }
  .photo-slot {
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    min-height: 70px;
    padding: 12px 16px;
  }
  .photo-slot.filled { min-height: 150px; }

  /* Gros boutons tactiles */
  .supplier-btn { flex: 1 1 calc(50% - 8px); padding: 14px 10px; }
  .btn-row-form .btn { min-width: 100%; padding: 15px; font-size: 15px; }

  /* Évite le zoom automatique d'iPhone sur les champs */
  .field input, #modalForm input,
  #modalForm select, #modalForm textarea,
  .search input, .inline-form input { font-size: 16px; }

  /* Stats en 2 colonnes */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-card h3 { font-size: 22px; }
  .view-head h2 { font-size: 22px; }

  /* Zone sûre iPhone (encoche / barre du bas) */
  .main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(26px + env(safe-area-inset-bottom)); }
}

/* ===== Modale réception : 2 colonnes propres ===== */
.modal-box.wide {
  width: min(1100px, 96vw);
  max-width: 96vw;
}

.rec-cols {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  align-items: start;
}

.rec-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Date + statut : même largeur, pas de débordement */
.rec-col .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rec-col .row > label,
.rec-col .row > input { min-width: 0; }
.rec-col select,
.rec-col input,
.rec-col textarea { width: 100%; box-sizing: border-box; }

/* Fournisseurs : plus de scroll, ça passe à la ligne */
.supplier-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: none !important;
  overflow: visible !important;
}
.supplier-picker .chip {
  padding: 5px 11px;
  font-size: 12px;
}

/* Photos : 3 cases égales, boutons au style sombre */
.photo-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.photo-slot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px;
  border: 1px dashed rgba(255, 120, 40, .35);
  border-radius: 12px;
}
.photo-slot .photo-btn {
  background: rgba(255, 255, 255, .06);
  color: #f3e9ff;
  border: 1px solid rgba(255, 120, 40, .3);
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
  width: 100%;
  cursor: pointer;
}
.photo-slot .photo-btn:hover { background: rgba(255, 255, 255, .12); }
.photo-preview img {
  width: 100%;
  max-height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

/* Bouton « Enregistrer et suivante » : même style sombre */
.rec-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.rec-actions .btn:not(.primary) {
  background: rgba(255, 255, 255, .08);
  color: #f3e9ff;
  border: 1px solid rgba(255, 120, 40, .35);
}
.rec-actions .btn:not(.primary):hover { background: rgba(255, 255, 255, .14); }

textarea[name="comment"] { min-height: 90px; resize: vertical; }

/* Mobile : une seule colonne */
@media (max-width: 800px) {
  .rec-cols { grid-template-columns: 1fr; }
  .rec-actions { grid-template-columns: 1fr; }
}

/* ===== FIX réception : forcer 2 colonnes pleine largeur ===== */
.modal-box.wide {
  width: min(1100px, 96vw) !important;
  max-width: 96vw !important;
}

.modal-box.wide #modalForm {
  display: block !important;
  width: 100% !important;
}

.modal-box.wide .rec-cols {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 32px !important;
  width: 100% !important;
  align-items: start !important;
}

.modal-box.wide .rec-col {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  width: 100% !important;
  min-width: 0 !important;
}

/* Les champs prennent toute la largeur de leur colonne */
.modal-box.wide .rec-col label,
.modal-box.wide .rec-col input:not([type="file"]),
.modal-box.wide .rec-col select,
.modal-box.wide .rec-col textarea {
  width: 100% !important;
  box-sizing: border-box !important;
}
.modal-box.wide .rec-col input[type="file"] {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Fournisseurs : liste compacte avec scroll discret */
.modal-box.wide .supplier-picker {
  max-height: 260px !important;
  overflow-y: auto !important;
  padding-right: 6px !important;
}
.modal-box.wide .supplier-picker::-webkit-scrollbar { width: 6px; }
.modal-box.wide .supplier-picker::-webkit-scrollbar-thumb {
  background: rgba(255, 120, 40, .4);
  border-radius: 6px;
}
.modal-box.wide .supplier-picker::-webkit-scrollbar-track { background: transparent; }

/* Les 3 cases photo : même taille, sur toute la largeur */
.modal-box.wide .photo-slots {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
  width: 100% !important;
}
.modal-box.wide .photo-slot { width: 100% !important; }

/* Mobile */
@media (max-width: 800px) {
  .modal-box.wide .rec-cols { grid-template-columns: 1fr !important; }
}


/* ===== RÉCEPTIONS : TITRE À GAUCHE / BOUTONS À DROITE ===== */

#view-receptions .view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Titre et description à gauche */
#view-receptions .view-head > div:first-child {
  margin-right: auto;
  text-align: left;
}

/* Boutons regroupés à droite */
#view-receptions .view-head .btn-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
  margin-top: 0;
}

/* Évite que les boutons rétrécissent */
#archiveReceptionsBtn,
#view-receptions [data-add="reception"] {
  flex-shrink: 0;
}


/* ==========================================
   ACTIA - BOUTON REMONTER EN HAUT
========================================== */

#backToTopBtn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 90;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 13px 18px;
  border-radius: 14px;

  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent2)
  );

  color: #fff;
  font-size: 13px;
  font-weight: 600;

  border: 1px solid var(--border);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);

  cursor: pointer;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px);

  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s ease;
}

#backToTopBtn.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

#backToTopBtn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px
    color-mix(in srgb, var(--accent) 45%, transparent);
}

#backToTopBtn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* Adaptation mobile */
@media (max-width: 700px) {
  #backToTopBtn {
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    padding: 13px 15px;
    border-radius: 50%;
  }

  #backToTopBtn span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #backToTopBtn {
    transition: none;
  }
}

/* ==========================================
   ACTIA - SUPPRESSION VISUELLE CHECKLIST
========================================== */

/* Masquer la catégorie dans le menu */
.nav-btn[data-view="checklist"] {
  display: none !important;
}

/* Masquer la page Checklist */
#view-checklist {
  display: none !important;
}





















/* =============================================
   ACTIA - GRAPHIQUE EN BARRES DU DASHBOARD
============================================= */

.monthly-bars-card {
  margin-bottom: 22px;
  padding: 26px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(10px);
}

/* En-tête */

.monthly-bars-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 35px;
}

.monthly-bars-header h3 {
  font-size: 20px;
  margin-bottom: 7px;
}

.monthly-bars-header p {
  font-size: 13px;
  color: var(--muted);
}

.monthly-bars-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.monthly-bars-total strong {
  font-size: 34px;
  line-height: 1;
}

.monthly-bars-total span {
  font-size: 12px;
  color: var(--muted);
}

/* Graphique */

.monthly-bars-chart-wrap {
  display: flex;
  gap: 12px;
  height: 300px;
}

.monthly-bars-y-axis {
  width: 30px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 26px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.monthly-bars-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.monthly-bars-plot {
  position: relative;
  height: 100%;
  min-width: 760px;
  padding-top: 0;
}

.monthly-bars-gridlines {
  position: absolute;
  inset: 0 0 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.monthly-bars-gridlines span {
  width: 100%;
  border-top: 1px dashed var(--border);
}

.monthly-bars-columns {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(31, minmax(0, 1fr));
  gap: 5px;
}

/* Colonnes quotidiennes */

.monthly-bars-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.monthly-bars-bar-area {
  height: calc(100% - 26px);
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.monthly-bars-bar {
  width: 100%;
  max-width: 23px;
  min-height: 0;
  border-radius: 6px 6px 0 0;

  background: linear-gradient(
    180deg,
    #00b82e,
    #056e0e
  );

  transition:
    filter 0.2s ease,
    box-shadow 0.2s ease;

  cursor: pointer;
}

.monthly-bars-bar:hover {
  filter: brightness(1.35);
  box-shadow: 0 0 16px rgba(0, 184, 46, 0.45);
}

.monthly-bars-bar.is-empty {
  background: transparent;
  min-height: 0;
}

.monthly-bars-bar.is-record {
  background: linear-gradient(
    180deg,
    #68ef80,
    #00b82e
  );
}

.monthly-bars-day-label {
  height: 26px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
}

/* Informations sous le graphique */

.monthly-bars-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.monthly-bars-selected-detail {
  text-align: center;
  color: var(--text);
  font-size: 13px;
  margin-top: 7px;
  min-height: 18px;
}

/* Statistiques */

.monthly-bars-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 25px;
}

.monthly-bars-stat {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--card);
}

.monthly-bars-stat span {
  color: var(--muted);
  font-size: 12px;
}

.monthly-bars-stat strong {
  color: var(--text);
  font-size: 18px;
}

/* Adaptation mobile */

@media (max-width: 700px) {
  .monthly-bars-card {
    padding: 17px;
  }

  .monthly-bars-header h3 {
    font-size: 17px;
  }

  .monthly-bars-chart-wrap {
    height: 240px;
  }

  .monthly-bars-stats {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .monthly-bars-stat {
    padding: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .monthly-bars-bar {
    transition: none;
  }
}





/* =============================================
   ACTIA - GRAPHIQUE POUR LES TROIS COMPTES
============================================= */

/* Le graphique prend toute la largeur disponible */
#monthlyReceptionsChart {
  width: 100%;
  min-width: 0;
}

/* Si le graphique se trouve dans la grille
   des cartes du Dashboard */
#view-dashboard .grid-2 > #monthlyReceptionsChart {
  grid-column: 1 / -1;
}

/* Évite un débordement horizontal */
#view-dashboard .monthly-bars-card {
  max-width: 100%;
  box-sizing: border-box;
}



/* ==========================================
   ACTIA - GRAPHIQUE MAGASIN / VISITEUR
========================================== */

/* Graphique dans la grille du Dashboard */
#view-dashboard .grid-2 > #monthlyReceptionsChart {
  grid-column: auto;
  width: 100%;
  min-width: 0;
  margin-bottom: 0;
}

/* Empêche le graphique de déborder de sa carte */
#monthlyReceptionsChart {
  box-sizing: border-box;
  max-width: 100%;
}



/* ==========================================
   ACTIA - PAGE STATS
========================================== */

#view-stats {
  width: 100%;
}

/* En-tête de la page */
#view-stats .view-head {
  margin-bottom: 24px;
}

/* Graphique sur toute la largeur */
#view-stats #monthlyReceptionsChart {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Espacement de la carte */
#view-stats .monthly-bars-card {
  margin-bottom: 24px;
}

/* Dégradé vert ACTIA */
#view-stats .monthly-bars-bar {
  background: linear-gradient(
    180deg,
    #00b82e,
    #056e0e
  );
}

/* Journée record */
#view-stats .monthly-bars-bar.is-record {
  background: linear-gradient(
    180deg,
    #68ef80,
    #00b82e
  );
}

/* Jours sans réception */
#view-stats .monthly-bars-bar.is-empty {
  background: transparent;
}

/* Adaptation mobile */
@media (max-width: 700px) {
  #view-stats .monthly-bars-card {
    padding: 16px;
  }
}



/* =========================================
   LOGO ACTIA 3D - BARRE LATÉRALE
========================================= */

.actia-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}



/* ==========================================
   ACTIA - FENÊTRES DE CONFIRMATION
========================================== */

.actia-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;

  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.actia-confirm-box {
  width: 100%;
  max-width: 490px;
  max-height: 90vh;
  overflow-y: auto;

  padding: 30px;

  background: var(--bg2);
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 22px;

  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);

  animation: actiaConfirmAppear 0.25s ease;
}

@keyframes actiaConfirmAppear {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.actia-confirm-icon {
  width: 60px;
  height: 60px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 20px;

  font-size: 29px;

  background: rgba(0, 184, 46, 0.12);
  border: 1px solid rgba(0, 184, 46, 0.25);
  border-radius: 17px;
}

.actia-confirm-box h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.actia-confirm-message {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.actia-confirm-details {
  display: flex;
  flex-direction: column;
  gap: 10px;

  margin: 22px 0;
  padding: 17px;

  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.actia-confirm-details > div {
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.actia-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.actia-confirm-accept {
  background: linear-gradient(
    135deg,
    #00b82e,
    #056e0e
  );

  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 184, 46, 0.25);
}

.actia-confirm-accept:hover:not(:disabled) {
  filter: brightness(1.13);
}

.actia-confirm-accept.danger {
  background: linear-gradient(
    135deg,
    #ef4444,
    #991b1b
  );

  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25);
}

.actia-confirm-accept:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.actia-confirm-verify {
  display: flex;
  flex-direction: column;
  gap: 10px;

  margin-top: 20px;

  font-size: 13px;
  color: var(--muted);
}

.actia-confirm-input {
  width: 100%;
  padding: 12px 14px;

  color: var(--text);
  background: var(--card);

  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
}

.actia-confirm-input:focus {
  border-color: #00b82e;
}

@media (max-width: 600px) {
  .actia-confirm-box {
    padding: 22px;
  }

  .actia-confirm-actions {
    flex-direction: column-reverse;
  }

  .actia-confirm-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .actia-confirm-box {
    animation: none;
  }
}



/* ==========================================
   ACTIA - GESTION DES FOURNISSEURS
========================================== */

.supplier-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  margin-bottom: 12px;
  padding: 0 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s;
}

.supplier-search-box:focus-within {
  border-color: #00b82e;
  box-shadow: 0 0 0 3px rgba(0, 184, 46, 0.1);
}

.supplier-search-icon {
  font-size: 16px;
}

.supplier-search-box input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  background: transparent;
  color: var(--text);
  border: none;
  outline: none;
  font-size: 13px;
}

.supplier-search-count {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.modal-box.wide .supplier-picker {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  max-height: 260px !important;
  overflow-y: auto !important;
  padding: 4px 6px 8px 0;
  margin-bottom: 12px;
}

.supplier-item {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  transition: border-color 0.2s;
}

.supplier-item:hover {
  border-color: rgba(0, 184, 46, 0.6);
}

.supplier-item.selected {
  background: linear-gradient(135deg, #00b82e, #056e0e);
  border-color: #00b82e;
}

.supplier-select-btn {
  padding: 8px 7px 8px 13px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.supplier-item:hover .supplier-select-btn {
  color: var(--text);
}

.supplier-item.selected .supplier-select-btn {
  color: #ffffff;
  font-weight: 600;
}

.supplier-remove-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 4px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.supplier-remove-btn:hover {
  background: #b91c1c;
  color: #ffffff;
}

.supplier-item.selected .supplier-remove-btn {
  color: #ffffff;
}

.supplier-new-btn {
  padding: 8px 14px;
  border: 1px dashed #00b82e;
  border-radius: 999px;
  background: rgba(0, 184, 46, 0.10);
  color: #55df79;
  font-size: 12px;
  font-weight: 600;
}

.supplier-new-btn:hover {
  background: rgba(0, 184, 46, 0.20);
}

.supplier-empty {
  width: 100%;
  padding: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

@media (max-width: 700px) {
  .supplier-search-box {
    min-height: 48px;
  }

  .supplier-select-btn {
    padding: 10px 7px 10px 13px;
  }

  .supplier-remove-btn {
    width: 30px;
    height: 30px;
  }
}

/* ==========================================
   ACTIA - CONFIRMATION FOURNISSEUR
========================================== */

.supplier-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;

  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.supplier-confirm-modal {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;

  padding: 30px;

  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 22px;

  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);

  animation: supplierConfirmShow 0.25s ease;
}

@keyframes supplierConfirmShow {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.supplier-confirm-icon {
  display: grid;
  place-items: center;

  width: 58px;
  height: 58px;

  margin-bottom: 20px;

  font-size: 27px;

  border-radius: 16px;
  background: rgba(0, 184, 46, 0.12);
  border: 1px solid rgba(0, 184, 46, 0.25);
}

.supplier-confirm-modal h2 {
  margin-bottom: 10px;

  color: var(--text);
  font-size: 22px;
  font-weight: 700;
}

.supplier-confirm-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.supplier-confirm-name {
  margin-top: 18px;
  padding: 14px 16px;

  border-radius: 12px;
  border: 1px solid rgba(0, 184, 46, 0.3);

  background: rgba(0, 184, 46, 0.08);

  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  text-align: center;

  overflow-wrap: anywhere;
}

.supplier-confirm-info {
  display: flex;
  gap: 11px;

  margin-top: 16px;
  padding: 14px;

  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
}

.supplier-confirm-info span {
  flex-shrink: 0;
  font-size: 18px;
}

.supplier-confirm-info p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.supplier-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;

  margin-top: 25px;
}

.supplier-confirm-delete {
  background: linear-gradient(
    135deg,
    #00b82e,
    #056e0e
  );

  color: #ffffff;
  font-weight: 600;

  box-shadow: 0 6px 20px rgba(0, 184, 46, 0.25);
}

.supplier-confirm-delete:hover {
  filter: brightness(1.15);
}

@media (max-width: 600px) {
  .supplier-confirm-modal {
    padding: 22px;
  }

  .supplier-confirm-actions {
    flex-direction: column-reverse;
  }

  .supplier-confirm-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .supplier-confirm-modal {
    animation: none;
  }
}

/* ==========================================
   ACTIA - BOUTON VALIDER FOURNISSEUR
========================================== */

#newSupplierOk {
  background: linear-gradient(135deg, #00b82e, #056e0e);
  color: #ffffff;
  border: 1px solid rgba(0, 184, 46, 0.4);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  padding: 10px 18px;
  white-space: nowrap;
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}

#newSupplierOk:hover {
  filter: brightness(1.15);
  box-shadow: 0 4px 16px rgba(0, 184, 46, 0.35);
}

#newSupplierOk:active {
  filter: brightness(0.95);
}


/* ==========================================
   ACTIA - BOUTON ANCIENNES STATS
========================================== */

.stats-history-footer {
  display: flex;
  justify-content: flex-start;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.stats-history-button {
  background: linear-gradient(135deg, #00b82e, #056e0e);
  color: #ffffff;
  border: 1px solid rgba(0, 184, 46, 0.35);
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 5px 18px rgba(0, 184, 46, 0.18);
}

.stats-history-button:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
}

/* ==========================================
   FENÊTRE HISTORIQUE
========================================== */

.stats-history-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
}

.stats-history-modal {
  width: 100%;
  max-width: 1100px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.stats-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.stats-history-heading {
  display: flex;
  align-items: center;
  gap: 15px;
}

.stats-history-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 15px;
  background: rgba(0, 184, 46, 0.12);
  border: 1px solid rgba(0, 184, 46, 0.25);
  font-size: 25px;
}

.stats-history-header h2 {
  margin-bottom: 5px;
  font-size: 22px;
}

.stats-history-header p {
  color: var(--muted);
  font-size: 13px;
}

.stats-history-close {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 18px;
}

.stats-history-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ff7675;
  border-color: rgba(239, 68, 68, 0.4);
}

.stats-history-body {
  padding: 26px 28px 30px;
}

/* Sélecteur d'année */

.stats-history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.stats-history-controls h3 {
  margin-bottom: 5px;
  font-size: 17px;
}

.stats-history-controls p {
  color: var(--muted);
  font-size: 12px;
}

.stats-history-year-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.stats-history-year-label select {
  min-width: 150px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.stats-history-year-label select:focus {
  border-color: #00b82e;
}

/* Grille des 12 mois */

.stats-history-months {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.stats-history-month {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--card);
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.stats-history-month span {
  font-size: 13px;
  font-weight: 600;
}

.stats-history-month strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.stats-history-month:hover:not(:disabled) {
  border-color: #00b82e;
  background: rgba(0, 184, 46, 0.07);
}

.stats-history-month.active {
  border-color: #00b82e;
  background: linear-gradient(
    135deg,
    rgba(0, 184, 46, 0.22),
    rgba(5, 110, 14, 0.12)
  );
}

.stats-history-month.active span {
  color: #70e48c;
}

.stats-history-month:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stats-history-loading {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Graphique historique */

.stats-history-result {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.stats-history-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.stats-history-result-header h3 {
  margin-bottom: 5px;
  font-size: 20px;
}

.stats-history-result-header p {
  color: var(--muted);
  font-size: 12px;
}

.stats-history-big-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.stats-history-big-total strong {
  font-size: 32px;
}

.stats-history-big-total span {
  color: var(--muted);
  font-size: 11px;
}

.stats-history-chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.stats-history-chart {
  display: grid;
  gap: 6px;
  min-width: 690px;
  height: 230px;
}

.stats-history-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.stats-history-bar-area {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: calc(100% - 25px);
  border-bottom: 1px solid var(--border);
}

.stats-history-bar {
  width: 100%;
  max-width: 22px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(
    180deg,
    #00b82e,
    #056e0e
  );
  cursor: help;
}

.stats-history-bar:hover {
  filter: brightness(1.3);
  box-shadow: 0 0 13px rgba(0, 184, 46, 0.35);
}

.stats-history-bar.empty {
  background: transparent;
}

.stats-history-bar.record {
  background: linear-gradient(
    180deg,
    #68ef80,
    #00b82e
  );
}

.stats-history-column > span {
  padding-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

/* Indicateurs */

.stats-history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 25px;
}

.stats-history-summary-item {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.stats-history-summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.stats-history-summary-item strong {
  font-size: 18px;
}

/* Responsive */

@media (max-width: 750px) {
  .stats-history-modal {
    max-height: 95vh;
  }

  .stats-history-header {
    padding: 18px;
  }

  .stats-history-body {
    padding: 18px;
  }

  .stats-history-months {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-history-summary {
    grid-template-columns: 1fr;
  }

  .stats-history-result {
    padding: 15px;
  }

  .stats-history-header h2 {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stats-history-button {
    transition: none;
  }
}









/* ==================================================
   ACTIA - AUTRES DOCUMENTS
================================================== */

#view-other-documents {
  width: 100%;
  min-width: 0;
}

/* Trois boutons principaux */

.other-doc-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.other-doc-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;

  min-width: 0;
  min-height: 185px;
  padding: 22px;

  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;

  color: var(--text);
  text-align: left;

  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.other-doc-action:hover {
  transform: translateY(-3px);
  border-color: #00b82e;
  background: rgba(0, 184, 46, 0.07);
}

.other-doc-action-icon {
  display: grid;
  place-items: center;

  width: 48px;
  height: 48px;

  font-size: 23px;
  background: rgba(0, 184, 46, 0.12);
  border-radius: 13px;
}

.other-doc-action strong {
  font-size: 15px;
  line-height: 1.4;
}

.other-doc-action small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.other-doc-action-plus {
  margin-top: auto;

  color: #45df6c;
  font-size: 12px;
  font-weight: 700;
}

/* Panel principal */

.other-doc-panel {
  padding: 24px;

  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.other-doc-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;

  padding-bottom: 22px;
  margin-bottom: 26px;

  border-bottom: 1px solid var(--border);
}

.other-doc-panel-head h3 {
  margin-bottom: 6px;
  font-size: 19px;
}

/* Catégories */

.other-doc-category {
  margin-bottom: 30px;
}

.other-doc-category:last-child {
  margin-bottom: 0;
}

.other-doc-category-head {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 15px;
}

.other-doc-category-head h3 {
  margin-bottom: 5px;
  font-size: 17px;
}

.other-doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Cartes documents */

.other-doc-card {
  min-width: 0;
  padding: 20px;

  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 15px;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.other-doc-card:hover {
  border-color: rgba(0, 184, 46, 0.4);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.other-doc-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;

  margin-bottom: 18px;
}

.other-doc-card-top h4 {
  margin-bottom: 6px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.other-doc-date {
  font-size: 12px;
  color: var(--muted);
}

/* Grille d'informations */

.other-doc-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.other-doc-info-field {
  display: flex;
  flex-direction: column;
  gap: 6px;

  min-width: 0;
  padding: 12px;

  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.other-doc-info-field span {
  color: var(--muted);
  font-size: 11px;
}

.other-doc-info-field strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Conformité */

.other-doc-status {
  display: inline-flex;
  align-items: center;

  padding: 7px 11px;
  border-radius: 999px;

  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.other-doc-status.conform {
  color: #56e57b;
  background: rgba(0, 184, 46, 0.13);
  border: 1px solid rgba(0, 184, 46, 0.25);
}

.other-doc-status.nonconform {
  color: #ffb366;
  background: rgba(255, 150, 40, 0.12);
  border: 1px solid rgba(255, 150, 40, 0.25);
}

/* Images et commentaires */

.other-doc-files,
.other-doc-comment {
  display: flex;
  flex-direction: column;
  gap: 10px;

  margin-top: 16px;
  padding: 14px;

  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.other-doc-files > span,
.other-doc-comment > strong {
  font-size: 12px;
  font-weight: 700;
}

.other-doc-file-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.other-doc-file-links .file-link {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.other-doc-comment p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.other-doc-empty {
  grid-column: 1 / -1;

  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: 12px;

  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Formulaire */

.other-doc-form {
  display: flex;
  flex-direction: column;
}

.other-doc-form-intro {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 22px;
  padding: 14px;

  background: rgba(0, 184, 46, 0.07);
  border: 1px solid rgba(0, 184, 46, 0.18);
  border-radius: 12px;
}

.other-doc-form-icon {
  display: grid;
  place-items: center;

  width: 46px;
  height: 46px;
  flex-shrink: 0;

  background: rgba(0, 184, 46, 0.12);
  border-radius: 12px;
  font-size: 22px;
}

.other-doc-form-intro strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.other-doc-form-intro p {
  color: var(--muted);
  font-size: 12px;
}

.other-doc-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;

  background: linear-gradient(
    135deg,
    #00b82e,
    #056e0e
  );

  color: #ffffff;
  font-weight: 700;
}

.other-doc-submit:hover {
  filter: brightness(1.12);
}

/* Responsive */

@media (max-width: 1100px) {
  .other-doc-actions {
    grid-template-columns: 1fr;
  }

  .other-doc-action {
    min-height: 0;
  }
}

@media (max-width: 850px) {
  .other-doc-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .other-doc-panel {
    padding: 15px;
  }

  .other-doc-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .other-doc-info-grid {
    grid-template-columns: 1fr;
  }

  .other-doc-card {
    padding: 15px;
  }
}










/* ==============================================
   ACTIA - FORMULAIRES AUTRES DOCUMENTS
   Version large et compacte
============================================== */

/* Fenêtre plus large uniquement pour ces formulaires */
.modal-box:has(.other-doc-form) {
  width: min(1100px, 96vw);
  max-width: 1100px;
  max-height: 94vh;
  overflow-y: auto;
  padding: 26px 30px;
}

/* En-tête du formulaire */
.modal-box:has(.other-doc-form) .modal-head {
  margin-bottom: 16px;
}

/* Formulaire en grille */
.other-doc-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 22px;
  align-items: start;
}

/* Bandeau d'introduction sur toute la largeur */
.other-doc-form-intro {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  padding: 12px 16px;
}

/* Champs */
.other-doc-form > label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  margin: 0;
}

/* Les groupes palettes / colis */
.other-doc-form > .row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  align-items: end;
}

.other-doc-form > .row > label {
  min-width: 0;
  margin: 0;
}

/* Entrées compactes */
.other-doc-form input:not([type="file"]),
.other-doc-form select {
  width: 100%;
  min-height: 43px;
  box-sizing: border-box;
}

/* Zone de commentaire */
.other-doc-form textarea {
  width: 100%;
  min-height: 85px;
  max-height: 160px;
  resize: vertical;
}

/* Champ des images */
.other-doc-form input[type="file"] {
  width: 100%;
  max-width: 100%;
  min-height: 43px;
}

/* Le bouton d'enregistrement occupe toute la largeur */
.other-doc-submit {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  background: linear-gradient(135deg, #00b82e, #056e0e);
  color: #ffffff;
  border-radius: 12px;
  font-weight: 700;
}

/* Effet au survol */
.other-doc-submit:hover {
  filter: brightness(1.12);
  box-shadow: 0 5px 20px rgba(0, 184, 46, 0.25);
}

/* ==============================================
   ÉCRANS TRÈS LARGES
============================================== */

@media (min-width: 1200px) {
  .modal-box:has(.other-doc-form) {
    width: min(1180px, 94vw);
    max-width: 1180px;
  }

  .other-doc-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px 20px;
  }

  /* Images et commentaire prennent davantage de place */
  .other-doc-form > label:has(input[type="file"]) {
    grid-column: span 2;
  }

  .other-doc-form > label:has(textarea) {
    grid-column: span 2;
  }
}

/* ==============================================
   TABLETTES
============================================== */

@media (max-width: 800px) {
  .modal-box:has(.other-doc-form) {
    width: 96vw;
    padding: 22px;
  }

  .other-doc-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* ==============================================
   TÉLÉPHONES
============================================== */

@media (max-width: 600px) {
  .modal-box:has(.other-doc-form) {
    width: 96vw;
    max-height: 95vh;
    padding: 18px;
  }

  .other-doc-form {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .other-doc-form-intro,
  .other-doc-submit,
  .other-doc-form > label:has(input[type="file"]),
  .other-doc-form > label:has(textarea) {
    grid-column: 1 / -1;
  }
}

/* ==========================================
   ACTIA - AUTRES DOCUMENTS EN LIGNES
========================================== */

/* Liste compacte */

.other-doc-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.other-doc-entry {
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 13px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.other-doc-entry:hover {
  border-color: rgba(0, 184, 46, 0.35);
}

.other-doc-entry.expanded {
  border-color: rgba(0, 184, 46, 0.5);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

/* Une ligne = un document */

.other-doc-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 115px 140px 28px;
  align-items: center;
  gap: 16px;

  width: 100%;
  min-height: 75px;
  padding: 14px 18px;

  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.other-doc-row:hover {
  background: rgba(0, 184, 46, 0.045);
}

.other-doc-row:focus-visible {
  outline: 2px solid #00b82e;
  outline-offset: -3px;
}

.other-doc-row-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: rgba(0, 184, 46, 0.1);
  font-size: 20px;
}

.other-doc-row-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.other-doc-row-main strong {
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.other-doc-row-main small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.other-doc-row-date {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.other-doc-row-status {
  display: flex;
  justify-content: flex-end;
}

.other-doc-row-arrow {
  display: flex;
  justify-content: center;
  color: var(--muted);
  font-size: 25px;
  transition: transform 0.2s ease;
}

.other-doc-entry.expanded .other-doc-row-arrow {
  transform: rotate(180deg);
}

/* Détails déroulés */

.other-doc-details {
  padding: 18px 20px 22px;
  border-top: 1px solid var(--border);
  background: rgba(0, 184, 46, 0.025);
}

.other-doc-details[hidden] {
  display: none !important;
}

.other-doc-details .other-doc-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.other-doc-details .other-doc-info-field {
  min-width: 0;
}

.other-doc-details .other-doc-files,
.other-doc-details .other-doc-comment {
  margin-top: 16px;
}

/* La liste occupe toute la largeur disponible */

#view-other-documents .other-doc-grid,
#view-other-documents .other-doc-list {
  width: 100%;
  max-width: 100%;
}

/* Tablettes */

@media (max-width: 950px) {
  .other-doc-row {
    grid-template-columns: 42px minmax(0, 1fr) 100px 28px;
    gap: 10px;
  }

  .other-doc-row-status {
    grid-column: 2 / 4;
    grid-row: 2;
    justify-content: flex-start;
  }

  .other-doc-row-arrow {
    grid-column: 4;
    grid-row: 1;
  }

  .other-doc-details .other-doc-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Téléphones */

@media (max-width: 600px) {
  .other-doc-row {
    grid-template-columns: 36px minmax(0, 1fr) 24px;
    gap: 10px;
    padding: 13px;
  }

  .other-doc-row-icon {
    width: 36px;
    height: 36px;
    font-size: 17px;
  }

  .other-doc-row-date {
    grid-column: 2;
    grid-row: 2;
  }

  .other-doc-row-status {
    grid-column: 2 / 3;
    grid-row: 3;
    justify-content: flex-start;
  }

  .other-doc-row-arrow {
    grid-column: 3;
    grid-row: 1;
  }

  .other-doc-details {
    padding: 13px;
  }

  .other-doc-details .other-doc-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .other-doc-entry,
  .other-doc-row-arrow {
    transition: none;
  }
}


/* ==========================================
   ACTIA - GESTION DES AUTRES DOCUMENTS
========================================== */

.other-doc-manage {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.other-doc-edit-btn {
  background: linear-gradient(135deg, #00b82e, #056e0e);
  color: #ffffff;
  border: 1px solid rgba(0, 184, 46, 0.35);
  border-radius: 11px;
  padding: 11px 17px;
  font-size: 13px;
  font-weight: 600;
}

.other-doc-edit-btn:hover {
  filter: brightness(1.15);
}

.other-doc-delete-btn {
  background: rgba(239, 68, 68, 0.10);
  color: #ff7675;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 11px;
  padding: 11px 17px;
  font-size: 13px;
  font-weight: 600;
}

.other-doc-delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

.other-doc-existing-images {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.other-doc-existing-images h4 {
  font-size: 14px;
}

.other-doc-existing-images p {
  color: var(--muted);
  font-size: 12px;
}

.other-doc-existing-file {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 12px;
  padding: 11px 13px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}

.other-doc-existing-file input[type="checkbox"] {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: #00b82e;
}

.other-doc-existing-file span {
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .other-doc-manage {
    flex-direction: column;
    align-items: stretch;
  }

  .other-doc-manage .btn {
    width: 100%;
  }
}

/* =====================================================
   ACTIA - CORRECTION AFFICHAGE GESTION DES STATISTIQUES
   Sélecteurs + boutons + mode sombre / clair
===================================================== */

/* Sélection de l'année et du mois */
#statsReceptionManagerOverlay select {
  background-color: #242832 !important;
  color: #ffffff !important;

  border: 1px solid #424856 !important;
  border-radius: 10px !important;

  padding: 10px 35px 10px 14px !important;

  font-size: 14px !important;
  font-weight: 600 !important;

  min-width: 150px;
  min-height: 42px;

  cursor: pointer;
  color-scheme: dark;
}

/* Options dans les listes déroulantes */
#statsReceptionManagerOverlay select option {
  background-color: #242832 !important;
  color: #ffffff !important;
}

/* Bouton retirer des statistiques */
#statsManagerExclude {
  background: linear-gradient(
    135deg,
    #dc2626,
    #991b1b
  ) !important;

  color: #ffffff !important;

  border: 1px solid #dc2626 !important;
  border-radius: 10px !important;

  padding: 12px 20px !important;

  font-size: 14px !important;
  font-weight: 700 !important;

  cursor: pointer;
  transition: 0.2s ease;
}

#statsManagerExclude:hover:not(:disabled) {
  background: linear-gradient(
    135deg,
    #ef4444,
    #b91c1c
  ) !important;

  transform: translateY(-1px);
}

/* Bouton rétablir */
#statsManagerRestore {
  background: #2b303b !important;
  color: #ffffff !important;

  border: 1px solid #414756 !important;
  border-radius: 10px !important;

  padding: 12px 20px !important;

  font-size: 14px !important;
  font-weight: 600 !important;

  cursor: pointer;
}

/* Boutons désactivés */
#statsManagerExclude:disabled,
#statsManagerRestore:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Amélioration des cases à cocher */
#statsReceptionManagerOverlay input[type="checkbox"] {
  accent-color: #00b82e;
  width: 17px;
  height: 17px;
  cursor: pointer;
}

/* Mode clair */
body.light #statsReceptionManagerOverlay select {
  background-color: #ffffff !important;
  color: #1f2937 !important;
  border-color: #d1d5db !important;
  color-scheme: light;
}

body.light #statsReceptionManagerOverlay select option {
  background-color: #ffffff !important;
  color: #1f2937 !important;
}

body.light #statsManagerRestore {
  background: #f3f4f6 !important;
  color: #1f2937 !important;
  border-color: #d1d5db !important;
}

/* =====================================================
   ACTIA - CONFIRMATION MODERNE DES STATISTIQUES
===================================================== */

.actia-stats-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(7px);

  animation: statsConfirmFade 0.2s ease;
}

.actia-stats-confirm {
  width: min(100%, 470px);
  padding: 26px;

  background: #191c25;
  color: #f5f5f7;

  border: 1px solid #343946;
  border-radius: 20px;

  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  animation: statsConfirmPop 0.25s ease;
}

.actia-stats-confirm-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.actia-stats-confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  width: 54px;
  height: 54px;

  background: rgba(239, 68, 68, 0.12);
  border-radius: 15px;

  font-size: 25px;
}

.actia-stats-confirm-heading {
  flex: 1;
  min-width: 0;
}

.actia-stats-confirm-heading h2 {
  margin: 2px 0 5px;
  color: inherit;
  font-size: 20px;
  font-weight: 750;
}

.actia-stats-confirm-heading p {
  margin: 0;
  color: #9ca3af;
  font-size: 13px;
}

.actia-stats-confirm-close {
  border: none;
  background: transparent;
  color: #9ca3af;

  padding: 5px;
  cursor: pointer;
  font-size: 19px;
}

.actia-stats-confirm-close:hover {
  color: #fff;
}

.actia-stats-confirm-description {
  margin: 24px 0 18px;
  color: #d1d5db;
  font-size: 15px;
  line-height: 1.65;
}

.actia-stats-confirm-description strong {
  color: #fff;
}

.actia-stats-confirm-info {
  display: grid;
  gap: 14px;

  background: #222630;
  border: 1px solid #343946;
  border-radius: 13px;

  padding: 16px;
}

.actia-stats-confirm-info > div {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.actia-stats-confirm-info span {
  font-size: 19px;
}

.actia-stats-confirm-info p {
  margin: 0;
  color: #c4cad5;

  font-size: 13px;
  line-height: 1.55;
}

.actia-stats-confirm-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;

  margin-top: 25px;
}

.actia-stats-confirm-actions button {
  border: 0;
  border-radius: 10px;

  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;

  cursor: pointer;
  transition: 0.2s ease;
}

.actia-stats-confirm-cancel {
  background: #343945;
  color: #fff;
}

.actia-stats-confirm-cancel:hover {
  background: #454b59;
}

.actia-stats-confirm-accept {
  color: #fff;
}

.actia-stats-confirm-accept.is-danger {
  background: #dc2626;
}

.actia-stats-confirm-accept.is-danger:hover {
  background: #b91c1c;
}

.actia-stats-confirm-accept.is-restore {
  background: #07862c;
}

.actia-stats-confirm-accept.is-restore:hover {
  background: #056b23;
}

/* Mode clair */

body.light .actia-stats-confirm {
  background: #fff;
  color: #111827;
  border-color: #e5e7eb;
}

body.light .actia-stats-confirm-heading p,
body.light .actia-stats-confirm-close {
  color: #6b7280;
}

body.light .actia-stats-confirm-description {
  color: #374151;
}

body.light .actia-stats-confirm-description strong {
  color: #111827;
}

body.light .actia-stats-confirm-info {
  background: #f8fafc;
  border-color: #e5e7eb;
}

body.light .actia-stats-confirm-info p {
  color: #4b5563;
}

body.light .actia-stats-confirm-cancel {
  background: #e5e7eb;
  color: #1f2937;
}

/* Animations */

@keyframes statsConfirmFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes statsConfirmPop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 480px) {
  .actia-stats-confirm {
    padding: 20px;
  }

  .actia-stats-confirm-actions button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .actia-stats-confirm-overlay,
  .actia-stats-confirm {
    animation: none;
  }
}

/* =====================================================
   ACTIA - SUGGESTIONS V1
   Formulaire + gestion administrateur
===================================================== */

.actia-suggestion-shell {
  max-width: 850px;
  margin: 26px auto;
  background: var(--card, #1c202a);
  border: 1px solid var(--border, #353b48);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.08);
}

.actia-suggestion-intro {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px;
  background: linear-gradient(
    135deg,
    rgba(0,184,46,.14),
    rgba(0,184,46,.03)
  );
  border-bottom: 1px solid var(--border, #353b48);
}

.actia-suggestion-main-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  font-size: 30px;
  background: rgba(0,184,46,.15);
  border-radius: 17px;
}

.actia-suggestion-intro h3 {
  font-size: 21px;
  margin: 0 0 7px;
  color: var(--text, #fff);
}

.actia-suggestion-intro p {
  margin: 0;
  color: var(--muted, #a0a6b3);
  line-height: 1.6;
  font-size: 14px;
}

.actia-suggestion-form {
  display: grid;
  gap: 24px;
  padding: 28px;
}

.actia-suggestion-form > label,
.actia-suggestion-upload > label:first-child {
  display: grid;
  gap: 10px;
  color: var(--text, #fff);
  font-weight: 650;
  font-size: 14px;
}

.actia-suggestion-form .optional {
  color: var(--muted, #9ca3af);
  font-size: 12px;
  font-weight: 400;
}

.actia-suggestion-form .required {
  color: #22c55e;
}

.actia-suggestion-form input:not([type="file"]),
.actia-suggestion-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  background: var(--bg2, #151821);
  border: 1px solid var(--border, #3a4050);
  border-radius: 11px;
  color: var(--text, #fff);
  font: inherit;
  font-weight: 400;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.actia-suggestion-form textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.65;
}

.actia-suggestion-form input:focus,
.actia-suggestion-form textarea:focus {
  border-color: #00b82e;
  box-shadow: 0 0 0 3px rgba(0,184,46,.13);
}

.actia-suggestion-form input::placeholder,
.actia-suggestion-form textarea::placeholder {
  color: var(--muted, #959ba8);
  opacity: .85;
}

.actia-suggestion-upload {
  display: grid;
  gap: 12px;
}

.actia-suggestion-dropzone {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 32px 15px;
  text-align: center;
  background: rgba(0,184,46,.035);
  border: 2px dashed rgba(0,184,46,.38);
  border-radius: 14px;
  cursor: pointer;
  transition: .2s ease;
}

.actia-suggestion-dropzone:hover {
  background: rgba(0,184,46,.09);
  border-color: #00b82e;
}

.actia-suggestion-upload-icon {
  font-size: 29px;
}

.actia-suggestion-dropzone strong {
  color: var(--text, #fff);
  font-size: 14px;
}

.actia-suggestion-dropzone small {
  color: var(--muted, #a0a6b3);
  font-size: 12px;
}

.actia-suggestion-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px,1fr));
  gap: 12px;
}

.actia-suggestion-preview {
  min-width: 0;
  padding: 7px;
  background: var(--bg2, #151821);
  border: 1px solid var(--border, #353b48);
  border-radius: 11px;
}

.actia-suggestion-preview img {
  display: block;
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 7px;
}

.actia-suggestion-preview small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted, #a0a6b3);
}

.actia-suggestion-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 20px;
  color: #fff !important;
  background: linear-gradient(135deg,#00b82e,#056e0e);
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .2s, filter .2s;
}

.actia-suggestion-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.actia-suggestion-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.actia-suggestion-message {
  color: var(--muted, #a0a6b3);
  font-size: 13px;
  line-height: 1.5;
}

.actia-suggestion-message:empty {
  display: none;
}

.actia-suggestion-message.is-success {
  color: #22c55e;
  background: rgba(34,197,94,.08);
  padding: 13px;
  border-radius: 10px;
}

.actia-suggestion-message.is-error {
  color: #ef7777;
  background: rgba(239,68,68,.08);
  padding: 13px;
  border-radius: 10px;
}

/* ==========================================
   PAGE ADMIN - TABLEAU DE BORD
========================================== */

.actia-suggestions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.actia-suggestions-summary {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 16px;
  margin: 24px 0;
}

.actia-suggestions-summary-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  background: var(--card, #1c202a);
  border: 1px solid var(--border, #353b48);
  border-radius: 15px;
}

.actia-suggestions-summary-card span {
  font-size: 13px;
  color: var(--muted, #a0a6b3);
}

.actia-suggestions-summary-card strong {
  font-size: 30px;
  color: var(--text, #fff);
  font-weight: 800;
}

.actia-suggestions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 19px;
}

.actia-suggestions-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actia-suggestions-filters button {
  padding: 10px 16px;
  background: var(--card, #1c202a);
  color: var(--muted, #a0a6b3);
  border: 1px solid var(--border, #353b48);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 650;
  transition: .2s;
}

.actia-suggestions-filters button.active {
  color: #fff;
  background: #087d2c;
  border-color: #087d2c;
}

.actia-suggestions-list {
  display: grid;
  gap: 17px;
}

.actia-suggestion-entry {
  padding: 23px;
  background: var(--card, #1c202a);
  border: 1px solid var(--border, #353b48);
  border-radius: 17px;
  box-shadow: 0 5px 20px rgba(0,0,0,.035);
}

.actia-suggestion-entry.is-closed {
  opacity: .82;
}

.actia-suggestion-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.actia-suggestion-entry-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.actia-suggestion-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  color: #31d35a;
  background: rgba(0,184,46,.13);
  border-radius: 12px;
  font-size: 19px;
  font-weight: 800;
}

.actia-suggestion-entry-user h3 {
  margin: 0 0 5px;
  color: var(--text, #fff);
  font-size: 16px;
}

.actia-suggestion-entry-user p {
  margin: 0;
  color: var(--muted, #a0a6b3);
  font-size: 12px;
}

.actia-suggestion-status {
  padding: 7px 11px;
  border-radius: 20px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 750;
}

.actia-suggestion-status.open {
  color: #4ade80;
  background: rgba(34,197,94,.12);
}

.actia-suggestion-status.closed {
  color: #a0a6b3;
  background: rgba(148,163,184,.13);
}

.actia-suggestion-entry-date {
  margin: 16px 0;
  color: var(--muted, #a0a6b3);
  font-size: 12px;
}

.actia-suggestion-entry-content {
  padding: 17px;
  background: var(--bg2, #151821);
  border: 1px solid var(--border, #353b48);
  border-radius: 12px;
}

.actia-suggestion-entry-content strong,
.actia-suggestion-entry-images > strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text, #fff);
  font-size: 13px;
}

.actia-suggestion-entry-content p {
  margin: 0;
  color: var(--text, #fff);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.actia-suggestion-entry-images {
  margin-top: 17px;
}

.actia-suggestion-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.actia-suggestion-image-button {
  padding: 9px 13px;
  max-width: 100%;
  color: var(--text, #fff);
  background: var(--bg2, #151821);
  border: 1px solid var(--border, #353b48);
  border-radius: 9px;
  font-size: 12px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.actia-suggestion-image-button:hover {
  border-color: #00b82e;
}

.actia-suggestion-entry-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 19px;
  padding-top: 17px;
  border-top: 1px solid var(--border, #353b48);
}

.actia-suggestion-close-btn {
  padding: 12px 17px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg,#00b82e,#056e0e);
  color: #fff !important;
  font-weight: 750;
  cursor: pointer;
  transition: .2s ease;
}

.actia-suggestion-close-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.actia-suggestion-closed-date {
  color: #22c55e;
  font-size: 12px;
}

.actia-suggestions-empty {
  padding: 55px 20px;
  text-align: center;
  color: var(--muted, #a0a6b3);
  background: var(--card, #1c202a);
  border: 1px solid var(--border, #353b48);
  border-radius: 17px;
}

.actia-suggestions-empty span {
  font-size: 36px;
}

.actia-suggestions-empty h3 {
  margin: 15px 0 7px;
  color: var(--text, #fff);
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 700px) {
  .actia-suggestion-shell {
    margin: 15px 0;
  }

  .actia-suggestion-intro {
    padding: 19px;
    align-items: flex-start;
  }

  .actia-suggestion-main-icon {
    width: 47px;
    height: 47px;
    font-size: 24px;
  }

  .actia-suggestion-intro h3 {
    font-size: 17px;
  }

  .actia-suggestion-form {
    padding: 19px;
    gap: 19px;
  }

  .actia-suggestions-summary {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .actia-suggestions-summary-card {
    padding: 16px;
  }

  .actia-suggestion-entry {
    padding: 16px;
  }

  .actia-suggestion-entry-head {
    flex-wrap: wrap;
  }

  .actia-suggestion-entry-footer {
    justify-content: stretch;
  }

  .actia-suggestion-close-btn {
    width: 100%;
  }
}

/* =====================================================
   ACTIA - BOUTON SUPPRESSION SUGGESTIONS FERMÉES
===================================================== */

.actia-suggestion-entry-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
}

.actia-suggestion-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 11px 17px;
  min-height: 42px;

  background: rgba(220, 38, 38, 0.12);
  color: #f87171;

  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;

  font-size: 13px;
  font-weight: 700;

  cursor: pointer;
  transition: 0.2s ease;
}

.actia-suggestion-delete-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;

  transform: translateY(-1px);
}

.actia-suggestion-delete-btn:focus-visible {
  outline: 3px solid rgba(239, 68, 68, 0.4);
  outline-offset: 3px;
}

body.light .actia-suggestion-delete-btn {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

body.light .actia-suggestion-delete-btn:hover {
  background: #dc2626;
  color: #ffffff;
}

@media (max-width: 600px) {
  .actia-suggestion-delete-btn {
    width: 100%;
  }
}

/* ===== RÉCEPTION : APERÇU DES PHOTOS (v. 18-11-2026) =====
   Remplace l'ancien rendu où l'image en position absolue
   recouvrait le bouton de la case. */
.modal-box .photo-slot {
  position: relative;
  justify-content: flex-start;
  min-height: 0;
  cursor: default;
  transition: border-color .2s, background .2s;
}
.modal-box .photo-slot.filled {
  border-style: solid;
  border-color: var(--accent);
  padding: 8px;
}
.modal-box .photo-slot .photo-preview { position: relative; width: 100%; }
.modal-box .photo-slot .photo-preview:empty { display: none; }
.modal-box .photo-slot .photo-preview img {
  position: static;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  max-height: none;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.modal-box .photo-slot .photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .65);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.modal-box .photo-slot .photo-remove:hover {
  background: #e5484d;
  transform: scale(1.08);
}
.modal-box .photo-slot .file-hint { font-size: 11.5px; line-height: 1.3; }

@media (max-width: 700px) {
  .modal-box .photo-slot.filled {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }
}

/* ===== RÉCEPTION : LECTURE AUTOMATIQUE DES BONS ===== */
.modal-box .photo-ocr {
  font-size: 11.5px;
  line-height: 1.35;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
  text-align: left;
}
.modal-box .photo-ocr[data-state="loading"] { animation: ocrPulse 1.4s ease-in-out infinite; }
.modal-box .photo-ocr[data-state="ok"] { background: rgba(46, 204, 113, .12); color: #7ee2a8; }
.modal-box .photo-ocr[data-state="info"] { background: rgba(108, 92, 231, .14); color: var(--text); }
.modal-box .photo-ocr[data-state="error"] { background: rgba(229, 72, 77, .14); color: #ff9a9d; }

@keyframes ocrPulse { 50% { opacity: .55; } }

.modal-box .ocr-filled {
  border-color: #2ecc71 !important;
  box-shadow: 0 0 0 3px rgba(46, 204, 113, .18) !important;
}

/* ===== RÉCEPTION : BL SUR PLUSIEURS PAGES ===== */
.modal-box .photo-slot .photo-preview {
  display: grid;
  gap: 6px;
}
.modal-box .photo-slot .photo-preview.multi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-box .photo-slot .photo-thumb { position: relative; min-width: 0; }
.modal-box .photo-slot .photo-preview.multi .photo-remove {
  width: 22px;
  height: 22px;
  top: 4px;
  right: 4px;
  font-size: 14px;
}
.modal-box .photo-slot .photo-page {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
}
.modal-box .photo-slot .photo-add-page {
  grid-column: 1 / -1;
  padding: 6px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  cursor: pointer;
}
.modal-box .photo-slot .photo-add-page:hover { background: rgba(255, 255, 255, .06); }

/* Téléphone : une case photo par ligne (la règle 3 colonnes ci-dessus est en !important) */
@media (max-width: 700px) {
  .modal-box.wide .photo-slots { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ===== CONTACTS FOURNISSEURS : ANNUAIRE (v. 18-11-2026) ===== */
.contacts-directory { display: flex; flex-direction: column; gap: 14px; }

.contact-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.contact-counters { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.contact-counters strong { color: var(--text); font-size: 15px; margin-right: 3px; }

.contact-filter {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2, var(--card));
  border: 1px solid var(--border);
  border-radius: 8px;
}
.contact-filter button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.contact-filter button:hover { color: var(--text); }
.contact-filter button.active {
  background: var(--surface, var(--bg2));
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.contact-filter-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--orange) 18%, transparent);
  color: var(--orange);
  font-size: 11px;
  text-align: center;
}

.contact-list {
  background: var(--surface, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  overflow: hidden;
}

.contact-letter {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 18px;
  background: var(--surface-2, var(--bg2));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
}
.contact-group:first-child .contact-letter { border-top: none; }

.contact-row {
  display: grid;
  grid-template-columns: 40px minmax(160px, 1.1fr) minmax(170px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.contact-group .contact-row:last-child { border-bottom: none; }
.contact-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.contact-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: hsl(var(--hue) 65% 55% / .16);
  color: hsl(var(--hue) 70% 68%);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
}
body.light .contact-avatar { color: hsl(var(--hue) 65% 36%); background: hsl(var(--hue) 70% 50% / .13); }

.contact-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contact-name strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-warn { font-size: 12px; color: var(--orange); }
.contact-ok { font-size: 12px; color: var(--muted); }

.contact-field { display: flex; align-items: center; gap: 6px; min-width: 0; }

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, var(--card));
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.contact-link:hover { border-color: var(--accent); color: var(--accent); }
.contact-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.contact-missing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  opacity: .8;
}

.contact-copy,
.contact-icon-btn {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.contact-copy { opacity: 0; }
.contact-row:hover .contact-copy,
.contact-copy:focus-visible { opacity: 1; }
.contact-copy:hover,
.contact-icon-btn:hover { background: var(--surface-2, var(--card)); border-color: var(--border); color: var(--text); }
.contact-icon-btn.danger:hover { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }

.contact-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* Petites icônes dessinées en CSS (couleur du texte) */
.ci {
  flex: none;
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}
.ci-phone { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z'/%3E%3C/svg%3E"); }
.ci-mail { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='m22 7-10 6L2 7'/%3E%3C/svg%3E"); }
.ci-copy { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E"); }
.ci-edit { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E"); }
.ci-trash { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3C/svg%3E"); }

/* Note épinglée : étiquette à la place de l'émoji */
.tag.tag-pinned {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
  font-weight: 600;
}

/* Écrans moyens : email sous le téléphone */
@media (max-width: 1100px) {
  .contact-row {
    grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1.3fr) auto;
    grid-template-areas: "av name phone actions" "av name email actions";
    row-gap: 6px;
  }
  .contact-avatar { grid-area: av; }
  .contact-name { grid-area: name; }
  .contact-field:nth-of-type(3) { grid-area: phone; }
  .contact-field:nth-of-type(4) { grid-area: email; }
  .contact-row > .contact-actions { grid-area: actions; }
}

/* Téléphone : carte compacte, boutons toujours visibles */
@media (max-width: 640px) {
  .contact-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-areas: "av name actions" "phone phone phone" "email email email";
    gap: 8px 12px;
    padding: 12px 14px;
  }
  .contact-avatar { width: 36px; height: 36px; font-size: 13px; }
  .contact-field .contact-link,
  .contact-field .contact-missing { flex: 1; }
  .contact-copy { opacity: 1; }
  .contact-counters { gap: 12px; }
}

/* ===== VÉRIF SUR PLAN : LISTE DES DOSSIERS (v. 18-11-2026) ===== */
.plan-list {
  background: var(--surface, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  overflow: hidden;
}

.plan-row {
  display: grid;
  grid-template-columns: 40px minmax(150px, 220px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.plan-row:last-child { border-bottom: none; }
.plan-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.plan-badge {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue) 14%, transparent);
  color: var(--blue);
}
.plan-badge .ci { width: 18px; height: 18px; }
.plan-row.is-empty .plan-badge {
  background: color-mix(in srgb, var(--orange) 14%, transparent);
  color: var(--orange);
}

.plan-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plan-id strong {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-count { font-size: 12px; color: var(--muted); }
.plan-warn { font-size: 12px; color: var(--orange); }

.plan-docs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }

.plan-doc {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, var(--card));
  overflow: hidden;
  transition: border-color .15s;
}
.plan-doc:hover { border-color: var(--accent); }

.plan-doc .plan-doc-open {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.plan-doc .plan-doc-open:hover { color: var(--accent); text-decoration: none; }
.plan-doc .ci-file { color: #e5484d; }
.plan-doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }

.plan-doc-del {
  align-self: stretch;
  width: 28px;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.plan-row:hover .plan-doc-del,
.plan-doc-del:focus-visible { opacity: 1; }
.plan-doc-del:hover { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.plan-doc-del .ci { width: 13px; height: 13px; }

.plan-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color .15s, color .15s;
}
.plan-add:hover { border-color: var(--accent); color: var(--text); }
.plan-add .ci { width: 13px; height: 13px; }

.ci-plan { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20V4l16 16z'/%3E%3Cpath d='M8 16v-4l4 4z'/%3E%3C/svg%3E"); }
.ci-file { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/%3E%3Cpath d='M14 3v6h6'/%3E%3C/svg%3E"); }
.ci-plus { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ci-x { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E"); }

/* Écrans moyens : documents sous le n° de plan */
@media (max-width: 900px) {
  .plan-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: "badge id actions" "docs docs docs";
    row-gap: 10px;
  }
  .plan-badge { grid-area: badge; }
  .plan-id { grid-area: id; }
  .plan-docs { grid-area: docs; }
  .plan-row > .contact-actions { grid-area: actions; }
  .plan-doc-del { opacity: 1; }
  .plan-doc-name { max-width: 200px; }
}

/* ===== BOUTONS D'ACTION DES NOTES : ICÔNES VERTES ===== */
:root { --icon-green: #16a34a; }
body:not(.light) { --icon-green: #22c55e; }

.act.act-icon {
  display: inline-grid;
  place-items: center;
  color: var(--icon-green);
}
.act.act-icon .ci { width: 16px; height: 16px; }
.act.act-icon:hover {
  background: color-mix(in srgb, var(--icon-green) 12%, transparent);
  border-color: color-mix(in srgb, var(--icon-green) 45%, transparent);
}
/* État actif (note épinglée / terminée) : bouton plein */
.act.act-icon.is-on {
  background: var(--icon-green);
  border-color: var(--icon-green);
  color: #fff;
}
/* Supprimer reste vert, mais passe au rouge au survol */
.act.act-icon[data-act="del"]:hover {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, transparent);
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
}

.ci-pin { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5'/%3E%3Cpath d='M9 10.8a2 2 0 0 1-1.1 1.8l-1.8.9A2 2 0 0 0 5 15.2V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.8a2 2 0 0 0-1.1-1.8l-1.8-.9a2 2 0 0 1-1.1-1.8V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z'/%3E%3C/svg%3E"); }
.ci-check { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }

/* Étiquette « Épinglée » assortie aux icônes vertes */
.tag.tag-pinned {
  background: color-mix(in srgb, var(--icon-green) 15%, transparent);
  border-color: color-mix(in srgb, var(--icon-green) 40%, transparent);
  color: var(--icon-green);
}

/* ===== TABLEAU DES RÉCEPTIONS : LIGNES ENTIÈRES ===== */
/* Fichiers en étiquettes courtes qui peuvent passer à la ligne */
#recBody .rec-row td:nth-child(8) { white-space: normal; min-width: 130px; max-width: 220px; }
#recBody .file-chips { display: flex; flex-wrap: wrap; gap: 4px; }
#recBody .rec-file {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2, var(--card));
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
#recBody .rec-file:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
#recBody .rec-file-bl { border-left: 3px solid var(--blue); }
#recBody .rec-file-br { border-left: 3px solid #8b5cf6; }
#recBody .rec-file-marchandise { border-left: 3px solid var(--orange); }

/* Plusieurs codes article : retour à la ligne au lieu d'élargir le tableau */
#recBody .rec-row td:nth-child(5) { white-space: normal; max-width: 180px; word-spacing: -1px; }

/* Sécurité : si le tableau devient plus large que l'écran, la colonne
   des boutons (modifier / supprimer) reste collée à droite et visible,
   et la barre de défilement horizontale reste accessible. */
#view-receptions .table-card { overflow-x: auto; }
#view-receptions .table th:last-child,
#recBody .rec-row td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface, var(--bg2));
  box-shadow: -8px 0 12px -10px rgba(0, 0, 0, .45);
}
#view-receptions .table th:last-child { background: var(--surface-2, var(--bg2)); z-index: 3; }

/* =========================================================
   RÉCEPTIONS : LISTE EN GRILLE (remplace le tableau)
   Tout tient dans la largeur de l'écran, sans défilement
   horizontal, quel que soit le navigateur.
   ========================================================= */
.rec-list {
  --rec-cols: 64px minmax(130px, 1.3fr) minmax(150px, 1.5fr) 64px 118px minmax(130px, 1.2fr) 80px;
  background: var(--surface, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  overflow: hidden;
}
.rec-list.no-actions { --rec-cols: 64px minmax(130px, 1.3fr) minmax(150px, 1.5fr) 64px 118px minmax(130px, 1.2fr); }

.rec-head,
.rec-row {
  display: grid;
  grid-template-columns: var(--rec-cols);
  align-items: center;
  gap: 14px;
  padding: 0 18px;
}

.rec-head {
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--surface-2, var(--bg2));
  border-bottom: 2px solid var(--border-strong, var(--border));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.rec-list.no-actions .rec-head span:last-child { display: none; }

.rec-row {
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.rec-row:nth-of-type(4n+1) { background: color-mix(in srgb, var(--surface-2, var(--card)) 45%, transparent); }
.rec-row:hover { background: color-mix(in srgb, var(--accent) 7%, var(--surface, transparent)); }

.rec-c { min-width: 0; display: flex; flex-direction: column; gap: 3px; }

/* Date : jour en grand */
.rec-date strong {
  font-family: var(--font-display, inherit);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.rec-date span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* Fournisseur + CF */
.rec-supplier { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-cf {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* BL + codes article */
.rec-ref em {
  display: inline-block;
  min-width: 32px;
  font-style: normal;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.rec-bl { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-codes { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: 13px; }
.rec-codes em { min-width: 26px; }
.rec-code { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Colis */
.rec-colis { align-items: center; text-align: center; }
.rec-colis strong { font-size: 18px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.rec-colis span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Statut */
.rec-status { flex-direction: row; align-items: center; gap: 8px; }
.rec-has-comment { width: 16px; height: 16px; color: var(--muted); }
.ci-comment { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E"); }

/* Fichiers */
.rec-files { flex-direction: row; flex-wrap: wrap; gap: 4px; }
#recBody .rec-file {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2, var(--card));
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.rec-none { color: var(--muted); }

/* Actions */
.rec-actions-cell { flex-direction: row; justify-content: flex-end; gap: 4px; }

/* Commentaire déplié */
.rec-detail {
  padding: 10px 18px 12px 96px;
  background: var(--surface-2, var(--card));
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.rec-body > .empty { padding: 28px; }

/* ---------- Écran moyen / tablette / téléphone : carte compacte ---------- */
@media (max-width: 1080px) {
  .rec-head { display: none; }

  .rec-row {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-areas:
      "date main   status"
      "date ref    colis"
      "files files actions";
    gap: 6px 14px;
    padding: 12px 16px;
  }
  .rec-list.no-actions .rec-row { grid-template-areas: "date main status" "date ref colis" "files files files"; }

  .rec-date { grid-area: date; align-self: start; }
  .rec-main { grid-area: main; }
  .rec-ref { grid-area: ref; }
  .rec-status { grid-area: status; justify-content: flex-end; }
  .rec-colis { grid-area: colis; flex-direction: row; gap: 4px; justify-content: flex-end; align-items: baseline; }
  .rec-colis strong { font-size: 15px; }
  .rec-files { grid-area: files; padding-top: 4px; }
  .rec-actions-cell { grid-area: actions; align-self: end; }
  .rec-detail { padding-left: 16px; }
}

/* ===== RÉCEPTIONS : PLUSIEURS CF / BL / CODES ARTICLE ===== */
.rec-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 4px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.rec-line em { flex: none; }

.rec-chip {
  display: inline-block;
  max-width: 100%;
  padding: 0 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--surface-2, var(--card)) 80%, transparent);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-chip-cf {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}
.rec-chip-bl { font-weight: 600; font-size: 13px; }
.rec-cfs { margin-top: 1px; }

.rec-more {
  flex: none;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  cursor: help;
}

/* Détail déplié : listes complètes + commentaire */
.rec-detail { display: flex; flex-direction: column; gap: 10px; }
.rec-detail[hidden] { display: none; }
.rec-detail-lists { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.rec-detail-lists > div { min-width: 0; }
.rec-detail-label {
  display: block;
  margin-bottom: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.rec-detail-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.rec-detail-chips .rec-chip { background: var(--surface, var(--bg2)); border: 1px solid var(--border); }

/* ===== BOUTON « HAUT DE PAGE » (style du site) ===== */
#backToTopBtn {
  bottom: calc(84px + env(safe-area-inset-bottom)); /* au-dessus du badge Netlify */
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-sm, 8px);
  background: var(--surface, var(--bg2));
  border: 1px solid var(--border-strong, var(--border));
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  box-shadow: var(--shadow, 0 6px 20px rgba(0, 0, 0, .3));
}
#backToTopBtn .btt-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: calc(var(--radius-sm, 8px) - 1px);
  background: var(--accent);
  color: #fff;
  transition: transform .2s ease;
}
#backToTopBtn .btt-icon .ci { width: 16px; height: 16px; }
#backToTopBtn:hover {
  transform: none;
  border-color: var(--accent);
  box-shadow: var(--shadow, 0 6px 20px rgba(0, 0, 0, .3));
}
#backToTopBtn:hover .btt-icon { transform: translateY(-2px); }
#backToTopBtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring, rgba(0, 184, 46, .35)); }

.ci-arrow-up { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E"); }

/* Téléphone : icône seule, carré arrondi */
@media (max-width: 700px) {
  #backToTopBtn { bottom: calc(80px + env(safe-area-inset-bottom)); padding: 5px; border-radius: var(--radius-sm, 8px); }
  #backToTopBtn .btt-icon { display: grid; width: 36px; height: 36px; }
  #backToTopBtn .btt-label { display: none; }
}
@media (max-width: 700px) {
  #backToTopBtn .btt-icon .ci { display: block; width: 18px; height: 18px; }
}

/* ===== BOUTON « THÈME » : MENU UNIQUE ===== */
body.has-theme-menu #themeSwitch,
body.has-theme-menu #themeToggle { display: none !important; }

.theme-menu { position: relative; margin-left: auto; flex: none; }

.theme-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm, 8px);
  background: var(--surface, var(--card));
  border: 1px solid var(--border-strong, var(--border));
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s, background .15s;
}
.theme-menu-btn:hover,
.theme-menu-btn[aria-expanded="true"] { border-color: var(--accent); }
.theme-menu-btn .ci-palette { width: 17px; height: 17px; color: var(--accent); }
.theme-menu-btn .ci-chevron { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; }
.theme-menu-btn[aria-expanded="true"] .ci-chevron { transform: rotate(180deg); }

.theme-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: 210px;
  padding: 6px;
  border-radius: var(--radius, 10px);
  background: var(--bg2);
  border: 1px solid var(--border-strong, var(--border));
  box-shadow: var(--shadow-lg, 0 18px 40px rgba(0, 0, 0, .45));
}
.theme-menu-panel[hidden] { display: none; }

.theme-menu-title {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.theme-menu-title:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 10px; }

.theme-menu-panel > button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
}
.theme-menu-panel > button:hover { background: var(--surface-2, var(--card)); }
.theme-menu-panel > button .ci { width: 16px; height: 16px; color: var(--muted); }
.theme-menu-panel .theme-emoji { width: 16px; text-align: center; font-size: 14px; line-height: 1; }
.theme-menu-panel .theme-tick { margin-left: auto; color: var(--accent); visibility: hidden; }
.theme-menu-panel > button[aria-checked="true"] { font-weight: 700; }
.theme-menu-panel > button[aria-checked="true"] .theme-tick { visibility: visible; }

.ci-palette { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='13.5' cy='6.5' r='1.2'/%3E%3Ccircle cx='17.5' cy='10.5' r='1.2'/%3E%3Ccircle cx='8.5' cy='7.5' r='1.2'/%3E%3Ccircle cx='6.5' cy='12.5' r='1.2'/%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.9 0 1.6-.7 1.6-1.7 0-.4-.2-.8-.4-1.1-.3-.3-.4-.7-.4-1.1 0-.9.7-1.7 1.7-1.7h2c3 0 5.5-2.5 5.5-5.5C22 6 17.5 2 12 2z'/%3E%3C/svg%3E"); }
.ci-chevron { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.ci-sun { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }
.ci-moon { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z'/%3E%3C/svg%3E"); }
.ci-circle { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E"); }

@media (max-width: 860px) {
  .theme-menu { margin-left: 0; }
  .theme-menu-label { display: none; }
  .theme-menu-btn { padding: 0 10px; }
}

/* ===== NOTES : TABLEAU D'AFFICHAGE ===== */
.notes-board { display: flex; flex-direction: column; gap: 18px; }

.notes-count-high strong { color: var(--red); }

.notes-section { display: flex; flex-direction: column; gap: 10px; }
.notes-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.notes-section-title span {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2, var(--card));
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0;
}
.notes-done > summary { cursor: pointer; list-style: none; user-select: none; }
.notes-done > summary::-webkit-details-marker { display: none; }
.notes-done > summary::before {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s;
  margin-right: 2px;
}
.notes-done[open] > summary::before { transform: rotate(45deg); }
.notes-done[open] > summary { margin-bottom: 10px; }

/* Colonnes « maçonnerie » : chaque carte garde sa hauteur */
.notes-masonry { columns: 300px; column-gap: 14px; }

.note-card {
  break-inside: avoid;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
  padding: 14px 16px 12px;
  background: var(--surface, var(--card));
  border: 1px solid var(--border);
  border-top: 3px solid var(--border-strong, var(--border));
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow-sm, none);
  transition: border-color .15s, box-shadow .15s;
}
.note-card:hover { box-shadow: var(--shadow, 0 6px 16px rgba(0, 0, 0, .25)); }
.note-card.prio-high { border-top-color: var(--red); }
.note-card.prio-mid { border-top-color: var(--orange); }
.note-card.prio-low { border-top-color: var(--green); }
.note-card.is-done { opacity: .62; }
.note-card.is-done .note-card-title { text-decoration: line-through; }

.note-card-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.note-prio,
.note-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
}
.note-prio::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.prio-high .note-prio { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.prio-mid .note-prio { color: var(--orange); background: color-mix(in srgb, var(--orange) 13%, transparent); }
.prio-low .note-prio { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.prio-none .note-prio { color: var(--muted); background: var(--surface-2, var(--card)); }
.note-cat { background: var(--surface-2, var(--card)); border: 1px solid var(--border); color: var(--text); font-weight: 600; }
.note-pin { margin-left: auto; width: 15px; height: 15px; color: var(--icon-green, #22c55e); }

.note-card-title { margin: 2px 0 0; font-size: 15.5px; font-weight: 700; line-height: 1.3; word-break: break-word; }
.note-card-text {
  margin: 0;
  color: color-mix(in srgb, var(--text) 82%, var(--muted));
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-card-files { display: flex; flex-wrap: wrap; gap: 5px; }
.note-card .note-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2, var(--card));
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
}
.note-card .note-file:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.note-card .note-file .ci-file { color: var(--blue); width: 14px; height: 14px; }
.note-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.note-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.note-date { font-size: 12px; color: var(--muted); }
.note-card-actions { display: flex; gap: 4px; margin-left: auto; }
.note-card-actions .act { width: 30px; height: 30px; }

@media (max-width: 700px) {
  .notes-masonry { columns: 1; }
}

/* ===== NON-CONFORMITÉS (NC) ===== */
.ci-camera { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E"); }
.ci-image { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='m21 15-5-5L5 21'/%3E%3C/svg%3E"); }

.nc-toolbar { margin-bottom: 16px; }
.nc-counters { display: flex; flex-wrap: wrap; gap: 8px; }
.nc-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface, var(--card));
  color: var(--muted);
  font-size: 12.5px;
}
.nc-counter strong { color: var(--text); font-size: 15px; }
.nc-counter-q { border-color: var(--accent); }

.nc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  align-items: start;
}
.nc-list > .empty { grid-column: 1 / -1; }

.nc-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px 16px 12px;
  background: var(--surface, var(--card));
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange, #f59e0b);
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow-sm, none);
  transition: box-shadow .15s;
}
.nc-card:hover { box-shadow: var(--shadow, 0 6px 16px rgba(0, 0, 0, .25)); }

.nc-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.nc-card-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nc-number {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: var(--radius-sm, 6px);
  background: color-mix(in srgb, var(--orange, #f59e0b) 14%, transparent);
  color: var(--orange, #f59e0b);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.nc-supplier { font-size: 16px; line-height: 1.25; word-break: break-word; }
.nc-date { flex: none; color: var(--muted); font-size: 12.5px; white-space: nowrap; padding-top: 2px; }

.nc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nc-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 7px 10px;
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-2, var(--bg2));
}
.nc-field-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.nc-field-value { font-size: 13.5px; font-weight: 600; word-break: break-word; font-variant-numeric: tabular-nums; }

.nc-desc { display: flex; flex-direction: column; gap: 4px; }
.nc-desc p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: color-mix(in srgb, var(--text) 85%, var(--muted));
}

.nc-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.nc-thumb {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-2, var(--bg2));
  cursor: zoom-in;
}
.nc-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.nc-thumb:hover img { transform: scale(1.05); }
.nc-thumb-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.nc-no-photo {
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm, 8px);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.nc-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.nc-photo-count { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.nc-card-actions { display: flex; gap: 4px; margin-left: auto; }
.nc-card-actions .act { width: 30px; height: 30px; }

/* Formulaire NC */
.modal-box.nc-modal { width: min(640px, 100%); }
.nc-photo-field { display: flex; flex-direction: column; gap: 8px; }
.nc-photo-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.nc-photo-field-head .muted { font-weight: 400; font-size: 12px; }
.nc-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.nc-photo-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-2, var(--bg2));
}
.nc-photo-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nc-photo-tile.is-new { border-color: var(--accent); }
.nc-photo-new {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}
.nc-photo-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  cursor: pointer;
}
.nc-photo-remove:hover { background: var(--red, #dc2626); }
.nc-photo-remove .ci { width: 13px; height: 13px; }
.nc-photo-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1;
  padding: 8px;
  border: 1.5px dashed var(--border-strong, var(--border));
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.nc-photo-add:hover { border-color: var(--accent); color: var(--accent); }
.nc-photo-add .ci { width: 22px; height: 22px; }
/* La prise de photo directe ne sert que sur téléphone / tablette */
@media (hover: hover) and (pointer: fine) {
  .nc-photo-camera { display: none; }
}

@media (max-width: 700px) {
  .nc-list { grid-template-columns: 1fr; }
  .nc-photo-grid { grid-template-columns: repeat(3, 1fr); }
}
.nc-field-value { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.nc-val { white-space: nowrap; }
.nc-number.is-empty { background: var(--surface-2, var(--bg2)); color: var(--muted); }
@media (max-width: 700px) {
  .nc-photos { grid-template-columns: repeat(4, 1fr); }
  .nc-card { padding: 12px 12px 10px; }
}

/* ===== LECTURE IA DES BONS (formulaire réception) ===== */
.modal-box .photo-ai {
  margin: 10px 0 4px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, rgba(255, 255, 255, .05));
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
}
.modal-box .photo-ai[data-state="loading"] { color: var(--muted); animation: ocrPulse 1.4s ease-in-out infinite; }
.modal-box .photo-ai[data-state="ok"] { border-color: rgba(46, 204, 113, .45); background: rgba(46, 204, 113, .1); }
.modal-box .photo-ai[data-state="warn"] { border-color: rgba(245, 158, 11, .55); background: rgba(245, 158, 11, .1); }
.modal-box .photo-ai[data-state="info"] { color: var(--muted); }
.modal-box .photo-ai strong { color: var(--text); }

/* Case à cocher dans les Paramètres */
.field.field-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.field.field-check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.field.field-check span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text); font-size: 13.5px; }
.modal-box .photo-ai .photo-ai-hint { color: var(--muted); font-size: 11.5px; }

/* ===== PATCHNOTES & NOTIFICATIONS ===== */
.patch-btn,
.notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  flex: none;
  border-radius: var(--radius-sm, 8px);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.patch-btn {
  padding: 0 13px 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 30%, var(--surface, #1b2129)), var(--surface, #1b2129));
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
}
.patch-btn svg { width: 19px; height: 19px; color: #f2c14e; }
.patch-btn:hover { border-color: var(--accent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.patch-btn:active, .notif-btn:active { transform: scale(.97); }

.notif-wrap { position: relative; flex: none; }
.notif-btn {
  width: 40px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface, var(--card));
  color: var(--text);
}
.notif-btn svg { width: 20px; height: 20px; }
.notif-btn:hover { border-color: var(--border-strong, var(--border)); }
.notif-btn.has-unread svg { color: #f2c14e; animation: notifRing 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes notifRing {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); }
  85% { transform: rotate(8deg); } 90% { transform: rotate(-5deg); }
}
.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  border: 2px solid var(--bg, #12161b);
  background: var(--red, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 95;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 480px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius, 10px);
  background: var(--surface, var(--card));
  box-shadow: var(--shadow-lg, 0 20px 50px rgba(0, 0, 0, .45));
}
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.notif-readall {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.notif-list { overflow-y: auto; padding: 6px; }
.notif-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.notif-item:hover { background: var(--surface-2, var(--bg2)); }
.notif-item.is-unread { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.notif-item-ico,
.notif-banner-ico,
.patch-view-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 55%, #000), color-mix(in srgb, var(--accent) 25%, var(--surface, #1b2129)));
  color: #f2c14e;
}
.notif-item-ico svg, .notif-banner-ico svg { width: 18px; height: 18px; }
.notif-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.notif-item-kind { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.notif-item.is-unread .notif-item-kind { color: var(--accent); }
.notif-item-text strong { font-size: 13.5px; word-break: break-word; }
.notif-item-date { font-size: 12px; color: var(--muted); }
.notif-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.notif-empty { padding: 18px 12px; color: var(--muted); font-size: 13px; text-align: center; }

/* Bandeau en haut des pages */
.notif-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -6px 0 18px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius, 10px);
  background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 18%, var(--surface, #1b2129)), var(--surface, #1b2129) 70%);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  animation: bannerIn .35s ease-out;
}
.notif-banner:hover { border-color: var(--accent); }
.notif-banner-ico { width: 30px; height: 30px; }
.notif-banner-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-banner-cta { flex: none; padding: 4px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700; }
.notif-banner-close { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); font-size: 18px; line-height: 1; }
.notif-banner-close:hover { background: var(--surface-2, var(--bg2)); color: var(--text); }
@keyframes bannerIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Fenêtre patchnote */
.modal-box.patch-modal { width: min(620px, 100%); }
.patch-hint { margin: 0; color: var(--muted); font-size: 12.5px; }
.patch-published { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.patch-published h4 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.patch-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.patch-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.patch-row-main:hover { background: var(--surface-2, var(--bg2)); }
.patch-row-main span { color: var(--muted); font-size: 12px; }
.patch-row .act { width: 30px; height: 30px; }

.patch-view-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.patch-view-ico { width: 46px; height: 46px; border-radius: 12px; }
.patch-view-ico svg { width: 24px; height: 24px; }
.patch-view-head h3 { margin: 0; font-size: 19px; line-height: 1.25; }
.patch-view-date { color: var(--muted); font-size: 13px; }
.patch-view-body {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  background: var(--surface-2, var(--bg2));
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.patch-view-body p { margin: 0 0 8px; }
.patch-view-body p:last-child { margin-bottom: 0; }
.patch-view-body ul { margin: 0 0 8px; padding-left: 20px; }
.patch-view-body li { margin: 3px 0; }

@media (max-width: 860px) {
  .patch-btn { padding: 0 10px; }
  .patch-btn span { display: none; }
  .notif-banner { margin: -4px 0 14px; font-size: 13px; }
}
/* ===== CRÉATION DE COMPTE (owner) ===== */
.accounts-card { margin-top: 18px; }
.accounts-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.accounts-head h3 { margin: 0 0 4px; }
.accounts-head .muted { margin: 0; font-size: 13px; }
.accounts-form { display: flex; flex-direction: column; gap: 16px; }
.accounts-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.accounts-fields .field { margin: 0; }
.accounts-label { display: block; margin-bottom: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.pwd-wrap { display: flex; gap: 6px; }
.pwd-wrap input { flex: 1; min-width: 0; }
.pwd-btn {
  flex: none;
  width: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-2, var(--bg2));
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
}
.pwd-btn:hover { border-color: var(--accent); }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-2, var(--bg2));
  font-size: 13.5px;
  cursor: pointer;
}
.seg label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.seg input { accent-color: var(--accent); margin: 0; }

.accounts-perms-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.accounts-perms-head .accounts-label { margin: 0; }
.perm-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius, 10px); }
.perm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.perm-table th, .perm-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: center; }
.perm-table thead th { background: var(--surface-2, var(--bg2)); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.perm-table tbody tr:last-child th, .perm-table tbody tr:last-child td { border-bottom: none; }
.perm-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.perm-table th[scope="row"] { text-align: left; font-weight: 600; white-space: nowrap; }
.perm-row-toggle { padding: 0; border: none; background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.perm-row-toggle:hover { color: var(--accent); }
.perm-cell { display: inline-grid; place-items: center; cursor: pointer; }
.perm-cell input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.perm-na { color: var(--muted); opacity: .5; }
.accounts-hint { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }
.accounts-submit { display: flex; justify-content: flex-end; }

.accounts-list { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.accounts-list h4 { margin: 0 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.acc-group { margin-bottom: 14px; }
.acc-group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 700; font-size: 14px; }
.acc-group-title span { padding: 1px 8px; border-radius: 999px; background: var(--surface-2, var(--bg2)); color: var(--muted); font-size: 11.5px; }
.acc-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px; border-radius: 8px; }
.acc-row:hover { background: var(--surface-2, var(--bg2)); }
.acc-avatar { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--accent) 22%, var(--surface-2, #222)); color: var(--text); font-weight: 800; }
.acc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-top strong { font-size: 14px; word-break: break-all; }
.acc-role { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; background: var(--surface-2, var(--bg2)); border: 1px solid var(--border); color: var(--muted); }
.acc-role-owner { background: color-mix(in srgb, #f2c14e 18%, transparent); border-color: rgba(242, 193, 78, .5); color: #f2c14e; }
.acc-role-admin { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.acc-email, .acc-last { color: var(--muted); font-size: 12px; word-break: break-all; }
.acc-perms { font-size: 12.5px; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.acc-actions { display: flex; gap: 4px; flex: none; }
.acc-actions .act { width: 30px; height: 30px; }

@media (max-width: 700px) {
  .accounts-fields { grid-template-columns: 1fr; }
  .perm-table th, .perm-table td { padding: 7px 6px; }
  .perm-table thead th { font-size: 10px; letter-spacing: .02em; }
}
/* ===== Verrouillage du site (page de connexion) ===== */
.site-lock{margin:0 0 22px;padding:22px 22px 20px;border-radius:16px;text-align:center;
  background:linear-gradient(160deg,rgba(217,58,72,.16),rgba(217,58,72,.06));
  border:2px solid rgba(217,58,72,.55);box-shadow:0 10px 30px rgba(217,58,72,.18)}
.site-lock[hidden]{display:none}
.site-lock-icon{font-size:40px;line-height:1;margin-bottom:8px}
.site-lock-title{display:block;font-size:22px;font-weight:800;letter-spacing:.3px;color:#ff6b78;margin-bottom:10px;text-transform:uppercase}
.site-lock-text{margin:0;font-size:17px;line-height:1.55;font-weight:600;color:inherit}
@media (max-width:520px){.site-lock{padding:18px 16px}.site-lock-title{font-size:19px}.site-lock-text{font-size:15.5px}}