/* Page de gestion de l'équipe (offre Pro / Collectivité), voir js/equipe.js. Mêmes briques que le back-office (css/admin.css) :
   cartes de chiffres, onglets, tableaux, menu « ⋯ ». Le logo de la barre du haut y est rouge (css/style.css, data-page="equipe"). */
.eq { display: flex; flex-direction: column; gap: 16px; }
.eq-chargement { padding: 24px 0; }
.eq-tete { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 2px; }
.eq-tete-titre { display: flex; align-items: center; gap: 14px; min-width: 0; }
.eq-tete h1 { font-size: 1.5rem; margin: 0; }
.eq-tete p { margin: 4px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.eq .eq-note { margin: 0; }
/* Interrupteur « Équipe / Postes séparés » (propriétaire) : deux positions, la choisie en relief */
.eq-mode { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.eq-mode-choix {
  padding: 5px 14px; border: 0; border-radius: 999px; background: none;
  color: var(--text-2); font: inherit; font-size: 0.86rem; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.eq-mode-choix:hover { color: var(--text); }
.eq-mode-choix[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); cursor: default; }
.eq-mode-choix:disabled { opacity: 0.55; cursor: progress; }

/* Cartes de chiffres : deux au plus, de même largeur et de même hauteur (la plus courte s'aligne sur l'autre), sans s'étirer sur toute la largeur. */
.eq-stats { display: flex; flex-wrap: wrap; gap: 12px; }
.eq-stat { flex: 0 1 260px; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.eq-stat strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.eq-stat > span { color: var(--text-2); font-size: 0.86rem; }
.eq-stat small { font-size: 0.8rem; }
.eq-stat.is-plein strong { color: var(--warning); }
.eq-barre { display: block; height: 6px; margin: 6px 0 2px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.eq-barre > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.eq-stat.is-plein .eq-barre > span { background: var(--warning); }

/* Onglets : .onglets / .onglet (style.css) ; nombre à côté du nom. */
.eq-nb { margin-left: 2px; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); font-size: 0.78rem; font-weight: 600; }
.eq-panneau { display: flex; flex-direction: column; gap: 12px; }
/* Barre d'un onglet : recherche à gauche, réglage au centre, action à droite. Les deux côtés font la même largeur,
   donc le réglage est centré pour de vrai (même place dans les deux onglets). */
.eq-barre-onglet { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.eq-barre-onglet > :nth-child(2) { justify-self: center; }
.eq-barre-onglet > :last-child { justify-self: end; }
.eq-barre-onglet p { margin: 0; }
.eq-barre-onglet .btn[hidden] { display: none; }
.eq-recherche { justify-self: start; width: 100%; max-width: 380px; }
.eq-vide { padding: 20px; }
.eq-plein { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--warning-soft); color: var(--text); font-size: 0.88rem; }

/* Tableaux */
/* Le tableau suit les coins arrondis de sa carte : rien ne dépassant du cadre, et pas de trait sous la dernière ligne (le bord
   de la carte fait la ligne). */
.eq-table { margin: 0; padding: 0; overflow: hidden; }
.eq-table .table tbody tr { cursor: default; }
.eq-table .table th, .eq-table .table td { padding-left: 12px; padding-right: 12px; }
.eq-table .table th:first-child, .eq-table .table td:first-child { padding-left: 20px; }
.eq-table .table td { vertical-align: middle; }
.eq-table .nowrap { white-space: nowrap; }
.eq-actions { text-align: right; white-space: nowrap; }
.eq-invitation td { background: var(--surface-2); }
.eq-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.eq-lien { color: inherit; }
.eq-table .table tbody tr[data-gerer] { cursor: pointer; }
.eq-table .table tbody tr[data-gerer]:hover td { background: var(--surface-2); }
@media (min-width: 901px) {
  .eq-table .table tbody tr:last-child td { border-bottom: 0; }
}
.eq-lien:hover strong { color: var(--primary); }
.eq-av { min-width: 150px; }
.eq-av .av-bar { width: 150px; }
.chip-plus { text-decoration: none; color: var(--primary); font-weight: 600; }

/* Fenêtres d'ajout, de réglage et de création */
.eq-sous-titre { margin: 4px 0 6px; font-size: 0.86rem; font-weight: 600; }
.eq-champ { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; font-weight: 600; margin-bottom: 10px; }
.eq-champ .muted { font-weight: 400; }
.eq-acces { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.eq-acces[hidden] { display: none; }
.eq-acces legend { font-size: 0.86rem; font-weight: 600; padding: 0 6px; }
.eq-case { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; font-weight: 400; cursor: pointer; }
.eq-case input { margin-top: 3px; flex: none; }
.eq-case[hidden] { display: none; }
.eq-archives { align-items: center; }
.eq-archives input { margin-top: 0; }
/* Réglage d'une barre d'onglet (membres qui créent et archivent, chantiers archivés) : interrupteur discret, sans cadre. */
.eq-interrupteur { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-2); cursor: pointer; user-select: none; }
.eq-interrupteur input { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 28px; height: 16px; margin: 0;
  border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: background 0.15s; }
.eq-interrupteur input::before { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25); transition: transform 0.15s; }
.eq-interrupteur input:checked { background: var(--primary); }
.eq-interrupteur input:checked::before { transform: translateX(12px); }
.eq-interrupteur input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.eq-interrupteur input:disabled { opacity: 0.5; cursor: default; }
.eq-interrupteur:has(input:checked) { color: var(--text); }
.eq-liste-chantiers { margin: 2px 0 4px 24px; max-height: 190px; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.eq-liste-chantiers[hidden] { display: none; }
.eq-liste-cases { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow: auto; padding: 4px 2px; }
.eq-creer { padding-top: 6px; border-top: 1px solid var(--border); margin-top: 2px; }
.eq .field-error, .dialog .field-error { margin: 6px 0; }

@media (max-width: 680px) {
  .eq-actions { text-align: left; }
}

/* Mot de passe provisoire à remettre (affiché une seule fois) */
.equipe-ident { max-width: 520px; }
.equipe-ident-liste { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0; font-size: 0.92rem; }
.equipe-ident-liste dt { color: var(--text-2); }
.equipe-ident-liste dd { margin: 0; overflow-wrap: anywhere; }
.equipe-mdp { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.04em; }

/* Invitation à rejoindre une équipe : écran de connexion (js/connexion.js) */
.auth:has(.invitations) { max-width: 520px; }
.invitations { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.invitation { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); background: var(--surface-2, var(--bg)); }
.invitation h2 { margin: 0 0 4px; font-size: 1.1rem; }
.invitation p { margin: 0 0 10px; }
.invitation-details { margin: 0 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; }
.invitation-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.auth .invitation-actions .btn { width: auto; }

/* Mention « Partagé · Équipe » sur les chantiers venus de l'équipe d'un autre */
.badge-partage { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page d'un chantier : colonne des comptes qui y ont accès, dans la marge de droite (la page garde sa largeur et son centrage ;
   js/equipe.js, panneauChantier). Sur un écran trop étroit pour la marge, elle passe sous le contenu. */
.eq-acces-nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
@media (min-width: 1740px) {
  .eq-acces-chantier { position: absolute; top: 24px; left: calc(100% - 8px); width: 270px; margin-top: 0; }
}

/* Page d'une personne (#/equipe/<id>) : elle prend toute la page ; la flèche de retour ronde des autres pages à gauche
   (ici un bouton : elle referme la page) et « Enregistrer » à droite, qui porte le formulaire du dessous. */
.eq-fiche { display: flex; flex-direction: column; gap: 16px; }
.eq-fiche .eq-tete { margin-top: 0; }
.eq-fiche .back-btn { padding: 0; cursor: pointer; }
/* Nom d'une personne gérable : un bouton qui a l'air d'un texte (la ligne entière se clique aussi). */
.eq-personne { padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--text); text-align: left; cursor: pointer; }
.eq-personne:hover { color: var(--primary); text-decoration: underline; }
.eq-fiche-bloc { padding: 16px 18px; }
.eq-fiche-infos { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 0.9rem; }
.eq-fiche-infos dt { color: var(--text-2); }
.eq-fiche-infos dd { margin: 0; }
.eq-fiche-infos .eq-nom { font-weight: 600; }
/* Carte du haut : l'identité de la personne, et dans le coin le menu « ⋯ » (code de connexion, retrait de l'équipe). */
.eq-fiche-entete { position: relative; padding-right: 60px; }
.eq-fiche-entete > .eq-menu { position: absolute; top: 10px; right: 10px; }
.eq-fiche-entete > .eq-menu > summary { color: var(--text-3); }
.eq-fiche-entete > .eq-menu > summary:hover, .eq-fiche-entete > .eq-menu[open] > summary { background: var(--surface-3); color: var(--text); }

/* « Rôle » et « Chantiers » : deux cases côte à côte, la doc des rôles sous la liste déroulante (js/equipe-membres.js).
   Sous 900 px, les cases passent l'une sous l'autre. */
.eq-droits { display: grid; gap: 16px; margin: 0; }
.eq-droits > [data-fiche-champs] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.eq-droits > [data-fiche-champs] > .field-error { grid-column: 1 / -1; }
.eq-droit { display: flex; flex-direction: column; gap: 12px; }
.eq-droit > h2, .eq-droit-tete h2 { margin: 0; }
.eq-droit .eq-champ { margin-bottom: 0; }
.eq-droit-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.eq-doc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.eq-doc-titre { margin: 0; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-3); }
.eq-doc-liste { display: flex; flex-direction: column; gap: 7px; margin: 0; }
.eq-doc-ligne { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; font-size: 0.85rem; line-height: 1.35; }
.eq-doc-ligne dt { font-weight: 600; color: var(--text); }
.eq-doc-ligne dd { margin: 0; color: var(--text-2); }
.eq-doc-ligne.is-actif dt { color: var(--primary); }
.eq-doc-ligne.is-actif dd { color: var(--text); }
.eq-doc-note { margin: 0; font-size: 0.8rem; line-height: 1.4; color: var(--text-3); }
.eq-fiche .eq-liste-chantiers { max-height: 300px; }
.eq-liste-chantiers.sans-archives .eq-case[data-archive] { display: none; }
@media (max-width: 900px) {
  .eq-droits > [data-fiche-champs] { grid-template-columns: minmax(0, 1fr); }
  /* Barre d'un onglet : une seule colonne, tout à gauche. */
  .eq-barre-onglet { grid-template-columns: minmax(0, 1fr); }
  .eq-barre-onglet > :nth-child(2), .eq-barre-onglet > :last-child { justify-self: start; }
  .eq-recherche { max-width: none; }
}
