/* ============================================================
   PORTAIL PARENT - SECUREECOLE
   Design System & Global Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

/* ── Filet de sécurité : .d-none ne doit JAMAIS dépendre du CDN Bootstrap.
   Tout le mécanisme afficher/masquer de la SPA (login vs dashboard, chaque
   page-section, tous les modals) repose sur cette classe. Si le CDN
   jsDelivr est bloqué/lent/hors-ligne, Bootstrap ne charge pas → .d-none
   n'existe nulle part → login-page ET app-shell restent visibles en même
   temps, superposés (bug observé en conditions réelles le 2026-08-06). */
.d-none { display: none !important; }

:root {
  /* Brand Colors */
  --primary:        #1a3c5e;
  --primary-light:  #2563a8;
  --primary-glow:   rgba(37, 99, 168, 0.15);
  --accent:         #e8a020;
  --accent-light:   #f5c35a;
  --success:        #16a34a;
  --danger:         #dc2626;
  --warning:        #d97706;

  /* Neutrals */
  --bg:             #f0f4f8;
  --bg-card:        #ffffff;
  --border:         #dde3ec;
  --text:           #0f1f33;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(15,31,51,.06), 0 1px 2px rgba(15,31,51,.04);
  --shadow-md:  0 4px 16px rgba(15,31,51,.08), 0 1px 4px rgba(15,31,51,.04);
  --shadow-lg:  0 10px 40px rgba(15,31,51,.12), 0 2px 8px rgba(15,31,51,.06);
  --shadow-accent: 0 6px 24px rgba(232,160,32,.25);

  /* Layout */
  --sidebar-w:  260px;
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', sans-serif;

  /* Transitions */
  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

body {
  /* font-family: var(--font-body); */
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1, h2, h3 { 
  /* font-family: var(--font-display);  */
  font-weight: 600; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--primary);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .school-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.sidebar-brand .logo-icon {
  width: 42px; height: 42px;
  background: var(--accent);
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
}
.sidebar-brand .school-name {
  color: white;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.1;
}
.sidebar-brand .school-tagline {
  color: rgba(255,255,255,.5);
  font-size: .7rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* Parent info card in sidebar */
.sidebar-user {
  margin: 16px;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .user-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user .user-name { color: white; font-weight: 600; font-size: .85rem; }
.sidebar-user .user-role { color: rgba(255,255,255,.5); font-size: .72rem; }

/* Nav */
.sidebar-nav { padding: 8px 12px; flex: 1; }
.nav-section-label {
  color: rgba(255,255,255,.35);
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 12px 12px 4px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-weight: 500;
  font-size: .875rem;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}
.nav-item i { font-size: 1.1rem; width: 20px; }
.nav-item:hover {
  background: rgba(255,255,255,.1);
  color: white;
}
.nav-item.active {
  background: rgba(255,255,255,.15);
  color: white;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer .nav-item { color: rgba(255,255,255,.5); }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-w));
}

/* Topbar */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  gap: 12px;
  min-width: 0;
  /* overflow visible — nécessaire pour le dropdown enfants */
  overflow: visible;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
/* Burger : caché sur grand écran, visible sinon */
.topbar-burger {
  display: none;
  flex-shrink: 0;
}
@media (max-width: 992px) {
  .topbar-burger { display: grid; }
}
/* Bouton profil masqué sur mobile */
@media (max-width: 576px) {
  .topbar-profil-btn { display: none; }
}
.topbar-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.btn-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  display: grid; place-items: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1rem;
  position: relative;
}
.btn-icon:hover { background: var(--bg); color: var(--primary); border-color: var(--primary); }
.btn-icon .badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid white;
}

/* Child selector pill */
.child-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-glow);
  border: 1px solid rgba(37,99,168,.2);
  border-radius: 40px;
  padding: 6px 14px 6px 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.child-selector:hover { background: rgba(37,99,168,.2); }
