/* ==========================================================================
   EDU Admin — feuille de style (thème inspiré de facebook.com)
   ========================================================================== */

@view-transition { navigation: auto; }

:root {
  --bg: #F0F2F5;
  --card: #FFFFFF;
  --text: #050505;
  --muted: #65676B;
  --line: #E4E6EB;
  --line-strong: #CED0D4;
  --hover: #F2F2F2;
  --input: #F0F2F5;
  --primary: #1877F2;
  --primary-d: #166FE5;
  --primary-soft: #E7F3FF;
  --green: #31A24C;   --green-soft: #E3F5E8;
  --red: #E41E3F;     --red-soft: #FDE8EC;
  --amber: #C98A00;   --amber-soft: #FFF3D1;
  --violet: #7B61FF;  --violet-soft: #ECE8FF;
  --teal: #00A5A5;    --teal-soft: #DDF4F4;
  --shadow: 0 1px 2px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.02);
  --shadow-lg: 0 12px 28px rgba(0,0,0,.18), 0 2px 4px rgba(0,0,0,.1);
  --radius: 12px;
  --top-h: 56px;
  --side-w: 288px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #18191A;
  --card: #242526;
  --text: #E4E6EB;
  --muted: #B0B3B8;
  --line: #3E4042;
  --line-strong: #4E5052;
  --hover: #3A3B3C;
  --input: #3A3B3C;
  --primary: #2D88FF;
  --primary-d: #4599FF;
  --primary-soft: #263951;
  --green: #45BD62;   --green-soft: #1B3A27;
  --red: #FF5A75;     --red-soft: #45222B;
  --amber: #F7B928;   --amber-soft: #43381A;
  --violet: #9B87FF;  --violet-soft: #2D2850;
  --teal: #2CC7C7;    --teal-soft: #17393A;
  --shadow: 0 1px 2px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 28px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.4;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background .25s, color .25s;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; letter-spacing: -.3px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 8px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.bold { font-weight: 600; }
[hidden] { display: none !important; }
.only-mobile { display: none !important; }
.inline { display: inline; }
.i { flex: none; vertical-align: middle; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Barre de progression de navigation ---------- */
.topbar-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 1000;
  background: linear-gradient(90deg, #1877F2, #42B72A, #1877F2); background-size: 200% 100%;
  transition: width .4s var(--ease), opacity .3s; opacity: 0; }
.topbar-progress.run { opacity: 1; animation: slide 1s linear infinite; }
@keyframes slide { to { background-position: -200% 0; } }

/* ---------- Barre du haut ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 100;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 0 16px; background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right { justify-content: flex-end; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 20px; letter-spacing: -.3px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--primary); }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #1877F2, #0A5BD3); box-shadow: 0 2px 8px rgba(24,119,242,.45); flex: none; transition: transform .4s var(--ease); }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand.big { font-size: 30px; color: #fff; } .brand.big b { color: #fff; }
.brand.big .brand-logo { width: 54px; height: 54px; background: rgba(255,255,255,.2); box-shadow: none; backdrop-filter: blur(6px); }
.search { position: relative; display: flex; align-items: center; margin-left: 4px; }
.search .i { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { width: 240px; height: 40px; border: 0; border-radius: 20px; background: var(--input); color: var(--text);
  padding: 0 14px 0 38px; font: inherit; transition: width .3s var(--ease), box-shadow .2s; }
.search input:focus { width: 300px; outline: none; box-shadow: 0 0 0 2px var(--primary); background: var(--card); }
.tb-tabs { display: flex; gap: 4px; height: 100%; align-items: stretch; }
.tab { position: relative; display: grid; place-items: center; width: 100px; color: var(--muted); border-radius: 8px; margin: 4px 0; transition: background .2s, color .2s; }
.tab:hover { background: var(--hover); text-decoration: none; }
.tab.active { color: var(--primary); background: transparent; }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -4px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); animation: grow-x .35s var(--ease); }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text); transition: background .2s, transform .15s; position: relative; }
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.round { width: 40px; height: 40px; background: var(--input); }
.icon-btn.round:hover { background: var(--hover); filter: brightness(.96); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: var(--red-soft); }
.icon-btn.ok { color: var(--green); }
.icon-btn.ok:hover { background: var(--green-soft); }
.badge-dot { position: absolute; top: -2px; right: -2px; 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(--card); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(228,30,63,.5)} 70%{box-shadow:0 0 0 8px rgba(228,30,63,0)} 100%{box-shadow:0 0 0 0 rgba(228,30,63,0)} }
.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; transition: transform .15s; }
.avatar-btn:active { transform: scale(.92); }

/* ---------- Menus déroulants ---------- */
.dd-wrap { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 24px); background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; z-index: 200; transform-origin: top right; animation: pop .22s var(--ease); }
.dropdown.me { width: 320px; }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(-6px); } to { opacity: 1; transform: none; } }
.dd-title { font-size: 20px; font-weight: 700; padding: 8px 10px; }
.dd-empty { padding: 20px; text-align: center; color: var(--muted); }
.dd-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; color: var(--text); font-weight: 500; }
.dd-item:hover { background: var(--hover); text-decoration: none; }
.dd-item small { display: block; color: var(--primary); font-weight: 400; font-size: 12px; }
.dd-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--input); display: grid; place-items: center; flex: none; }
.dd-profile { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; color: var(--text); }
.dd-profile:hover { background: var(--hover); text-decoration: none; }
.dd-profile small { display: block; color: var(--muted); font-weight: 400; }
.dropdown form { margin: 0; }

