@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --fond:        #FFF8E7;
  --fond-carte:  #FFFFFF;
  --texte:       #2C2C2C;
  --texte-doux:  #5C5C5C;
  --primaire:    #2563EB;
  --primaire-h:  #1D4ED8;
  --succes:      #16A34A;
  --danger:      #DC2626;
  --warning:     #D97706;
  --bordure:     #DDD5C0;
  --radius:      8px;
  --ombre:       0 2px 8px rgba(0,0,0,0.08);
}

body {
  font-family: 'Atkinson Hyperlegible', sans-serif;
  background: var(--fond);
  color: var(--texte);
  font-size: 16px;
  line-height: 1.5;
}

h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }

a { color: var(--primaire); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Boutons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primaire { background: var(--primaire); color: #fff; }
.btn-primaire:hover { background: var(--primaire-h); }
.btn-succes   { background: var(--succes);   color: #fff; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-neutre   { background: var(--bordure);  color: var(--texte); }
.btn-neutre:hover { background: #ccc5b0; }
.btn-sm { padding: 5px 12px; font-size: 0.875rem; }

/* ── Boutons icône (tableaux) ── */
.btn-icon {
  padding: 3px 8px;
  font-size: 0.78rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: background 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}
.btn-icon.neutre   { background: #EDE8DA; color: var(--texte); }
.btn-icon.neutre:hover { background: #DDD5C0; }
.btn-icon.succes   { background: var(--succes);   color: #fff; }
.btn-icon.succes:hover { background: #15803D; }
.btn-icon.primaire { background: var(--primaire); color: #fff; }
.btn-icon.primaire:hover { background: var(--primaire-h); }
.btn-icon.danger   { background: var(--danger);   color: #fff; }
.btn-icon.danger:hover { background: #B91C1C; }

/* ── Formulaires ── */
label {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.9rem;
}
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--bordure);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--texte);
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primaire);
}
.champ { margin-bottom: 1rem; }

/* ── Cartes ── */
.carte {
  background: var(--fond-carte);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

/* ── Alertes ── */
.alerte {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 700;
  margin-bottom: 1rem;
  border-left: 4px solid;
}
.alerte-danger  { background: #FEE2E2; color: #991B1B; border-color: var(--danger); }
.alerte-warning { background: #FEF3C7; color: #92400E; border-color: var(--warning); }
.alerte-succes  { background: #DCFCE7; color: #14532D; border-color: var(--succes); }
.alerte-info    { background: #DBEAFE; color: #1E3A8A; border-color: var(--primaire); }

/* ── Badges statut ── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.4;
}
.badge-vert   { background: #DCFCE7; color: #14532D; }
.badge-rouge  { background: #FEE2E2; color: #991B1B; }
.badge-orange { background: #FEF3C7; color: #92400E; }
.badge-bleu   { background: #DBEAFE; color: #1E3A8A; }
.badge-gris   { background: #F3F4F6; color: #374151; }

/* ── Tableaux ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--bordure);
  margin-bottom: 1rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--fond-carte);
}
thead th {
  background: #F5EFD8;
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  border-bottom: 2px solid var(--bordure);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { background: #EDE5C8; }
thead th.tri-asc::after  { content: ' ▲'; font-size: 0.65rem; }
thead th.tri-desc::after { content: ' ▼'; font-size: 0.65rem; }
tbody tr { border-bottom: 1px solid var(--bordure); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #FFF3D0; }
tbody td {
  padding: 7px 12px;
  font-size: 0.88rem;
  vertical-align: middle;
}
tbody tr.retard { background: #FEE2E2; }
tbody tr.retard:hover { background: #FECACA; }

/* ── Recherche tableau ── */
.barre-recherche {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.barre-recherche input {
  max-width: 280px;
}
.barre-recherche select {
  max-width: 200px;
}

/* ── Navigation ── */
.nav {
  background: #2C2C2C;
  color: #fff;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #FFF8E7;
  letter-spacing: 0.5px;
}
.nav-liens {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.nav-liens a {
  color: #D1D5DB;
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.15s;
}
.nav-liens a:hover,
.nav-liens a.actif {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}
.nav-user {
  color: #9CA3AF;
  font-size: 0.85rem;
}

/* ── Layout principal ── */
.contenu {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Grille stats ── */
.stats-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-carte {
  background: var(--fond-carte);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.stat-carte .stat-nombre {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-carte .stat-label {
  font-size: 0.85rem;
  color: var(--texte-doux);
}

/* ── Modal ── */
.modal-fond {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-fond.visible { display: flex; }
.modal {
  background: var(--fond-carte);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-titre {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--bordure);
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--bordure);
}

/* ── Utilitaires ── */
.hidden      { display: none !important; }
.flex        { display: flex; }
.flex-entre  { display: flex; justify-content: space-between; align-items: center; }
.gap-1       { gap: 0.5rem; }
.gap-2       { gap: 1rem; }
.mb-1        { margin-bottom: 0.5rem; }
.mb-2        { margin-bottom: 1rem; }
.mb-3        { margin-bottom: 1.5rem; }
.mt-1        { margin-top: 0.5rem; }
.mt-2        { margin-top: 1rem; }
.texte-doux  { color: var(--texte-doux); }
.texte-petit { font-size: 0.82rem; }
.gras        { font-weight: 700; }
.centrer     { text-align: center; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
.modal-boite {
  background: var(--fond-carte);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-corps {
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.modal-pied {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  border-top: 1px solid var(--bordure);
}
