/* Crewvaluation : feuille du lot D — A13 « Paramètres » et A12 « Formations » (carte de la fiche, rapport).
   N'emploie que les variables du thème Signal de style.css (aucune couleur codée en dur) ; lime seulement sur
   marine ou en fond sous du marine ; contraste 4,5:1 vérifié par essais/essai_lotD.mjs. */

/* Onglets en pastilles : définis une seule fois dans style.css (intégration v3). */

/* ----- Carte d'un référentiel ----- */

.carte-entete-ref { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; }
.carte-entete-ref > div:first-child { flex: 1 1 320px; min-width: 0; }
.carte-entete-ref h2 { margin-bottom: 6px; }
.carte-entete-ref .carte-aide { margin: 0; max-width: 75ch; }
.bandeau-info { margin-top: 14px; }
.bandeau-info .bandeau-texte > span:last-child { max-width: 90ch; }
.titre-groupe-ref { margin: 22px 0 8px; }

.liste-ref { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--bordure); }
.titre-groupe-ref + .liste-ref { margin-top: 0; }
.ligne-ref {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 10px 14px;
  padding: 12px 8px; border-bottom: 1px solid var(--bordure); background: var(--surface);
}
.ligne-ref-retiree { background: var(--surface-douce); }
.ligne-ref-corps { flex: 1 1 auto; min-width: 0; }
.ligne-ref-nom { font-weight: 700; overflow-wrap: anywhere; }
.ligne-ref-nom .etiquette { margin-top: 0; }
.ligne-ref-secondaire { margin-top: 2px; font-size: 13px; color: var(--texte-2); overflow-wrap: anywhere; }
.ligne-ref-details { margin-top: 4px; max-width: 80ch; font-size: 14px; color: var(--texte-2); }
.ligne-ref-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.groupe-ordre { display: inline-flex; gap: 4px; margin-right: 4px; }

.bouton-icone { min-width: var(--hauteur-bouton); padding: 0; font-size: 18px; line-height: 1; }
.bouton-icone:disabled { opacity: 0.35; }

/* Poignée de glisser (six points), décorative : l'ordre se change aussi au clavier avec ↑ ↓. */
.poignee {
  flex: 0 0 14px; width: 14px; height: 24px; cursor: grab; border-radius: var(--rayon-petit);
  background-image: radial-gradient(circle, var(--texte-2) 1.6px, transparent 2px);
  background-size: 7px 8px; background-position: 0 0;
}
.ligne-ref[draggable="true"]:active .poignee { cursor: grabbing; }
.ligne-ref-glissee { opacity: 0.55; }
.ligne-ref-dessus-avant { box-shadow: inset 0 3px 0 var(--bleu); }
.ligne-ref-dessus-apres { box-shadow: inset 0 -3px 0 var(--bleu); }