/* ---------- Avatars ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; object-fit: cover; flex: none; letter-spacing: .3px; }
.avatar.xs { width: 28px; height: 28px; font-size: 11px; }
.avatar.sm { width: 40px; height: 40px; font-size: 14px; }
.avatar.md { width: 44px; height: 44px; font-size: 16px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.xl { width: 128px; height: 128px; font-size: 44px; border: 4px solid var(--card); box-shadow: var(--shadow); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; color: var(--text); }
.person small { color: var(--muted); }

/* ---------- Menu latéral ---------- */
.sidebar { position: fixed; top: var(--top-h); left: 0; bottom: 0; width: var(--side-w); padding: 12px 8px 24px; overflow-y: auto; background: var(--bg); z-index: 90; transition: transform .35s var(--ease); }
.sb-school { display: flex; align-items: center; gap: 12px; padding: 10px; margin-bottom: 4px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.sb-school small { display: block; color: var(--muted); }
.sb-school b { display: block; line-height: 1.2; }
.sb-group { padding: 16px 10px 6px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; position: relative; transition: background .15s, transform .15s; }
.sb-link:hover { background: var(--hover); text-decoration: none; transform: translateX(2px); }
.sb-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--primary); box-shadow: var(--shadow); transition: background .2s, color .2s, transform .25s var(--ease); }
.sb-link:hover .sb-ico { transform: scale(1.08) rotate(-4deg); }
.sb-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.sb-link.active .sb-ico { background: var(--primary); color: #fff; }
.sb-foot { padding: 20px 10px; color: var(--muted); font-size: 12px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 80; }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Contenu ---------- */
.main { margin-left: var(--side-w); padding: calc(var(--top-h) + 24px) 28px 56px; min-height: 100vh; }
.main > * { max-width: 1120px; margin-left: auto; margin-right: auto; }
.main > .reveal, .main > .card { animation: fadeUp .5s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: fadeUp .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
body.leaving .main { opacity: .55; transform: scale(.996); transition: opacity .2s, transform .2s; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; transition: box-shadow .25s, transform .25s var(--ease), background .25s; }
.card.flush { padding: 0; overflow: hidden; }
.card.hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 17px; }
.card-b { padding: 20px; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.pop { animation: pop-in .5s var(--ease) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.94) translateY(12px); } to { opacity: 1; transform: none; } }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.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)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.split > div > .card:last-child { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.gap-s { gap: 6px; }

/* ---------- Statistiques ---------- */
.stat { display: flex; align-items: center; gap: 14px; padding: 18px; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; transition: transform .35s var(--ease); }
.stat:hover .stat-ico { transform: scale(1.1) rotate(-6deg); }
.stat-ico.blue { background: var(--primary-soft); color: var(--primary); }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.red { background: var(--red-soft); color: var(--red); }
.stat-ico.amber { background: var(--amber-soft); color: var(--amber); }
.stat-ico.violet { background: var(--violet-soft); color: var(--violet); }
.stat-ico.teal { background: var(--teal-soft); color: var(--teal); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Boutons ---------- */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border: 0; border-radius: 8px;
  font-weight: 600; font-size: 15px; background: var(--input); color: var(--text); transition: background .2s, transform .15s, box-shadow .2s; white-space: nowrap; }
.btn:hover { background: var(--hover); filter: brightness(.97); text-decoration: none; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); filter: none; box-shadow: 0 4px 14px rgba(24,119,242,.35); }
.btn.green { background: var(--green); color: #fff; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn.lg { height: 46px; font-size: 17px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.45); transform: scale(0); animation: ripple .6s linear; pointer-events: none; }
.btn:not(.primary):not(.green) .ripple { background: rgba(120,120,120,.25); }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--input); color: var(--muted); white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-weight: 600; font-size: 14px; }
.field label i { color: var(--red); font-style: normal; }
input, select, textarea { font: inherit; color: var(--text); }
.field input, .field select, .field textarea, .toolbar input, .toolbar select, .cell-input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); transition: border-color .2s, box-shadow .2s; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .toolbar select:focus, .cell-input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input[type=file] { padding: 8px; }
.help { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.span2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar > * { flex: 0 1 auto; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1 1 200px; }
.pw { position: relative; }
.pw input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
.photo-pick { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }

/* ---------- Alertes ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.success { background: var(--green-soft); color: var(--green); }
.alert.info { background: var(--primary-soft); color: var(--primary); }
.alert.warn { background: var(--amber-soft); color: var(--amber); }
.shake { animation: shake .45s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }
.table td.actions form, .table td.actions a { display: inline-flex; }
.table tr.total td { font-weight: 800; background: var(--input); }
.table tbody tr { animation: fadeUp .45s var(--ease) both; animation-delay: calc(var(--r, 0) * 25ms); }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; }
.page-link { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 10px; border-radius: 8px; background: var(--input); color: var(--text); font-weight: 600; transition: background .15s, transform .15s; }
.page-link:hover { background: var(--hover); text-decoration: none; transform: translateY(-1px); }
.page-link.active { background: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ---------- Onglets / puces ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { padding: 8px 16px; border-radius: 99px; background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow); transition: background .2s, color .2s, transform .15s; }
.chip:hover { background: var(--hover); text-decoration: none; transform: translateY(-1px); }
.chip.active { background: var(--primary); color: #fff; }

/* ---------- Listes ---------- */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); transition: background .15s; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--hover); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { color: var(--muted); display: block; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------- Profil ---------- */
.cover { height: 150px; border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(120deg, #1877F2, #5B9DFF 50%, #7B61FF); position: relative; overflow: hidden; }
.cover::before, .cover::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.12); animation: float 9s ease-in-out infinite; }
.cover::before { width: 220px; height: 220px; right: -40px; top: -80px; }
.cover::after { width: 140px; height: 140px; left: 20%; bottom: -70px; animation-delay: -4s; }
.profile-head { display: flex; gap: 20px; align-items: flex-end; padding: 0 24px 20px; margin-top: -48px; position: relative; flex-wrap: wrap; }
.profile-head h1 { font-size: 28px; }
.profile-head .grow { flex: 1; min-width: 200px; padding-bottom: 6px; }

/* ---------- Annonces (fil) ---------- */
.post { padding: 0; }
.post-h { display: flex; gap: 12px; align-items: center; padding: 16px 20px 8px; }
.post-h small { color: var(--muted); display: block; }
.post-b { padding: 4px 20px 18px; white-space: pre-line; }
.post-b h3 { margin-bottom: 6px; }

/* ---------- Barres, anneaux, progression ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--input); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #1877F2, #5B9DFF); width: 0; transition: width 1.1s var(--ease); }
.progress.green > i { background: linear-gradient(90deg, #31A24C, #6BD27E); }
.progress.red > i { background: linear-gradient(90deg, #E41E3F, #FF7B93); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 24px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar > i { display: block; width: 100%; max-width: 44px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, #5B9DFF, #1877F2); transform-origin: bottom; animation: grow .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); position: relative; min-height: 3px; }
.bar > i::before { content: attr(data-v); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.bar > span { font-size: 11px; color: var(--muted); text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.ring { position: relative; width: 120px; height: 120px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .bg { stroke: var(--input); }
.ring .fg { stroke: var(--primary); stroke-dasharray: 314; stroke-dashoffset: 314; transition: stroke-dashoffset 1.4s var(--ease); }
.ring.good .fg { stroke: var(--green); } .ring.bad .fg { stroke: var(--red); } .ring.mid .fg { stroke: var(--amber); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.ring .val small { font-size: 11px; color: var(--muted); display: block; text-align: center; font-weight: 500; margin-top: -4px; }

/* ---------- Saisie de notes ---------- */
.cell-input { width: 86px; text-align: center; font-weight: 700; padding: 6px; min-height: 38px; }
.cell-input.good { border-color: var(--green); background: var(--green-soft); }
.cell-input.mid { border-color: var(--amber); background: var(--amber-soft); }
.cell-input.bad { border-color: var(--red); background: var(--red-soft); }
.note-pill { display: inline-block; min-width: 48px; text-align: center; padding: 3px 8px; border-radius: 8px; font-weight: 700; }
.note-pill.good { background: var(--green-soft); color: var(--green); }
.note-pill.mid { background: var(--amber-soft); color: var(--amber); }
.note-pill.bad { background: var(--red-soft); color: var(--red); }
.seg { display: inline-flex; background: var(--input); border-radius: 10px; padding: 3px; gap: 2px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; transition: background .2s, color .2s, transform .15s; }
.seg input:checked + span { background: var(--card); box-shadow: var(--shadow); }
.seg input[value=absence]:checked + span { background: var(--red); color: #fff; }
.seg input[value=retard]:checked + span { background: var(--amber); color: #fff; }
.seg input[value=present]:checked + span { background: var(--green); color: #fff; }
.seg label:active span { transform: scale(.94); }

/* ---------- Emploi du temps ---------- */
.tt { display: grid; grid-template-columns: 78px repeat(6, minmax(120px, 1fr)); gap: 6px; min-width: 860px; }
.tt-h { text-align: center; font-weight: 700; padding: 10px 4px; background: var(--primary-soft); color: var(--primary); border-radius: 8px; }
.tt-time { font-size: 12px; color: var(--muted); font-weight: 600; text-align: right; padding: 6px 6px 0 0; }
.tt-cell { border-radius: 10px; padding: 8px 10px; min-height: 64px; font-size: 13px; color: #fff; position: relative; transition: transform .2s var(--ease), box-shadow .2s; animation: pop-in .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.tt-cell:hover { transform: translateY(-2px) scale(1.02); box-shadow: var(--shadow-lg); z-index: 2; }
.tt-cell b { display: block; padding-right: 22px; font-size: 14px; }
.tt-cell small { opacity: .9; display: block; }
.tt-cell form { position: absolute; top: 4px; right: 4px; }
.tt-cell .x { width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.25); color: #fff; display: grid; place-items: center; }
.tt-empty { border: 1px dashed var(--line-strong); border-radius: 10px; min-height: 64px; }

/* ---------- Emploi du temps mobile ---------- */
.tt-mobile { display: none; }
@media (max-width: 719px) { .tt-desktop { display: none; } .tt-mobile { display: block; } }

/* ---------- Bulletin / reçu (impression) ---------- */
.paper { background: #fff; color: #111; border-radius: 6px; box-shadow: var(--shadow); padding: 28px 32px; margin: 0 auto 20px; max-width: 900px; }
:root[data-theme="dark"] .paper { box-shadow: 0 0 0 1px #555; }
.paper h1, .paper h2, .paper h3 { color: #111; }
.paper-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 3px double #1877F2; padding-bottom: 12px; margin-bottom: 14px; align-items: center; }
.paper-head .l { font-size: 13px; line-height: 1.5; }
.paper-head .c { text-align: center; }
.paper-head .c h1 { font-size: 22px; text-transform: uppercase; letter-spacing: 1px; }
.paper table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.paper th, .paper td { border: 1px solid #b9bec7; padding: 6px 8px; }
.paper th { background: #eaf2ff; text-align: center; color: #0b3d91; }
.paper td.c { text-align: center; }
.paper .sum { background: #f4f6fa; font-weight: 700; }
.paper .sign { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 24px; text-align: center; font-size: 13px; min-height: 90px; }
.paper .meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 20px; margin-bottom: 12px; font-size: 14px; }
.paper .box { border: 1px solid #b9bec7; border-radius: 6px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.paper .logo { width: 64px; height: 64px; object-fit: contain; }
.receipt { max-width: 560px; }

/* ---------- États vides ---------- */
.empty { text-align: center; padding: 48px 24px; }
.empty-ico { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; animation: float 4s ease-in-out infinite; }
.empty p { color: var(--muted); max-width: 420px; margin: 8px auto 16px; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Toasts & modales ---------- */
.toasts { position: fixed; left: 20px; bottom: 20px; z-index: 500; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 420px; padding: 14px 16px; border-radius: 12px; background: #242526; color: #fff; box-shadow: var(--shadow-lg);
  pointer-events: auto; animation: toast-in .45s var(--ease) both; border-left: 5px solid var(--primary); }
.toast.success { border-color: #45BD62; } .toast.error { border-color: #FF5A75; } .toast.warn { border-color: #F7B928; }
.toast.out { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-40px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-30px); } }
.modal-root { position: fixed; inset: 0; z-index: 600; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.55); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--card); border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); animation: pop-in .3s var(--ease); }
.modal h3 { margin-bottom: 8px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Navigation mobile ---------- */
.bottom-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.bn-item:hover { text-decoration: none; }
.bn-item.active { color: var(--primary); }
.bn-item.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); animation: grow-x .35s var(--ease); }
.bn-item:active svg { transform: scale(.82); }
.bn-item svg { transition: transform .15s; }

/* ---------- Connexion ---------- */
body.bare { background: var(--card); }
.bare-main { min-height: 100vh; }
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-art { position: relative; overflow: hidden; background: linear-gradient(135deg, #0A5BD3, #1877F2 45%, #7B61FF); color: #fff; display: flex; align-items: center; padding: 48px; }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .25; background: #fff; animation: float 10s ease-in-out infinite; }
.blob.b1 { width: 360px; height: 360px; left: -100px; top: -100px; }
.blob.b2 { width: 220px; height: 220px; right: 10%; bottom: 8%; animation-delay: -3s; opacity: .15; }
.blob.b3 { width: 120px; height: 120px; right: 20%; top: 12%; animation-delay: -6s; opacity: .18; }
.art-inner { position: relative; max-width: 480px; animation: fadeUp .8s var(--ease) both; }
.art-inner h2 { font-size: 34px; margin: 28px 0 12px; letter-spacing: -.5px; }
.art-inner p { font-size: 17px; opacity: .92; }
.art-list { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.art-list li { display: flex; gap: 10px; align-items: center; font-weight: 500; animation: fadeUp .7s var(--ease) both; }
.art-list li:nth-child(1){animation-delay:.3s}.art-list li:nth-child(2){animation-delay:.4s}.art-list li:nth-child(3){animation-delay:.5s}.art-list li:nth-child(4){animation-delay:.6s}
.login-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.login-card { width: 100%; max-width: 420px; padding: 32px 28px; }
.login-card h1 { margin: 12px 0 4px; text-align: center; }
.login-card .muted { text-align: center; margin-bottom: 20px; }
.login-card .brand.center { display: flex; margin: 0 auto; width: fit-content; }

/* ---------- Installation PWA : écran de démarrage ---------- */
.splash { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: linear-gradient(135deg, #0A5BD3, #1877F2 55%, #7B61FF); color: #fff; transition: opacity .5s, visibility .5s; }
.splash.hide { opacity: 0; visibility: hidden; }
.splash .logo { width: 96px; height: 96px; border-radius: 28px; background: rgba(255,255,255,.2); display: grid; place-items: center; animation: splash-pop 1s var(--ease) both; margin: 0 auto 16px; }
.splash .logo svg { width: 52px; height: 52px; }
.splash b { display: block; text-align: center; font-size: 26px; letter-spacing: -.3px; animation: fadeUp .8s .2s var(--ease) both; }
@keyframes splash-pop { from { transform: scale(.4) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Impression ---------- */
@media print {
  .topbar, .sidebar, .bottom-nav, .toasts, .scrim, .page-head, .no-print, .topbar-progress { display: none !important; }
  body { background: #fff; }
  .main { margin: 0; padding: 0; }
  .paper { box-shadow: none; border-radius: 0; margin: 0; padding: 0; max-width: none; page-break-after: always; }
  .paper:last-child { page-break-after: auto; }
  .card { box-shadow: none; }
  * { animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .tab { width: 72px; }
  .search input { width: 200px; }
}
@media (max-width: 1099px) {
  .only-mobile { display: inline-grid !important; }
  .sidebar { transform: translateX(-102%); width: min(320px, 86vw); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .brand-text { display: none; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .tb-tabs { justify-content: center; }
}
@media (max-width: 899px) {
  .tb-tabs, .search { display: none; }
  .topbar { grid-template-columns: 1fr auto; padding: 0 10px; }
  .brand-text { display: inline; font-size: 18px; }
  .bottom-nav { display: flex; }
  .main { padding: calc(var(--top-h) + 16px) 14px calc(80px + env(safe-area-inset-bottom)); }
  .toasts { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .split { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 22px; }
}
@media (max-width: 719px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { background: linear-gradient(160deg, #1877F2, #7B61FF 120%); min-height: 100vh; }
  .login-card .only-mobile { display: flex !important; }
  .brand-text { display: inline; }
}
@media (max-width: 639px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; font-size: 12px; text-transform: uppercase; }
  .page-head { align-items: flex-start; }
  .card { padding: 16px; }
  .card-h, .toolbar { padding: 12px 16px; }
  .toolbar input, .toolbar select { width: 100%; }
  .toolbar > * { flex: 1 1 100%; }
  .profile-head { padding: 0 16px 16px; }
  .paper { padding: 16px; }
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.stack td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; text-align: left; flex: none; padding-top: 2px; }
  .table.stack td.main-cell { display: block; text-align: left; padding-bottom: 8px; }
  .table.stack td.main-cell::before { display: none; }
  .table.stack td.actions { justify-content: flex-end; padding-top: 8px; }
  .table.stack td.actions::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.stat-value{white-space:nowrap}
@media(max-width:600px){.grid.g4{grid-template-columns:1fr 1fr!important;gap:10px}}
@media(prefers-reduced-motion:reduce){@view-transition{navigation:none}}

/* ---------- Cartes d'élèves & certificats ---------- */
.id-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; justify-items: center; }
.id-card { width: 85.6mm; height: 54mm; background: #fff; color: #111; border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; border: 1px solid #d0d7e2; font-size: 11px; page-break-inside: avoid; break-inside: avoid; }
.id-top { display: flex; align-items: center; gap: 8px; background: linear-gradient(135deg, #1877F2, #0a56c4); color: #fff; padding: 6px 10px; }
.id-top img, .id-logo { width: 26px; height: 26px; border-radius: 6px; background: #fff; object-fit: contain; display: grid; place-items: center; color: #1877F2; flex: none; }
.id-top b { display: block; font-size: 12px; line-height: 1.2; }
.id-top small { font-size: 9px; opacity: .9; }
.id-body { flex: 1; display: flex; gap: 8px; padding: 8px 10px; align-items: center; }
.id-body .avatar.lg { width: 64px; height: 76px; border-radius: 6px; font-size: 20px; }
.id-info { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.3; }
.id-info b.up { font-size: 13px; }
.id-info span { color: #444; font-size: 10px; }
.id-qr { width: 76px; height: 76px; flex: none; }
.id-qr svg { width: 100%; height: 100%; display: block; }
.id-foot { background: #f0f2f5; font-size: 9px; padding: 3px 10px; color: #555; text-align: center; }
.cert-p { font-size: 16px; line-height: 1.8; margin: 8px 0; }
@media print {
  .id-sheet { grid-template-columns: repeat(2, 85.6mm); gap: 6mm; justify-content: center; }
  .id-card { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .id-top { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Bulletin scolaire ---------- */
.paper.bs { padding: 0; overflow: hidden; border-radius: 18px; max-width: 920px; color: #12254a; background: linear-gradient(180deg, #fff 0, #f5f9fe 100%); -webkit-print-color-adjust: exact; print-color-adjust: exact; position: relative; }
.bs * { box-sizing: border-box; }
.bs-top { position: relative; display: flex; align-items: center; gap: 16px; padding: 14px 20px 0; min-height: 132px; }
.bs-wave { position: absolute; top: 58px; width: 30%; height: 70px; pointer-events: none; }
.bs-wave.l { left: 0; } .bs-wave.r { right: 0; top: 74px; }
.bs-logo-wrap { position: relative; z-index: 1; flex: none; width: 126px; height: 112px; display: grid; place-items: center; }
.bs-logo { max-width: 120px; max-height: 112px; object-fit: contain; }
.bs-head { position: relative; z-index: 1; flex: 1; text-align: center; min-width: 0; }
.bs-school { font-size: 31px; font-weight: 800; color: #0a3d91; line-height: 1.05; letter-spacing: .2px; }
.bs-motto { font-size: 22px; color: #1c6dd0; font-style: italic; margin-top: 6px; letter-spacing: 1px; }
.bs-slogan { position: relative; z-index: 1; flex: none; width: 190px; text-align: right; font-family: "Segoe Script", "Brush Script MT", "Comic Sans MS", cursive; font-style: italic; color: #0a3d91; font-size: 19px; line-height: 1.15; }
.bs-slogan svg { width: 100%; height: 12px; display: block; margin-top: 3px; }
.bs-title { position: relative; z-index: 2; text-align: center; margin: -2px 40px 16px; }
.bs-title h1 { display: block; margin: 0 auto; max-width: 600px; padding: 8px 40px; background: linear-gradient(180deg, #0f4cb0, #082f73); color: #fff !important; font-size: 40px; letter-spacing: 1.5px; border-radius: 22px; box-shadow: 0 6px 14px rgba(8,47,115,.28); }
.bs-sub { display: block; width: fit-content; margin: -4px auto 0; padding: 6px 30px; background: linear-gradient(90deg, #1c6dd0, #0f4cb0); color: #fff; border-radius: 0 0 22px 22px; font-weight: 700; font-size: 20px; letter-spacing: .4px; position: relative; z-index: 1; }
.bs-sub sup { font-size: 11px; }
.bs-id { display: grid; grid-template-columns: 1fr 1fr; margin: 0 22px 14px; background: #eaf3fd; border: 1.5px solid #9cc3ec; border-radius: 14px; padding: 12px 8px; }
.bs-id-col { display: grid; gap: 9px; padding: 0 14px; }
.bs-id-col + .bs-id-col { border-left: 2px solid #9cb7dc; }
.bs-id-col > div { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.bs-id .ic { width: 32px; color: #0a3d91; flex: none; display: inline-flex; }
.bs-id .lb { width: 138px; color: #1c4a8c; flex: none; }
.bs-id b { font-size: 18px; color: #0a3d91; }
.bs-tablewrap { margin: 0 22px; overflow-x: auto; border: 2px solid #1c6dd0; border-radius: 12px; background: #fff; }
.bs-table { width: 100%; min-width: 860px; table-layout: fixed; border-collapse: collapse; font-size: 15px; }
.paper .bs-table th, .paper .bs-table td { border: 0; border-bottom: 1px solid #dbe6f5; text-align: center; padding: 8px 6px; }
.paper .bs-table thead th { background: #0b3a82; color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.2; border-left: 1px solid #3b6fc0; padding: 9px 4px; vertical-align: middle; }
.bs-table thead th:first-child { border-left: 0; }
.bs-table thead th small { font-size: 9.5px; font-weight: 400; opacity: .9; }
.bs-table thead th:not(.m):not(.n) { width: 92px; }
.bs-table thead th:not(.m):not(.n):last-child { width: 130px; }
.bs-table th.n, .bs-table td.n { width: 44px; font-weight: 700; color: #0a3d91; }
.bs-table th.m, .bs-table td.m { text-align: left; padding-left: 12px; }
.bs-table tbody tr:nth-child(even) { background: #eef5fd; }
.bs-table td.pt { font-weight: 800; color: #0a3d91; font-size: 16px; }
.bs-pill { display: inline-block; min-width: 100px; padding: 4px 10px; border-radius: 9px; font-weight: 600; font-size: 14px; color: #12341f; background: #9ad8a8; }
.bs-pill.bs-excellent { background: #5aa9f5; color: #06244f; }
.bs-pill.bs-tres-bien, .bs-pill.bs-bien { background: #9ad8a8; }
.bs-pill.bs-assez-bien { background: #f9d65c; color: #4a3a00; }
.bs-pill.bs-passable { background: #f6b36b; color: #4a2a00; }
.bs-pill.bs-insuffisant { background: #f4a1a1; color: #5a0d0d; }
.bs-pill.bs-faible { background: #ee7f7f; color: #4a0a0a; }
.bs-pill.bs-tres-faible { background: #d65f5f; color: #fff; }
.bs-bottom { display: grid; grid-template-columns: 150px 1.55fr 1fr; gap: 12px; margin: 14px 22px; align-items: stretch; }
.bs-rank { background: linear-gradient(180deg, #0f4cb0, #082f73); color: #fff; border-radius: 12px; text-align: center; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bs-rank .lab { font-weight: 800; letter-spacing: .5px; font-size: 14px; }
.bs-rank .big { font-size: 46px; font-weight: 800; line-height: 1; }
.bs-rank .big sup { font-size: 22px; }
.bs-rank .sur { font-size: 17px; font-weight: 700; margin-top: 2px; }
.bs-stats { display: grid; grid-template-columns: repeat(4, 1fr); background: #eaf3fd; border: 1.5px solid #9cc3ec; border-radius: 12px; padding: 10px 4px; }
.bs-stats > div { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 0 6px; }
.bs-stats > div + div { border-left: 2px solid #9cb7dc; }
.bs-stats .ic { color: #0a3d91; display: inline-flex; }
.bs-stats .ic.fill svg { fill: currentColor; }
.bs-stats .ic.down svg { transform: rotate(90deg); stroke-width: 3; }
.bs-stats .lb { font-size: 13px; color: #0a3d91; line-height: 1.15; font-weight: 700; }
.bs-stats b { font-size: 28px; color: #0a3d91; line-height: 1.1; }
.bs-stats small { font-size: 13px; color: #0a3d91; }
.bs-appr { background: #eaf3fd; border: 1.5px solid #9cc3ec; border-radius: 12px; padding: 10px 14px; font-size: 13px; }
.bs-appr .ttl { display: flex; align-items: center; gap: 6px; color: #0a3d91; font-size: 15px; }
.bs-appr p { margin: 4px 0; line-height: 1.35; }
.bs-appr .cont { font-family: "Segoe Script", "Brush Script MT", "Comic Sans MS", cursive; font-style: italic; color: #0a3d91; font-size: 18px; }
.bs-appr .mini { font-size: 10.5px; color: #4b6a99; margin-top: 2px; }
.bs-annual { margin: 0 22px 12px; background: #eef5fd; border: 2px solid #1c6dd0; border-radius: 12px; overflow: hidden; }
.bs-annual .ttl { background: #1c6dd0; color: #fff; padding: 4px 14px; font-weight: 700; text-align: center; }
.bs-annual .row { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 6px; padding: 8px; text-align: center; }
.bs-annual .row > div { display: grid; min-width: 110px; }
.bs-annual .row span { font-size: 12px; color: #1c4a8c; }
.bs-annual .row b { font-size: 20px; color: #0a3d91; }
.bs-annual .hl b { font-size: 24px; }
.bs-annual .dec { flex-basis: 100%; border-top: 1px solid #b5c9e6; padding-top: 6px; }
.bs-annual .dec b { font-size: 16px; }
.bs-sign { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 18px; align-items: end; padding: 6px 28px 14px; min-height: 92px; font-size: 13px; }
.bs-sign .sg { border-bottom: 1.5px dotted #6a86b3; min-height: 64px; display: flex; flex-direction: column; justify-content: space-between; font-weight: 700; color: #0a3d91; padding-bottom: 2px; }
.bs-sign .sg span { display: flex; align-items: center; gap: 6px; }
.bs-sign .sg b { color: #12254a; font-size: 12px; order: 3; margin-top: 2px; }
.bs-sign .mid { text-align: center; font-family: "Segoe Script", "Brush Script MT", "Comic Sans MS", cursive; font-style: italic; color: #1c6dd0; font-size: 16px; align-self: center; }
.bs-foot { display: flex; align-items: center; justify-content: space-around; gap: 10px; background: linear-gradient(180deg, #0f4cb0, #082f73); color: #fff; padding: 14px 20px; font-size: 15px; border-radius: 34px 34px 0 0; margin-top: 6px; }
.bs-foot b { font-size: 15px; }
.bs-foot span { display: inline-flex; align-items: center; gap: 6px; }
.bs-foot em { font-family: "Segoe Script", "Brush Script MT", "Comic Sans MS", cursive; font-size: 16px; }
.bs-foot .sep { width: 1px; height: 26px; background: rgba(255,255,255,.45); }
.bs-foot .sep.thin { height: 18px; }
@media screen and (max-width: 760px) {
  .bs-top { flex-wrap: wrap; justify-content: center; text-align: center; } .bs-slogan { width: 100%; text-align: center; } .bs-wave { display: none; }
  .bs-school { font-size: 22px; } .bs-motto { font-size: 16px; } .bs-title { margin: 0 12px 14px; } .bs-title h1 { font-size: 24px; padding: 6px 18px; } .bs-sub { font-size: 15px; padding: 5px 16px; }
  .bs-id { grid-template-columns: 1fr; gap: 10px; margin: 0 12px 12px; } .bs-id-col + .bs-id-col { border-left: 0; }
  .bs-tablewrap, .bs-bottom, .bs-annual { margin-left: 12px; margin-right: 12px; }
  .bs-stats { grid-template-columns: repeat(2, 1fr); gap: 10px 0; } .bs-stats > div:nth-child(3) { border-left: 0; }
  .bs-bottom { grid-template-columns: 1fr; } .bs-sign { grid-template-columns: 1fr; } .bs-foot { flex-wrap: wrap; font-size: 13px; border-radius: 22px 22px 0 0; } .bs-foot .sep { display: none; }
}
@page { size: A4 portrait; margin: 5mm; }
@media print {
  html, body { background: #fff !important; }
  .main { margin: 0 !important; padding: 0 !important; min-height: 0 !important; }
  .main > * { max-width: none !important; margin: 0 !important; }
  .paper.bs { border-radius: 0; max-width: none; width: 100%; font-size: 11px; page-break-after: always; break-after: page; page-break-inside: avoid; break-inside: avoid; }
  .paper.bs:last-of-type { page-break-after: auto; break-after: auto; }
  .bs-top { min-height: 96px; padding: 8px 14px 0; gap: 10px; } .bs-wave { top: 42px; height: 52px; } .bs-wave.r { top: 56px; }
  .bs-logo-wrap { width: 96px; height: 86px; } .bs-logo { max-width: 92px; max-height: 86px; }
  .bs-school { font-size: 24px; } .bs-motto { font-size: 16px; margin-top: 3px; } .bs-slogan { width: 150px; font-size: 14px; }
  .bs-title { margin: -2px 30px 8px; } .bs-title h1 { font-size: 28px; padding: 5px 30px; } .bs-sub { font-size: 14px; padding: 4px 22px; }
  .bs-id { margin: 0 14px 8px; padding: 6px 4px; } .bs-id-col { gap: 3px; } .bs-id-col > div { font-size: 12px; } .bs-id b { font-size: 13.5px; } .bs-id .lb { width: 112px; } .bs-id .ic svg { width: 20px; height: 20px; }
  .bs-tablewrap { margin: 0 14px; overflow: visible; }
  .bs-table { min-width: 0; font-size: 11.5px; } .paper .bs-table td { padding: 2px 4px; } .paper .bs-table thead th { font-size: 10.5px; padding: 4px 2px; }
  .bs-table thead th:not(.m):not(.n) { width: 62px; } .bs-table thead th:not(.m):not(.n):last-child { width: 92px; } .bs-table th.n, .bs-table td.n { width: 26px; }
  .bs-table td.pt { font-size: 12.5px; } .bs-pill { min-width: 76px; padding: 1px 5px; font-size: 10.5px; }
  .bs-bottom { margin: 8px 14px; gap: 8px; grid-template-columns: 100px 1.55fr 1fr; } .bs-rank { padding: 6px 4px; } .bs-rank .big { font-size: 32px; } .bs-rank svg { width: 46px; height: 38px; } .bs-rank .sur { font-size: 13px; } .bs-rank .lab { font-size: 10px; }
  .bs-stats { padding: 6px 2px; } .bs-stats b { font-size: 19px; } .bs-stats .lb { font-size: 9.5px; } .bs-stats small { font-size: 10px; } .bs-stats .ic svg { width: 20px; height: 20px; }
  .bs-appr { font-size: 10px; padding: 6px 8px; } .bs-appr .ttl { font-size: 12px; } .bs-appr .cont { font-size: 14px; }
  .bs-annual { margin: 0 14px 6px; } .bs-annual .row b { font-size: 14px; } .bs-annual .hl b { font-size: 16px; } .bs-annual .row { padding: 3px; gap: 2px; } .bs-annual .row span { font-size: 10px; } .bs-annual .dec { padding-top: 2px; } .bs-annual .dec b { font-size: 12px; } .bs-annual .ttl { padding: 2px 10px; font-size: 11px; }
  .bs-sign { padding: 2px 20px 6px; min-height: 54px; font-size: 10.5px; gap: 12px; } .bs-sign .sg { min-height: 40px; } .bs-sign .mid { font-size: 12px; }
  .bs-foot { padding: 8px 14px; font-size: 11px; margin-top: 2px; } .bs-foot b { font-size: 11px; } .bs-foot em { font-size: 12px; } .bs-foot .sep { height: 18px; }
}

/* ---------- Robustesse responsive (mobile / tablette) ---------- */
html, body { max-width: 100%; overflow-x: clip; }
.main, .main > *, .card, .grid > *, .stat > div { min-width: 0; }
.stat > div:last-child { flex: 1; min-width: 0; }
.stat-value { white-space: normal; overflow-wrap: anywhere; font-size: clamp(17px, 2.1vw + 11px, 26px); }
.stat-label, .stat-sub { overflow-wrap: anywhere; }
img, svg, video, canvas { max-width: 100%; }
img { height: auto; }
input, select, textarea { max-width: 100%; }
pre, code { overflow-x: auto; max-width: 100%; }
.card h1, .card h2, .card h3, .page-head h1, .page-head p, td, th { overflow-wrap: anywhere; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  .stat { padding: 12px; gap: 10px; }
  .stat-ico { width: 40px; height: 40px; border-radius: 11px; }
  .stat-ico svg { width: 20px; height: 20px; }
  .stat-label { font-size: 12px; }
  .card { padding-left: 14px; padding-right: 14px; }
  .btn { white-space: normal; }
}
@media (max-width: 380px) { .grid.g4 { grid-template-columns: 1fr !important; } }

/* ---------- Messages parents ---------- */
.msg-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn.wa:hover { background: #1fb457; }
@media (max-width: 719px) { .msg-actions { justify-content: flex-start; } }

.wz { position: fixed; inset: 0; background: rgba(10,20,40,.55); display: grid; place-items: center; z-index: 200; padding: 16px; }
.wz[hidden] { display: none; }
.wz-box { background: var(--card, #fff); border-radius: 16px; padding: 20px; width: min(480px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.wz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.wz-msg { white-space: pre-wrap; font: inherit; background: var(--input, #f1f4f9); border-radius: 12px; padding: 12px; margin: 12px 0; max-height: 34vh; overflow: auto; }
.wz-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wz-actions .btn.wa { flex: 1; justify-content: center; }

/* ---------- Statistiques & graphiques ---------- */
.hbars { display: grid; gap: 10px; }
.hb { display: grid; grid-template-columns: minmax(80px, 150px) 1fr 62px; align-items: center; gap: 10px; font-size: 14px; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-t { height: 14px; background: var(--input); border-radius: 8px; overflow: hidden; display: block; }
.hb-t i { display: block; height: 100%; border-radius: 8px; background: var(--primary); transition: width .6s var(--ease); }
.hb-t i.green { background: var(--green); } .hb-t i.red { background: var(--red); } .hb-t i.amber { background: var(--amber); } .hb-t i.violet { background: var(--violet); }
.hb-v { text-align: right; }
.hist { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 6px; }
.hi { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; font-size: 12px; }
.hi i { display: block; width: 100%; max-width: 46px; border-radius: 8px 8px 0 0; background: var(--primary); }
.hi i.green { background: var(--green); } .hi i.red { background: var(--red); } .hi i.amber { background: var(--amber); }
.hi span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.lchart { width: 100%; height: auto; display: block; }
.lc-grid { stroke: var(--line); stroke-width: 1; }
.lc-ref { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 5 4; }
.lc-t { fill: var(--muted); font-size: 11px; }
.lc-v { font-size: 11px; font-weight: 700; }
.lc-leg { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 6px; }
.lc-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lc-leg i.ref { background: none; border-top: 2px dashed var(--red); border-radius: 0; height: 0; width: 16px; vertical-align: 3px; }
@media (max-width: 520px) { .hb { grid-template-columns: 90px 1fr 54px; font-size: 13px; } }

/* ---------- Mode hors ligne ---------- */
.off-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 150; max-width: min(560px, calc(100vw - 24px)); width: max-content; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 10px 16px; border-radius: 14px; background: var(--card); color: var(--text); border: 1px solid var(--line-strong); box-shadow: 0 8px 28px rgba(0,0,0,.22); font-size: 14px; }
.off-bar[hidden] { display: none; }
.off-bar.warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.off-bar.info { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.off-bar.ok { background: var(--green-soft); color: var(--green); border-color: var(--green); }
@media (min-width: 1100px) { .off-bar { bottom: 20px; } }

/* v2.6 — comptes par téléphone */
.stat-mini { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat-mini b { font-size: 22px; margin-right: 6px; }

/* Onglets de la console plateforme */
.pf-tabs { min-width: 0; max-width: 100%; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 0 14px; scrollbar-width: thin; }
.pf-tabs a { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--hover); }
.pf-tabs a:hover { text-decoration: none; color: var(--text); }
.pf-tabs a.active { color: #fff; background: var(--primary); }

/* ---- Console super-administrateur ---- */
.console-pill { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #fff; background: linear-gradient(135deg, #5B3FD6, #1A3A6B); vertical-align: middle; }
body.app .console-pill { line-height: 1.4; }
.console-login .login-art { background: linear-gradient(135deg, #0B1F3A, #1A3A6B 55%, #5B3FD6); }
.hbars .hb-l { min-width: 0; }
@media (max-width: 640px) { .console-pill { display: none; } }
