/* =====================================================================
   KelasiConnect — système visuel
   Inspiration : l'uniforme scolaire congolais (bleu marine et blanc)
   et l'étoile jaune du drapeau, utilisée avec parcimonie comme repère.
   Typo : Bricolage Grotesque (titres) · Onest (interface)
   ===================================================================== */
:root {
  --ink: #0B3B3C;          /* fleuve — surfaces sombres, texte fort */
  --ink-2: #15605F;
  --ink-3: #1E7470;
  --paper: #ffffff;        /* chemise blanche — surfaces */
  --chalk: #EEF3F1;        /* fond général */
  --chalk-2: #E3EBE7;
  --line: #DCE5E1;
  --muted: #5F706B;
  --sky: #1F9D6E;          /* malachite — action principale */
  --sky-soft: #E3F4EC;
  --star: #D8973F;         /* cuivre du Katanga — accent */
  --cuivre: #B9722A;
  --glow: #4FD1A0;         /* reflet de malachite */
  --star-soft: #F7EBDD;
  --ok: #1F9D6E;  --ok-soft: #E3F4EC;
  --warn: #c97700; --warn-soft: #fdf0dc;
  --bad: #cf3341;  --bad-soft: #fde6e8;
  --info: #2C68A8; --info-soft: #E4EEF8;
  --r-lg: 18px; --r-md: 12px; --r-sm: 8px;
  --shadow: 0 1px 0 rgba(11,59,60,.04), 0 6px 24px -12px rgba(11,59,60,.2);
  --font-ui: "Instrument Sans", "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Onest", system-ui, sans-serif;
  --sidebar: 268px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-ui); font-size: 15px; line-height: 1.5; color: #13211F; background: var(--chalk); }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0 0 .75em; }
