/* ============================================================
   GESTI SCHOOL — Design System (refonte 2026)
   Thème : sidebar sombre, accent indigo/violet, ombres douces.
   Tous les noms de classes historiques sont conservés.
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --accent: #7c3aed;
  --accent-2: #06b6d4;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --border: #e8edf4;

  --sidebar-bg: #11162a;
  --sidebar-bg-2: #1b2540;
  --sidebar-text: #b6c0d4;
  --sidebar-muted: #6b7793;
  --sidebar-hover: rgba(255,255,255,.06);

  --ok: #10b981; --warn: #f59e0b; --err: #ef4444; --info: #3b82f6;

  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.04);
  --shadow: 0 6px 22px rgba(15,23,42,.08);
  --shadow-lg: 0 18px 50px rgba(15,23,42,.18);

  --sidebar-w: 264px;
  --sidebar-collapsed: 74px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ===== AUTH ===== */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 10% -10%, #6366f1 0%, transparent 55%),
              radial-gradient(1000px 500px at 110% 110%, #06b6d4 0%, transparent 50%),
              linear-gradient(135deg, #11162a 0%, #1e293b 100%);
  padding: 16px;
}
.auth-card {
  background: var(--surface); border-radius: 22px; padding: 40px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 18px; display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px; font-size: 28px; color: #fff;
  box-shadow: 0 8px 24px rgba(79,70,229,.4);
}
.auth-logo h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.auth-logo p  { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ===== LAYOUT ===== */
#app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR (dark) */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(185deg, var(--sidebar-bg) 0%, #0c1022 100%);
  border-right: 1px solid rgba(255,255,255,.04);
  display: flex; flex-direction: column; flex-shrink: 0;
  transition: width .25s ease; overflow: hidden; z-index: 100;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  height: var(--topbar-h); display: flex; align-items: center;
  padding: 0 18px; gap: 11px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.sidebar-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 11px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 19px; flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(79,70,229,.45);
}
.sidebar-title { font-weight: 800; font-size: 15px; color: #fff; white-space: nowrap; transition: opacity .2s; letter-spacing: -.2px; }
.sidebar.collapsed .sidebar-title { opacity: 0; pointer-events: none; }

.sidebar-establishment {
  padding: 9px 18px; margin: 0;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 11px; color: #c7d2fe; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar.collapsed .sidebar-establishment { display: none; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; scrollbar-width: thin; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.nav-section-title {
  font-size: 10px; font-weight: 700; color: var(--sidebar-muted);
  text-transform: uppercase; letter-spacing: .1em; padding: 14px 12px 6px; white-space: nowrap;
}
.sidebar.collapsed .nav-section-title { opacity: 0; height: 10px; }

.nav-item, .nav-group-toggle {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px; cursor: pointer;
  color: var(--sidebar-text); font-weight: 500; transition: all .15s;
  text-decoration: none; white-space: nowrap; position: relative;
  margin-bottom: 2px; width: 100%; border: none; background: none; font-size: 13.5px;
}
.nav-item:hover, .nav-group-toggle:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.4); }
.nav-item .nav-icon, .nav-group-toggle .nav-icon { width: 22px; font-size: 16px; text-align: center; flex-shrink: 0; }
.nav-item .nav-label, .nav-group-toggle .nav-label { transition: opacity .2s; font-size: 13.5px; flex: 1; text-align: left; }
.sidebar.collapsed .nav-label { opacity: 0; pointer-events: none; }