.child-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  display: grid; place-items: center;
  color: white;
  font-size: .75rem;
  font-weight: 700;
}
.child-name { font-weight: 600; font-size: .8rem; color: var(--primary); }
.child-class { font-size: .7rem; color: var(--text-muted); }

/* Page content */
.page-body { padding: 24px 28px; flex: 1; min-width: 0; overflow-x: hidden; }
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 1.6rem; color: var(--text); }
.page-header p { color: var(--text-muted); font-size: .875rem; margin-top: 4px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--primary-light); }
.card-body { padding: 22px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 20px; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #e0eaff; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }

.stat-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.stat-change {
  font-size: .72rem;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   NOTES / GRADES TABLE
   ============================================================ */
.grades-table { width: 100%; border-collapse: collapse; }
.grades-table thead tr th {
  background: var(--bg);
  padding: 10px 16px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.grades-table tbody tr td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  color: var(--text);
}
.grades-table tbody tr:last-child td { border-bottom: none; }
.grades-table tbody tr:hover td { background: var(--bg); }

.subject-name { font-weight: 600; }
.coef-badge {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Note pill */
.note-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .85rem;
  font-family: var(--font-display);
}
.note-pill.excellent { background: #dcfce7; color: #15803d; }
.note-pill.bien      { background: #dbeafe; color: #1d4ed8; }
.note-pill.passable  { background: #fef3c7; color: #92400e; }
.note-pill.mediocre  { background: #fee2e2; color: #991b1b; }

.appreciation-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .75rem;
  font-weight: 600;
}

/* ============================================================
   PAYMENT MODULE
   ============================================================ */
.payment-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }

.amount-summary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  padding: 28px;
  color: white;
  position: relative;
  overflow: hidden;
}
.amount-summary::before {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.amount-summary::after {
  content: '';
  position: absolute;
  right: 20px; bottom: -60px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.amount-label { font-size: .8rem; opacity: .7; text-transform: uppercase; letter-spacing: .08em; }
.amount-value { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; margin: 6px 0; }
.amount-currency { font-size: 1rem; opacity: .8; }

.payment-methods { display: flex; flex-direction: column; gap: 12px; }
.payment-method-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
}
.payment-method-btn:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}
.payment-method-btn.selected {
  border-color: var(--primary-light);
  background: var(--primary-glow);
}
.payment-method-btn.selected .method-radio { border-color: var(--primary-light); }
.payment-method-btn.selected .method-radio::after { opacity: 1; }

.method-logo {
  width: 48px; height: 34px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 1.2rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.method-logo.om { background: #ff6600; color: white; font-size: .65rem; letter-spacing: -.02em; }
.method-logo.mtn { background: #ffcc00; color: #0a0a0a; font-size: .65rem; }

.method-info .method-name { font-weight: 700; font-size: .9rem; }
.method-info .method-sub { font-size: .75rem; color: var(--text-muted); }

.method-radio {
  margin-left: auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition);
}
.method-radio::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary-light);
  opacity: 0;
  transition: opacity var(--transition);
}

/* ============================================================
   PAYMENT HISTORY
   ============================================================ */
.payment-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.payment-row:last-child { border-bottom: none; }
.payment-icon-wrap {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.payment-icon-wrap.paid   { background: #dcfce7; color: #16a34a; }
.payment-icon-wrap.pending { background: #fef3c7; color: #d97706; }
.payment-meta { flex: 1; }
.payment-meta .p-title { font-weight: 600; font-size: .875rem; }
.payment-meta .p-date  { font-size: .75rem; color: var(--text-muted); }
.payment-amount { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.payment-amount.paid   { color: var(--success); }
.payment-amount.pending { color: var(--warning); }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }

/* ============================================================
   PROGRESS / TRANCHE
   ============================================================ */
.tranche-list { display: flex; flex-direction: column; gap: 12px; }
.tranche-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition);
}
.tranche-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.tranche-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}
.tranche-num.paid    { background: var(--success); color: white; }
.tranche-num.pending { background: var(--warning); color: white; }
.tranche-num.unpaid  { background: var(--border); color: var(--text-muted); }
.tranche-info { flex: 1; }
.tranche-info .t-label { font-weight: 600; font-size: .875rem; }
.tranche-info .t-date  { font-size: .75rem; color: var(--text-muted); }
.tranche-amount { font-weight: 700; font-family: var(--font-display); font-size: .95rem; }

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */
.alert-msg {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: .875rem;
  animation: slideIn .3s ease;
}
.alert-msg i { margin-top: 2px; flex-shrink: 0; font-size: 1rem; }
.alert-msg.info    { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
.alert-msg.success { background: #dcfce7; color: #166534; border-left: 3px solid #22c55e; }
.alert-msg.warning { background: #fef3c7; color: #713f12; border-left: 3px solid #f59e0b; }
.alert-msg.danger  { background: #fee2e2; color: #991b1b; border-left: 3px solid #ef4444; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: .8rem;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: .02em;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .875rem;
  color: var(--text);
  background: var(--bg-card);
  transition: all var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-light); box-shadow: var(--shadow-md); }

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover { background: #c8881a; box-shadow: var(--shadow-accent); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary); }

.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================================================
   MODULE TABS
   ============================================================ */
.module-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.module-tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}
.module-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   OTP / PHONE INPUT
   ============================================================ */
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.otp-input {
  width: 52px; height: 58px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-display);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition);
  color: var(--primary);
}
.otp-input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-glow); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,31,51,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.97);
  transition: transform var(--transition);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-family: var(--font-display); font-size: 1.1rem; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px 20px; display: flex; gap: 12px; justify-content: flex-end; }

