/* admin-mobile-panneaux.css — voir admin-mobile.css pour la base commune (≤ 700 px)
   Panneaux généraux : Tableau de bord, Événements, Archives, Cartes Info, Dons,
   Statistiques, Projet, Adhésions, Configuration, Gestion des accès.
   Rien ici ne s'applique au-dessus de 700 px. */

@media (max-width: 700px) {

  /* ── Formulaires .row2 : un seul écart vertical régulier (gap + marge .fg se cumulaient) ── */
  #p-events .row2, #p-dons .row2, #p-stats .row2, #p-projet .row2, #p-config .row2 { gap: 0 .75rem; }

  /* Bouton « label » d'upload (📷 Upload) : pas de majuscules héritées de .fg label, centré, tactile */
  .panel .fg label.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: .85rem !important;
  }
  #gallery-photos-list label { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }
  #gallery-photos-list > div { flex-wrap: nowrap !important; }
  #gallery-photos-list input:not([type="file"]) { flex: 1 1 auto !important; min-width: 0 !important; flex-basis: 0 !important; }

  /* ════════════════ TABLEAU DE BORD ════════════════ */
  /* 5 statistiques : 2 + 2, la 5ᵉ en bandeau pleine largeur (icône · valeur · libellé) */
  #p-dashboard .dash-grid > .dash-stat:nth-child(5):last-child {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .7rem .8rem;
  }
  #p-dashboard .dash-grid > .dash-stat:nth-child(5):last-child .ico,
  #p-dashboard .dash-grid > .dash-stat:nth-child(5):last-child .lbl { margin: 0; }
  #p-dashboard .dash-stat .lbl { font-size: .66rem; line-height: 1.25; }

  /* En-têtes de carte (titre + bouton) sur une ligne */
  #p-dashboard .dash-act-head h3, #p-dashboard .dash-log-head h3 { min-width: 0; flex: 1 1 auto; border-bottom: 0; padding-bottom: 0; }
  #p-dashboard .dash-act-head .btn, #p-dashboard .dash-log-head .btn { flex: 0 0 auto; white-space: nowrap !important; width: auto !important; }

  /* Actions requises : en-tête de groupe sur une ligne, liste plus lisible */
  #dash-actions .act-group-card > div:first-child { flex-wrap: nowrap !important; }
  #dash-actions .act-group-card > div:first-child > span:nth-child(2) { min-width: 0; line-height: 1.25; }
  #dash-actions .act-group-card button[data-action="dismissAction"] { min-width: 40px; flex: 0 0 auto; }
  #dash-actions .act-group-card ul { font-size: .84rem !important; line-height: 1.45; padding-left: 1.5rem !important; padding-right: .75rem !important; }
  #dash-actions .act-group-card li { margin: .3rem 0 !important; }

  /* Liens de partage : champ sur toute la ligne, Copier / Partager côte à côte */
  #p-dashboard div:has(> input[id^="link-"]) {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
  }
  #p-dashboard div:has(> input[id^="link-"]) > input { grid-column: 1 / -1; font-size: 14px !important; }
  #p-dashboard div:has(> input[id^="link-"]) > .btn { justify-content: center; }

  /* Journal d'activité : plus haut, entrées compactes (date · qui · action · détail) */
  #dash-activity-log { max-height: 65vh !important; font-size: .85rem !important; }
  #dash-activity-log table.m-cards > tbody > tr { padding: .5rem .75rem; margin-bottom: .5rem; }
  #dash-activity-log table.m-cards > tbody > tr > td {
    display: inline !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: .84rem !important;
  }
  #dash-activity-log table.m-cards > tbody > tr > td.log-date { display: block !important; font-size: .74rem !important; margin-bottom: .15rem; }
  #dash-activity-log table.m-cards > tbody > tr > td.log-who::after { content: " · "; font-weight: 400; color: #9ca3af; }
  #dash-activity-log table.m-cards > tbody > tr > td.log-det { display: block !important; margin-top: .15rem; font-size: .8rem !important; }
  #dash-activity-log table.m-cards > tbody > tr > td.log-det:empty { display: none !important; }

  /* ════════════════ ÉVÉNEMENTS / CARTES INFO / ARCHIVES ════════════════ */
  #p-events > div:has(> [data-action="toggleEvForm"]) { margin-bottom: .8rem !important; }
  #p-events > div:has(> [data-action="toggleEvForm"]) > div:empty { display: none; }
  #p-events [data-action="toggleEvForm"] { width: 100%; justify-content: center; min-height: 44px; }

  /* Boutons d'une fiche : grille de 2, le dernier seul s'étend sur la ligne */
  .panel .ev-item-actions,
  #p-archives .ev-item > div:last-child {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    width: 100%;
  }
  .panel .ev-item-actions > .btn,
  #p-archives .ev-item > div:last-child > .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: .45rem .4rem !important;
    font-size: .8rem !important;
  }
  .panel .ev-item-actions > .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
  #p-archives .ev-item { flex-direction: column; align-items: stretch; gap: .6rem; }
  #p-archives .ev-item > div:first-child { width: 100%; }
  #p-sidebar .ev-item-info { padding-right: 0; line-height: 1.4; }

  /* Éditeur d'événement : cases à cocher empilées, actions pleine largeur */
  #ev-form-card > div[style*="background:#f0f7f3"] { flex-direction: column; align-items: flex-start !important; gap: .7rem !important; }
  #ev-form-card > div[style*="background:#f0f7f3"] label { min-height: 32px; }
  #ev-form-card > div:has(> #ev-submit-btn), #sb-form-card > div:has(> #sb-submit-btn),
  #don-form-card > div:has(> #don-submit-btn) {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: .5rem !important;
  }
  #ev-form-card > div:has(> #ev-submit-btn) > .btn, #sb-form-card > div:has(> #sb-submit-btn) > .btn,
  #don-form-card > div:has(> #don-submit-btn) > .btn { justify-content: center; }

  /* ════════════════ STATISTIQUES ════════════════ */
  /* Chiffre + libellé côte à côte, champs alignés en bas */
  #p-stats .st-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) !important; align-items: end; }
  #p-stats .st-pair label { font-size: .68rem; }

  /* ════════════════ CONFIGURATION ════════════════ */
  #p-config .toggle-row span { font-size: .9rem; line-height: 1.35; }
  #p-config .card > div:has(> [data-action="dlJSON"]) { flex-direction: column; align-items: stretch; gap: .5rem !important; }
  #p-config .card > div:has(> [data-action="dlJSON"]) > .btn,
  #p-config [data-action="sendChangePwdCode"], #p-config [data-action="confirmChangePwd"] { width: 100%; justify-content: center; }

  /* ════════════════ ADHÉSIONS ════════════════ */
  #p-adhesions table.m-cards td.adh-nom { font-size: 1rem; padding-top: .65rem !important; }
  #p-adhesions table.m-cards td.adh-actions { padding-top: .5rem !important; }
  #p-adhesions table.m-cards td.adh-actions .adh-traite {
    flex: 1 1 100%;
    display: block;
    font-size: .76rem !important;
  }
  #p-adhesions table.m-cards td.adh-actions .adh-traite:empty { display: none; }
  #p-adhesions table.m-cards td.adh-actions .adh-traite::before { content: "Traitée le "; }
  #p-adhesions table.m-cards td.adh-actions button { flex: 1 1 calc(50% - .2rem) !important; font-size: .85rem; padding: .5rem .6rem; }
  #p-adhesions table.m-cards .montant-input { width: 7rem; }
  #p-adhesions table.m-cards .btn-save-montant { min-width: 44px; margin-left: .4rem; }
  #p-adhesions table.m-cards .cot-select { width: 100%; }

  /* ════════════════ GESTION DES ACCÈS ════════════════ */
  /* Formulaire d'ajout : cases « panneau » en grille de 2 */
  #usr-panels-wrap { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem !important; }
  #usr-panels-wrap label { min-height: 40px; font-size: .82rem !important; gap: 6px !important; line-height: 1.2; }
  #p-acces [data-action="usrAdd"] { width: 100%; justify-content: center; }

  /* Fiche utilisateur : infos sur toute la largeur, boutons en grille dessous */
  #usr-list-wrap .usr-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem !important;
    padding: .9rem .1rem !important;
  }
  #usr-list-wrap .usr-row > .usr-info { grid-column: 1 / -1; min-width: 0; margin-bottom: .25rem; }
  #usr-list-wrap .usr-row > .usr-info > div { font-size: .8rem !important; line-height: 1.4; }
  #usr-list-wrap .usr-row > .usr-info > div:first-child { font-size: .95rem !important; }
  #usr-list-wrap .usr-row > button { width: 100%; font-size: .82rem !important; }
  #usr-list-wrap .usr-row > button[data-action="usrInviter"] { grid-column: 1 / -1; }
  /* « 🔑 Accès » en tête, pleine largeur ; l'éditeur déplié prend toute la ligne */
  #usr-list-wrap .usr-row > button[data-action="usrAcces"] { grid-column: 1 / -1; }
  #usr-list-wrap .usr-row > .usr-acces { grid-column: 1 / -1; padding: .75rem .6rem; }
  .usr-acces-grille { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .usr-acces-grille label { min-height: 44px !important; font-size: .82rem !important; padding: 6px 8px !important; }
  .usr-acces-btns button { flex: 1 1 0; min-height: 44px !important; }

  /* Mot de passe encadreur partagé : champ puis bouton, pleine largeur */
  #aide-enc-pwd { width: 100%; flex: 0 0 auto !important; }
  #aide-enc-pwd::placeholder { font-size: 14px; }
  #p-acces [data-action="aideSetEncPwd"] { width: 100%; justify-content: center; }

  /* Code généré : grand mais jamais plus large que l'écran */
  #usr-code-val { font-size: 1.15rem !important; max-width: 100%; overflow-wrap: anywhere; }
  #cand-lien { overflow-wrap: anywhere; max-width: 100%; }
}
