body {
  font-family: system-ui, sans-serif;
  background: #f0f2f5;
  margin: 0;
  padding: 40px 16px;
}

.carte {
  max-width: 500px;
  margin: 0 auto;
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
  margin-top: 0;
  font-size: 1.6rem;
}

#formulaire {
  display: flex;
  flex-wrap: wrap; /* sur un petit écran, les champs passent à la ligne */
  gap: 8px;
}

/* Le texte de la tâche prend toute la première ligne ;
   la date, la catégorie et le bouton se rangent en dessous */
#champ-tache {
  flex: 1 1 100%;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

/* Le bouton « Ajouter » : gris anthracite, pour ne pas ressembler
   aux couleurs des catégories ni au filtre choisi (bleu) */
#bouton-ajouter {
  background: #343a40;
  font-weight: bold;
}

#bouton-ajouter:hover {
  background: #1f2327;
}

#champ-echeance {
  padding: 9px;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

#champ-categorie {
  flex: 1;
  padding: 9px;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: white;
}

/* L'étiquette de catégorie : une petite pastille colorée */
.categorie {
  font-size: 0.75rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.categorie-maison {
  background: #e6f4ea;
  color: #1e7b34;
}

.categorie-courses {
  background: #f3e8fa;
  color: #862e9c;
}

.categorie-pro {
  background: #e3effb;
  color: #1864ab;
}

/* La date d'échéance affichée à côté d'une tâche */
.echeance {
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
}

.echeance.aujourdhui {
  color: #c76a00;
  font-weight: bold;
}

.echeance.en-retard {
  color: #e5484d;
  font-weight: bold;
}

button {
  padding: 10px 16px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #4a6cf7;
  color: white;
  cursor: pointer;
}

button:hover {
  background: #3654d1;
}

/* Les boutons de filtre par catégorie */
#filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.filtre {
  padding: 6px 12px;
  font-size: 0.85rem;
  background: #e8eaee;
  color: #333;
  border-radius: 999px;
}

.filtre:hover {
  background: #d5d8de;
}

/* Le filtre choisi */
.filtre.actif {
  background: #4a6cf7;
  color: white;
}

#liste {
  list-style: none;
  padding: 0;
  margin-top: 12px;
}

#liste li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #eee;
}

#liste input[type="checkbox"] {
  flex-shrink: 0; /* la case garde sa taille même si la ligne est serrée */
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Le texte de la tâche + sa date : la date passe à la ligne si ça ne tient pas */
.contenu {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 2px;
  overflow-wrap: anywhere; /* coupe les très longs mots plutôt que de déborder */
}

/* Bas de la liste : compteur à gauche, bouton à droite */
#pied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
}

#compteur {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

#effacer-terminees {
  padding: 6px 10px;
  font-size: 0.85rem;
  background: #e8eaee;
  color: #333;
}

#effacer-terminees:hover {
  background: #d5d8de;
}

/* Le bouton reste caché quand il n'y a rien à effacer */
#effacer-terminees[hidden] {
  display: none;
}

/* Le bouton « Supprimer », poussé tout à droite */
.supprimer {
  flex-shrink: 0;
  margin-left: auto;
  padding: 6px 10px;
  font-size: 0.85rem;
  background: #e5484d;
}

.supprimer:hover {
  background: #c7363b;
}

/* Une tâche terminée : texte barré et grisé */
.faite {
  text-decoration: line-through;
  color: #999;
}