.pastille-note, .pastille-rang {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; padding: 0 8px; border-radius: var(--rayon-pastille);
  font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.pastille-rang { background: var(--marine); color: var(--lime); }
.pastille-note-1 { background: var(--note-1); color: var(--note-1-texte); }
.pastille-note-2 { background: var(--note-2); color: var(--note-2-texte); }
.pastille-note-3 { background: var(--note-3); color: var(--note-3-texte); }
.pastille-note-4 { background: var(--note-4); color: var(--note-4-texte); }
.pastille-note-5 { background: var(--note-5); color: var(--note-5-texte); }

/* Étiquettes du lot D */
.etiquette-info { background: var(--surface-douce); color: var(--texte-2); box-shadow: inset 0 0 0 1px var(--bordure); }
.etiquette-neuf { background: var(--bleu-pale); color: var(--marine); }
.etiquette-retire { background: var(--marine); color: var(--blanc); }
.etiquette-retard { background: var(--danger); color: var(--blanc); }
.etiquette-haute { background: var(--danger-pale); color: var(--danger); }
.etiquette-faite { background: var(--bleu-pale); color: var(--bleu); }

/* Formulaires */
.champs-paire { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 14px; }
.champ-court { max-width: 160px; }
.case-figee { color: var(--texte-2); cursor: default; }
.cases-ligne { flex-direction: row; flex-wrap: wrap; gap: 2px 18px; }
.cases-ligne > legend { width: 100%; }
.dialogue .bandeau { margin-top: 4px; }

/* ----- A12 : carte « Formations » de la fiche ----- */

.formations-colonnes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 32px; margin-top: 8px; }
.formations-colonne > h3 { margin: 14px 0 8px; }
.liste-formations { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--bordure); }
.ligne-formation {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  padding: 12px 4px 12px 12px; border-bottom: 1px solid var(--bordure); border-left: 4px solid transparent;
}
.ligne-formation-retard { border-left-color: var(--danger); background: var(--danger-pale); }
.ligne-formation-corps { flex: 1 1 260px; min-width: 0; }
.ligne-formation-nom { font-weight: 700; overflow-wrap: anywhere; }
.ligne-formation-nom > span:first-child { margin-right: 2px; }
.ligne-formation-nom .etiquette { margin-top: 0; }
.ligne-formation-meta { margin-top: 3px; font-size: 14px; color: var(--texte-2); }
.ligne-formation-note { margin-top: 4px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ligne-formation-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.texte-retard { color: var(--danger); font-weight: 750; }
.ligne-formation-meta.texte-retard { color: var(--danger); }
.texte-proche { color: var(--marine); font-weight: 750; }
.formations-vide { padding: 14px 12px; color: var(--texte-2); background: var(--surface-douce); border-radius: var(--rayon); }
.formations-historique { margin-top: 12px; }
.formations-historique > summary {
  display: inline-flex; align-items: center; min-height: 40px; cursor: pointer;
  font-weight: 700; color: var(--bleu); border-radius: var(--rayon-petit);
}
.formations-historique[open] > summary { margin-bottom: 6px; }
.formations-exemptions { grid-column: 1 / -1; }

@media (min-width: 960px) {
  .formations-colonnes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* Bascule « Détail | Liste à cocher » et liste à cocher de la carte « Formations ». */
.formations-bascule { margin: 6px 0 2px; }
.formations-relecture-echec { margin-top: 8px; background: var(--danger-pale); border-left-color: var(--danger); }
.formations-relecture-echec > p { flex: 1 1 240px; }
/* Liste à cocher choisie : la vue Détail reste rendue (pour l'impression) mais cachée à l'écran. */
.carte-formations[data-vue="liste"] .formations-detail { display: none; }
.formations-compteur { margin-top: 8px; font-size: 14px; color: var(--texte-2); }
.formations-compteur strong { color: var(--marine); }
.formations-cocher-filtre { margin: 8px 0 4px; }
.formations-cocher-groupe > h3 { margin: 16px 0 8px; }
.liste-formations-cocher { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--bordure); }
.ligne-formation-cocher {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 18px;
  padding: 10px 4px 10px 12px; border-bottom: 1px solid var(--bordure); border-left: 4px solid transparent;
}
.ligne-formation-cocher-faite { border-left-color: var(--bleu); }
.ligne-formation-cocher-exemptee { border-left-color: var(--texte-2); }
.ligne-formation-cocher-corps { flex: 1 1 260px; min-width: 0; }
.ligne-formation-cocher-cases { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.ligne-formation-cocher-cases .case:has(input:disabled), .ligne-formation-cocher-cases .case input:disabled { cursor: default; }
.ligne-formation-cocher .message-erreur { margin-top: 6px; }

/* ----- Fiche de compétences (carte « Compétences » de la fiche) ----- */

.competences-compteur { margin-top: 4px; font-size: 14px; color: var(--texte-2); }
.competences-compteur strong { color: var(--marine); }
.competences-filtre { margin: 10px 0 4px; }
.competences-section > h3 { margin: 16px 0 8px; }
.liste-competences { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--bordure); }
.ligne-competence {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 18px;
  padding: 10px 4px 10px 12px; border-bottom: 1px solid var(--bordure); border-left: 4px solid transparent;
}
.ligne-competence-acquise { border-left-color: var(--bleu); }
.ligne-competence-corps { flex: 1 1 260px; min-width: 0; }
.ligne-competence-cases { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.ligne-competence-cases .case:has(input:disabled), .ligne-competence-cases .case input:disabled { cursor: default; }
.competence-commentaire { margin-top: 4px; }
.competence-commentaire > summary {
  display: inline-flex; align-items: center; min-height: 36px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--bleu); border-radius: var(--rayon-petit);
}
.competence-commentaire textarea { width: 100%; margin-top: 4px; }
.competence-commentaire-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.ligne-competence .message-erreur { margin-top: 6px; }

/* ----- A12 : rapport des formations ----- */

.tuiles-formations { grid-template-columns: repeat(auto-fit, minmax(160px, 220px)); }
.tuile-retard { background: var(--danger); }
.tuile-retard .tuile-libelle, .tuile-retard .tuile-valeur { color: var(--blanc); }
.filtres-formations { align-items: flex-end; margin-bottom: 14px; }
.filtres-formations > .cases { flex: 1 1 220px; }
.tableau-formations { min-width: 720px; }
.tableau-formations .ligne-retard > th { color: var(--danger); }
.tableau-formations td .etiquette, .tableau-formations th .etiquette { margin-top: 0; }
.formations-vide-rapport { text-align: center; padding: 28px 16px; }

/* ----- Téléphone (390 px) ----- */

@media (max-width: 600px) {
  .carte-entete-ref > .bouton, .carte-entete-ref > .actions { width: 100%; }
  .carte-entete-ref > .bouton { justify-content: center; }
  .carte-entete-ref > .actions > .bouton { flex: 1 1 auto; }
  .ligne-ref { flex-wrap: wrap; padding: 12px 2px; }
  .ligne-ref-corps { flex-basis: calc(100% - 90px); }
  .ligne-ref-actions { flex: 1 1 100%; justify-content: flex-start; }
  .ligne-formation { padding-left: 10px; }
  .ligne-formation-actions { width: 100%; }
  .ligne-competence { padding-left: 10px; }
  .ligne-competence-cases { width: 100%; }
  .ligne-formation-cocher { padding-left: 10px; }
  .ligne-formation-cocher-cases { width: 100%; }

  /* Tableau empilé : une carte par ligne, chaque cellule avec son libellé. */
  .tableau-empilable { min-width: 0; }
  .defilement-horizontal:has(> .tableau-empilable) { overflow-x: visible; }
  .tableau-empilable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tableau-empilable, .tableau-empilable tbody, .tableau-empilable tr, .tableau-empilable th, .tableau-empilable td { display: block; }
  .tableau-empilable tr { padding: 10px 0; border-bottom: 1px solid var(--bordure); }
  .tableau-empilable tbody tr:last-child { border-bottom: 0; }
  .tableau-empilable th, .tableau-empilable td { padding: 3px 0; border: 0; }
  .tableau-empilable td { display: flex; flex-wrap: wrap; gap: 4px 10px; }
  .tableau-empilable td::before { content: attr(data-libelle); min-width: 92px; font-size: 12px; font-weight: 750; color: var(--texte-2); text-transform: uppercase; letter-spacing: 0.04em; }
  .tableau-empilable tbody th { font-size: 16px; }
}
