/* ════════════════════════════════════════════════════════════════
   Perception Academic — Design system
   Palette extraite du logo : bleu ciel #4CB5EF (disque), indigo #424BB4 (toque/arc), bleu roi #244AAD (bandeau)
   ════════════════════════════════════════════════════════════════ */
:root {
  --primary: #244AAD;         /* bleu roi du bandeau — boutons, liens, actif */
  --primary-hover: #1D3D91;
  --primary-dark: #1A2F74;
  --primary-light: #EAF2FD;   /* teinte du bleu ciel */
  --primary-50: #F3F7FE;
  --secondary: #4CB5EF;       /* bleu ciel du disque — accents, graphiques */
  --secondary-light: #E3F4FD;
  --accent: #424BB4;          /* indigo de la toque */
  --accent-light: #ECEDFA;
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F9FAFD;
  --border: #E3E8F1;
  --border-strong: #CFD7E6;
  --text: #16213E;
  --text-2: #3A4666;
  --muted: #6B7690;
  --faint: #98A2B8;
  --success: #1E8E62; --success-light: #E4F5EE;
  --warning: #B7791F; --warning-light: #FBF1DE;
  --danger: #CF3F57;  --danger-light: #FCE9EC;
  --info: #2F7DC4;    --info-light: #E6F1FB;
  --radius: 10px; --radius-lg: 14px; --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(22, 33, 62, .05);
  --shadow: 0 4px 16px rgba(22, 33, 62, .07), 0 1px 3px rgba(22, 33, 62, .05);
  --shadow-lg: 0 24px 60px rgba(22, 33, 62, .18), 0 4px 12px rgba(22, 33, 62, .08);
  --font: 'Plus Jakarta Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'Plus Jakarta Sans', system-ui, sans-serif;
  --sidebar: 244px;
  --header: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
[dir="rtl"] body, :lang(ar) { font-family: var(--font-ar); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.num, td.num, .kpi-value { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.strong { font-weight: 600; } .nowrap { white-space: nowrap; } .right { text-align: end; } .center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
svg[aria-hidden="true"] { width: 18px; height: 18px; flex: none; }
.card-head h2 svg { width: 17px; height: 17px; color: var(--muted); }

/* ─── Layout ─────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-inline-end: 1px solid var(--border); padding: 14px 12px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; text-decoration: none !important; }
.brand img { width: 38px; height: 38px; flex: none; }
.brand-name { font-weight: 750; font-size: 15px; color: var(--text); letter-spacing: -.015em; line-height: 1.15; }
.brand-name span { color: var(--primary); }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 12px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-weight: 550; font-size: 13.5px; text-decoration: none; position: relative; transition: background .15s, color .15s; }
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--muted); transition: color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-light); color: var(--primary); }
.nav a.active svg { color: var(--primary); }
.nav a.active::before { content: ''; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav .count { margin-inline-start: auto; font-size: 11px; font-weight: 650; background: var(--danger); color: #fff; border-radius: 10px; padding: 0 6px; line-height: 17px; }
.nav-bottom { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-bottom a, .nav-bottom button { display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-weight: 550; font-size: 13.5px; background: none; border: 0; cursor: pointer; width: 100%; text-decoration: none; }
.nav-bottom a:hover, .nav-bottom button:hover { background: var(--surface-2); }
.nav-bottom a.active { background: var(--primary-light); color: var(--primary); }
.nav-bottom svg { width: 18px; height: 18px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--header); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: rgba(245, 247, 251, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--border); }
.search-trigger { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--faint); cursor: text; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger svg { width: 16px; height: 16px; }
.search-trigger kbd { margin-inline-start: auto; font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface-2); }
.topbar-right { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.year-select { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 0 28px 0 10px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236B7690' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
[dir="rtl"] .year-select { background-position: left 9px center; padding: 0 10px 0 28px; }
.icon-btn { position: relative; width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: none; color: var(--text-2); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--surface); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 6px; inset-inline-end: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 12.5px; color: var(--primary); background: var(--primary-light); flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; } .avatar.lg { width: 56px; height: 56px; font-size: 19px; } .avatar.xl { width: 68px; height: 68px; font-size: 22px; }
.avatar.f { background: #F1EAFB; color: #5B3FA8; } .avatar.m { background: var(--secondary-light); color: #145E8A; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.user-chip .who { line-height: 1.15; } .user-chip .who b { font-size: 12.5px; display: block; } .user-chip .who span { font-size: 11px; color: var(--muted); }
.demo-banner { background: linear-gradient(90deg, var(--accent-light), var(--secondary-light)); color: var(--primary-dark); font-size: 12px; font-weight: 600; text-align: center; padding: 5px 12px; border-bottom: 1px solid var(--border); }
.demo-banner b { font-weight: 750; }
.content { padding: 8px 24px 40px; max-width: 1440px; width: 100%; margin: 0 auto; }
.page-enter { animation: pageIn .22s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ─── En-tête de page & sous-navigation ──────────────────────── */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 14px 0 16px; }
.page-head .titles { flex: 1; min-width: 220px; }
.page-head .eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.page-head .eyebrow a { color: var(--muted); }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a, .tabs button { flex: none; position: relative; padding: 10px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; white-space: nowrap; transition: color .15s; }
.subnav a:hover, .tabs button:hover { color: var(--text); }
.subnav a.active, .tabs button.active { color: var(--primary); }
.subnav a.active::after, .tabs button.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button .n { font-size: 11px; font-weight: 650; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 0 6px; margin-inline-start: 4px; }
.segmented { display: inline-flex; padding: 3px; background: #EBEFF6; border-radius: 9px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-weight: 600; font-size: 12.5px; color: var(--muted); cursor: pointer; transition: all .15s; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ─── Cartes, grilles ────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 52px; }
.card-head h2 { font-size: 14.5px; font-weight: 650; flex: 1; display: flex; align-items: center; gap: 8px; }
.card-head .link { font-size: 12.5px; font-weight: 600; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-side { grid-template-columns: 300px minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.top { align-items: flex-start; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* KPI compacts */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; display: flex; flex-direction: column; gap: 3px; text-decoration: none !important; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; animation: kpiIn .35s var(--ease) both; }
a.kpi:hover { border-color: #BCD0F0; box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi-label svg { width: 15px; height: 15px; color: var(--secondary); }
.kpi-value { font-size: 23px; font-weight: 700; letter-spacing: -.02em; color: var(--text); line-height: 1.25; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-inline-start: 2px; }
.kpi-hint { font-size: 11.5px; color: var(--faint); }
.kpi.alert .kpi-value { color: var(--danger); }
@keyframes kpiIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.kpis.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .kpis.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .kpis.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .kpis.cols-4, .kpis.cols-5, .kpis.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpis .kpi:nth-child(2) { animation-delay: .03s; } .kpis .kpi:nth-child(3) { animation-delay: .06s; } .kpis .kpi:nth-child(4) { animation-delay: .09s; }
.kpis .kpi:nth-child(5) { animation-delay: .12s; } .kpis .kpi:nth-child(6) { animation-delay: .15s; } .kpis .kpi:nth-child(7) { animation-delay: .18s; } .kpis .kpi:nth-child(8) { animation-delay: .21s; }
.stat-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-inline div b { display: block; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-inline div span { font-size: 12px; color: var(--muted); }

/* ─── Boutons ────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s, transform .08s; }
.btn:hover { background: var(--surface-2); border-color: #B9C3D6; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(36, 74, 173, .25); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn.ghost:hover { background: #EDF1F8; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); border-color: transparent; background: none; }
.btn.danger-ghost:hover { background: var(--danger-light); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; gap: 5px; }
.btn.xs svg, .btn.sm svg { width: 14px; height: 14px; }
.btn.icon { width: 36px; padding: 0; } .btn.sm.icon { width: 30px; } .btn.xs.icon { width: 26px; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ''; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ─── Formulaires ────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--danger); }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-inline-end: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236B7690' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
[dir="rtl"] select.input { background-position: left 10px center; }
.input:hover { border-color: #B6C1D6; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36, 74, 173, .14); }
.input.sm { height: 32px; font-size: 13px; padding: 0 9px; }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(207, 63, 87, .1); }
.field .error { font-size: 12px; color: var(--danger); font-weight: 500; }
.field .help { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); grid-column: 1 / -1; padding-top: 6px; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.check-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border-strong); border-radius: 18px; font-size: 12.5px; font-weight: 550; cursor: pointer; user-select: none; transition: all .15s; background: var(--surface); }
.check-pill input { display: none; }
.check-pill:has(input:checked) { background: var(--primary-light); border-color: #A9C2EE; color: var(--primary); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 550; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 10px; background: #CBD3E1; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s var(--ease); }
.switch input:checked { background: var(--primary); } .switch input:checked::after { transform: translateX(14px); }

/* Barre de filtres */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.toolbar .search svg { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }
.toolbar .search .input { padding-inline-start: 32px; height: 36px; }
.toolbar select.input { width: auto; min-width: 128px; max-width: 200px; height: 36px; font-size: 13px; }
.toolbar select.input.set { border-color: #A9C2EE; background-color: var(--primary-50); color: var(--primary); font-weight: 600; }
.toolbar .spacer { flex: 1; }
.filter-toggle { display: none; }

/* ─── Tableaux ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table th:first-child { border-top-left-radius: 0; }
.table td { padding: 10px 14px; border-bottom: 1px solid #EEF1F6; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover { background: #F7F9FD; }
.table td.num, .table th.num { text-align: end; }
.table .cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table .cell-main b { font-weight: 600; display: block; }
.table .cell-main span { font-size: 12px; color: var(--muted); }
.table.compact td { padding: 7px 12px; } .table.compact th { padding: 8px 12px; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.pagination { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.pagination .spacer { flex: 1; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: #EEF1F6; color: var(--text-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.success { background: var(--success-light); color: var(--success); }
.badge.warning { background: var(--warning-light); color: var(--warning); }
.badge.danger { background: var(--danger-light); color: var(--danger); }
.badge.info { background: var(--info-light); color: var(--info); }
.badge.primary { background: var(--primary-light); color: var(--primary); }
.badge.accent { background: var(--accent-light); color: var(--accent); }
.badge.neutral { background: #EEF1F6; color: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.tag.level { background: var(--primary-50); border-color: #D5E2F7; color: var(--primary); }
.subject-dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-inline-end: 6px; flex: none; }

/* ─── Barres de progression ──────────────────────────────────── */
.progress { height: 6px; border-radius: 4px; background: #E9EDF4; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width .6s var(--ease); }
.progress.lg { height: 9px; }
.progress.success > span { background: var(--success); } .progress.warning > span { background: var(--warning); } .progress.danger > span { background: var(--danger); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.meter .progress { flex: 1; }
.meter b { font-size: 12px; font-weight: 650; min-width: 34px; text-align: end; font-variant-numeric: tabular-nums; }

/* ─── Listes ─────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid #EEF1F6; text-decoration: none !important; color: inherit; transition: background .12s; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, .list-item.clickable:hover { background: #F7F9FD; cursor: pointer; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; display: block; }
.list-item .li-sub { font-size: 12.5px; color: var(--muted); display: block; }
.time-col { width: 52px; flex: none; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.time-col span { display: block; font-size: 11px; font-weight: 500; color: var(--faint); }
.alert-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 18px; border-bottom: 1px solid #EEF1F6; text-decoration: none !important; color: inherit; }
.alert-item:hover { background: #F7F9FD; }
.alert-item:last-child { border-bottom: 0; }
.alert-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.alert-icon svg { width: 16px; height: 16px; }
.alert-icon.warning { background: var(--warning-light); color: var(--warning); } .alert-icon.danger { background: var(--danger-light); color: var(--danger); }
.alert-icon.info { background: var(--info-light); color: var(--info); } .alert-icon.success { background: var(--success-light); color: var(--success); }
.activity-item { display: flex; gap: 12px; padding: 10px 18px; position: relative; }
.activity-item .a-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); margin-top: 7px; flex: none; box-shadow: 0 0 0 3px var(--secondary-light); }
.activity-item .a-text { font-size: 13px; }
.activity-item .a-meta { font-size: 11.5px; color: var(--faint); }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13px; border: 1px solid; }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.callout.warning { background: var(--warning-light); border-color: #F0D9A8; color: #7A5212; }
.callout.danger { background: var(--danger-light); border-color: #F4C4CD; color: #8E2238; }
.callout.info { background: var(--info-light); border-color: #C5DDF3; color: #1D4E7E; }
.callout.success { background: var(--success-light); border-color: #BCE3D1; color: #155F43; }
.callout b { font-weight: 700; }
.conflict-box { border: 1px solid #F4C4CD; background: #FFF8F9; border-radius: 12px; padding: 14px 16px; }
.conflict-box h4 { color: var(--danger); font-size: 13.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.conflict-box h4 svg { width: 17px; height: 17px; }
.conflict-box .c-msg { font-size: 13px; padding: 4px 0; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.suggest button { border: 1px solid #C8D6F1; background: var(--primary-50); color: var(--primary); border-radius: 16px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.suggest button:hover { background: var(--primary-light); }

/* ─── États vides / chargement / erreur ──────────────────────── */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; color: #B4C0D6; margin-bottom: 10px; }
.empty h3 { color: var(--text); font-size: 14.5px; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 360px; margin: 0 auto; }
.empty .btn { margin-top: 14px; }
.skeleton { background: linear-gradient(90deg, #EEF1F6 25%, #F6F8FB 37%, #EEF1F6 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-page { display: grid; gap: 14px; padding-top: 18px; }
.error-state { text-align: center; padding: 50px 20px; }
.error-state svg { width: 38px; height: 38px; color: var(--danger); }

/* ─── Modales, tiroirs, toasts ───────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 44, .42); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fadeIn .16s ease; }
.overlay.closing { animation: fadeOut .14s ease forwards; }
@keyframes fadeIn { from { opacity: 0; } } @keyframes fadeOut { to { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: modalIn .2s var(--ease); }
.modal.lg { max-width: 760px; } .modal.sm { max-width: 420px; } .modal.xl { max-width: 980px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; flex: 1; }
.modal-head .sub { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot .left { margin-inline-end: auto; }
.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer { width: min(560px, 100vw); height: 100vh; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: drawerIn .24s var(--ease); margin-inline-start: auto; }
[dir="rtl"] .drawer { animation-name: drawerInRtl; }
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } } @keyframes drawerInRtl { from { transform: translateX(-30px); opacity: 0; } }
.drawer .modal-body { flex: 1; }
.drawer .modal-foot { border-radius: 0; }
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 380px; background: #16213E; color: #fff; border-radius: 10px; padding: 11px 14px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: toastIn .22s var(--ease); }
.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast.success svg { color: #6EE7B7; } .toast.error { background: #8E2238; } .toast.warning svg { color: #FCD34D; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.popover { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 380px; max-height: 480px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 60; animation: modalIn .16s var(--ease); }
.popover-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 650; }
.popover .alert-item.read { opacity: .6; }
.menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; animation: modalIn .14s var(--ease); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; border: 0; background: none; font-size: 13px; font-weight: 550; color: var(--text); text-align: start; cursor: pointer; text-decoration: none !important; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu svg { width: 16px; height: 16px; color: var(--muted); }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* Recherche globale */
.search-modal { max-width: 620px; align-self: start; margin-top: 10vh; }
.search-box { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.search-box svg { width: 19px; height: 19px; color: var(--muted); }
.search-box input { flex: 1; border: 0; outline: none; font-size: 16px; background: none; }
.search-results { max-height: 420px; overflow-y: auto; padding: 6px; }
.search-result { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; text-decoration: none !important; color: inherit; }
.search-result.active, .search-result:hover { background: var(--primary-50); }
.search-result .sr-type { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); flex: none; }
.search-result .sr-type svg { width: 16px; height: 16px; }
.search-result b { font-weight: 600; display: block; font-size: 13.5px; }
.search-result span { font-size: 12.5px; color: var(--muted); }
.search-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: 10px 12px 4px; }

/* ─── Planning ───────────────────────────────────────────────── */
.plan-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.plan-range { font-weight: 650; font-size: 14px; min-width: 200px; text-align: center; }
.week-grid { display: grid; grid-template-columns: 56px repeat(7, minmax(120px, 1fr)); min-width: 980px; position: relative; }
.week-grid .wg-head { position: sticky; top: 0; background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 8px; font-size: 12px; font-weight: 650; color: var(--text-2); text-align: center; z-index: 2; }
.week-grid .wg-head.today { color: var(--primary); }
.week-grid .wg-head.today span { background: var(--primary); color: #fff; border-radius: 10px; padding: 0 7px; }
.week-grid .wg-head .off { display: block; font-weight: 500; color: var(--faint); font-size: 11px; }
.wg-hours { border-inline-end: 1px solid var(--border); }
.wg-hour { height: 48px; font-size: 11px; color: var(--faint); text-align: end; padding-inline-end: 8px; transform: translateY(-7px); }
.wg-col { position: relative; border-inline-end: 1px solid #EEF1F6; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, #EEF1F6 47px, #EEF1F6 48px); }
.wg-col.today { background-color: #FAFCFF; }
.ev { position: absolute; inset-inline: 3px; border-radius: 7px; padding: 4px 7px; font-size: 11.5px; line-height: 1.3; overflow: hidden; cursor: pointer; border: 1px solid; border-inline-start-width: 3px; background: var(--surface); transition: box-shadow .15s, transform .15s; }
.ev:hover { box-shadow: var(--shadow); z-index: 3; transform: translateY(-1px); }
.ev b { display: block; font-weight: 700; font-size: 12px; }
.ev .ev-sub { color: var(--muted); }
.ev.conflict { border-color: var(--danger) !important; background: #FFF4F6 !important; }
.ev.a_remplacer { background: repeating-linear-gradient(135deg, #FFF8EC, #FFF8EC 6px, #FFF1D9 6px, #FFF1D9 12px) !important; border-color: var(--warning) !important; }
.ev.annule { opacity: .5; text-decoration: line-through; }
.ev.realise { opacity: .78; }
.day-list .dl-day { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.day-list .dl-day:last-child { border-bottom: 0; }
.dl-date { width: 86px; flex: none; }
.dl-date b { display: block; font-size: 20px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.dl-date span { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.dl-date.today b { color: var(--primary); }
.dl-sessions { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.session-card { border: 1px solid var(--border); border-inline-start: 3px solid var(--primary); border-radius: 9px; padding: 8px 11px; font-size: 12.5px; cursor: pointer; background: var(--surface); transition: box-shadow .15s, border-color .15s; }
.session-card:hover { box-shadow: var(--shadow); }
.session-card .sc-top { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.session-card .sc-top .time { font-variant-numeric: tabular-nums; }
.session-card .sc-meta { color: var(--muted); margin-top: 2px; }
.session-card.conflict { border-color: var(--danger); background: #FFF6F8; }
.session-card.a_remplacer { background: #FFF9EE; border-color: #EBCB8B; }
.session-card.annule { opacity: .55; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.avail-grid { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; align-items: center; }
.avail-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.timeline-bar { position: relative; height: 26px; border-radius: 6px; background: #EEF1F6; overflow: hidden; }
.timeline-bar span { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, var(--secondary), #7CC8F3); border-radius: 6px; color: #0B3B5C; font-size: 11px; font-weight: 700; display: flex; align-items: center; padding: 0 8px; white-space: nowrap; }
.timeline-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); margin-top: 3px; }

/* Pipeline prospects */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.pipe-col { background: #EEF2F8; border-radius: 12px; padding: 8px; min-height: 240px; transition: background .15s; }
.pipe-col.over { background: var(--primary-light); outline: 2px dashed #A9C2EE; }
.pipe-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 10px; font-size: 13px; }
.pipe-list { display: flex; flex-direction: column; gap: 8px; }
.pipe-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; }
.pipe-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pipe-card.dragging { opacity: .5; }
@media (max-width: 1100px) { #p-body + .card { display: none; } }

/* Calcul du tarif */
.price-box { border: 1px solid #CFE0F7; background: var(--primary-50); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.price-total { border-top: 1px solid #CFE0F7; margin-top: 8px; padding-top: 8px; font-weight: 700; }
.price-total b { font-size: 17px; color: var(--primary); }

/* Vue Mois */
.month-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mc-head { padding: 8px; font-size: 12px; font-weight: 650; color: var(--muted); text-align: center; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.mc-day { min-height: 118px; padding: 6px 7px; border-inline-end: 1px solid #EEF1F6; border-bottom: 1px solid #EEF1F6; cursor: pointer; transition: background .12s; min-width: 0; }
.mc-day:nth-child(7n) { border-inline-end: 0; }
.mc-day:hover { background: #F7F9FD; }
.mc-day.we { background: #FBFCFE; }
.mc-day.out { opacity: .45; }
.mc-day.today .mc-top b { background: var(--primary); color: #fff; border-radius: 10px; padding: 0 7px; }
.mc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 12.5px; }
.mc-count { font-size: 10.5px; font-weight: 700; background: var(--primary-light); color: var(--primary); border-radius: 9px; padding: 0 6px; }
.mc-count.danger { background: var(--danger-light); color: var(--danger); } .mc-count.warning { background: var(--warning-light); color: var(--warning); }
.mc-list { display: flex; flex-direction: column; gap: 2px; }
.mc-ev { display: block; font-size: 11px; line-height: 1.35; padding: 1px 5px; border-radius: 4px; border-inline-start: 3px solid var(--primary); background: var(--primary-50); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-ev.realise { background: var(--success-light); } .mc-ev.a_remplacer { background: var(--warning-light); } .mc-ev.conflict { background: var(--danger-light); }
.mc-more { font-size: 10.5px; color: var(--muted); font-weight: 600; padding-inline-start: 5px; }
@media (max-width: 760px) { .mc-day { min-height: 58px; padding: 4px; } .mc-list { display: none; } .mc-top { flex-direction: column; gap: 3px; } .mc-head { padding: 6px 2px; font-size: 10.5px; } }

/* ─── Présences / notes ──────────────────────────────────────── */
.att-row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid #EEF1F6; }
.att-row:last-child { border-bottom: 0; }
.att-row .name { flex: 1; min-width: 0; font-weight: 600; }
.att-choices { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.att-choices button { height: 30px; padding: 0 11px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-2); transition: all .12s; }
.att-choices button:hover { border-color: #9FB0CD; }
.att-choices button.on.present { background: var(--success); border-color: var(--success); color: #fff; }
.att-choices button.on.absent { background: var(--danger); border-color: var(--danger); color: #fff; }
.att-choices button.on.retard { background: var(--warning); border-color: var(--warning); color: #fff; }
.att-choices button.on.justifie { background: var(--info); border-color: var(--info); color: #fff; }
.grade-input { width: 76px; height: 34px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.good { color: var(--success); } .score.mid { color: var(--text); } .score.low { color: var(--danger); }
.delta { font-size: 11.5px; font-weight: 700; }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); }

/* Programmes */
.chapter { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 10px; transition: box-shadow .15s; }
.chapter:hover { box-shadow: var(--shadow-sm); }
.chapter-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.chapter-head .ord { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 750; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); flex: none; }
.chapter.termine .ord { background: var(--success-light); color: var(--success); border-color: #BCE3D1; }
.chapter.en_cours .ord { background: var(--primary-light); color: var(--primary); border-color: #BFD3F3; }
.chapter-body { padding: 0 16px 14px 58px; display: none; }
.chapter.open .chapter-body { display: block; }
.chapter-items { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.chapter-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid #EEF1F6; border-radius: 8px; font-size: 13px; }
.tree { display: flex; flex-direction: column; gap: 14px; }
.tree-cycle h3 { font-size: 13px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--text-2); }
.level-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.level-chip { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); cursor: pointer; transition: all .15s; }
.level-chip:hover { border-color: #A9C2EE; box-shadow: var(--shadow-sm); }
.level-chip b { font-size: 15px; font-weight: 750; }
.level-chip.inactive { opacity: .5; }
.flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.flow span { padding: 3px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.flow i { color: var(--faint); font-style: normal; }

/* Fiches (élève, professeur) */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 6px 0 18px; }
.profile-head .ph-main { flex: 1; min-width: 220px; }
.profile-head h1 { font-size: 21px; }
.profile-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.info-list { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; font-size: 13.5px; }
.info-list dt { color: var(--muted); font-weight: 500; }
.info-list dd { margin: 0; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini-stat { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.mini-stat span { font-size: 11.5px; color: var(--muted); font-weight: 550; display: block; }
.mini-stat b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.month-cell { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; background: var(--surface); }
.month-cell .m { font-size: 12px; font-weight: 650; text-transform: capitalize; color: var(--text-2); }
.month-cell .a { font-size: 12px; color: var(--muted); margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.pay-dot { display: inline-block; width: 22px; height: 22px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; transition: transform .1s; }
.pay-dot:hover { transform: scale(1.12); }
.pay-dot.paye { background: #BFE6D3; border-color: #94D2B5; } .pay-dot.partiel { background: #FBE3B6; border-color: #F0C877; }
.pay-dot.en_retard { background: #F7C5CF; border-color: #EC97A8; } .pay-dot.en_attente { background: #D7E6FA; border-color: #A9C6EE; }
.pay-dot.non_facture { background: #F2F4F8; border-color: #E3E8F1; border-style: dashed; }
.salary-calc { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 13.5px; }
.salary-calc .total { font-size: 18px; font-weight: 750; color: var(--primary); border-top: 1px solid var(--border); padding-top: 10px; }
.salary-calc .total-label { border-top: 1px solid var(--border); padding-top: 12px; font-weight: 650; }

/* Graphiques */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart .val { fill: var(--text-2); font-weight: 650; }
.chart .bar { transition: opacity .15s; } .chart .bar:hover { opacity: .8; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 58px; gap: 10px; align-items: center; font-size: 12.5px; padding: 4px 0; }
.hbar .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-weight: 550; }
.hbar .track { height: 10px; border-radius: 5px; background: #EEF1F6; overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 5px; background: var(--primary); transition: width .6s var(--ease); }
.hbar .v { text-align: end; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ─── Connexion ──────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.login-side { background: radial-gradient(120% 90% at 0% 0%, #2B57C4 0%, var(--primary) 38%, var(--accent) 100%); color: #fff; padding: 44px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.login-side::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -200px; background: radial-gradient(circle, rgba(76, 181, 239, .55), rgba(76, 181, 239, 0) 65%); }
.login-side .brand-name { color: #fff; font-size: 17px; } .login-side .brand-name span { color: #BFE5FB; }
.login-side .logo-wrap { background: #fff; border-radius: 14px; padding: 6px; display: inline-grid; }
.login-side h2 { font-size: 30px; line-height: 1.2; font-weight: 750; margin-top: auto; max-width: 460px; letter-spacing: -.02em; }
.login-side p { color: #D6E4FB; margin-top: 12px; max-width: 440px; font-size: 14.5px; }
.login-side ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; font-size: 13.5px; color: #E6EEFC; position: relative; z-index: 1; }
.login-side li { display: flex; align-items: center; gap: 10px; }
.login-side li svg { width: 17px; height: 17px; color: #9ED8F7; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 24px; }
.demo-accounts { margin-top: 22px; border: 1px dashed #BFD0EE; border-radius: 12px; padding: 12px 14px; background: var(--primary-50); }
.demo-accounts b { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.demo-accounts button { display: flex; width: 100%; justify-content: space-between; gap: 10px; border: 0; background: none; padding: 6px 0; font-size: 12.5px; cursor: pointer; color: var(--text-2); border-bottom: 1px solid #DDE7F7; }
.demo-accounts button:last-child { border-bottom: 0; }
.demo-accounts button:hover span:first-child { color: var(--primary); }

/* Impression (reçus, fiches de salaire, rapports) */
.print-doc { max-width: 780px; margin: 0 auto; background: #fff; padding: 36px 40px; border: 1px solid var(--border); border-radius: 12px; }
.print-doc .pd-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.pd-school { font-weight: 750; font-size: 16px; color: var(--text); }
.pd-bar { display: flex; height: 6px; border-radius: 4px; overflow: hidden; margin: 12px 0 20px; }
.pd-bar span:first-child { flex: 1; background: var(--secondary); } .pd-bar span:last-child { flex: 1; background: var(--accent); }
.modal.doc { max-width: 860px; }
.doc-preview { border: 0; padding: 8px 6px; max-width: none; }
.doc-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 12px; text-transform: uppercase; color: var(--text); }
.kv { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv b { font-weight: 700; text-align: end; }
.kv .input { width: 260px; max-width: 100%; text-align: end; background: var(--primary-50); border-color: #A9CDEE; font-weight: 600; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
.sheet-table th, .sheet-table td { border: 1px solid var(--border); padding: 7px 9px; text-align: center; }
.sheet-table th { background: var(--surface-2); font-weight: 700; }
.sheet-table td:first-child { text-align: start; }
.sheet-table tfoot td { background: var(--surface-2); font-weight: 750; }
.sheet-table .input { height: 32px; }
.net-row { display: flex; justify-content: space-between; align-items: center; border-top: 3px solid var(--text); border-bottom: 3px solid var(--text); padding: 12px 0; margin-top: 10px; font-size: 20px; font-weight: 800; }
.net-row b { color: var(--primary); }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 26px; text-align: center; font-size: 13px; color: var(--muted); }
.signatures div { border-bottom: 1px solid var(--border-strong); padding-bottom: 60px; }
.print-doc .pd-head img { width: 54px; height: 54px; }
.print-doc h1 { font-size: 20px; }
.print-doc table { width: 100%; border-collapse: collapse; font-size: 13px; }
.print-doc table td, .print-doc table th { border: 1px solid var(--border); padding: 7px 10px; text-align: start; }
.print-doc table th { background: var(--surface-2); font-weight: 650; }
.print-doc .big { font-size: 22px; font-weight: 800; color: var(--primary); }
.print-actions { max-width: 780px; margin: 0 auto 14px; display: flex; gap: 8px; justify-content: flex-end; }
.demo-stamp { display: inline-block; border: 1.5px solid var(--warning); color: var(--warning); border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .sidebar, .topbar, .demo-banner, .print-actions, .bottom-nav, .toasts, .no-print { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; }
  .print-doc { border: 0; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* Navigation mobile */
.bottom-nav { display: none; }
.mobile-menu-btn { display: none; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1180px) {
  :root { --sidebar: 72px; }
  .sidebar { padding: 14px 10px; align-items: center; }
  .brand { padding: 4px 0 16px; } .brand > div, .nav-label, .nav a span, .nav-bottom span, .nav .count { display: none; }
  .nav a, .nav-bottom a, .nav-bottom button { width: 44px; justify-content: center; padding: 0; }
  .nav a.active::before { inset-inline-start: -10px; }
  .g-main, .g-side { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; gap: 8px; }
  .search-trigger kbd, .search-trigger .label, .user-chip .who { display: none; }
  .search-trigger { max-width: none; }
  .user-chip { padding: 2px; border: 0; background: none; }
  .year-select { padding: 0 24px 0 8px; font-size: 12px; }
  .content { padding: 4px 16px 96px; }
  .page-head { padding: 10px 0 12px; }
  h1 { font-size: 19px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 11px 12px; } .kpi-value { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; gap: 2px; } .info-list dd { margin-bottom: 8px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar select.input { flex: 1 1 calc(50% - 8px); max-width: none; min-width: 0; }
  .modal { max-height: calc(100vh - 20px); border-radius: 16px 16px 0 0; align-self: end; }
  .overlay:not(.drawer-overlay) { padding: 0; place-items: end stretch; }
  .search-modal { margin-top: 0; align-self: start; border-radius: 0 0 16px 16px; }
  .popover { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; }
  /* Tableaux → cartes empilées */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table.responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: end; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 550; text-align: start; flex: none; }
  .table.responsive td.primary-cell { text-align: start; padding-bottom: 6px; }
  .table.responsive td.primary-cell::before, .table.responsive td[data-label=""]::before { display: none; }
  .table.responsive td.num { text-align: end; }
  .table.responsive td .cv { min-width: 0; text-align: end; }
  .table.responsive td.primary-cell .cv { text-align: start; width: 100%; }
  .table.responsive td .cv .cell-main { justify-content: flex-start; }
  .table.responsive tfoot { display: block; } .table.responsive tfoot tr { display: flex; justify-content: space-between; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 4px 0; border-radius: 8px; cursor: pointer; }
  .bottom-nav svg { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--primary); }
  .login { grid-template-columns: 1fr; } .login-side { display: none; }
  .dl-day { flex-direction: column; gap: 8px !important; } .dl-date { display: flex; gap: 8px; align-items: baseline; width: auto; }
  .chapter-body { padding-inline-start: 16px; }
  .avail-grid { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 90px 1fr 48px; }
  .print-doc { padding: 20px; }
  .toasts { left: 16px; right: 16px; bottom: 84px; }
}