/* Sous-menus repliables */
.nav-chevron { font-size: 10px; color: var(--sidebar-muted); transition: transform .2s; }
.nav-group.open > .nav-group-toggle .nav-chevron { transform: rotate(180deg); }
.nav-group.open > .nav-group-toggle { color: #fff; }
.nav-submenu { max-height: 0; overflow: hidden; transition: max-height .28s ease; padding-left: 8px; }
.nav-group.open > .nav-submenu { max-height: 520px; }
.nav-subitem {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px 8px 30px; border-radius: 9px; cursor: pointer;
  color: var(--sidebar-muted); font-size: 12.5px; font-weight: 500;
  text-decoration: none; white-space: nowrap; position: relative; margin-bottom: 1px;
  transition: all .15s;
}
.nav-subitem::before {
  content: ''; position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--sidebar-muted); transition: all .15s;
}
.nav-subitem:hover { background: var(--sidebar-hover); color: #fff; }
.nav-subitem:hover::before { background: var(--accent-2); }
.nav-subitem.active { color: #fff; background: rgba(124,58,237,.18); }
.nav-subitem.active::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.sidebar.collapsed .nav-group .nav-submenu { display: none; }
.sidebar.collapsed .nav-chevron { display: none; }

/* tooltip en mode replié */
.sidebar.collapsed .nav-item, .sidebar.collapsed .nav-group-toggle { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-item::after, .sidebar.collapsed .nav-group-toggle::after {
  content: attr(data-tooltip); position: absolute; left: calc(var(--sidebar-collapsed) + 6px);
  background: #0f172a; color: #fff; padding: 5px 11px; border-radius: 7px; font-size: 12px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 200;
  box-shadow: var(--shadow);
}
.sidebar.collapsed .nav-item:hover::after, .sidebar.collapsed .nav-group-toggle:hover::after { opacity: 1; }

/* SIDEBAR USER */
.sidebar-user { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-user-inner { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; background: rgba(255,255,255,.03); }
.user-avatar {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; transition: opacity .2s; }
.sidebar.collapsed .user-info { opacity: 0; pointer-events: none; }
.user-name { font-weight: 700; font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { background: none; border: none; cursor: pointer; color: var(--sidebar-muted); padding: 4px; border-radius: 6px; transition: color .15s; flex-shrink: 0; }
.btn-logout:hover { color: var(--err); }
.sidebar.collapsed .btn-logout { opacity: 0; pointer-events: none; }

/* MAIN */
.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* TOPBAR */
.topbar {
  height: var(--topbar-h); background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  padding: 0 24px; gap: 12px; flex-shrink: 0;
}
.btn-toggle { background: none; border: none; cursor: pointer; width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 18px; }
.btn-toggle:hover { background: var(--surface-2); }
.topbar-title { font-weight: 800; font-size: 17px; color: var(--text); flex: 1; letter-spacing: -.3px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Avatar dropdown */
.avatar-dropdown-wrap { position: relative; }
.avatar-dropdown { display: none; position: absolute; top: calc(100% + 10px); right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); min-width: 224px; z-index: 1000; padding: 8px; animation: dd-in .15s ease; }
.avatar-dropdown.open { display: block; }
@keyframes dd-in { from { opacity:0; transform:translateY(-6px) } to { opacity:1; transform:translateY(0) } }
.avatar-dd-header { display: flex; align-items: center; gap: 10px; padding: 8px 6px 10px; }
.avatar-dd-name { font-weight: 700; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-dd-email { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 148px; }
.avatar-dd-divider { height: 1px; background: var(--border); margin: 4px 0; }
.avatar-dd-item { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; cursor: pointer; padding: 9px 10px; border-radius: 9px; font-size: 13px; color: #334155; text-align: left; transition: background .12s; }
.avatar-dd-item:hover { background: var(--surface-2); }
.avatar-dd-logout { color: var(--err); }
.avatar-dd-logout:hover { background: #fff1f2; }
.topbar-btn { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); background: none; border: none; font-size: 17px; position: relative; }
.topbar-btn:hover { background: var(--surface-2); }
.notif-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; background: var(--err); border-radius: 50%; border: 2px solid #fff; }
#topbar-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; cursor: pointer; }

/* PAGE */
.page-content { flex: 1; overflow-y: auto; padding: 26px; }
.page { display: none; animation: pageIn .25s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* En-tête de page */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: var(--text); }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* CARDS */
.card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 22px; box-shadow: var(--shadow-sm); }
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }

/* STAT CARDS */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border);
  padding: 20px; display: flex; align-items: flex-start; justify-content: space-between;
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden;
}
.stat-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--primary-light); opacity: .5; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -.5px; line-height: 1.1; }
.stat-change { font-size: 11px; font-weight: 600; margin-top: 4px; }
.stat-change.up { color: var(--ok); }
.stat-change.down { color: var(--err); }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; position: relative; z-index: 1; box-shadow: var(--shadow-sm); }
.bg-blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.bg-green  { background: linear-gradient(135deg, #10b981, #059669); }
.bg-amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-red    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.bg-pink   { background: linear-gradient(135deg, #ec4899, #db2777); }
.bg-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.bg-cyan   { background: linear-gradient(135deg, #06b6d4, #0891b2); }

/* TABLES */
.table-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-header { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface-2); }
th { padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td { padding: 13px 16px; border-top: 1px solid var(--surface-2); font-size: 13px; color: #475569; vertical-align: middle; }
tr:hover td { background: #fafbff; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; flex-shrink: 0; }
.avatar-blue   { background: #eef2ff; color: var(--primary); }
.avatar-green  { background: #ecfdf5; color: #059669; }
.avatar-amber  { background: #fffbeb; color: #d97706; }
.avatar-purple { background: #f5f3ff; color: #7c3aed; }
.cell-main { font-weight: 600; color: var(--text); font-size: 13px; }
.cell-sub  { font-size: 11px; color: var(--faint); }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-purple { background: #f5f3ff; color: #5b21b6; }
.badge-indigo { background: var(--primary-light); color: var(--primary-dark); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.32); }
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 6px 20px rgba(79,70,229,.42); }
.btn-secondary { background: var(--surface); color: #475569; border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: #d6deea; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 9px; font-size: 14px; }
.btn-view   { background: #eef2ff; color: var(--primary); }
.btn-view:hover { background: #e0e7ff; }
.btn-edit   { background: #fffbeb; color: #d97706; }
.btn-edit:hover { background: #fef3c7; }
.btn-delete { background: #fff1f2; color: #e11d48; }
.btn-delete:hover { background: #fee2e2; }
.btn-danger { background: #fee2e2; color: #dc2626; border: none; }
.btn-danger:hover { background: #fecaca; }
.profile-row { display:flex; justify-content:space-between; align-items:center; padding:9px 0; border-bottom:1px solid var(--border); font-size:13px; }
.profile-row:last-child { border-bottom: none; }
.profile-label { color: var(--faint); font-weight: 500; }
.profile-val { color: var(--text); font-weight: 600; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.form-control { width: 100%; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--text); transition: border-color .15s, box-shadow .15s; background: var(--surface); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }
.input-icon { position: relative; }
.input-icon .form-control { padding-left: 38px; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 16px; }

/* SEARCH */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px; min-width: 220px; }
.search-bar .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }

/* TABLE FOOTER */
.table-footer { padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }
.pagination { display: flex; gap: 4px; }
.pg-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pg-btn:hover:not(.active) { background: var(--surface-2); }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 11px; font-size: 13px; margin-bottom: 16px; }
.alert-danger { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* CHARTS */
.chart-container { position: relative; }

/* MODAL */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(3px); z-index: 500; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.show { display: flex; animation: dd-in .15s ease; }
.modal-box { background: var(--surface); border-radius: 20px; padding: 28px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--faint); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* LOADER */
.loader { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -280px; transition: left .25s; height: 100%; }
  .sidebar.mobile-open { left: 0; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }
  .sidebar-overlay.show { display: block; }
}

/* TOAST */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #11162a; color: #fff; padding: 13px 20px; border-radius: 12px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn .2s ease; min-width: 250px; }
.toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast.error   { background: linear-gradient(135deg, #be123c, #ef4444); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* QUICK ACTIONS */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.quick-action { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 20px 16px; text-align: center; cursor: pointer; transition: all .15s; text-decoration: none; }
.quick-action:hover { border-color: var(--primary); box-shadow: 0 6px 20px rgba(79,70,229,.14); transform: translateY(-2px); }
.quick-action .qa-icon { font-size: 26px; margin-bottom: 8px; }
.quick-action .qa-label { font-size: 12px; font-weight: 600; color: #475569; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 20px; color: var(--faint); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* GRID + utils */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; } .flex-1 { flex: 1; }

/* ===== DASHBOARD WIDGETS ===== */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.panel-title { font-size: 14px; font-weight: 800; color: var(--text); display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--surface-2); }
.list-row:last-child { border-bottom: none; }
.list-ico { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.list-main { font-weight: 600; font-size: 13px; color: var(--text); }
.list-sub { font-size: 11.5px; color: var(--faint); }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* ===== SEGMENTED CONTROL (assiduité) ===== */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.seg-btn { border: none; background: none; padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .12s; border-right: 1px solid var(--border); }
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: #eef2ff; }
.seg-btn.active { color: #fff; }
.seg-btn.active[data-v="PRESENT"]    { background: #10b981; }
.seg-btn.active[data-v="RETARD"]     { background: #f59e0b; }
.seg-btn.active[data-v="ABSENT"]     { background: #ef4444; }
.seg-btn.active[data-v="EXCUSE"]     { background: #64748b; }

/* ===== KPI / REPORTING ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kpi-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; }
.kpi-name { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; color: var(--text); }
.kpi-foot { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.report-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }

/* ===== COMMUNICATION TABS ===== */
.comm-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.comm-tab { padding: 8px 16px; border: none; background: none; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 6px 6px 0 0; transition: color .15s, border-color .15s; }
.comm-tab:hover { color: var(--primary); }
.comm-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }
.comm-list { display: flex; flex-direction: column; gap: 8px; }
.message-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; transition: box-shadow .15s; }
.message-item:hover { box-shadow: var(--shadow-sm); }
.message-item.unread { border-left: 3px solid var(--primary); background: #f8faff; }
.message-sender { font-size: 12px; color: var(--muted); }
.message-subject { font-size: 14px; color: var(--text); margin: 4px 0 2px; }
.message-preview { font-size: 12px; color: var(--faint); }

/* ===== FORUM ===== */
.forum-post-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; cursor: pointer; transition: box-shadow .15s; }
.forum-post-item:hover { box-shadow: var(--shadow-sm); }
.forum-category { font-size: 11px; }

/* ===== PARENT PORTAL ===== */
.parent-children-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 20px; }
.parent-child-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: box-shadow .2s, transform .15s; }
.parent-child-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* ===== FICHE EMPLOYÉ ===== */
.fiche-header { position: relative; background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); color: #fff; padding: 24px; }
.fiche-avatar { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: #fff; flex-shrink: 0; border: 2px solid rgba(255,255,255,.4); }
.fiche-name { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.fiche-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.fiche-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
@media (max-width: 520px) { .fiche-grid { grid-template-columns: 1fr; } }
.fiche-row { display: flex; flex-direction: column; padding: 5px 0; }
.fiche-label { font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.fiche-val { font-size: 13px; color: var(--text); font-weight: 500; margin-top: 1px; }

/* ===== Groupes par établissement (SUPER_ADMIN) ===== */
.est-group { margin-bottom: 32px; }
.est-group-header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: linear-gradient(135deg, var(--surface-2) 0%, var(--primary-light) 100%); border: 1px solid var(--border); border-radius: 12px 12px 0 0; border-bottom: 3px solid var(--primary); }
.est-group-icon { font-size: 24px; width: 40px; text-align: center; flex-shrink: 0; }
.est-group-name { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.est-group-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-top: none; border-radius: 0 0 12px 12px; }

/* ============================================================
   REÇU THERMIQUE 80mm (impression)
   ============================================================ */
.receipt { width: 80mm; max-width: 80mm; margin: 0 auto; padding: 6mm 4mm; background: #fff; color: #000;
  font-family: 'Courier New', 'Consolas', monospace; font-size: 12px; line-height: 1.45; }
.receipt * { font-family: inherit; }
.receipt .r-center { text-align: center; }
.receipt .r-title { font-size: 15px; font-weight: 800; letter-spacing: 1px; }
.receipt .r-sub { font-size: 11px; }
.receipt .r-hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }
.receipt .r-line { display: flex; justify-content: space-between; gap: 8px; }
.receipt .r-line .r-l { flex: 1; }
.receipt .r-line .r-r { text-align: right; white-space: nowrap; }
.receipt .r-total { font-size: 14px; font-weight: 800; }
.receipt .r-foot { font-size: 10.5px; text-align: center; margin-top: 8px; }
.receipt-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

@media print {
  body * { visibility: hidden !important; }
  #receipt-print, #receipt-print * { visibility: visible !important; }
  #receipt-print { position: absolute; left: 0; top: 0; width: 80mm; }
  .receipt-actions, .modal-header, .modal-close { display: none !important; }
  @page { size: 80mm auto; margin: 0; }
}
