/* Page components (home, projects). Uses only variables from tokens.css. */

/* ---------- Page header ---------- */
.entete-page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-8); }
.entete-page h1 { margin: 0; }
.entete-page .sur-titre { margin: 0 0 var(--sp-1); font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--text-tertiary); }
.entete-page .sur-titre::first-letter { text-transform: uppercase; }
.entete-page .resume { margin: var(--sp-2) 0 0; color: var(--text-secondary); }
.entete-page .meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin: var(--sp-2) 0 0; color: var(--text-secondary); font-size: var(--fs-14); }
.lien-retour { display: inline-flex; align-items: center; gap: var(--sp-1); margin-bottom: var(--sp-3); color: var(--text-secondary); text-decoration: none; font-size: var(--fs-14); }
.lien-retour:hover { color: var(--text); }
.lien-retour .icone { transform: rotate(180deg); }

/* ---------- Section title with a count ---------- */
.titre-section { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-8) 0 var(--sp-3); font-size: var(--fs-16); }
.titre-section .icone { color: var(--text-tertiary); }
.titre-section .nombre { font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--text-tertiary); }
.titre-section .a-droite { margin-left: auto; font-size: var(--fs-14); font-weight: var(--fw-regular); }

/* ---------- Status tags (task and project statuses) ---------- */
.s-a_faire, .s-refuse, .s-archive { background: var(--tag-gray-bg); color: var(--tag-gray-text); }
.s-en_cours { background: var(--tag-blue-bg); color: var(--tag-blue-text); }
.s-a_commencer { background: var(--tag-yellow-bg); color: var(--tag-yellow-text); }
.bandeau-info { margin: 0 0 var(--sp-4); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); background: var(--accent-subtle); color: var(--text); font-size: var(--fs-14); }
.s-en_attente, .s-propose { background: var(--tag-yellow-bg); color: var(--tag-yellow-text); }
.s-bloquee { background: var(--tag-orange-bg); color: var(--tag-orange-text); }
.s-a_valider { background: var(--tag-purple-bg); color: var(--tag-purple-text); }
.s-refusee { background: var(--tag-pink-bg); color: var(--tag-pink-text); }
.s-terminee, .s-termine { background: var(--tag-green-bg); color: var(--tag-green-text); }
td .statut { vertical-align: 1px; }

/* Strong status color (--c) for dots and bars: .c-<status> */
.c-a_faire, .c-refuse, .c-archive { --c: var(--text-tertiary); }
.c-en_cours { --c: var(--tag-blue-text); }
.c-en_attente, .c-propose { --c: var(--warning); }
.c-bloquee { --c: var(--tag-orange-text); }
.c-a_valider { --c: var(--tag-purple-text); }
.c-refusee { --c: var(--tag-pink-text); }
.c-terminee, .c-termine { --c: var(--success); }
.point { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c, currentColor); margin-right: 6px; }

/* Date chip; late dates in danger color */
.date { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); font-size: var(--fs-12); white-space: nowrap; }
.date .icone { width: 14px; height: 14px; }
.date.retard { color: var(--warning-text); font-weight: var(--fw-medium); }

/* ---------- Stat tiles ---------- */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); margin: 0 0 var(--sp-2); padding: 0; list-style: none; }
.tuiles li { margin: 0; }
.tuile {
  display: flex; flex-direction: column; gap: var(--sp-1);
  height: 100%; padding: var(--sp-3) var(--sp-4);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  color: var(--text); text-decoration: none;
  transition: border-color var(--duration) var(--easing), background-color var(--duration) var(--easing);
}
a.tuile:hover { border-color: var(--border-strong); background: var(--bg-subtle); color: var(--text); }
.tuile .valeur { font-size: var(--fs-28); font-weight: var(--fw-semibold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.tuile .libelle { display: flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--text-secondary); }
.tuile.danger { border-color: var(--border-strong); }
.tuile.danger .valeur, .tuile.danger .libelle { color: var(--warning-text); }
.tuile.calme .valeur { color: var(--text-tertiary); }

/* ---------- Distribution bar (my tasks by status) ---------- */
.repartition { display: flex; gap: 2px; height: 8px; margin: var(--sp-3) 0 var(--sp-2); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-hover); }
.repartition span { display: block; min-width: 4px; background: var(--c); }
.legende { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin: 0; padding: 0; list-style: none; font-size: var(--fs-12); color: var(--text-secondary); }
.legende li { display: inline-flex; align-items: center; margin: 0; }
.legende strong { margin-left: 4px; color: var(--text); }

