/* ==========================================================================
   PORTAIL PARENTS — ASSOCIATION ALIF (TAMANI)
   Feuille de style principale — Mobile First, Accessibilité AA, Aucune ressource externe
   CSP Stricte : Aucun style en ligne requis
   ========================================================================== */

:root {
  /* Charte graphique officielle ALIF */
  --color-primary: #4E8F1E;
  --color-primary-dark: #2f5c12;
  --color-primary-hover: #3d7317;
  --color-primary-light: #f0f8ec;
  --color-primary-border: #c8e6b8;

  /* Teintes de fond et cartes */
  --color-bg: #f8fafc;
  --color-card: #ffffff;
  --color-border: #e2e8f0;
  --color-border-subtle: #edf2f7;

  /* Typographie et contrastes (Ratio AA >= 4.5:1 sur texte normal) */
  --color-text-main: #0f172a;       /* Slate-900 (très lisible plein soleil) */
  --color-text-muted: #475569;      /* Slate-600 */
  --color-text-light: #64748b;      /* Slate-500 */
  --color-text-inverse: #ffffff;

  /* États et alertes bienveillants (sans vocabulaire anxiogène) */
  --color-success: #166534;
  --color-success-bg: #dcfce7;
  --color-success-border: #bbf7d0;

  --color-warning: #9a3412;
  --color-warning-bg: #ffedd5;
  --color-warning-border: #fed7aa;

  --color-info: #0369a1;
  --color-info-bg: #e0f2fe;
  --color-info-border: #bae6fd;

  --color-danger: #991b1b;
  --color-danger-bg: #fee2e2;
  --color-danger-border: #fecaca;

  /* WhatsApp */
  --color-whatsapp: #25D366;
  --color-whatsapp-dark: #128C7E;

  /* Tailles et espacements */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --touch-target: 44px; /* Zone tactile minimum recommandée */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 24px rgba(78, 143, 30, 0.15);

  /* Polices système locales (zéro requête réseau) */
  --font-stack: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Réinitialisation propre et dimensionnement */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Règle impérative pour l'attribut standard hidden */
[hidden] {
  display: none !important;
}

html {
  font-size: 16px; /* Empêche le zoom forcé sur mobile */
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-stack);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Accessibilité Clavier */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* En-tête du Portail */
.portal-header {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: var(--color-text-inverse);
  padding: 16px 16px 20px;
  text-align: center;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.portal-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.portal-logo {
  width: 48px;
  height: 48px;
  background-color: #ffffff;
  border-radius: var(--radius-full);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  object-fit: contain;
}

.portal-title {
  font-size: 1.125rem; /* 18px */
  font-weight: 700;
  line-height: 1.2;
}

.portal-subtitle {
  font-size: 0.8125rem; /* 13px */
  opacity: 0.92;
  font-weight: 500;
}

/* Bandeau de fraîcheur des données */
.sync-bar {
  background-color: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.75rem; /* 12px */
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.sync-dot {
  width: 7px;
  height: 7px;
  background-color: #a7f3d0;
  border-radius: var(--radius-full);
  display: inline-block;
}

/* Conteneur principal */
.app-container {
  width: 100%;
  max-width: 520px;
  min-width: 0;
  margin: -10px auto 0;
  padding: 0 14px 40px;
  flex: 1;
}

/* Alertes globales (Données anciennes, Erreur, Hors-ligne) */
.alert-banner {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 0.875rem; /* 14px */
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.alert-warning {
  background-color: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning);
}

.alert-danger {
  background-color: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger);
}

.alert-info {
  background-color: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  color: var(--color-info);
}

/* Carte Élève (Identité) */
.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  min-width: 0;
  max-width: 100%;
}

.student-card {
  text-align: center;
}

.student-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.student-name {
  font-size: 1.25rem; /* 20px */
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 6px;
}

.student-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem; /* 12px */
  font-weight: 600;
  background-color: #f1f5f9;
  color: var(--color-text-muted);
}

/* Navigation principale par onglets */
.nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background-color: #e2e8f0;
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  margin-bottom: 14px;
}

