/* ------------------------------------------------------------------ base */

:root {
  --fond: #f2f4f8;
  --carte: #ffffff;
  --encre: #16233b;
  --encre-douce: #5b6b85;
  --bordure: #dde3ee;
  --accent: #1f4fd8;
  --accent-fonce: #173ea8;
  --rouge: #d23b3b;
  --rouge-fond: #fdeeee;
  --orange: #b45f06;
  --orange-fond: #fdf3e4;
  --vert: #1e7f4f;
  --vert-fond: #e8f6ee;
  --violet: #6b3fa0;
  --violet-fond: #f2ebfa;
  --bleu-fond: #e8eefc;
  --ombre: 0 10px 30px rgba(22, 35, 59, 0.10);
  --rayon: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--fond);
  color: var(--encre);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 650; }

button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- en-tête */

.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  background: var(--carte);
  border-bottom: 1px solid var(--bordure);
  position: sticky;
  top: 0;
  z-index: 20;
}

.entete-titre { display: flex; align-items: baseline; gap: 12px; }
.entete h1 { font-size: 1.25rem; letter-spacing: 0.2px; }
.date-du-jour { color: var(--encre-douce); font-size: 0.88rem; text-transform: capitalize; }

.entete-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

#recherche {
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 8px 12px;
  width: 210px;
  background: var(--fond);
}
#recherche:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.bouton {
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--carte);
  color: var(--encre);
  transition: background 0.12s ease, border-color 0.12s ease;
}
.bouton:hover { background: var(--fond); }

.bouton-principal {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.bouton-principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }

.bouton-discret { color: var(--encre-douce); }

.bouton-danger { color: var(--rouge); border-color: #f0c9c9; }
.bouton-danger:hover { background: var(--rouge-fond); }

/* --------------------------------------------------------------- colonnes */

.colonnes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  padding: 22px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

.titre-colonne {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--encre-douce);
  margin-bottom: 12px;
}

.colonne .boite { margin-bottom: 16px; }

.boite {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 14px 16px;
}

.boite > h3, .boite summary h3 {
  font-size: 0.98rem;
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.boite-urgente { border-top: 3px solid var(--rouge); }
.boite-alerte { border-top: 3px solid var(--orange); }

.boite-repliable summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
}
.boite-repliable summary::-webkit-details-marker { display: none; }
.boite-repliable summary::after { content: "▸"; margin-left: auto; color: var(--encre-douce); }
.boite-repliable[open] summary::after { content: "▾"; }
.boite-repliable[open] summary { margin-bottom: 6px; }

.compteur {
  background: var(--fond);
  color: var(--encre-douce);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 9px;
}

.liste-cartes { display: flex; flex-direction: column; gap: 8px; }

.liste-vide { color: var(--encre-douce); font-size: 0.85rem; font-style: italic; padding: 4px 2px; }

/* ------------------------------------------------------------------ cartes */

.carte-fiche {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.carte-fiche:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(31, 79, 216, 0.10); }

