/* Madrasatokom — Palette claire v1.1 du Kit Design.
   Cartes / barre latérale #FFFFFF, fond #F4F8FF, bleu #2B7FFF,
   titres #1D4ED8, bleu clair #DCEBFF, textes #1E293B / #64748B,
   pastels vert / orange / rouge. Poppins (titres), Inter (FR), Tajawal (arabe). */
:root {
  --bg: #F4F8FF; --card: #FFFFFF; --line: #F1F5F9; --primary: #2B7FFF;
  --title: #1D4ED8; --light-blue: #DCEBFF; --text: #1E293B; --muted: #64748B;
  --green-bg: #DCFCE7; --green: #15803D; --orange-bg: #FEF3C7; --orange: #B45309;
  --red-bg: #FEE2E2; --red: #B91C1C; --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, Tajawal, system-ui, sans-serif; }
h1, h2, h3, .brand strong { font-family: Poppins, Tajawal, sans-serif; color: var(--title); }
a { color: var(--primary); text-decoration: none; }
.sidebar { width: 250px; background: var(--card); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 20px; border-bottom: 1px solid var(--line); }
.brand-logo { font-size: 32px; }
.brand strong { display: block; font-size: 18px; }
.brand small { color: var(--muted); }
.sidebar nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar nav a { padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 500; }
.sidebar nav a:hover { background: var(--light-blue); }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.nav-icon { display: inline-block; width: 24px; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot a { color: var(--muted); font-size: 14px; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 24px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 22px; }
.lang-switch { border: 1px solid var(--primary); border-radius: 20px; padding: 6px 14px; font-weight: 600; }
.school-switch select { padding: 8px; border-radius: 8px; border: 1px solid #CBD5E1; background: #fff; }
.school-current { padding: 8px 10px; border-radius: 8px; background: #DCEBFF; color: #1D4ED8; font-weight: 600; }
.content { padding: 24px; max-width: 1100px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(30, 41, 59, .06); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat b { font-size: 28px; color: var(--title); display: block; }
.stat span { color: var(--muted); font-size: 14px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; font-size: 14px; }
th { background: var(--light-blue); color: var(--title); }
.btn { display: inline-block; background: var(--primary); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.form { display: grid; gap: 12px; max-width: 560px; }
.field { display: grid; gap: 6px; font-weight: 500; }
.field input, .field select, .field textarea { padding: 10px 12px; border: 1px solid #CBD5E1;
  border-radius: 10px; font: inherit; background: #fff; }
.flash { background: var(--green-bg); color: var(--green); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.error { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.grade-green { background: var(--green-bg); color: var(--green); font-weight: 700; }
.grade-orange { background: var(--orange-bg); color: var(--orange); font-weight: 700; }
.grade-red { background: var(--red-bg); color: var(--red); font-weight: 700; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--light-blue); color: var(--title); }
/* Page de connexion : panneau bleu à gauche, formulaire à droite. */
.login-page { display: flex; min-height: 100vh; }
.login-hero { flex: 1; background: linear-gradient(160deg, #1D4ED8, #2B7FFF 60%, #38BDF8);
  color: #fff; padding: 48px; display: flex; flex-direction: column; gap: 24px; position: relative; overflow: hidden; }
.login-hero::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); top: -120px; inset-inline-start: -120px; }
.login-hero h1 { color: #fff; font-size: 32px; margin: 0; }
.login-hero .slogan { font-size: 28px; font-weight: 700; line-height: 1.3; }
.login-hero .slogan em { color: #7DD3FC; font-style: normal; }
.login-hero ul { list-style: none; padding: 0; display: grid; gap: 12px; font-size: 17px; }
.login-hero .illus-slot { border: 2px dashed rgba(255, 255, 255, .6); border-radius: var(--radius);
  padding: 28px; text-align: center; color: rgba(255, 255, 255, .85); margin-top: auto; }
.login-form-wrap { flex: 1; display: flex; flex-direction: column; padding: 24px; background: #fff; }
.login-card { max-width: 460px; width: 100%; margin: auto; }
.login-card h2 { font-size: 26px; margin-bottom: 4px; }
.login-card p.sub { color: var(--muted); margin-top: 0; }
.login-roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px 24px;
  border-top: 1px solid var(--line); text-align: center; font-size: 13px; }
.login-roles b { display: block; font-size: 14px; }
.secure-box { background: #ECFDF5; border-radius: 10px; padding: 12px; font-size: 13px; margin-top: 16px; }
@media (max-width: 820px) {
  .login-page { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .login-roles { grid-template-columns: repeat(2, 1fr); }
}

/* Sélecteur d'espace (Phase 1) : menu déroulant de la topbar + cartes
   de la page de sélection. */
.space-switch { position: relative; }
.space-switch-btn { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; }
.space-switch-btn::-webkit-details-marker { display: none; }
.space-switch-btn svg { width: 18px; height: 18px; }
.space-menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(8, 43, 101, .16); padding: 6px; z-index: 50; display: flex; flex-direction: column; }
.space-menu a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; color: var(--text); font-weight: 500; }
.space-menu a:hover { background: var(--light-blue); }
.space-menu a.active { background: var(--light-blue); color: var(--primary); font-weight: 700; }
.space-menu a svg { width: 18px; height: 18px; }
.space-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.space-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; color: var(--text); box-shadow: 0 1px 3px rgba(8, 43, 101, .06); }
.space-card:hover { border-color: var(--primary); }
.space-card-ico { color: var(--primary); }
.space-card-ico svg { width: 28px; height: 28px; }
.space-card b { font-size: 17px; color: var(--title); }
.space-card span { font-size: 14px; color: var(--muted); }

/* ==========================================================================
   Interface Élève — design system (maquette validée, migration 0011)
   Tokens : bleu marine #082B65, bleu primaire #1263D6, bleu clair #EAF3FF,
   vert #16A36B, orange #F59E0B, rouge #DC3545.
   Mode clair par défaut ; mode sombre via [data-theme="dark"] sur <html>.
   ========================================================================== */
:root {
  --navy: #082B65;
  --primary: #1263D6;
  --primary-dark: #0E4FA8;
  --light-blue: #EAF3FF;
  --green: #16A36B;
  --orange: #F59E0B;
  --red: #DC3545;
  --bg: #F2F6FC;
  --surface: #FFFFFF;
  --surface-2: #F7FAFF;
  --border: #DCE6F2;
  --text: #12263F;
  --text-2: #4A5F7A;
  --text-3: #7C90AB;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --shadow: 0 1px 2px rgba(8, 43, 101, .06), 0 8px 24px rgba(8, 43, 101, .06);
  /* Couleurs matières (tokenisées, une par matière par ordre alphabétique). */
  --subj-1: #1263D6; --subj-2: #16A36B; --subj-3: #F59E0B; --subj-4: #DC3545;
  --subj-5: #7C3AED; --subj-6: #0891B2; --subj-7: #DB2777; --subj-8: #65A30D;
  /* Couleurs calendrier par type d'événement. */
  --cal-exam: #DC3545; --cal-holiday: #16A36B; --cal-event: #1263D6;
  --cal-meeting: #F59E0B; --cal-trip: #7C3AED; --cal-other: #7C90AB;
}
[data-theme="dark"] {
  --bg: #0B1526;
  --surface: #12263F;
  --surface-2: #0E1E33;
  --border: #1E3A5F;
  --text: #EAF3FF;
  --text-2: #A9BED8;
  --text-3: #7C90AB;
  --light-blue: #14294A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .35);
}
/* Le corps utilise les tokens (remplace le fond v1.1). */
body { background: var(--bg); color: var(--text); }
.card, .stat { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); }
.card h2, .card h3 { color: var(--text); }
.muted { color: var(--text-2); }
a { color: var(--primary); }
.btn { background: var(--primary); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--red); }
.btn.ghost { background: transparent; color: var(--primary); border-color: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Coquille : sidebar marine réductible + topbar ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--navy); color: #EAF3FF;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 40;
  transition: width .2s ease, flex-basis .2s ease;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; font-weight: 800; font-size: 18px; color: #fff; white-space: nowrap; }
.sidebar .brand .logo-dot { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 17px; flex: 0 0 34px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin: 2px 0; border-radius: 10px;
  color: #C7D6F2; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a .ico { flex: 0 0 20px; display: grid; place-items: center; }
.sidebar nav a .lbl { overflow: hidden; text-overflow: ellipsis; }
.sidebar .side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .12); }
.sidebar .side-foot a { color: #C7D6F2; }
.sidebar .nav-section { padding: 14px 12px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #7C90AB; white-space: nowrap; }
/* Sidebar réduite : icônes seules, libellés masqués. */
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .lbl,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .brand span { display: none; }
body.sidebar-collapsed .sidebar nav a { justify-content: center; padding: 11px 0; }
body.sidebar-collapsed .sidebar .brand { justify-content: center; padding: 18px 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 19px; margin: 0; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.count-badge {
  position: absolute; top: -6px; inset-inline-end: -6px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.search-box { position: relative; flex: 0 1 340px; }
.search-box input {
  width: 100%; padding: 9px 12px 9px 38px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.search-box .ico { position: absolute; top: 50%; inset-inline-start: 12px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); inset-inline: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; display: none;
}
.search-results.open { display: block; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: var(--text); font-size: 14px; }
.search-results a:hover { background: var(--surface-2); }
.search-results .kind { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
/* Avatar + menu du compte. */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
  background: var(--primary); color: #fff; font-weight: 700;
  display: inline-grid; place-items: center; font-size: 15px; overflow: hidden;
}
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.account { position: relative; }
.account-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 60;
  min-width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; display: none;
}
.account-menu.open { display: block; }
.account-menu .who { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.account-menu .who b { display: block; font-size: 14px; }
.account-menu .who span { font-size: 12px; color: var(--text-3); }
.account-menu a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--text); font-size: 14px; }
.account-menu a:hover { background: var(--surface-2); }

/* ---------- Composants ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { display: flex; gap: 12px; align-items: flex-start; }
.kpi .kpi-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--light-blue); color: var(--primary); display: grid; place-items: center; flex: 0 0 44px; }
.kpi .kpi-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.kpi .kpi-lbl { font-size: 13px; color: var(--text-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--light-blue); color: var(--primary);
}
.chip.green { background: #E7F6EE; color: var(--green); }
.chip.orange { background: #FEF3DF; color: #B45309; }
.chip.red { background: #FDECEC; color: var(--red); }
.chip.grey { background: #EEF2F7; color: var(--text-2); }
.chip.purple { background: #F1EAFE; color: #7C3AED; }
[data-theme="dark"] .chip.green { background: #0F2E22; }
[data-theme="dark"] .chip.orange { background: #3A2A08; color: #F5B544; }
[data-theme="dark"] .chip.red { background: #3A1414; }
[data-theme="dark"] .chip.grey { background: #1A2C44; }
[data-theme="dark"] .chip.purple { background: #241344; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.tabs a, .tabs button {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer;
}
.tabs a.active, .tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input[type="search"], .filters input[type="text"] { max-width: 240px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: start; }
.tbl th { color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tbl tr:hover td { background: var(--surface-2); }
.progress { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress.green > i { background: var(--green); }
.progress.orange > i { background: var(--orange); }
.progress.red > i { background: var(--red); }
.empty { text-align: center; color: var(--text-3); padding: 28px 12px; }
.empty .ico { margin-bottom: 8px; color: var(--text-3); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.dot.sm { width: 8px; height: 8px; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 43, 101, .45); z-index: 90;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 560px; width: 100%; padding: 22px; max-height: 85vh; overflow-y: auto; }
.modal h3 { margin-top: 0; }
.toast {
  position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); z-index: 100; display: none;
}
[dir="rtl"] .toast { transform: translateX(50%); }
.toast.show { display: block; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 44px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 99px; background: var(--border);
  transition: .2s; cursor: pointer;
}
.switch .slider:before {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; inset-inline-start: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + .slider:before { transform: translateX(-20px); }
.setting-row { display: flex; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .grow { flex: 1; }
.setting-row b { display: block; font-size: 14px; }
.setting-row small { color: var(--text-2); }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }
.rank-badge {
  display: inline-grid; place-items: center; min-width: 56px; height: 56px; padding: 6px;
  border-radius: 16px; background: var(--light-blue); color: var(--primary);
  font-weight: 800; font-size: 18px; line-height: 1;
}
.rank-badge small { display: block; font-size: 11px; font-weight: 600; color: var(--text-2); }
.grade-big { font-size: 34px; font-weight: 800; line-height: 1; }
.grade-big small { font-size: 15px; color: var(--text-3); font-weight: 600; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 8px 2px 0; }
.bar-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-chart .bar i { display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 0 0; background: var(--primary); }
.bar-chart .bar span { font-size: 11px; color: var(--text-3); }
.bar-chart .bar b { font-size: 12px; }
.course-card { display: flex; flex-direction: column; gap: 10px; }
.course-card .head { display: flex; gap: 12px; align-items: center; }
.course-card .head .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: 0 0 44px; }
.course-card .avg { font-size: 20px; font-weight: 800; }
/* Emploi du temps : grille jour/semaine. */
.tt { display: grid; gap: 10px; }
.tt .tt-day { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tt .tt-day > header { background: var(--surface-2); padding: 9px 14px; font-weight: 700; display: flex; justify-content: space-between; }
.tt .tt-slot { display: flex; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); align-items: center; }
.tt .tt-slot .time { font-weight: 700; white-space: nowrap; color: var(--text-2); font-size: 13px; }
.tt .tt-slot .subj { flex: 1; }
.tt .tt-slot.cancelled { opacity: .6; }
.tt .tt-slot.cancelled .subj b { text-decoration: line-through; }
/* Calendrier mensuel. */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .cal-head { font-size: 12px; font-weight: 700; color: var(--text-3); text-align: center; padding: 6px 0; }
.cal .cal-day { min-height: 76px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; font-size: 12px; background: var(--surface); }
.cal .cal-day.other { opacity: .4; }
.cal .cal-day.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.cal .cal-day b { display: block; font-size: 13px; margin-bottom: 4px; }
.cal .cal-ev { display: flex; gap: 5px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Messagerie. */
.msg-list a { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); color: var(--text); align-items: center; }
.msg-list a:last-child { border-bottom: 0; }
.msg-thread { display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow-y: auto; padding: 6px 2px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.msg.mine { align-self: flex-end; background: var(--primary); color: #fff; border-end-end-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-end-start-radius: 4px; }
.msg small { display: block; font-size: 11px; opacity: .75; margin-top: 4px; }
/* Annonces. */
.announce { display: flex; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.announce:last-child { border-bottom: 0; }
.announce .a-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 40px; background: var(--light-blue); color: var(--primary); }
/* Bulletin : vue impression. */
.bulletin { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.bulletin header { background: var(--navy); color: #fff; padding: 18px 20px; }
.bulletin header h2 { color: #fff; margin: 0 0 4px; }
.bulletin header p { color: #C7D6F2; margin: 0; font-size: 13px; }
/* Accessibilité. */
html.large-text { font-size: 112.5%; }
html.high-contrast { --text-2: #24344D; --text-3: #3A4E6B; --border: #9FB3CC; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* Icônes SVG en ligne (style Lucide, sans dépendance externe). */
.ico { display: inline-flex; vertical-align: -3px; }
.ico svg { width: 20px; height: 20px; }
.ico.sm svg { width: 16px; height: 16px; }
.ico.lg svg { width: 26px; height: 26px; }
/* RTL : sidebar à droite, recherche et compteurs miroir. */
[dir="rtl"] .sidebar { order: 2; }
[dir="rtl"] .main { order: 1; }
[dir="rtl"] .search-box input { padding: 9px 38px 9px 12px; }
/* Responsive. */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; inset-inline-start: 0; transform: translateX(0); transition: transform .2s ease; }
  [dir="ltr"] body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  [dir="rtl"] body.sidebar-collapsed .sidebar { transform: translateX(100%); }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); flex-basis: var(--sidebar-w); }
  body.sidebar-collapsed .sidebar .lbl,
  body.sidebar-collapsed .sidebar .nav-section,
  body.sidebar-collapsed .sidebar .brand span { display: block; }
  body.sidebar-collapsed .sidebar nav a { justify-content: flex-start; padding: 10px 12px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .search-box { display: none; }
  .kv { grid-template-columns: 1fr; }
  .cal .cal-day { min-height: 54px; }
  .topbar { padding: 10px 12px; }
  .content { padding: 14px; }
}
@media print {
  .sidebar, .topbar, .btn, .tabs, .filters { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