/* ============================================================
   CHILD SWITCHER DROPDOWN
   ============================================================ */
.children-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: min(340px, calc(100vw - 32px));
  /* Borne la hauteur totale du menu à l'écran, avec scroll interne
     uniquement — évite que la liste (des centaines d'enfants pour un
     compte admin par ex.) ne pousse toute la page en dessous. */
  max-height: min(420px, calc(100vh - 96px));
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition);
}
.children-dropdown.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.children-dropdown-header {
  padding: 10px 14px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.children-dropdown-search {
  position: relative;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.children-dropdown-search i {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .8rem;
  color: var(--text-muted);
}
.children-dropdown-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px 7px 30px;
  font-size: .82rem;
  background: var(--bg);
  color: var(--text);
}
.children-dropdown-search input:focus {
  outline: none;
  border-color: var(--primary-light);
}
.children-dropdown-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.children-dropdown-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: .82rem;
}
.child-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.child-option:last-child { border-bottom: none; }
.child-option:hover { background: var(--bg); }
.child-option.active { background: var(--primary-glow); }
.child-opt-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: .85rem;
  color: white;
  flex-shrink: 0;
}
.child-opt-name { font-weight: 600; font-size: .875rem; }
.child-opt-class { font-size: .75rem; color: var(--text-muted); }

/* ============================================================
   ATTENDANCE
   ============================================================ */