/* ---------- Row lists (tasks, notifications) ---------- */
.lignes { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); overflow: hidden; }
.lignes > li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); max-width: none; margin: 0; padding: var(--sp-2) var(--sp-4); min-height: 44px; border-top: 1px solid var(--border); }
.lignes > li:first-child { border-top: 0; }
.lignes > li:hover { background: var(--bg-subtle); }
.lignes .principal { flex: 1 1 240px; min-width: 0; }
.lignes .principal a { font-weight: var(--fw-medium); text-decoration: none; }
.lignes .principal a:hover { text-decoration: underline; }
.lignes .secondaire { display: block; font-size: var(--fs-12); color: var(--text-secondary); }
.lignes .cote { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }
.lignes .citation { flex-basis: 100%; margin: 0; padding-left: var(--sp-3); border-left: 2px solid var(--tag-pink-text); color: var(--text-secondary); font-size: var(--fs-14); }
.lignes form.ligne { display: inline; }

/* ---------- Cards ---------- */
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-3); margin: 0 0 var(--sp-4); padding: 0; list-style: none; }
.grille-cartes > li { margin: 0; max-width: none; }
.carte {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-2);
  height: 100%; padding: var(--sp-4);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color var(--duration) var(--easing), background-color var(--duration) var(--easing);
}
.carte:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.carte h3 { margin: 0; font-size: var(--fs-16); }
.carte h3 a { text-decoration: none; }
/* Whole card clickable through its title link */
.carte h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.carte h3 a:focus-visible { outline: none; }
.carte h3 a:focus-visible::after { box-shadow: 0 0 0 3px var(--focus-ring); }
.carte p { margin: 0; color: var(--text-secondary); font-size: var(--fs-14); }
.carte .extrait { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.carte .haut { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.carte .bas { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: auto; padding-top: var(--sp-2); font-size: var(--fs-12); color: var(--text-secondary); }
.carte .vignette {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-md);
  background: var(--accent-subtle); color: var(--accent);
}
.carte .vignette .icone { width: 18px; height: 18px; }
.carte.proposition { border-style: dashed; background: var(--bg-subtle); }
.carte.proposition .vignette { background: var(--tag-yellow-bg); color: var(--tag-yellow-text); }

/* Card for creating something new */
.carte-nouvelle {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 100%; min-height: 140px; padding: var(--sp-4);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  color: var(--text-secondary); text-decoration: none; text-align: center;
  transition: border-color var(--duration) var(--easing), color var(--duration) var(--easing), background-color var(--duration) var(--easing);
}
.carte-nouvelle:hover { border-color: var(--border-strong); color: var(--text); background: var(--bg-hover); }
.carte-nouvelle .icone { width: 22px; height: 22px; }

/* ---------- Progress bar ---------- */
progress.avancement {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 6px; border: 0; border-radius: var(--radius-sm);
  background: var(--bg-hover); color: var(--success); overflow: hidden;
}
progress.avancement::-webkit-progress-bar { background: var(--bg-hover); border-radius: var(--radius-sm); }
progress.avancement::-webkit-progress-value { background: var(--success); border-radius: var(--radius-sm); }
progress.avancement::-moz-progress-bar { background: var(--success); border-radius: var(--radius-sm); }

/* ---------- Shortcut pills (project sections) ---------- */
.raccourcis { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-6); padding: 0; list-style: none; }
.raccourcis li { margin: 0; }
.raccourcis a {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: var(--control-md); padding: 0 var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg);
  color: var(--text); text-decoration: none; font-weight: var(--fw-medium);
  transition: border-color var(--duration) var(--easing), background-color var(--duration) var(--easing);
}
.raccourcis a:hover { border-color: var(--border-strong); background: var(--bg-hover); color: var(--text); }
.raccourcis .icone { color: var(--text-secondary); }

/* ---------- Two columns: main + side panel ---------- */
.deux-colonnes { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--sp-6); align-items: start; }
.panneau {
  padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-subtle);
}
.panneau h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-14); }
.panneau + .panneau { margin-top: var(--sp-3); }
.panneau dl { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-3); margin: 0; font-size: var(--fs-14); }
.panneau dt { color: var(--text-secondary); }
.panneau dd { margin: 0; }
.panneau .actions { gap: var(--sp-2); }
.panneau .actions .btn, .panneau .actions button { width: 100%; justify-content: flex-start; }
.panneau .actions form { width: 100%; }
.panneau.danger { background: var(--bg); border-color: var(--danger-subtle); }
.panneau.danger h2 { color: var(--danger); }
.panneau textarea { max-width: none; }