.tab-button {
  min-height: var(--touch-target);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.6875rem; /* 11px sur mobile compact */
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tab-button span {
  max-width: 100%;
  white-space: normal;      /* « Emploi du temps » passe sur 2 lignes plutôt que d'être coupé */
  text-align: center;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.tab-button.active {
  background-color: #ffffff;
  color: var(--color-primary-dark);
  box-shadow: var(--shadow-sm);
}

/* Sections des Volets */
.tab-content {
  display: none;
  min-width: 0;
  max-width: 100%;
}

.tab-content.active {
  display: block;
}

/* Titres de section */
.section-heading {
  font-size: 1rem; /* 16px */
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* KPI Principal : Situation Cotisation */
.kpi-box {
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 14px;
}

.kpi-solde {
  background-color: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success);
}

.kpi-attente {
  background-color: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning);
}

.kpi-label {
  font-size: 0.8125rem; /* 13px */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-amount {
  font-size: 2rem; /* 32px */
  font-weight: 800;
  line-height: 1.2;
  margin: 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.kpi-currency {
  font-size: 1rem;
  font-weight: 700;
}

.kpi-subtext {
  font-size: 0.8125rem; /* 13px */
  opacity: 0.9;
  line-height: 1.4;
}

/* Mise en avant du dernier paiement */
.dernier-paiement-box {
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.dernier-paiement-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background-color: #e8f5e9;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dernier-paiement-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dernier-paiement-label {
  font-size: 0.6875rem; /* 11px */
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dernier-paiement-date {
  font-size: 0.9375rem; /* 15px */
  font-weight: 700;
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Grille des chiffres de l'année */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-item {
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.stat-item.full-width {
  grid-column: span 2;
}

.stat-label {
  font-size: 0.6875rem; /* 11px */
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-val {
  font-size: 1rem; /* 16px */
  font-weight: 700;
  color: var(--color-text-main);
  margin-top: 2px;
}

/* Barre de progression annuelle */
.progress-container {
  margin-top: 12px;
}

.progress-track {
  height: 8px;
  background-color: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.progress-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem; /* 12px */
  font-weight: 600;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Boutons d'action */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--touch-target);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem; /* 14px */
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-whatsapp {
  background-color: var(--color-whatsapp);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.3);
  margin: 12px 0;
}

.btn-whatsapp:hover {
  background-color: #20ba59;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

/* Note d'information bienveillante */
.info-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background-color: #f8fafc;
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8125rem; /* 13px */
  color: var(--color-text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.info-note svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--color-primary);
}

/* Échéancier et listes */
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.item-row:last-child {
  border-bottom: none;
}

.item-title {
  font-size: 0.875rem; /* 14px */
  font-weight: 600;
  color: var(--color-text-main);
}

.item-subtitle {
  font-size: 0.75rem; /* 12px */
  color: var(--color-text-muted);
  margin-top: 1px;
}

.item-right {
  text-align: end;
  flex-shrink: 0;
  margin-left: 8px;
}

.item-amount {
  font-size: 0.875rem; /* 14px */
  font-weight: 700;
  color: var(--color-text-main);
}

/* Badges de statut */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem; /* 11px */
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-top: 2px;
}

.badge-solde {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.badge-partiel {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-attente {
  background-color: #f1f5f9;
  color: var(--color-text-muted);
}

.badge-danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-info {
  background-color: var(--color-info-bg);
  color: var(--color-info);
}

/* Cantine Scolaire */
.cantine-card {
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}

.cantine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.cantine-day-name {
  font-weight: 700;
  font-size: 0.875rem; /* 14px */
  color: var(--color-text-main);
}

.cantine-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.8125rem; /* 13px */
  margin-bottom: 5px;
}

.cantine-tag {
  font-size: 0.6875rem; /* 11px */
  font-weight: 700;
  color: var(--color-primary-dark);
  background-color: var(--color-primary-light);
  padding: 1px 6px;
  border-radius: 4px;
  min-width: 58px;
  text-align: center;
  flex-shrink: 0;
}

/* Formulaires Démarches */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 0.8125rem; /* 13px */
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 4px;
}

.form-select, .form-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem; /* 16px évite zoom iOS */
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--color-text-main);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

/* Suivi des demandes */
.demande-box {
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}

.demande-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.demande-type {
  font-weight: 700;
  font-size: 0.875rem; /* 14px */
}

.demande-comment {
  font-size: 0.8125rem; /* 13px */
  color: var(--color-text-muted);
  margin-bottom: 6px;
  line-height: 1.4;
}

.demande-reply {
  background-color: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--color-primary-dark);
}

/* Pied de page */
.portal-footer {
  text-align: center;
  font-size: 0.75rem; /* 12px */
  color: var(--color-text-light);
  margin-top: 24px;
  line-height: 1.5;
}

.footer-contact {
  margin-bottom: 6px;
}

.footer-link {
  color: var(--color-primary-dark);
  text-decoration: none;
  font-weight: 600;
}

.footer-security {
  font-size: 0.6875rem; /* 11px */
  opacity: 0.8;
  margin-top: 8px;
}

/* Mentions légales (D84) : lien de pied de page et page statique */
.footer-mentions { font-size: 0.6875rem; margin-top: 4px; }
.footer-mentions a, .mentions-retour a { color: inherit; text-decoration: underline; }
.mentions { max-width: 46rem; margin-inline: auto; line-height: 1.55; overflow-wrap: anywhere; }
.mentions h1 { font-size: 1.375rem; margin: 0 0 8px; }
.mentions h2 { font-size: 1.0625rem; margin: 20px 0 6px; }
.mentions p { margin: 0 0 10px; }
.mentions ul { margin: 0 0 10px; padding-left: 20px; }
.mentions-retour { max-width: 46rem; margin: 12px auto 0; font-size: 0.875rem; text-align: center; }

/* États vides (Empty states) */
.empty-state {
  text-align: center;
  padding: 24px 12px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.empty-state-icon {
  margin-bottom: 8px;
  opacity: 0.6;
}

/* Écran de chargement et masque global */
.loading-screen {
  text-align: center;
  padding: 40px 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toolbar pour Mock Dev */
#mock-dev-toolbar {
  position: fixed;
  bottom: 12px;
  right: 12px;
  background: #1e293b;
  color: #ffffff;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  max-width: 250px;
  z-index: 9999;
}

#mock-dev-toolbar.collapsed {
  padding: 6px 10px;
}

#mock-dev-toolbar.collapsed .mock-body {
  display: none;
}

#mock-dev-toolbar .mock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#mock-dev-toolbar .mock-title {
  font-weight: 700;
  font-size: 12px;
}

#mock-dev-toolbar .mock-toggle-btn {
  background: #334155;
  color: #ffffff;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
}

