* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(135deg, #eef1f7 0%, #e6ebf5 100%);
  margin: 0;
  min-height: 100vh;
  color: #1f2430;
}

/* --- Navigation, présente sur toutes les pages une fois connecté --- */
.barre-navigation {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #ffffff;
  padding: 14px 32px;
  box-shadow: 0 2px 8px rgba(30, 41, 59, .06);
}

.barre-navigation a {
  text-decoration: none;
  color: #5c6577;
  font-weight: 600;
  font-size: 15px;
}

.barre-navigation a.lien-actif {
  color: #2563eb;
}

.barre-navigation .form-deconnexion {
  margin-left: auto;
}

.barre-navigation button {
  background: none;
  border: 1px solid #dde1ea;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  color: #5c6577;
  font-size: 13px;
}

/* --- Pages de connexion / inscription --- */
.conteneur-auth {
  max-width: 380px;
  margin: 80px auto;
  background: #fff;
  padding: 36px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(30, 41, 59, .08);
}

.conteneur-auth h1 {
  text-align: center;
  margin-top: 0;
}

.conteneur-auth form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.conteneur-auth label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #5c6577;
}

.conteneur-auth input {
  padding: 10px 12px;
  border: 1.5px solid #dde1ea;
  border-radius: 8px;
  font-size: 15px;
}

