@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/admin/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/admin/fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/admin/fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/admin/fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/admin/fonts/inter-800.woff2") format("woff2");
}

:root {
  --marine-950: #071426;
  --marine-900: #0b1f33;
  --marine-800: #12293f;
  --marine-700: #1c3a54;
  --marine-600: #2a5074;
  --marine-100: #eaf1f8;

  --gris-900: #171b20;
  --gris-700: #454c54;
  --gris-500: #6b7480;
  --gris-400: #9aa3ac;
  --gris-300: #d8dee3;
  --gris-200: #e8ecf0;
  --gris-100: #f4f6f8;
  --blanc: #ffffff;

  --vert: #00ed00;
  --vert-vif: #00d600;
  --vert-fonce: #00a800;
  --vert-encre: #05330a;
  --vert-texte: #0a7d1e;
  --vert-100: #e3fbe3;
  --vert-50: #f1fdf1;

  --orange: #b45f06;
  --orange-100: #fdf0e0;
  --rouge: #c22a1f;
  --rouge-100: #fbe9e8;
  --violet: #6d28d9;
  --violet-100: #efe7fc;
  --cyan: #0e7490;
  --cyan-100: #e0f4f8;
  --jaune: #92720a;
  --jaune-100: #fdf6d8;

  --rayon-sm: 8px;
  --rayon: 12px;
  --rayon-lg: 18px;

  --ombre-sm: 0 1px 2px rgba(11, 31, 51, 0.06), 0 1px 1px rgba(11, 31, 51, 0.04);
  --ombre-md: 0 6px 16px -4px rgba(11, 31, 51, 0.12), 0 2px 6px -2px rgba(11, 31, 51, 0.08);
  --ombre-lg: 0 20px 40px -12px rgba(11, 31, 51, 0.22), 0 8px 16px -8px rgba(11, 31, 51, 0.12);
  --ombre-vert: 0 6px 16px -4px rgba(0, 200, 0, 0.4);

  --ressort: cubic-bezier(0.34, 1.56, 0.64, 1);
  --douceur: cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--gris-900);
  background: var(--gris-100);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--vert-texte); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--marine-900); font-weight: 800; letter-spacing: -0.015em; }

.icone-svg { width: 1em; height: 1em; flex-shrink: 0; }

.mise-en-page {
  display: flex;
  height: 100vh;
}

/* --- Barre laterale (fixe : ne defile pas avec le contenu) --- */
.barre-laterale {
  width: 250px;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  background: linear-gradient(190deg, var(--marine-950), var(--marine-800) 85%);
  color: var(--blanc);
  display: flex;
  flex-direction: column;
  padding: 22px 0;
}
.barre-laterale .logo {
  font-weight: 700;
  font-size: .82rem;
  padding: 0 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 14px;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.barre-laterale .logo .logo-image { width: 100%; max-width: 170px; height: auto; }
.barre-laterale .logo span { color: rgba(255,255,255,.65); }
.barre-laterale nav { padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.barre-laterale nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  padding: 10px 12px;
  font-size: .89rem;
  font-weight: 600;
  border-radius: var(--rayon-sm);
  transition: background .16s var(--douceur), color .16s var(--douceur);
}
.barre-laterale nav a .icone-svg { width: 18px; height: 18px; opacity: .85; flex-shrink: 0; }
.barre-laterale nav a:hover { background: rgba(255,255,255,.06); color: var(--blanc); text-decoration: none; }
.barre-laterale nav a.actif { background: var(--vert); color: var(--vert-encre); box-shadow: var(--ombre-vert); }
.barre-laterale nav a.actif .icone-svg { opacity: 1; }
.barre-laterale .bas {
  margin-top: auto;
  padding: 16px 22px 0;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .82rem;
  color: rgba(255,255,255,.55);
}
.barre-laterale .bas > div:first-child { color: var(--blanc); font-weight: 700; font-size: .88rem; }
.barre-laterale .bas button { margin-top: 8px; width: 100%; justify-content: center; }
.barre-laterale .bas button.lien-discret {
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  width: auto;
  justify-content: flex-start;
  gap: 6px;
  margin-top: 10px;
  padding: 0;
  font-size: .78rem;
  font-weight: 500;
  color: rgba(255,255,255,.5);
}
.barre-laterale .bas button.lien-discret:hover {
  background: none;
  color: rgba(255,255,255,.85);
  text-decoration: underline;
  transform: none;
  filter: none;
}
.barre-laterale .bas button.lien-discret .icone-svg { width: 13px; height: 13px; opacity: .7; }

/* --- Contenu principal --- */
.contenu {
  flex: 1;
  padding: 32px 40px;
  height: 100vh;
  overflow-y: auto;
}
.entete-page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.entete-page h1 { font-size: 1.5rem; margin: 0; }
.entete-page p.sous-titre { margin: 5px 0 0; color: var(--gris-700); font-size: .9rem; }

/* --- Cartes --- */
.carte {
  background: var(--blanc);
  border: 1px solid var(--gris-200);
  border-radius: var(--rayon-lg);
  box-shadow: var(--ombre-sm);
  padding: 24px;
  margin-bottom: 22px;
}
.carte h2, .carte h3 { display: flex; align-items: center; gap: 9px; font-size: 1rem; margin: 0 0 16px; }
.carte h2 .icone-svg, .carte h3 .icone-svg { color: var(--vert-texte); width: 19px; height: 19px; }

.grille-cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

/* Bouton "Plus de filtres" (dashboard.html) : uniquement visible sur mobile, voir le media query. */
#bouton-plus-filtres { display: none; }
.stat-tuile {
  background: var(--blanc);
  border: 1px solid var(--gris-200);
  border-radius: var(--rayon-lg);
  box-shadow: var(--ombre-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform .18s var(--ressort), box-shadow .18s var(--douceur);
}
.stat-tuile:hover { transform: translateY(-2px); box-shadow: var(--ombre-md); }
.stat-tuile .icone-tuile {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--vert-100), var(--vert-50));
  color: var(--vert-encre);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-tuile .icone-tuile .icone-svg { width: 19px; height: 19px; }
.stat-tuile .valeur { font-size: 1.85rem; font-weight: 800; color: var(--marine-900); letter-spacing: -0.02em; }
.stat-tuile .label { color: var(--gris-700); font-size: .85rem; margin-top: 2px; }

/* --- Formulaires --- */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 5px; color: var(--gris-700); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gris-300);
  border-radius: var(--rayon-sm);
  font-size: .92rem;
  background: var(--blanc);
  color: var(--gris-900);
  font-family: inherit;
  transition: border-color .15s var(--douceur), box-shadow .15s var(--douceur);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--vert-fonce);
  box-shadow: 0 0 0 4px rgba(0, 237, 0, 0.14);
}