#mock-dev-toolbar .mock-desc {
  font-size: 11px;
  opacity: 0.8;
  margin: 6px 0;
}

#mock-dev-toolbar select {
  width: 100%;
  padding: 6px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 6px;
  background: #334155;
  color: #ffffff;
  border: 1px solid #475569;
}

#mock-dev-toolbar .mock-btn {
  background: #475569;
  color: #ffffff;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  width: 100%;
}

/* Support RTL sans modification structurelle */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .item-right {
  text-align: start;
}

[dir="rtl"] .demande-reply {
  border-left: none;
  border-right: 3px solid var(--color-primary);
}

/* Classes utilitaires pour conformité CSP stricte (zéro attribut style) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.mb-0 { margin-bottom: 0 !important; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 12px; }
.mt-lg { margin-top: 14px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 12px; }
.mb-lg { margin-bottom: 14px; }
.btn-compact { width: auto; min-height: 38px; padding: 6px 12px; }
.text-italic { font-style: italic; }
.color-primary-text { color: var(--color-primary-dark); }
.progress-initial { width: 0%; }

/* Responsive Grand Écran (>= 600px) */
@media (min-width: 600px) {
  .app-container {
    margin-top: -16px;
    padding-inline: 20px;
  }

  .portal-header {
    padding: 24px 20px 28px;
  }

  .portal-logo {
    width: 56px;
    height: 56px;
  }

  .portal-title {
    font-size: 1.375rem; /* 22px */
  }

  .nav-tabs {
    gap: 8px;
    padding: 6px;
  }

  .tab-button {
    font-size: 0.875rem;
    padding: 8px 4px;
  }
}

.turnstile-zone { margin: 12px 0; min-height: 65px; }