.carte-fiche .ligne-haute {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.carte-fiche .nom { font-weight: 600; }
.carte-fiche .action {
  color: var(--encre-douce);
  font-size: 0.86rem;
  margin-top: 3px;
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}
.carte-fiche .action .date-action { white-space: nowrap; font-variant-numeric: tabular-nums; }

.badges { display: inline-flex; gap: 6px; flex-shrink: 0; }

.badge {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.badge-outbound   { background: var(--bleu-fond);   color: var(--accent-fonce); }
.badge-apporteur  { background: var(--vert-fond);   color: var(--vert); }
.badge-visibilite { background: var(--orange-fond); color: var(--orange); }
.badge-reseau     { background: var(--violet-fond); color: var(--violet); }
.badge-retard     { background: var(--rouge-fond);  color: var(--rouge); }
.badge-statut     { background: var(--fond);        color: var(--encre-douce); }

/* ------------------------------------------------------------- sous-groupes */

.sous-groupes { display: flex; flex-direction: column; gap: 12px; }

.sous-groupe .titre-sous-groupe {
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--encre-douce);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------------------------------------------------------------- modales */

.voile[hidden] { display: none; }

.voile {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px 16px;
  z-index: 50;
  overflow-y: auto;
}

.modale {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  width: 100%;
  max-width: 640px;
  padding: 22px 24px;
  animation: apparition 0.14s ease-out;
}

@keyframes apparition {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.modale-entete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modale-entete h2 { font-size: 1.15rem; }
.modale-entete .badges { margin-top: 6px; }

.bouton-fermer {
  border: none;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--encre-douce);
  padding: 2px 6px;
}
.bouton-fermer:hover { color: var(--encre); }

.bloc-fiche { margin-bottom: 14px; }
.bloc-fiche .etiquette {
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--encre-douce);
  margin-bottom: 4px;
}
.bloc-fiche .valeur { white-space: pre-wrap; overflow-wrap: anywhere; }
.bloc-fiche .valeur.vide { color: var(--encre-douce); font-style: italic; }

.action-en-cours {
  background: var(--bleu-fond);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.action-en-cours.retard { background: var(--rouge-fond); }
.action-en-cours .intitule { font-weight: 600; }
.action-en-cours .quand { color: var(--encre-douce); font-size: 0.86rem; }

.pied-modale {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
  border-top: 1px solid var(--bordure);
  padding-top: 14px;
}

/* -------------------------------------------------------------- formulaire */

.champ { margin-bottom: 14px; }
.champ label, .champ .etiquette-champ {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 5px;
}
.obligatoire::after { content: " *"; color: var(--rouge); }

.champ input[type="text"], .champ input[type="date"], .champ textarea {
  width: 100%;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
}
.champ input:focus, .champ textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.champ textarea { resize: vertical; min-height: 84px; }

.rangee { display: flex; gap: 10px; }
.rangee > .champ { flex: 1; }

.pastilles { display: flex; gap: 8px; flex-wrap: wrap; }
.pastille input { position: absolute; opacity: 0; pointer-events: none; }
.pastille span {
  display: inline-block;
  border: 1px solid var(--bordure);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.88rem;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.1s ease;
}
.pastille input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pastille input:focus-visible + span { outline: 2px solid var(--accent-fonce); outline-offset: 1px; }

.aide-champ { font-size: 0.8rem; color: var(--encre-douce); margin-top: 4px; }

.lien-discret {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 0.85rem;
  text-decoration: underline;
}

.message-erreur {
  background: var(--rouge-fond);
  color: var(--rouge);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.88rem;
  margin: 10px 0;
}

/* ------------------------------------------------------ liste des archives */

.ligne-archive {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--bordure);
  flex-wrap: wrap;
}
.ligne-archive:last-child { border-bottom: none; }
.ligne-archive .infos { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ligne-archive .boutons { display: flex; gap: 8px; }

/* ------------------------------------------------------------- notification */

.notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--encre);
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.9rem;
  box-shadow: var(--ombre);
  z-index: 100;
}
.notification.erreur { background: var(--rouge); }

/* -------------------------------------------------------------- connexion */

.page-connexion {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.carte-connexion {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 34px 32px;
  width: 100%;
  max-width: 380px;
  margin-top: 14vh;
}
.carte-connexion h1 { font-size: 1.3rem; }
.carte-connexion .sous-titre { color: var(--encre-douce); margin: 4px 0 22px; }
.carte-connexion label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.carte-connexion input {
  width: 100%;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.carte-connexion input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.carte-connexion .bouton { width: 100%; padding: 10px; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 900px) {
  .colonnes { grid-template-columns: 1fr; padding: 14px; }
  .entete { padding: 12px 14px; }
  #recherche { width: 140px; }
  .modale { padding: 18px 16px; }
  .rangee { flex-direction: column; gap: 0; }
}