input[type=file] {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px dashed var(--gris-300);
  border-radius: var(--rayon-sm);
  background: var(--gris-100);
  font-size: .85rem;
  color: var(--gris-700);
  cursor: pointer;
  transition: border-color .15s var(--douceur), background .15s var(--douceur);
}
input[type=file]:hover { border-color: var(--vert-fonce); background: var(--vert-50); }
input[type=file]:focus-visible { outline: none; border-color: var(--vert-fonce); box-shadow: 0 0 0 4px rgba(0, 237, 0, 0.14); }
input[type=file]::file-selector-button {
  margin-right: 12px;
  padding: 8px 16px;
  border: none;
  border-radius: 100px;
  background: linear-gradient(155deg, var(--vert-vif), var(--vert-fonce));
  color: var(--vert-encre);
  font-weight: 700;
  font-size: .82rem;
  font-family: inherit;
  cursor: pointer;
  transition: filter .15s var(--douceur);
}
input[type=file]::file-selector-button:hover { filter: brightness(1.05); }

.champ { margin-bottom: 14px; }
.ligne-champs { display: flex; gap: 14px; flex-wrap: wrap; }
.ligne-champs > .champ { flex: 1; min-width: 160px; }
fieldset { border: 1.5px solid var(--gris-200); border-radius: var(--rayon-sm); padding: 12px 14px; margin-bottom: 14px; }
legend { font-weight: 700; font-size: .85rem; padding: 0 6px; color: var(--marine-900); }
.case-check { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 400; }
.case-check input { width: auto; accent-color: var(--vert-fonce); }