/* Liens vers les réseaux sociaux de l'association (icônes SVG intégrées : aucune ressource externe). */
.social-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.social-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  color: #ffffff; font-weight: 700; font-size: 14px; text-decoration: none; line-height: 1;
}
.social-link svg { flex: 0 0 auto; }
.social-facebook { background: #1877f2; }
.social-facebook:hover, .social-facebook:focus-visible { background: #1462c9; }
.social-instagram { background: #c13584; }
.social-instagram:hover, .social-instagram:focus-visible { background: #9d2a6b; }
.social-link:focus-visible { outline: 3px solid #1e293b; outline-offset: 2px; }

/* Sept onglets : deux rangées sur téléphone (grille de 4), une seule rangée sur grand écran. */
@media (min-width: 720px) {
  .nav-tabs { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
}
.item-deadline { color: var(--color-primary-dark); font-weight: 600; }

/* Actualités : annonces de l'association (ADR 0046). `hidden` doit l'emporter sur `display:flex` du bouton. */
.tab-button[hidden] { display: none; }
.tab-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--color-danger);
  color: var(--color-text-inverse); font-size: 0.6875rem; line-height: 18px; text-align: center; }
.annonce { border: 1px solid var(--color-border); border-radius: 12px; padding: 12px; margin-top: 10px; min-width: 0; background: var(--color-card); }
.annonce-nouvelle { border-color: var(--color-primary-border); background: var(--color-primary-light); }
.annonce h4 { margin: 0 0 2px; font-size: 1rem; overflow-wrap: anywhere; }
.annonce-date { font-size: 0.75rem; color: var(--color-text-light); margin-bottom: 6px; }
.annonce-texte p { margin: 0 0 8px; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.45; }
.annonce-lu { font-size: 0.8125rem; color: var(--color-success); font-weight: 700; }

/* Onglet Règlement intérieur (mémo pratique des parents) */
.memo-hours { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.memo-hour-box { background: #f8faf6; border: 1px solid #e6eee0; border-radius: 12px; padding: 10px; min-width: 0; }
.memo-hour-label { font-size: 0.6875rem; font-weight: 700; color: var(--color-primary-dark); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }
.memo-hour-value { font-size: 0.9375rem; font-weight: 800; color: var(--color-text-main); overflow-wrap: anywhere; }
.memo-hour-note { font-size: 0.6875rem; color: var(--color-text-muted); margin-top: 3px; line-height: 1.3; }
.memo-note { border-left: 4px solid; border-radius: 0 10px 10px 0; padding: 10px 12px; font-size: 0.8125rem; line-height: 1.45; margin-top: 10px; }
.memo-note-gold { background: #fdfaf2; border-color: #d4931a; color: #5d4a1f; }
.memo-note-green { background: #f1f8ee; border-color: #689f38; color: #274813; }
.memo-note-orange { background: #fcf6ed; border-color: #e67e22; color: #63360b; }
.memo-intro { font-size: 0.8125rem; color: var(--color-text-muted); margin-bottom: 10px; }
.memo-snack { border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid; }
.memo-snack-no { background: #fff5f5; border-color: #fed7d7; }
.memo-snack-yes { background: #f0fff4; border-color: #c6f6d5; }
.memo-snack-title { font-size: 0.8125rem; font-weight: 800; margin-bottom: 6px; }
.memo-snack-no .memo-snack-title { color: #c53030; }
.memo-snack-yes .memo-snack-title { color: #2f855a; }
.memo-list { list-style: none; margin: 0; padding: 0; font-size: 0.8125rem; line-height: 1.45; color: #334155; }
.memo-list li { margin-bottom: 4px; overflow-wrap: anywhere; }
.memo-rules { margin: 0; padding-left: 22px; font-size: 0.8125rem; line-height: 1.5; color: #334155; }
.memo-rules li { margin-bottom: 9px; padding-left: 4px; }
.memo-rules li::marker { color: #704772; font-weight: 800; }
.memo-closing { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--color-border, rgba(0,0,0,0.08)); font-size: 0.75rem; color: var(--color-text-muted); font-style: italic; }

/* ==========================================================================
   Volet 7 : Emploi du temps (Mobile-first, Accessibilité AA, Règle CSP)
   ========================================================================== */

.edt-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.edt-meta-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.edt-maj-text {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Bascule Vue par jour / Vue semaine */
.edt-view-toggle {
  display: flex;
  background: var(--color-bg);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-bottom: 14px;
  gap: 4px;
}

.btn-toggle-view {
  flex: 1;
  min-height: var(--touch-target, 44px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-view:hover:not(.active) {
  color: var(--color-text-main);
  background: rgba(0, 0, 0, 0.03);
}

.btn-toggle-view.active {
  background: var(--color-card);
  color: var(--color-primary-dark);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.btn-toggle-view:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 1px;
}

.edt-view-section {
  min-width: 0;
  max-width: 100%;
}

/* Barre des 5 jours (Dimanche à Jeudi) */
.edt-days-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 14px;
  min-width: 0;
}

.edt-day-btn {
  min-width: 0;
  min-height: 48px;
  padding: 6px 1px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.edt-day-btn:hover:not(.active) {
  border-color: var(--color-primary-border);
  background: var(--color-primary-light);
}

.edt-day-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(78, 143, 30, 0.25);
}

.edt-day-btn:focus-visible {
  outline: 3px solid var(--color-primary-dark);
  outline-offset: 2px;
}

.edt-day-ar {
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.edt-day-fr {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  margin-top: 1px;
  line-height: 1;
  white-space: nowrap;
}

.edt-day-btn.active .edt-day-fr {
  color: rgba(255, 255, 255, 0.92);
}

/* Liste des créneaux (Vue par jour) */
.edt-day-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.edt-slot-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
  min-width: 0;
}

.edt-slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.edt-slot-time {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-main);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

.edt-slot-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: right;
}

.edt-slot-note {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: right;
}

/* Créneaux discrets : Pause et Repas */
.edt-slot-quiet {
  background: #fbfbfa;
  border-color: #e8e8e4;
  padding: 8px 12px;
  box-shadow: none;
}

.edt-slot-quiet .edt-slot-time {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.edt-slot-quiet .edt-slot-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Badges de types de créneau (AA Contrast) */
.badge-edt-cours {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-edt-activite {
  background-color: #f3e8f5;
  color: #704772;
  border: 1px solid #e2cce6;
}

.badge-edt-pause,
.badge-edt-repas {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-edt-sortie {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-edt-autre {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge-edt-neutre {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* ==========================================================================
   Vue Semaine (Grille RTL, overflow horizontal sans élargir la page)
   ========================================================================== */

.edt-table-wrap {
  direction: rtl;           /* défilement ancré à droite (dimanche) et débordement vers la gauche : la page ne s'élargit jamais */
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-card);
}

.edt-table-wrap:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 1px;
}

.edt-week-table {
  width: 100%;
  min-width: 560px;
  border-collapse: separate;
  border-spacing: 3px;
  padding: 4px;
  table-layout: fixed;
}

.edt-week-table th {
  padding: 8px 4px;
  text-align: center;
  vertical-align: middle;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  color: var(--color-text-main);
  border: 1px solid var(--color-border-subtle);
}

.edt-th-horaire {
  width: 86px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  white-space: nowrap;
  position: sticky;
  right: 0;
  z-index: 2;
  background: #f1f5f9;
  border-left: 1px solid var(--color-border);
}

.edt-th-day {
  font-size: 0.8125rem;
}

.edt-th-ar {
  display: block;
  font-weight: 700;
  line-height: 1.2;
}

.edt-th-fr {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-top: 1px;
  line-height: 1;
}

.edt-td-horaire {
  width: 86px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--color-card);
  border: 1px solid var(--color-border-subtle);
  border-left: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

.edt-td-slot {
  text-align: center;
  vertical-align: middle;
  padding: 6px 4px;
  border-radius: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.8125rem;
  line-height: 1.25;
}

.edt-cell-title {
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.edt-cell-time {
  font-size: 0.6875rem;
  opacity: 0.85;
  display: block;
  font-variant-numeric: tabular-nums;
}

.edt-cell-note {
  font-size: 0.6875rem;
  opacity: 0.85;
  font-style: italic;
  display: block;
  margin-top: 2px;
}

/* Couleurs des cellules de la grille semaine */
.edt-cell-cours {
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.edt-cell-activite {
  background-color: #faf5fc;
  border: 1px solid #e2cce6;
  color: #704772;
}

.edt-cell-pause,
.edt-cell-repas {
  background-color: #fefce8;
  border: 1px solid #fef08a;
  color: #854d0e;
}

.edt-cell-sortie {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.edt-cell-autre,
.edt-cell-neutre {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.edt-cell-empty {
  background-color: #fafaf9;
  border: 1px dashed var(--color-border-subtle);
  border-radius: 4px;
}

/* Élargissement adapté sur grand écran pour confort des 7 onglets et de l'emploi du temps */
@media (min-width: 720px) {
  .app-container {
    max-width: 780px;
  }

  .edt-slot-card {
    padding: 14px 18px;
  }

  .edt-day-btn {
    min-height: 52px;
  }
}

@media (min-width: 1024px) {
  .app-container {
    max-width: 860px;
  }
}


/* =========================================================================
   Règlement intérieur et boîte d'actions (ADR 0044)
   ========================================================================= */
.form-input {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--color-text-main);
  background: var(--color-card); border: 1px solid var(--color-border); border-radius: 8px;
}
.form-input:focus { outline: 3px solid var(--color-primary); outline-offset: 1px; }
.btn-lien {
  background: none; border: 0; padding: 0; font: inherit; color: var(--color-primary-dark);
  text-decoration: underline; cursor: pointer;
}
.alert-success { background-color: var(--color-success-bg); border: 1px solid var(--color-success-border); color: var(--color-success); }

.actions-box { border-left: 4px solid var(--color-warning); }
.actions-liste { list-style: none; margin: 0; padding: 0; }
.actions-item {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0;
}
.actions-item-titre { font-weight: 600; min-width: 0; }

/* Parcours « Mon dossier » (ADR 0061) */
.parcours-box { border-left: 4px solid var(--color-primary); }
.parcours-prochaine { margin: 12px 0; }
.parcours-etapes { list-style: none; margin: 8px 0 0; padding: 0; }
.parcours-etape { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.parcours-marque { flex: 0 0 auto; width: 1.4em; text-align: center; font-weight: 700; }
.parcours-etape-texte { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.parcours-ar { align-self: flex-start; font-size: 0.85em; color: var(--color-text-muted); }
.parcours-etat { flex: 0 0 auto; font-size: 0.85em; font-weight: 600; color: var(--color-text-muted); }
.parcours-fait .parcours-marque { color: var(--color-success); }
.parcours-alerte { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }

.reglement-ecran {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.6); padding: 12px;
}
.reglement-ecran[hidden] { display: none; }
body.reglement-ouvert { overflow: hidden; }
.reglement-panneau {
  background: var(--color-card); border-radius: 14px; width: 100%; max-width: 720px; max-height: 94vh;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.reglement-entete { padding: 16px 18px 8px; }
.reglement-entete h2 { margin: 0 0 4px; font-size: 1.15rem; color: var(--color-primary-dark); }
.reglement-avertissement {
  margin: 8px 0 0; padding: 8px 10px; font-size: 0.875rem; background: var(--color-info-bg);
  border: 1px solid var(--color-info-border); color: var(--color-info); border-radius: 8px;
}
.reglement-texte { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 8px 18px; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.reglement-texte:focus { outline: 3px solid var(--color-primary); outline-offset: -3px; }
.reglement-formulaire, .reglement-accuse { padding: 12px 18px 16px; overflow-y: auto; flex: 0 0 auto; max-height: 45vh; }
.reglement-case { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 12px; font-weight: 600; }
.reglement-case input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; }
.reglement-erreur { color: var(--color-danger); font-weight: 600; margin: 4px 0 8px; }
.reglement-erreur[hidden], .reglement-accuse[hidden], .reglement-formulaire[hidden] { display: none; }
.reglement-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.reglement-actions .btn { width: auto; min-width: 120px; }
.reglement-chapitre { border: 1px solid var(--color-border-subtle); border-radius: 10px; margin: 8px 0; padding: 0 12px; }
.reglement-chapitre-titre { cursor: pointer; font-weight: 700; padding: 10px 0; color: var(--color-primary-dark); }
.reglement-article { padding: 0 0 8px; }
.reglement-article-titre { margin: 8px 0 4px; font-size: 1rem; }
.reglement-paragraphe { margin: 4px 0; line-height: 1.55; }
.reglement-puces { margin: 4px 0 4px 1.2rem; padding: 0; line-height: 1.55; }
.reglement-texte-pane { margin-top: 12px; }
@media (max-width: 480px) {
  .reglement-ecran { padding: 0; }
  .reglement-panneau { max-height: 100vh; height: 100%; border-radius: 0; }
  .reglement-entete { padding: 10px 14px 6px; }
  .reglement-entete h2 { font-size: 1.05rem; }
  .reglement-avertissement { font-size: 0.8125rem; padding: 6px 8px; }
  .reglement-texte { padding: 6px 14px; }
  .reglement-formulaire, .reglement-accuse { padding: 8px 14px 12px; max-height: 52vh; }
  .reglement-formulaire .form-group { margin-bottom: 8px; }
  .reglement-actions .btn { flex: 1 1 calc(50% - 8px); min-width: 0; }
}

/* ADR 0056 : numéros de téléphone et propositions de correction */
.correction-ar { display: block; margin-top: 2px; font-weight: 400; color: var(--color-text-muted, #5b6b5b); }
.correction-ligne .item-subtitle { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
#corrections-formulaire-zone > summary { display: inline-block; cursor: pointer; list-style: none; }
#corrections-formulaire-zone > summary::-webkit-details-marker { display: none; }
#card-coordonnees .form-input, #card-coordonnees .form-select { width: 100%; box-sizing: border-box; }

/* Mon dossier : zone désignée par « Ouvrir », mise en évidence quelques secondes */
.parcours-cible { outline: 3px solid var(--color-primary); outline-offset: 4px; border-radius: 12px; }