:focus-visible { outline: 3px solid var(--star); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.ic { width: 1.2em; height: 1.2em; fill: currentColor; vertical-align: -0.24em; flex: none; display: inline-block; }

/* ---------------------------------------------------------------- Layout */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #0B3B3C 0%, #0A3334 55%, #072A2B 100%); color: #C6DDD5; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #1E7470 transparent; isolation: isolate; }
.sidebar::before { content: ""; position: absolute; left: -40%; right: -40%; bottom: 0; height: 260px; background: url("../img/malachite.svg") center bottom / cover no-repeat; opacity: .32; z-index: -1; pointer-events: none; animation: malachite-drift 24s ease-in-out infinite alternate; }
.sidebar::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 180px; background: radial-gradient(120% 80% at 0% 0%, rgba(79,209,160,.16), transparent 70%); z-index: -1; pointer-events: none; }
@keyframes malachite-drift { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 40px; height: 40px; flex: none; border-radius: 13px; box-shadow: 0 0 0 1px rgba(79,209,160,.25), 0 8px 22px -6px rgba(31,157,110,.65); transition: transform .3s ease, box-shadow .3s ease; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); box-shadow: 0 0 0 1px rgba(79,209,160,.5), 0 10px 28px -6px rgba(79,209,160,.8); }
.brand-name { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.brand-school { display: block; font-size: 12px; color: #8FB3A8; margin-top: 4px; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { padding: 6px 12px 24px; flex: 1; }
.nav-group { margin-top: 16px; }
.nav-title { font-size: 12px; color: #7FA89D; padding: 0 12px 6px; display: flex; align-items: center; gap: 8px; }
.nav-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(79,209,160,.25), transparent); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 12px; color: #C6DDD5; font-weight: 500; font-size: 14.5px; position: relative; overflow: hidden; transition: background .2s ease, color .2s ease, transform .2s ease, padding-left .2s ease; }
.nav a .ic { width: 20px; height: 20px; color: #8DB8AA; transition: color .2s ease, transform .25s ease; }
.nav a::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(111,226,182,.14), transparent); transform: skewX(-18deg); transition: left .55s ease; pointer-events: none; }
.nav a:hover { background: rgba(79,209,160,.09); color: #fff; text-decoration: none; padding-left: 16px; }
.nav a:hover::after { left: 120%; }
.nav a:hover .ic { color: #6FE2B6; transform: scale(1.12); }
.nav a[aria-current="page"] { background: linear-gradient(90deg, rgba(31,157,110,.42), rgba(31,157,110,.08)); color: #fff; box-shadow: inset 0 0 0 1px rgba(79,209,160,.22); }
.nav a[aria-current="page"] .ic { color: #6FE2B6; filter: drop-shadow(0 0 6px rgba(79,209,160,.7)); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 4px; border-radius: 0 4px 4px 0; background: var(--glow); box-shadow: 0 0 12px 1px rgba(79,209,160,.85); }
.nav .count { margin-left: auto; background: var(--star); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; box-shadow: 0 0 0 3px rgba(216,151,63,.2); animation: count-pulse 2.4s ease-in-out infinite; }
@keyframes count-pulse { 50% { box-shadow: 0 0 0 6px rgba(216,151,63,0); } }
.sidebar-foot { padding: 14px 22px 20px; border-top: 1px solid rgba(79,209,160,.12); font-size: 12px; color: #7FA89D; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: rgba(238,242,247,.86); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.icon-btn.menu-btn { display: none; }
.search-trigger { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font: inherit; cursor: pointer; text-align: left; }
.search-trigger kbd { margin-left: auto; font: 12px var(--font-ui); background: var(--chalk); border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.year-chip { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--chalk-2); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--paper); }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font: inherit; color: var(--ink); cursor: pointer; }
.user-btn .who { text-align: left; line-height: 1.15; }
.user-btn .who small { display: block; color: var(--muted); font-size: 12px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 6px; display: none; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--chalk); text-decoration: none; }

.content { padding: 8px 28px 48px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 22px; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* ---------------------------------------------------------------- Surfaces */
.panel { background: var(--paper); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.panel-body { padding: 20px; }
.panel-body.tight { padding: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.stack > * + * { margin-top: 18px; }
.grid > *, .stack > * { min-width: 0; }

/* KPI : chiffres en typo d'affichage, pas d'icône décorative */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi .hint.up { color: var(--ok); }
.kpi .hint.down { color: var(--bad); }

/* ---------------------------------------------------------------- Tableau de présence (pièce signature du tableau de bord) */
.today { background: var(--ink); color: #fff; border-radius: 22px; padding: 26px 28px; display: grid; grid-template-columns: 260px 1fr; gap: 32px; margin-bottom: 18px; position: relative; overflow: hidden; }
.today::after { content: ""; position: absolute; right: -60px; bottom: -70px; width: 520px; height: 260px; background: url("../img/malachite.svg") center / cover no-repeat; opacity: .38; pointer-events: none; }
.today > * { position: relative; z-index: 1; }
.today h2 { color: #fff; font-size: 15px; font-family: var(--font-ui); font-weight: 500; color: #A3C5BA; }
.today .big { font-family: var(--font-display); font-size: 64px; font-weight: 700; line-height: 1; margin: 10px 0 6px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.today .big small { font-size: 26px; color: #A3C5BA; font-weight: 600; }
.today .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: #C6DDD5; margin-top: 14px; }
.today .legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.board { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.board-row { display: grid; grid-template-columns: 150px 1fr 54px; align-items: center; gap: 12px; font-size: 13px; }
.board-row .cls { color: #C6DDD5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .rate { text-align: right; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; }
.dots i { width: 13px; height: 13px; border-radius: 4px; background: rgba(255,255,255,.12); display: block; }
.dots i.present { background: #4FD1A0; }
.dots i.late { background: #F0B44C; }
.dots i.absent { background: #ff6b78; }
.dots i.excused { background: #9d94ff; }
.dots i.early_leave { background: #6fb2ff; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #F6F9F8; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #E9EFEC; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #F2F7F5; }
.table tr[data-href] { cursor: pointer; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions form { display: inline; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .meta { min-width: 0; }
.person .name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .sub { font-size: 12.5px; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--ink-2); background: var(--chalk-2); object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; border-radius: 22px; font-size: 26px; }
.avatar.f { background: #fde7ef; color: #a3305a; }
.avatar.m { background: #E3F4EC; color: #0E5E4A; }

/* ---------------------------------------------------------------- Badges, chips */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--chalk); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--chalk); font-size: 13px; color: var(--ink-2); }

/* ---------------------------------------------------------------- Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 11px; border: 1px solid transparent; font: 600 14px var(--font-ui); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--sky); color: #fff; }
.btn-primary:hover { background: #147A55; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--chalk); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-danger:hover { background: #fbd3d7; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--sky); font: inherit; cursor: pointer; }
.link-btn.danger { color: var(--bad); }

/* ---------------------------------------------------------------- Formulaires */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.field { grid-column: span 12; display: flex; flex-direction: column; gap: 6px; }
.field.s6 { grid-column: span 6; } .field.s4 { grid-column: span 4; } .field.s3 { grid-column: span 3; } .field.s8 { grid-column: span 8; } .field.s2 { grid-column: span 2; }
label, .label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.req::after { content: " *"; color: var(--bad); }
input:not([type]), input[type=url], input[type=month], input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=tel], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #FBFDFC; font: 15px var(--font-ui); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-soft); background: #fff; }
.help { font-size: 12.5px; color: var(--muted); }
.error-text { font-size: 12.5px; color: var(--bad); }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--sky); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar input, .toolbar select { width: auto; min-width: 150px; padding: 8px 11px; font-size: 14px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.fieldset { border: 1px dashed var(--line); border-radius: var(--r-md); padding: 16px; }
.fieldset legend { font-weight: 650; padding: 0 6px; font-family: var(--font-display); }

/* Segmented control (statut de présence) */
.seg { position: relative; display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line); }
.seg label:last-of-type { border-right: 0; }
.seg input:checked + label.p { background: var(--ok-soft); color: var(--ok); }
.seg input:checked + label.l { background: var(--warn-soft); color: var(--warn); }
.seg input:checked + label.a { background: var(--bad-soft); color: var(--bad); }
.seg input:checked + label.e { background: var(--info-soft); color: var(--info); }
.seg input:focus-visible + label { outline: 2px solid var(--star); }

/* ---------------------------------------------------------------- Onglets */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a, .tabs button { padding: 13px 14px; font-weight: 600; font-size: 14px; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-family: var(--font-ui); }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab-panel[hidden] { display: none; }

/* ---------------------------------------------------------------- Divers */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ic { width: 42px; height: 42px; color: #A3BDB4; display: block; margin: 0 auto 10px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.flashes { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.toast { background: var(--ink); color: #fff; border-radius: 14px; padding: 13px 16px 13px 14px; box-shadow: 0 12px 40px -12px rgba(11,59,60,.5); display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; animation: toast-in .25s ease-out; }
.toast .ic { width: 21px; height: 21px; flex: none; }
.toast.success .ic { color: #51e0b0; }
.toast.error .ic { color: #ff8a95; }
.toast.info .ic, .toast.warning .ic { color: var(--star); }
.toast button { margin-left: auto; background: none; border: 0; color: #9FC4B8; cursor: pointer; font-size: 18px; line-height: 1; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.alert { padding: 12px 16px; border-radius: 12px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert-info { background: var(--sky-soft); color: #0E5E4A; }
.alert-warn { background: var(--warn-soft); color: #8a5300; }
.alert-bad { background: var(--bad-soft); color: #9c1d29; }
.alert-ok { background: var(--ok-soft); color: #076a50; }
.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 9px 14px; font-size: 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid #E9EFEC; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.progress { height: 8px; border-radius: 99px; background: var(--chalk-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.pager { display: flex; gap: 4px; padding: 14px 20px; justify-content: flex-end; flex-wrap: wrap; }
.pager a, .pager-gap { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.pager a:hover { background: var(--chalk); text-decoration: none; }
.pager a[aria-current] { background: var(--ink); color: #fff; }
.profile-head { display: flex; gap: 20px; align-items: center; padding: 22px; flex-wrap: wrap; }
.profile-head h1 { font-size: 26px; }
.profile-head .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--sky); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .bar span { width: 100%; max-width: 42px; background: var(--sky); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bars .bar small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.bars .bar b { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }

/* Grille de saisie des notes */
.grade-grid input.score { width: 86px; text-align: right; font-variant-numeric: tabular-nums; padding: 7px 10px; }
.grade-grid input.score.low { color: var(--bad); border-color: #f3b8be; background: #fff8f8; }
.grade-grid input.score.saved { border-color: var(--ok); }
.cell-low { color: var(--bad); font-weight: 600; }

/* Modale */
dialog.modal { border: 0; border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(11,59,60,.45); color: var(--ink); }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(11,59,60,.45); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head button { margin-left: auto; }
.modal-body { padding: 22px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #F6F9F8; }

/* Palette de commande */
.palette { position: fixed; inset: 0; z-index: 200; display: none; background: rgba(11,59,60,.4); padding: 12vh 16px 16px; }
.palette.open { display: block; }
.palette-box { max-width: 620px; margin: 0 auto; background: var(--paper); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px -20px rgba(11,59,60,.5); }
.palette-box input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 20px; font-size: 17px; background: #fff; }
.palette-box input:focus { box-shadow: none; }
.palette-results { max-height: 52vh; overflow: auto; padding: 6px; }
.palette-results a { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; color: var(--ink); }
.palette-results a.active, .palette-results a:hover { background: var(--chalk); text-decoration: none; }
.palette-results .kind { margin-left: auto; font-size: 12px; color: var(--muted); }
.palette-hint { padding: 14px 20px; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- Authentification */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); }
.auth-art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-art .brand { padding: 0; }
.auth-art blockquote { margin: auto 0 0; font-family: var(--font-display); font-size: clamp(28px, 3.4vw, 46px); line-height: 1.08; font-weight: 650; letter-spacing: -.025em; max-width: 13ch; }
.auth-art .foot { margin-top: 26px; color: #8FB3A8; font-size: 14px; max-width: 46ch; }
.auth-art::before { content: ""; position: absolute; left: -10%; right: -10%; bottom: 0; height: 60%; background: url("../img/malachite.svg") center bottom / cover no-repeat; opacity: .55; animation: malachite-drift 30s ease-in-out infinite alternate; }
.auth-art > * { position: relative; }
.auth-art .stripes { display: none; }

.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 390px; }
.auth-form h1 { font-size: 30px; margin-bottom: 6px; }
.auth-form .lead { color: var(--muted); margin-bottom: 26px; }
.auth-form .field + .field { margin-top: 14px; }
.otp { letter-spacing: 12px; font-size: 26px !important; text-align: center; font-family: var(--font-display) !important; }

/* ---------------------------------------------------------------- Borne de pointage / retrait */
.kiosk { min-height: 100vh; background: var(--ink); color: #fff; display: grid; grid-template-rows: auto 1fr auto; }
.kiosk-top { display: flex; align-items: center; gap: 16px; padding: 20px 32px; }
.kiosk-top .clock { margin-left: auto; font-family: var(--font-display); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kiosk-stage { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 0 32px 24px; align-items: stretch; }
.kiosk-scan { background: var(--ink-2); border-radius: 26px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
#qr-reader { border-radius: 18px; overflow: hidden; background: #072526; min-height: 300px; }
#qr-reader video { border-radius: 18px; }
.kiosk-input { display: flex; gap: 10px; }
.kiosk-input input { background: #082A2B; color: #fff; border-color: var(--ink-3); font-size: 18px; padding: 14px; }
.kiosk-result { border-radius: 26px; background: var(--ink-2); padding: 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; transition: background .25s; }
.kiosk-result.ok { background: #147A55; }
.kiosk-result.warn { background: #8f5a00; }
.kiosk-result.bad { background: #93202c; }
.kiosk-result.info { background: #3c3496; }
.kiosk-result .photo { width: 170px; height: 170px; border-radius: 40px; object-fit: cover; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 54px; font-family: var(--font-display); font-weight: 700; }
.kiosk-result h2 { font-size: 34px; color: #fff; }
.kiosk-result .msg { font-size: 22px; font-weight: 600; }
.kiosk-result .meta { color: rgba(255,255,255,.75); font-size: 16px; }
.kiosk-log { padding: 14px 32px 22px; display: flex; gap: 10px; overflow-x: auto; }
.kiosk-log .item { flex: none; background: var(--ink-2); border-radius: 14px; padding: 9px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.kiosk-log .item i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #4FD1A0); display: inline-block; }

/* Carte d'élève — format CR80 (85,6 × 54 mm) */
.cards-sheet { display: flex; flex-wrap: wrap; gap: 6mm; }
.id-card { width: 85.6mm; height: 54mm; border-radius: 3.2mm; overflow: hidden; position: relative; background: #fff; color: var(--ink); box-shadow: 0 0 0 .2mm #cfd7e3; display: grid; grid-template-columns: 24mm 1fr 21mm; grid-template-rows: 11mm 1fr 7mm; font-family: var(--font-ui); page-break-inside: avoid; break-inside: avoid; }
.id-card .band { grid-column: 1 / -1; background: var(--ink); color: #fff; display: flex; align-items: center; gap: 2.4mm; padding: 0 3.4mm; }
.id-card .band img, .id-card .band svg { width: 7mm; height: 7mm; }
.id-card .band b { font-family: var(--font-display); font-size: 3.1mm; line-height: 1.05; display: block; }
.id-card .band small { font-size: 2.2mm; color: #b8c4da; display: block; }
.id-card .band .yr { margin-left: auto; background: var(--star); color: var(--ink); font-weight: 700; font-size: 2.4mm; padding: .6mm 1.8mm; border-radius: 1mm; }
.id-card .ph { margin: 2.6mm 0 0 3.4mm; width: 19mm; height: 23mm; border-radius: 2mm; object-fit: cover; background: var(--chalk-2); display: grid; place-items: center; font-weight: 700; font-size: 6mm; color: var(--ink-3); }
.id-card .info { padding: 2.6mm 1mm 0 2mm; font-size: 2.5mm; line-height: 1.35; min-width: 0; }
.id-card .info .n { font-family: var(--font-display); font-weight: 700; font-size: 3.4mm; line-height: 1.1; margin-bottom: 1mm; text-transform: uppercase; }
.id-card .info .k { color: var(--muted); font-size: 2.1mm; }
.id-card .qr { padding: 2.6mm 3mm 0 0; }
.id-card .qr canvas, .id-card .qr img { width: 18mm !important; height: 18mm !important; }
.id-card .foot { grid-column: 1 / -1; background: var(--chalk); display: flex; align-items: center; justify-content: space-between; padding: 0 3.4mm; font-size: 2.1mm; color: var(--muted); border-top: .5mm solid var(--star); }

/* ---------------------------------------------------------------- Impression (bulletins, reçus, cartes) */
.print-page { background: #fff; max-width: 210mm; margin: 0 auto; padding: 12mm; color: #111; font-size: 11.5px; }
.print-toolbar { position: sticky; top: 0; background: var(--ink); color: #fff; padding: 10px 20px; display: flex; gap: 10px; align-items: center; z-index: 10; }
.print-toolbar .grow { flex: 1; }
.doc-head { display: grid; grid-template-columns: 70px 1fr 90px; gap: 14px; align-items: center; border-bottom: 2.5px solid var(--ink); padding-bottom: 10px; margin-bottom: 12px; }
.doc-head .t { text-align: center; }
.doc-head .t b { display: block; font-size: 13px; letter-spacing: .02em; }
.doc-head .t span { display: block; font-size: 11px; }
.doc-title { text-align: center; font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 10px 0; color: var(--ink); }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin-bottom: 10px; font-size: 11.5px; }
table.bt { width: 100%; border-collapse: collapse; font-size: 11px; }
.bt th, .bt td { border: 1px solid #9aa6b8; padding: 3.5px 5px; text-align: center; }
.bt th { background: #eef2f7; font-weight: 700; }
.bt td.l { text-align: left; }
.bt tr.dom td { background: #f6f8fb; font-weight: 700; text-align: left; }
.bt tr.tot td { font-weight: 700; background: #eef2f7; }
.sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 22px; text-align: center; font-size: 11px; }
.sign div { padding-top: 40px; border-top: 1px dotted #888; }
.receipt { max-width: 148mm; }
.stamp { display: inline-block; border: 2px solid var(--ok); color: var(--ok); font-weight: 800; padding: 4px 12px; border-radius: 8px; transform: rotate(-6deg); font-family: var(--font-display); letter-spacing: .04em; }

@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff; }
  .no-print, .print-toolbar, .sidebar, .topbar, .flashes { display: none !important; }
  .print-page { padding: 0; max-width: none; }
  .page-break { page-break-after: always; break-after: page; }
  .id-card { box-shadow: 0 0 0 .2mm #bbb; }
}
body.print-cards { background: #fff; }
@media print { body.print-cards { margin: 0; } }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .today { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar); z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.3); }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 4px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .kiosk-stage { grid-template-columns: 1fr; padding: 0 16px 16px; }
  .year-chip, .user-btn .who { display: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .grid-4 { grid-template-columns: 1fr; }
  .field.s6, .field.s4, .field.s3, .field.s8, .field.s2 { grid-column: span 12; }
  .board-row { grid-template-columns: 90px 1fr 44px; }
  .today .big { font-size: 48px; }
  .search-trigger kbd { display: none; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.kiosk .seg { background: var(--ink-2); border-color: var(--ink-3); }
.kiosk .seg label { color: #C6DDD5; }
.kiosk .seg input:checked + label { background: var(--glow); color: var(--ink); }
.print-page .small { font-size: 10px; }

.nfc-btn { margin-top: 6px; align-self: flex-start; }
.nfc-btn.active, .btn.active { background: var(--sky-soft); color: var(--ok); border-color: var(--ok); }
.badge-result { display: grid; grid-template-columns: 140px 1fr; gap: 22px; align-items: start; }
.badge-result .photo { width: 140px; height: 160px; border-radius: 22px; object-fit: cover; background: var(--chalk-2); display: grid; place-items: center; font-family: var(--font-display); font-size: 42px; font-weight: 700; color: var(--ink-2); }
@media (max-width: 640px) { .badge-result { grid-template-columns: 1fr; } }
.camera-box { position: relative; border-radius: 18px; overflow: hidden; background: #072526; aspect-ratio: 3 / 4; max-width: 260px; }
.camera-box video, .camera-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-box .frame { position: absolute; inset: 12% 16% 20%; border: 2px dashed rgba(255,255,255,.6); border-radius: 50% 50% 46% 46%; pointer-events: none; }
/* Badge du personnel : bandeau cuivre pour le distinguer de la carte d'élève */
.id-card.staff-card .band { background: linear-gradient(120deg, var(--cuivre), #8a5420); }
.id-card.staff-card .band .yr { background: rgba(255,255,255,.22); color: #fff; }
.id-card, .id-card * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