.attendance-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.day-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: .65rem;
  font-weight: 600;
}
.day-cell.present { background: #dcfce7; color: #15803d; }
.day-cell.absent  { background: #fee2e2; color: #991b1b; }
.day-cell.weekend { background: var(--bg); color: var(--text-light); }
.day-cell.empty   { background: transparent; }

/* ============================================================
   PROGRESS RING
   ============================================================ */
.progress-ring-wrap { position: relative; display: inline-block; }
.progress-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-value { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; line-height: 1; }
.ring-sub { font-size: .65rem; color: var(--text-muted); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.page-section { animation: fadeIn .3s ease; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablette large (sidebar qui réduit l'espace) */
@media (max-width: 1100px) {
  :root { --sidebar-w: 220px; }
  .page-body { padding: 20px 20px; }
  .topbar { padding: 12px 20px; }
  .payment-grid { grid-template-columns: 1fr; }
}

/* Tablette / petit écran desktop */
@media (max-width: 992px) {
  /* Sidebar glisse hors écran */
  .sidebar {
    transform: translateX(-100%);
    z-index: 500;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }

  /* Plus de marge sur le contenu */
  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .topbar { padding: 12px 16px; }
  .page-body { padding: 16px; }

  /* Overlay sombre derrière le menu ouvert */
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 400;
    display: none;
  }
  .sidebar-overlay.open { display: block; }

  /* Bouton fermer menu dans sidebar */
  #btn-menu-close { display: flex !important; }
}

/* Tablette portrait */
@media (max-width: 768px) {
  .child-class { display: none; }
  .child-name { font-size: .75rem; }
  .topbar-title { font-size: 1rem; }
  .payment-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.4rem; }
  .child-selector { padding: 5px 10px 5px 6px; gap: 6px; }
}

/* Mobile */
@media (max-width: 576px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-value { font-size: 1.4rem; }
  .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
  .stat-change { font-size: .68rem; }
  h1 { font-size: 1.3rem; }

  .topbar-title { display: none; }
  .page-body { padding: 12px; }
  .card-header { padding: 14px 16px 10px; }
  .card-body { padding: 14px 16px; }
  .card-body.p-0 { padding: 0; }
  .payment-grid { grid-template-columns: 1fr; }
  .payment-row { gap: 10px; }
  .payment-amount { font-size: .875rem; }
  .tranche-item { padding: 12px 14px; gap: 10px; }
  .amount-value { font-size: 1.8rem; }
}


/* ============================================================
   LOGIN PAGE STYLES
   ============================================================ */
.login-left {
  flex: 1;
  background: linear-gradient(145deg, var(--primary) 0%, #0a2540 100%);
  display: flex; flex-direction: column;
  justify-content: center; align-items: flex-start;
  padding: 60px; position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; right: -80px; top: -80px;
  width: 400px; height: 400px; border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 60px; position: relative; z-index: 1; }
.login-brand .l-icon { width: 52px; height: 52px; background: var(--accent); border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; color: white; }
.login-brand .l-name { font-family: var(--font-display); font-size: 1.4rem; color: white; line-height: 1.1; }
.login-brand .l-sub  { color: rgba(255,255,255,.5); font-size: .8rem; }
.login-tagline { position: relative; z-index: 1; color: white; }
.login-tagline h1 { font-size: 2.4rem; line-height: 1.2; margin-bottom: 16px; }
.login-tagline h1 span { color: var(--accent-light); }
.login-tagline p { color: rgba(255,255,255,.65); font-size: .95rem; max-width: 420px; line-height: 1.7; }
.features { margin-top: 48px; display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }
.feature-item { display: flex; align-items: center; gap: 14px; color: rgba(255,255,255,.8); font-size: .875rem; }
.feature-item i { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.1); display: grid; place-items: center; font-size: 1rem; color: var(--accent-light); flex-shrink: 0; }
.login-right { width: 480px; display: flex; flex-direction: column; justify-content: center; padding: 60px 52px; background: white; }
.login-form-title { margin-bottom: 32px; }
.login-form-title h2 { font-size: 1.8rem; margin-bottom: 6px; }
.login-form-title p { color: var(--text-muted); font-size: .9rem; }
.login-footer { margin-top: 32px; text-align: center; font-size: .8rem; color: var(--text-muted); }
@media (max-width: 768px) {
  #login-page > div { flex-direction: column; }
  .login-left { padding: 36px 24px; min-height: 220px; }
  .login-right { width: 100%; padding: 36px 24px; }
  .features { display: none; }
  .login-tagline h1 { font-size: 1.6rem; }
}
/* Solde hero responsive */
@media (max-width: 576px) {
  .solde-hero > div:first-child { grid-template-columns: 1fr !important; }
}