.conteneur-auth button {
  margin-top: 8px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.lien-secondaire {
  text-align: center;
  font-size: 14px;
  margin-top: 18px;
}

.message-erreur {
  color: #dc2626;
  font-size: 13px;
}

.message-succes {
  color: #15803d;
  font-size: 13px;
}

.message-info {
  color: #5c6577;
  font-size: 13px;
}

/* --- Page des tâches --- */
.conteneur {
  max-width: 480px;
  margin: 48px auto;
  background: #ffffff;
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(30, 41, 59, .08);
}

.conteneur form {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.conteneur input[type=text] {
  flex: 1;
  padding: 11px 14px;
  border: 1.5px solid #dde1ea;
  border-radius: 8px;
  font-size: 15px;
}

.conteneur button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.conteneur form>button[type=submit] {
  background: #2563eb;
  color: white;
}

.conteneur ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.conteneur li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid #f0f2f6;
}

.conteneur li.terminee span {
  text-decoration: line-through;
  color: #a3a9b7;
}

.echeance {
  font-size: 11px;
  color: #8a92a3;
  margin-left: 8px;
}

.actions {
  display: flex;
  gap: 6px;
}

.actions form {
  margin: 0;
}

.actions form:first-child button {
  background: #ecfdf3;
  color: #15803d;
  width: 34px;
  height: 34px;
  padding: 0;
}

.actions form:last-child button {
  background: #fef2f2;
  color: #dc2626;
  width: 34px;
  height: 34px;
  padding: 0;
}

/* --- Page agenda / calendrier --- */
.conteneur-large {
  max-width: 900px;
  margin: 32px auto;
  background: #fff;
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(30, 41, 59, .08);
}

.entete-calendrier {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.entete-calendrier a {
  text-decoration: none;
  font-size: 20px;
  color: #5c6577;
  padding: 4px 12px;
}

.grille-calendrier {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.grille-calendrier th {
  padding: 8px;
  font-size: 12px;
  color: #8a92a3;
  text-transform: uppercase;
}

.grille-calendrier td {
  border: 1px solid #f0f2f6;
  height: 90px;
  vertical-align: top;
  padding: 6px;
}

.grille-calendrier td.jour-hors-mois {
  background: #fafbfd;
  color: #c3c8d1;
}

.numero-jour {
  font-size: 13px;
  font-weight: 600;
}

.puce-evenement {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 5px;
  margin-top: 4px;
}

.puce-evenement form {
  margin: 0;
}

.bouton-supprimer-mini {
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  font-size: 11px;
  padding: 0 0 0 4px;
}

.formulaire-evenement {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  align-items: flex-end;
}

.formulaire-evenement label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #5c6577;
}

.formulaire-evenement input {
  padding: 8px 10px;
  border: 1.5px solid #dde1ea;
  border-radius: 6px;
}

.formulaire-evenement button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
  height: fit-content;
}

/* --- Page statistiques --- */
.grille-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.carte-stat {
  background: #f8fafc;
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.carte-stat.carte-alerte {
  background: #fef2f2;
}

.valeur-stat {
  font-size: 28px;
  font-weight: 700;
  color: #1f2430;
}

.carte-alerte .valeur-stat {
  color: #dc2626;
}

.libelle-stat {
  font-size: 13px;
  color: #5c6577;
}

/* --- Navigation : support de 4 liens désormais (Accueil ajouté) --- */
.barre-navigation {
  flex-wrap: wrap;
}

/* --- Page d'accueil --- */
.grille-accueil {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.bloc-accueil {
  background: #f8fafc;
  border-radius: 12px;
  padding: 22px;
}

.bloc-accueil h2 {
  margin-top: 0;
  font-size: 17px;
}

.liste-simple {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.liste-simple li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #eef0f4;
  font-size: 14px;
}

.liste-simple li.vide {
  color: #8a92a3;
  font-style: italic;
  border-bottom: none;
}

.date-evenement {
  font-size: 12px;
  color: #8a92a3;
}

.lien-voir-tout {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.vide {
  color: #8a92a3;
  font-style: italic;
}

/* --- Étiquettes de priorité, réutilisées sur plusieurs pages --- */
.etiquette-priorite {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.priorite-BASSE {
  background: #ecfdf3;
  color: #15803d;
}

.priorite-NORMALE {
  background: #eff6ff;
  color: #2563eb;
}

.priorite-HAUTE {
  background: #fef2f2;
  color: #dc2626;
}

/* --- Page des tâches : vrai tableau, conteneur élargi --- */
.conteneur-tableau {
  max-width: 900px;
  margin: 32px auto;
  background: #fff;
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(30, 41, 59, .08);
  overflow-x: auto;
}

.formulaire-tache {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.formulaire-tache input[type=text],
.formulaire-tache select {
  padding: 10px 12px;
  border: 1.5px solid #dde1ea;
  border-radius: 8px;
  font-size: 14px;
}

.formulaire-tache input[name=titre] {
  flex: 1;
  min-width: 180px;
}

.formulaire-tache button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

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

.tableau-taches th {
  text-align: left;
  padding: 10px 8px;
  font-size: 12px;
  color: #8a92a3;
  text-transform: uppercase;
  border-bottom: 2px solid #eef0f4;
}

.tableau-taches td {
  padding: 12px 8px;
  border-bottom: 1px solid #f0f2f6;
  vertical-align: middle;
}

.tableau-taches tr.ligne-terminee td {
  color: #a3a9b7;
}

.tableau-taches tr.ligne-terminee td:nth-child(2) {
  text-decoration: line-through;
}

.puce-terminee {
  color: #15803d;
  font-size: 12px;
  font-weight: 600;
}

.cellule-actions {
  display: flex;
  gap: 6px;
}

.cellule-actions form {
  margin: 0;
}

.bouton-icone {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}

.bouton-valider {
  background: #ecfdf3;
  color: #15803d;
}

.bouton-modifier {
  background: #eff6ff;
  color: #2563eb;
}

.bouton-supprimer {
  background: #fef2f2;
  color: #dc2626;
}

/* --- Formulaires de modification (tâche et événement) --- */
.formulaire-vertical {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.formulaire-vertical label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #5c6577;
}

.formulaire-vertical input,
.formulaire-vertical select {
  padding: 10px 12px;
  border: 1.5px solid #dde1ea;
  border-radius: 8px;
  font-size: 15px;
}

.actions-formulaire {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.actions-formulaire button {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.bouton-annuler {
  padding: 12px 20px;
  border-radius: 8px;
  background: #f0f2f6;
  color: #5c6577;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* --- Agenda : mise en évidence du jour actuel, lien sur les événements --- */
.grille-calendrier td.jour-aujourdhui {
  background: #eff6ff;
  border: 2px solid #2563eb;
}

.grille-calendrier td.jour-aujourdhui .numero-jour {
  color: #2563eb;
}

.titre-evenement {
  color: inherit;
  text-decoration: none;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.titre-evenement:hover {
  text-decoration: underline;
}

/* --- Responsive : mobile --- */
@media (max-width: 720px) {
  .barre-navigation {
    padding: 12px 16px;
    gap: 14px;
    font-size: 13px;
  }

  .conteneur,
  .conteneur-auth,
  .conteneur-large,
  .conteneur-tableau {
    margin: 16px;
    padding: 20px;
    max-width: none;
  }

  .grille-accueil {
    grid-template-columns: 1fr;
  }

  .grille-calendrier td {
    height: 60px;
    font-size: 12px;
  }

  .formulaire-evenement,
  .formulaire-tache {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --- Encapsule un champ de formulaire + son message d'erreur éventuel --- */
.champ-formulaire {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.champ-formulaire .message-erreur {
  margin: 0;
}