/* Header action button */
.btn .icone, button .icone { color: inherit; }

/* Table inside a bordered box */
.boite-tableau { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; background: var(--bg); }
.boite-tableau table { margin: 0; }
.boite-tableau tr:last-child td { border-bottom: 0; }
.boite-tableau td a { font-weight: var(--fw-medium); text-decoration: none; }
.boite-tableau td a:hover { text-decoration: underline; }
.priorite-haute { color: var(--text); font-weight: var(--fw-semibold); }
.priorite-basse { color: var(--text-tertiary); }

/* Callout */
.encadre { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-lg); background: var(--warning-subtle); color: var(--warning-text); max-width: none; }
.encadre.danger { background: var(--danger-subtle); color: var(--danger); }
.encadre .icone { margin-top: 3px; }
.encadre a { color: inherit; }

/* Discreet "more" details */
details.replie > summary { cursor: pointer; color: var(--text-secondary); font-size: var(--fs-14); margin: var(--sp-4) 0 var(--sp-2); }
details.replie > summary:hover { color: var(--text); }

@media (max-width: 900px) {
  .deux-colonnes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .entete-page { margin-bottom: var(--sp-6); }
  .lignes .cote { margin-left: 0; }
  /* Tableaux sur téléphone : les colonnes gardent une largeur lisible et le tableau défile
     dans sa boîte ; la première colonne reste visible pendant le défilement. */
  .boite-tableau td, .tableau-scroll td { min-width: 7.5rem; }
  .boite-tableau td:first-child, .tableau-scroll td:first-child,
  .boite-tableau th:first-child, .tableau-scroll th:first-child {
    position: sticky; left: 0; box-shadow: inset -1px 0 0 var(--border);
  }
  .boite-tableau td:first-child, .tableau-scroll td:first-child { z-index: 1; min-width: 9.5rem; background: var(--bg); }
  .boite-tableau th:first-child, .tableau-scroll th:first-child { z-index: 2; }
  td button, td .btn, td .statut { white-space: nowrap; }
}
.panneau .description { margin: var(--sp-3) 0 0; color: var(--text-secondary); font-size: var(--fs-14); }
.deux-colonnes > section > .titre-section:first-child { margin-top: 0; }

/* ---------- Shared page helpers ---------- */
/* Free text kept as typed (descriptions, comments, AI answers) */
.texte-libre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-16); max-width: var(--measure); }
.texte-libre.encadre-neutre { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-subtle); }
.coupe-mots { overflow-wrap: anywhere; }
/* Comment thread item; .a-corriger marks a correction request */
.commentaire { padding: var(--sp-2) 0 var(--sp-2) var(--sp-3); border-left: 2px solid var(--border-strong); margin-bottom: var(--sp-3); }
.commentaire.a-corriger { border-left-color: var(--warning); }
/* Read-only form block with label above */
.champ { display: block; margin-bottom: var(--sp-3); font-weight: var(--fw-medium); }
.aide { display: block; font-size: var(--fs-12); font-weight: var(--fw-regular); color: var(--text-secondary); }
/* Inline secondary text after a link in a row, separators kept as text */
.secondaire-ligne { color: var(--text-secondary); font-size: var(--fs-14); }
.lien-suite { margin: var(--sp-2) 0 0; font-size: var(--fs-14); }
.sep { color: var(--text-tertiary); }
.raccourcis .sep { display: none; }
.lignes .cote progress.avancement { width: 120px; }
.panneau p { font-size: var(--fs-14); margin-bottom: var(--sp-2); }
.panneau .actions form.ligne { display: block; margin: 0; }

/* Icons replacing former emoji inside text */
.icone-texte { vertical-align: -3px; margin-right: var(--sp-1); color: var(--text-secondary); }
.statut .icone-texte { width: 12px; height: 12px; vertical-align: -1px; color: inherit; }
.erreur .icone-texte, .alerte .icone-texte, .encadre .icone-texte { color: inherit; }
/* Unread notification marker */
.point-non-lu { display: inline-block; width: 8px; height: 8px; margin-right: var(--sp-2); border-radius: 50%; background: var(--accent); vertical-align: 1px; }