/* --- Boutons --- */
button, .bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  border-radius: 100px;
  padding: 9px 18px;
  font-size: .87rem;
  font-weight: 700;
  font-family: inherit;
  white-space: nowrap;
  background: linear-gradient(155deg, var(--vert-vif), var(--vert-fonce));
  color: var(--vert-encre);
  box-shadow: var(--ombre-vert);
  transition: transform .15s var(--ressort), filter .15s var(--douceur);
}
button .icone-svg { width: 15px; height: 15px; }
button:hover { transform: translateY(-1px); filter: brightness(1.04); }
button:active { transform: translateY(0); }
button:focus-visible { outline: 3px solid rgba(0,237,0,.5); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button.secondaire { background: var(--blanc); color: var(--marine-900); border: 1.5px solid var(--gris-300); box-shadow: none; }
button.secondaire:hover { background: var(--gris-100); filter: none; }
button.discret { background: transparent; color: var(--gris-700); border: none; padding: 6px 9px; box-shadow: none; font-weight: 600; }
button.discret:hover { background: var(--gris-200); transform: none; }
button.danger { background: linear-gradient(155deg, #e0453a, var(--rouge)); color: var(--blanc); box-shadow: 0 6px 16px -4px rgba(194,42,31,.4); }
button.danger:hover { filter: brightness(1.06); }
.barre-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
td .barre-actions { flex-wrap: nowrap; }

/* --- Tableaux --- */
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--gris-200); }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gris-500); background: var(--gris-100); font-weight: 700; }
th:first-child { border-top-left-radius: var(--rayon-sm); }
th:last-child { border-top-right-radius: var(--rayon-sm); }
tbody tr { transition: background .12s var(--douceur); }
tbody tr:hover { background: var(--vert-50); }
tr.non-pris-en-charge { background: var(--orange-100); }
tr.non-pris-en-charge:hover { background: #fbe4c4; }

/* --- Badges --- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 100px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-gris { background: var(--gris-200); color: var(--gris-700); }
.badge-bleu { background: var(--marine-100); color: var(--marine-700); }
.badge-vert { background: var(--vert-100); color: var(--vert-texte); }
.badge-orange { background: var(--orange-100); color: var(--orange); }
.badge-rouge { background: var(--rouge-100); color: var(--rouge); }
.badge-violet { background: var(--violet-100); color: var(--violet); }
.badge-cyan { background: var(--cyan-100); color: var(--cyan); }
.badge-jaune { background: var(--jaune-100); color: var(--jaune); }

/* --- Alertes --- */
.alerte { padding: 13px 15px; border-radius: var(--rayon-sm); font-size: .88rem; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 9px; }
.alerte .icone-svg { flex-shrink: 0; margin-top: 1px; width: 17px; height: 17px; }
.alerte-erreur { background: var(--rouge-100); color: var(--rouge); border: 1px solid #f2cbc7; }
.alerte-succes { background: var(--vert-100); color: var(--vert-encre); border: 1px solid #b9edb9; }
.alerte-info { background: var(--marine-100); color: var(--marine-700); border: 1px solid #d3e2ef; }
.alerte-warning { background: var(--orange-100); color: var(--orange); border: 1px solid #f0d7b0; }

#zone-toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
#zone-toasts .toast {
  margin-bottom: 0;
  box-shadow: var(--ombre-md, 0 10px 25px -8px rgba(0,0,0,.25));
  animation: toast-entree .2s var(--ressort);
  pointer-events: auto;
}
#zone-toasts .toast.disparait { animation: toast-sortie .25s ease forwards; }
@keyframes toast-entree { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-sortie { to { opacity: 0; transform: translateY(8px); } }

/* --- Onglets --- */
.onglets { display: flex; gap: 2px; border-bottom: 1.5px solid var(--gris-200); margin-bottom: 20px; flex-wrap: wrap; }
.onglets button {
  background: transparent;
  color: var(--gris-700);
  border: none;
  border-bottom: 2.5px solid transparent;
  border-radius: var(--rayon-sm) var(--rayon-sm) 0 0;
  padding: 11px 16px;
  box-shadow: none;
  font-weight: 600;
}
.onglets button.actif { color: var(--vert-texte); border-bottom-color: var(--vert-fonce); background: var(--vert-50); }
.onglets button:hover { background: var(--gris-100); transform: none; filter: none; }
.onglets button.a-des-nouveautes { position: relative; }
.onglets button.a-des-nouveautes::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rouge);
  box-shadow: 0 0 0 2px var(--blanc);
  animation: pulsation 1.4s ease-in-out infinite;
}
@keyframes pulsation { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3); opacity: .7; } }
.panneau-onglet { display: none; animation: apparition .3s var(--douceur); }
.panneau-onglet.actif { display: block; }
@keyframes apparition { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* --- Messagerie --- */
.fil-messages { display: flex; flex-direction: column; gap: 11px; max-height: 420px; overflow-y: auto; padding: 4px; margin-bottom: 14px; }
.message { max-width: 78%; padding: 11px 14px; border-radius: 14px; font-size: .88rem; box-shadow: var(--ombre-sm); }
.message .meta { font-size: .73rem; color: var(--gris-500); margin-bottom: 3px; font-weight: 600; }
.message.signalant { align-self: flex-start; background: var(--gris-100); border: 1px solid var(--gris-200); border-bottom-left-radius: 4px; }
.message.interne { align-self: flex-end; background: var(--vert-50); border: 1px solid var(--vert-100); border-bottom-right-radius: 4px; }
.message p { margin: 0; white-space: pre-wrap; }

/* --- Modale --- */
.fond-modale { position: fixed; inset: 0; background: rgba(7,20,38,.6); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.fond-modale.ouverte { display: flex; }
.modale { background: var(--blanc); border-radius: var(--rayon-lg); padding: 28px; max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: var(--ombre-lg); }
.modale h2 { margin-top: 0; font-size: 1.15rem; }

/* --- Utilitaires --- */
.texte-discret { color: var(--gris-500); font-size: .82rem; }
.texte-centre { text-align: center; }
.espace-haut { margin-top: 16px; }
.espace-bas { margin-bottom: 16px; }
.chargement { color: var(--gris-500); font-style: italic; padding: 20px 0; }
.vide { color: var(--gris-500); font-style: italic; padding: 16px 0; }

/* --- Page de connexion --- */
.page-connexion {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(0,237,0,.14), transparent 45%),
    linear-gradient(160deg, var(--marine-950), var(--marine-800));
  padding: 20px;
}
.carte-connexion {
  background: var(--blanc);
  border-radius: var(--rayon-lg);
  padding: 38px 34px;
  width: 100%;
  max-width: 410px;
  box-shadow: var(--ombre-lg);
}
.logo-connexion { width: 46px; height: auto; margin-bottom: 14px; }
.carte-connexion h1 { font-size: 1.25rem; margin: 0 0 6px; color: var(--marine-900); }
.carte-connexion p.sous-titre { color: var(--gris-700); font-size: .85rem; margin: 0 0 24px; }
.carte-connexion button { width: 100%; justify-content: center; margin-top: 8px; padding: 11px 18px; }

@media (max-width: 860px) {
  body { height: auto; overflow: visible; }
  .mise-en-page { flex-direction: column; height: auto; }
  .barre-laterale { width: 100%; height: auto; overflow-y: visible; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px; }
  .barre-laterale .logo, .barre-laterale .bas { display: none; }
  .barre-laterale nav { display: flex; flex-direction: row; padding: 0; }
  .barre-laterale nav a { white-space: nowrap; }
  .contenu { height: auto; overflow-y: visible; padding: 20px 16px; }

  /* Filtres secondaires repliables (voir dashboard.html) : uniquement la recherche par reference
     reste visible par defaut, le reste se deplie via #bouton-plus-filtres. */
  #bouton-plus-filtres { display: inline-flex; }
  .filtres-secondaires { display: none; margin-top: 14px; }
  .filtres-secondaires.ouverte { display: block; }

  /* Tableaux -&gt; cartes empilees, jamais de scroll horizontal (dashboard, journal, comptes --
     voir la classe .tableau-mobile-cartes ajoutee sur ces tableaux). */
  table.tableau-mobile-cartes { border: none; }
  table.tableau-mobile-cartes thead { display: none; }
  table.tableau-mobile-cartes, table.tableau-mobile-cartes tbody, table.tableau-mobile-cartes tr, table.tableau-mobile-cartes td {
    display: block;
    width: 100%;
  }
  table.tableau-mobile-cartes tr {
    border: 1px solid var(--gris-200);
    border-radius: var(--rayon-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  table.tableau-mobile-cartes tr:has(td.chargement), table.tableau-mobile-cartes tr:has(td.vide) {
    border: none;
    padding: 11px 14px;
    margin-bottom: 0;
  }
  table.tableau-mobile-cartes td { border-bottom: none; padding: 5px 0; }
  table.tableau-mobile-cartes td:empty { display: none; }
  /* Les boutons d'action (Ouvrir/Me designer, Desactiver/Reinitialiser/Supprimer...) s'empilent
     en pleine largeur au lieu de rester sur une seule ligne (source du debordement horizontal). */
  table.tableau-mobile-cartes td .barre-actions { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  table.tableau-mobile-cartes td .barre-actions > * { width: 100%; }
  table.tableau-mobile-cartes td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gris-500);
    font-weight: 700;
    margin-bottom: 2px;
  }

  /* KPI 3 par 3 sur mobile (stats.html) */
  .grille-cartes { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-tuile { padding: 10px 8px; gap: 6px; }
  .stat-tuile .icone-tuile { width: 28px; height: 28px; border-radius: 8px; }
  .stat-tuile .icone-tuile .icone-svg { width: 15px; height: 15px; }
  .stat-tuile .valeur { font-size: 1.25rem; }
  .stat-tuile .label { font-size: .68rem; margin-top: 0; line-height: 1.25; }
}
