/* Tableau de bord (pilotage-v1.js) — style « Mac » : widgets arrondis, ombres très douces, sélecteur segmenté,
   anneau de recouvrement, graphique en colonnes avec bulle au survol. Couleurs ardoise et doré. */
@media screen {
  /* « Statistiques » quitte le menu : on y accède depuis « Plus de détails ». */
  .nav-link[data-view="statistics"] { display: none; }

  /* Élèves et Inscriptions réunis (eleves-inscriptions-v1.js) : une entrée de menu, deux onglets, deux boutons. */
  .nav-link[data-view="enrollments"] { display: none; }
  .gs-onglets-eleves { margin: 0 0 16px; }
  #students .gs-barre-eleves > #student-search { order: -3; }
  #students .gs-barre-eleves > #gs-nouvel-eleve { order: -2; white-space: nowrap; }
  #students .gs-barre-eleves > #add-student { order: -1; white-space: nowrap; padding: 9px 13px; font-size: inherit; }
  /* « Compléter les numéros » (numeros-parents-v1.js) : sur la première rangée, après les deux actions principales. */
  #students .gs-barre-eleves > #gs-completer-numeros { order: -1; white-space: nowrap; padding: 9px 13px; font-size: inherit; }
  /* Les six actions secondaires tiennent sur une ligne en 1366 × 768 (police Open Sans, plus large). */
  #students .gs-barre-eleves > .secondary:not(#add-student) { padding: 6px 10px; font-size: 12.5px; }

  /* Menu de gauche légèrement translucide, comme la barre latérale du Finder. */
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .sidebar { background: rgba(58, 69, 75, .94); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); }
  }

  #gs-pilotage { display: grid; gap: 18px; margin-bottom: 22px; }
  .gs-pilotage-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
  .gs-surtitre { margin: 0; color: var(--or-texte, #8a6300); font-weight: 700; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; }
  .gs-pilotage-outils { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
  .gs-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* Sélecteur segmenté (période) */
  .gs-segment { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: #e6eaed; }
  .gs-segment button {
    border: 0; background: transparent; color: var(--ink, #2f3a40); font: inherit; font-size: 13px; font-weight: 600;
    padding: 6px 13px; min-height: 30px; border-radius: 8px; cursor: pointer;
    transition: background-color 160ms ease-out, box-shadow 160ms ease-out, color 160ms ease-out;
  }
  .gs-segment button:hover { color: var(--ardoise, #3a454b); background: rgba(255, 255, 255, .5); }
  .gs-segment button[aria-checked="true"], .gs-segment button[aria-selected="true"] { background: #fff; color: var(--ardoise, #3a454b); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .06); }
  .gs-segment button:active { transform: none; }

  /* Widgets (chiffres clés) */
  .gs-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .gs-kpi {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; text-align: left; min-width: 0;
    padding: 18px 20px 16px; border-radius: 16px; background: #fff; border: 1px solid rgba(0, 0, 0, .05);
    box-shadow: 0 1px 1px rgba(16, 24, 32, .04), 0 8px 24px rgba(16, 24, 32, .06);
    color: var(--ink, #2f3a40); font: inherit; cursor: pointer;
    transition: transform 160ms cubic-bezier(.2, .8, .2, 1), box-shadow 200ms ease-out;
  }
  .gs-kpi:hover { transform: translateY(-1px); box-shadow: 0 1px 1px rgba(16, 24, 32, .04), 0 14px 32px rgba(16, 24, 32, .1); }
  .gs-kpi:active { transform: scale(.985); }
  .gs-kpi-texte { display: flex; flex-direction: column; gap: 6px; min-width: 0; height: 100%; }
  .gs-kpi-label { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted, #5d6970); }
  .gs-kpi strong { font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; color: var(--ardoise, #3a454b); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .gs-kpi.negatif strong { color: #b3261e; }
  .gs-kpi.positif strong { color: #137a51; }
  .gs-kpi small { color: var(--muted, #5d6970); font-size: 12.5px; line-height: 1.4; }
  .gs-kpi small b { color: var(--ink, #2f3a40); font-weight: 650; }
  .gs-kpi.alerte small b { color: #8a4b00; }
  .gs-kpi em { margin-top: auto; padding-top: 6px; font-style: normal; font-size: 12.5px; font-weight: 650; color: #2c5a73; }
  .gs-kpi.avec-visuel { position: relative; }
  .gs-kpi.avec-visuel small { padding-right: 54px; }
  .gs-anneau { position: absolute; bottom: 14px; right: 16px; width: 46px; height: 46px; }
  .gs-anneau text { font: 700 12px 'Open Sans', system-ui, sans-serif; fill: var(--ardoise, #3a454b); }

  /* À faire + Mois par mois */
  .gs-pilotage-bas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
  .gs-bloc.card { padding: 18px 20px; border-radius: 16px; border: 1px solid rgba(0, 0, 0, .05); box-shadow: 0 1px 1px rgba(16, 24, 32, .04), 0 8px 24px rgba(16, 24, 32, .06); }
  .gs-bloc-tete { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line, #e3e7ea); }
  .gs-bloc-tete h2 { margin: 0; font-size: 1.05rem; color: var(--ardoise, #3a454b); }
  .gs-bloc-tete h2::after { content: ''; display: block; width: 28px; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--or, #f9bf3b); }
  .gs-bloc-tete > span { color: var(--muted, #5d6970); font-size: 12.5px; }
  .gs-afaire .gs-bloc-tete > span::first-letter { text-transform: uppercase; }
  .gs-vide { color: var(--muted, #5d6970); margin: 12px 0; }

  .gs-retards-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 4px; }
  .gs-retards ol { list-style: none; margin: 0; padding: 0; }
  .gs-retards li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eef1f3; }
  .gs-retards li > span { min-width: 0; cursor: pointer; }
  .gs-retards li b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gs-retards li small { display: block; color: var(--muted, #5d6970); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gs-retards li > strong { color: #8a4b00; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .gs-retards .gs-encaisser { padding: 6px 13px; min-height: 30px; font-size: 13px; border-radius: 8px; }

  .gs-todos { list-style: none; margin: 8px 0 0; padding: 0; }
  .gs-todo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eef1f3; }
  .gs-todo:last-child { border-bottom: 0; }
  .gs-todo span { min-width: 0; }
  .gs-todo b { display: block; }
  .gs-todo small { display: block; color: var(--muted, #5d6970); font-size: 12.5px; }
  .gs-todo .secondary { white-space: nowrap; padding: 6px 13px; min-height: 30px; font-size: 13px; border-radius: 8px; }

  /* Graphique mois par mois */
  .gs-legende { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .gs-legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
  .gs-graphe-zone { position: relative; margin-top: 10px; }
  .gs-graphe-place { width: 100%; overflow: hidden; }
  .gs-graphe { display: block; max-width: 100%; height: auto; }
  .gs-graphe .gs-axe { font: 11px 'Open Sans', system-ui, sans-serif; fill: #7a868d; }
  .gs-graphe .gs-mois-nom { font: 600 12px 'Open Sans', system-ui, sans-serif; fill: var(--ink, #2f3a40); text-transform: capitalize; }
  .gs-graphe .gs-mois-nom.courant { fill: var(--or-texte, #8a6300); }
  .gs-graphe .gs-mois-res { font: 600 11px 'Open Sans', system-ui, sans-serif; }
  .gs-graphe .gs-mois-res.pos { fill: #137a51; }
  .gs-graphe .gs-mois-res.neg { fill: #b3261e; }
  .gs-graphe .gs-cible { cursor: default; outline: none; }
  .gs-graphe .gs-cible.actif, .gs-graphe .gs-cible:focus-visible { fill: rgba(58, 69, 75, .05); }
  .gs-bulle {
    position: absolute; z-index: 5; pointer-events: none; min-width: 190px; padding: 10px 12px; border-radius: 12px;
    background: rgba(255, 255, 255, .92); border: 1px solid rgba(0, 0, 0, .08); box-shadow: 0 10px 30px rgba(16, 24, 32, .16);
    font-size: 12.5px; display: grid; gap: 4px;
  }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .gs-bulle { background: rgba(255, 255, 255, .78); -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); } }
  .gs-bulle[hidden] { display: none; }
  .gs-bulle b { text-transform: capitalize; margin-bottom: 2px; }
  .gs-bulle span { display: flex; align-items: center; gap: 6px; color: var(--muted, #5d6970); }
  .gs-bulle span i { width: 9px; height: 9px; border-radius: 3px; }
  .gs-bulle em { margin-left: auto; padding-left: 12px; font-style: normal; font-weight: 650; color: var(--ink, #2f3a40); font-variant-numeric: tabular-nums; }
  .gs-bulle .gs-bulle-res { border-top: 1px solid #eef1f3; padding-top: 4px; margin-top: 2px; }
  .gs-bulle em.pos, .gs-totaux b.pos { color: #137a51; }
  .gs-bulle em.neg, .gs-totaux b.neg { color: #b3261e; }
  .gs-totaux { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 6px; padding-top: 10px; border-top: 1px solid #eef1f3; color: var(--muted, #5d6970); font-size: 12.5px; }
  .gs-totaux b { color: var(--ink, #2f3a40); font-variant-numeric: tabular-nums; margin-left: 4px; }
  .gs-chiffres { margin-top: 10px; }
  .gs-chiffres > summary { cursor: pointer; color: #2c5a73; font-weight: 600; font-size: 13px; }
  .gs-mois-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-top: 8px; }
  .gs-mois-table th { background: transparent; padding: 8px 8px 6px; font-size: 11px; text-align: right; }
  .gs-mois-table th:first-child { text-align: left; }
  .gs-mois-table td { padding: 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid #eef1f3; }
  .gs-mois-table td:first-child { text-align: left; text-transform: capitalize; font-weight: 600; }
  .gs-mois-table td:first-child small { display: block; font-weight: 400; text-transform: none; color: var(--or-texte, #8a6300); font-size: 11px; }
  .gs-mois-table tbody tr:hover { background: transparent; }
  .gs-mois-table .pos { color: #137a51; font-weight: 650; }
  .gs-mois-table .neg { color: #b3261e; font-weight: 650; }

  /* Plus de détails (ancien tableau de bord, intact) */
  #gs-plus-details { border: 1px solid rgba(0, 0, 0, .05); border-radius: 16px; background: #fff; margin-bottom: 18px; box-shadow: 0 1px 1px rgba(16, 24, 32, .04); }
  #gs-plus-details > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 14px 18px; border-radius: 16px; }
  #gs-plus-details > summary::-webkit-details-marker { display: none; }
  #gs-plus-details > summary::before { content: '+'; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: #eef1f3; color: var(--ardoise, #3a454b); font-weight: 700; align-self: center; }
  #gs-plus-details[open] > summary::before { content: '−'; }
  #gs-plus-details > summary span { font-weight: 700; color: var(--ardoise, #3a454b); }
  #gs-plus-details > summary small { color: var(--muted, #5d6970); }
  #gs-plus-details > summary:hover { background: #f7f9fa; }
  #gs-plus-details .gs-plus-corps { padding: 4px 18px 18px; border-top: 1px solid var(--line, #e3e7ea); }
  #gs-plus-details .dashboard-filter { display: none; }
  .gs-plus-stats { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 0; margin-bottom: 14px; border-bottom: 1px solid var(--line, #e3e7ea); }
  .gs-plus-stats p { margin: 0; color: var(--muted, #5d6970); }
  #gs-controle-donnees { margin-top: 18px; }

  @media (max-width: 1180px) { .gs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gs-pilotage-bas { grid-template-columns: 1fr; } }
  /* Téléphone : écran Élèves rangé (recherche pleine largeur, puis « + Nouvel élève » et « Réinscription », puis le reste). */
  @media (max-width: 600px) {
    #students .toolbar.gs-barre-eleves { display: flex; }
    #students .gs-barre-eleves > #student-search { flex: 1 1 100%; }
    #students .gs-barre-eleves > #gs-nouvel-eleve, #students .gs-barre-eleves > #add-student { flex: 1 1 0; }
    #students .gs-barre-eleves > #gs-completer-numeros { order: -1; flex: 1 1 100%; }
    #students .gs-barre-eleves > * { margin-bottom: 0 !important; }
  }
  @media (max-width: 560px) {
    .gs-kpis { grid-template-columns: 1fr; }
    .gs-segment { width: 100%; } .gs-segment button { flex: 1; padding: 6px 4px; }
    .gs-retards li { grid-template-columns: minmax(0, 1fr) auto; }
    .gs-retards li .gs-encaisser { grid-column: 1 / -1; justify-self: start; }
  }
  @media (prefers-reduced-motion: reduce) { .gs-kpi, .gs-segment button { transition: none; } .gs-kpi:hover, .gs-kpi:active { transform: none; } }
  @media (prefers-reduced-transparency: reduce) { .sidebar { background: var(--ardoise, #3a454b); -webkit-backdrop-filter: none; backdrop-filter: none; } .gs-bulle { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; } }

  /* Relance WhatsApp en série (relance-whatsapp-v1.js) */
  .gs-relance-bouton { width: 100%; margin: 6px 0 8px; padding: 10px 14px; min-height: 40px; border-radius: 10px; border: 1px solid #b9e2c8; background: #eaf7ef; color: #0f6b3a; font: inherit; font-weight: 650; cursor: pointer; }
  .gs-relance-bouton:hover { background: #def2e6; }
  #overdue-panel .gs-relance-tous { margin-left: 10px; }
  #gs-relance { width: min(620px, 96vw); max-height: 90vh; padding: 0; border-radius: 18px; }
  #gs-relance[open] { display: flex; flex-direction: column; }
  .gs-relance-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 12px; }
  .gs-relance-tete h2 { margin: 0; font-size: 1.15rem; color: var(--ardoise, #3a454b); }
  .gs-relance-tete p { margin: 4px 0 0; color: var(--muted, #5d6970); font-size: 13px; }
  .gs-relance-auto { margin: 0 22px 10px; padding: 9px 12px; border-radius: 10px; background: #f2f4f6; font-size: 13px; color: var(--ink, #2f3a40); }
  .gs-relance-progres { height: 6px; margin: 0 22px; border-radius: 99px; background: #e6ebef; overflow: hidden; }
  .gs-relance-progres i { display: block; height: 100%; background: #1f9d55; border-radius: 99px; transition: width 300ms ease-out; }
  .gs-relance-suivant { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 22px 0; padding: 14px 16px; border-radius: 14px; background: #f4faf6; border: 1px solid #cfe9d8; }
  .gs-relance-suivant small { display: block; color: var(--muted, #5d6970); font-size: 12px; }
  .gs-relance-suivant b { display: block; font-size: 1.05rem; }
  .gs-relance-suivant span { color: var(--muted, #5d6970); font-size: 13px; }
  .gs-relance-actions { display: flex; gap: 8px; }
  .gs-relance-actions .primary { background: #1f9d55; }
  .gs-relance-actions .primary:hover { background: #17834a; }
  .gs-relance-aide { margin: 8px 22px 0; color: var(--muted, #5d6970); font-size: 12.5px; }
  .gs-relance-fini { margin: 14px 22px 0; padding: 14px 16px; border-radius: 14px; background: #f4faf6; display: grid; gap: 4px; }
  .gs-relance-fini span { color: var(--muted, #5d6970); font-size: 13px; }
  .gs-relance-option { margin: 12px 22px 0; font-weight: 400; font-size: 13px; }
  .gs-relance-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 22px 0; font-size: 13px; color: var(--muted, #5d6970); }
  .gs-relance-liste { list-style: none; margin: 10px 0 0; padding: 0 22px; overflow: auto; flex: 1; min-height: 80px; }
  .gs-relance-liste li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eef1f3; }
  .gs-relance-liste li.courant { background: #f7fbf8; }
  .gs-relance-liste b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gs-relance-liste small { color: var(--muted, #5d6970); font-size: 12px; }
  .gs-relance-liste em { font-style: normal; font-size: 12px; color: var(--muted, #5d6970); white-space: nowrap; }
  .gs-relance-sans { margin: 8px 22px 18px; }
  .gs-relance-sans summary { cursor: pointer; font-weight: 600; color: #8a4b00; }
  .gs-relance-sans ul { list-style: none; padding: 0; margin: 6px 0 0; }
  .gs-relance-sans li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #eef1f3; font-size: 13px; }
  #gs-relance > :last-child { margin-bottom: 18px; }

  /* Boutons d'action des retards (WhatsApp, convocations) côte à côte */
  .gs-retards-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
  .gs-retards-actions > * { flex: 1 1 200px; margin: 0; min-height: 40px; border-radius: 10px; }
  #overdue-panel .gs-convocations { margin-left: 10px; }
  /* Convocations des parents en retard (convocations-v1.js) */
  #gs-convocations { width: min(760px, 96vw); max-height: 92vh; padding: 0; border-radius: 18px; }
  #gs-convocations[open] { display: flex; flex-direction: column; }
  .gs-convoc-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 10px; }
  .gs-convoc-tete h2 { margin: 0; font-size: 1.15rem; color: var(--ardoise, #3a454b); }
  .gs-convoc-tete p { margin: 4px 0 0; color: var(--muted, #5d6970); font-size: 13px; }
  .gs-convoc-reglages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; padding: 4px 22px 12px; border-bottom: 1px solid var(--line, #e3e7ea); }
  .gs-convoc-reglages label { margin: 0; font-size: 12px; display: grid; gap: 4px; }
  .gs-convoc-reglages .gs-convoc-large { grid-column: 1 / -1; }
  .gs-convoc-format { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; color: var(--muted, #5d6970); }
  .gs-convoc-format .gs-check { display: inline-flex; font-weight: 400; color: var(--ink, #2f3a40); }
  .gs-convoc-liste-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 22px 4px; font-size: 12.5px; color: var(--muted, #5d6970); }
  .gs-convoc-liste-tete .gs-check { font-weight: 600; color: var(--ink, #2f3a40); font-size: 13px; margin: 0; }
  .gs-convoc-liste { list-style: none; margin: 0; padding: 0 22px; overflow: auto; flex: 1; min-height: 120px; }
  .gs-convoc-liste li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #eef1f3; }
  .gs-convoc-liste li.retire { opacity: .55; }
  .gs-convoc-liste .gs-check { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 400; min-width: 0; }
  .gs-convoc-liste .gs-check span { min-width: 0; }
  .gs-convoc-liste b { display: block; }
  .gs-convoc-liste small { display: block; color: var(--muted, #5d6970); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gs-convoc-liste strong { color: #8a4b00; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .gs-convoc-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 22px 18px; border-top: 1px solid var(--line, #e3e7ea); }
  .gs-convoc-pied .gs-check { margin: 0; font-weight: 400; font-size: 13px; }
  @media (max-width: 640px) { .gs-convoc-reglages { grid-template-columns: 1fr 1fr; } }

  /* Élève transféré dans la liste Élèves */
  .gs-tag-transfere { background: #eef1f3; color: #4a565d; }
}
