/* Gestion scolaire La Rochelle – feuille de styles */
:root {
    --navy: #1b2f6b;
    --navy-deep: #13224f;
    --navy-soft: #e8ecf7;
    --red: #c4161c;
    --red-soft: #fde8e8;
    --gold: #f2b705;
    --gold-soft: #fff6d6;
    --ink: #14213d;
    --ink-2: #4a5775;
    --line: #dde3ef;
    --paper: #f4f6fb;
    --white: #ffffff;
    --ok: #177245;
    --ok-soft: #e3f4ea;
    --radius-s: 6px;
    --radius-m: 10px;
    --font: "Lexend", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --sidebar: 248px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--paper); }
a { color: var(--navy); }
a:hover { color: var(--red); }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--navy-soft); color: var(--navy-deep); padding: .1em .4em; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-2); }
small { font-size: .82em; }
.ico { width: 20px; height: 20px; flex: none; }

/* ---------- Mise en page applicative ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
    background: var(--navy); color: #dfe5f5; display: flex; flex-direction: column;
    border-right: 5px solid var(--red); box-shadow: inset -9px 0 0 -4px var(--gold);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand:hover { color: #fff; }
.brand img { width: 52px; height: 52px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: .01em; }
.brand-text small { color: #b9c3e0; font-size: 12.5px; }
.nav { flex: 1; padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-logout button {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-s);
    color: #dfe5f5; text-decoration: none; font: inherit; font-size: 14.5px; width: 100%;
    background: none; border: 0; cursor: pointer; text-align: left;
}
.nav a:hover, .nav-logout button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: #fff; color: var(--navy); font-weight: 600; }
.nav a.active .ico { color: var(--red); }
.nav-logout { padding: 10px; border-top: 1px solid rgba(255,255,255,.12); margin: 0; }

.main { margin-left: var(--sidebar); min-height: 100vh; 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(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px);
}
.page-title { font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.burger { display: none; background: none; border: 0; padding: 6px; color: var(--navy); cursor: pointer; border-radius: var(--radius-s); }
.etab-switch select { max-width: 260px; }
.etab-single { font-size: 14px; color: var(--ink-2); }
.user-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold); color: var(--navy-deep); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--ink-2); }
.content { flex: 1; padding: 26px 28px 40px; max-width: 1320px; width: 100%; }
.footer { padding: 16px 28px; color: var(--ink-2); font-size: 13px; border-top: 1px solid var(--line); background: var(--white); }
.backdrop { display: none; }

/* ---------- Composants ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; margin-bottom: 22px; }
.panel-tight { padding: 14px 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 16.5px; }
.panel-head + .panel-head, .role-list + .panel-head { margin-top: 22px; }
.link { font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-2 > .panel { margin-bottom: 0; }

.welcome { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.welcome h2 { font-size: 26px; color: var(--navy); }
.welcome p { margin: 4px 0 0; color: var(--ink-2); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; border-bottom: 3px solid var(--navy); }
.stat:nth-child(2) { border-bottom-color: var(--red); }
.stat:nth-child(3) { border-bottom-color: var(--gold); }
.stat-ico { grid-row: span 2; width: 44px; height: 44px; border-radius: 50%; background: var(--navy-soft); color: var(--navy); display: grid; place-items: center; }
.stat strong { font-size: 26px; line-height: 1.1; color: var(--navy-deep); }
.stat > span:last-child { color: var(--ink-2); font-size: 14px; }

.role-list, .activity { list-style: none; margin: 0; padding: 0; }
.role-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.role-list li:last-child { border-bottom: 0; }
.activity li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.activity li:last-child { border-bottom: 0; }
.activity span { color: var(--ink-2); font-size: 14px; }
.activity small { color: var(--ink-2); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.toolbar > p { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters.panel { margin-bottom: 18px; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-2); width: 18px; height: 18px; }
.input-icon input[type=search] { padding-left: 36px; min-width: 240px; }
label.inline { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }

/* Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px;
    border-radius: var(--radius-s); border: 1px solid transparent; font: inherit; font-size: 14.5px; font-weight: 500;
    cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); color: #fff; }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #9d1015; color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--navy-soft); color: var(--navy); }
.btn-danger-text:hover { background: var(--red-soft); color: var(--red); }
.btn-sm { padding: 6px 9px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px 10px; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }

/* Formulaires */
.form fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.form legend { font-weight: 600; font-size: 16px; color: var(--navy); padding: 0 0 10px; width: 100%; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.form-wide { max-width: 900px; }
.field { margin-bottom: 16px; min-width: 0; }
.field label, .field .label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--ink-2); font-size: 12.5px; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=time], input:not([type]), select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid #c5cde0; border-radius: var(--radius-s); font: inherit; font-size: 15px;
    color: var(--ink); background: var(--white);
}
.filters input, .filters select, .etab-switch select, label.inline input { width: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); outline: 2px solid rgba(27,47,107,.18); outline-offset: 0; }
select:disabled { background: var(--paper); color: var(--ink-2); }
.has-error input, .has-error select { border-color: var(--red); }
.field-error { color: var(--red); font-size: 13px; margin: 5px 0 0; }
.hint { color: var(--ink-2); font-size: 13.5px; margin: -6px 0 14px; }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14.5px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--navy); flex: none; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); }
.check-grid.has-error { border-color: var(--red); }
.check-child { padding-left: 22px; }
.segmented { display: inline-flex; border: 1px solid #c5cde0; border-radius: var(--radius-s); overflow: hidden; }
.segmented label { margin: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 9px 16px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.segmented label + label span { border-left: 1px solid #c5cde0; }
.segmented input:checked + span { background: var(--navy); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: -3px; }
.segmented .is-disabled span { opacity: .45; cursor: not-allowed; }
.mat-preview { background: var(--gold-soft); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: var(--radius-s); font-size: 14.5px; margin-bottom: 12px; }
.mat-preview code { background: #fff; font-size: 1.05em; font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--line); }

/* Tableaux */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #f8f9fd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.is-muted td { color: var(--ink-2); }
.table tr.is-child td:first-child { padding-left: 26px; }
.tree { color: var(--red); font-weight: 700; }
.table-count { margin: 12px 0 0; color: var(--ink-2); font-size: 13.5px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; color: var(--ink-2); font-size: 14px; }
.pager span { flex: 1; }

/* Badges et messages */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--navy-soft); color: var(--navy); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-muted { background: #eceef3; color: #6b7389; }
.badge-role-superadmin { background: var(--navy); color: #fff; }
.badge-role-admin { background: var(--red-soft); color: var(--red); }
.badge-role-directeur { background: var(--gold-soft); color: #7a5b00; }
.badge-role-secretaire { background: #e7f1fb; color: #1d5a8f; }
.badge-role-enseignant { background: var(--ok-soft); color: var(--ok); }
.notice { padding: 12px 14px; border-radius: var(--radius-s); margin-bottom: 16px; font-size: 14.5px; border-left: 4px solid; }
.notice-error { background: var(--red-soft); border-color: var(--red); color: #7c0d11; }
.notice-success { background: var(--ok-soft); border-color: var(--ok); color: #0f4d2e; }
.notice-info { background: var(--navy-soft); border-color: var(--navy); color: var(--navy-deep); }
.notice-warning { background: var(--gold-soft); border-color: var(--gold); color: #5f4700; }
.empty-inline { text-align: center; padding: 26px 10px; color: var(--ink-2); }
.empty-inline p { margin: 0 0 14px; }
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state h2 { font-size: 22px; color: var(--navy); margin-bottom: 8px; }
.empty-state p { color: var(--ink-2); margin: 0 0 20px; }
.info-list { margin: 0 0 14px; }
.info-list div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.info-list dt { color: var(--ink-2); font-size: 14px; }
.info-list dd { margin: 0; }

/* ---------- Pages publiques ---------- */
body.guest {
    min-height: 100vh; background: var(--navy);
    background-image: radial-gradient(circle at 50% -10%, #2b4598 0, var(--navy) 55%, var(--navy-deep) 100%);
}
.guest-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 16px; }
.guest-card { width: 100%; max-width: 410px; background: var(--white); border-radius: 14px; padding: 76px 30px 28px; position: relative; margin-top: 60px; border-bottom: 5px solid var(--red); }
.guest-logo { position: absolute; top: -60px; left: 50%; transform: translateX(-50%); width: 120px; height: 120px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.28)); }
.guest-title { text-align: center; font-size: 21px; color: var(--navy); margin-bottom: 6px; }
.guest-sub { text-align: center; color: var(--ink-2); font-size: 14px; margin: 0 0 20px; }
.guest-link { text-align: center; margin: 18px 0 0; font-size: 14px; }
.guest-foot { color: #b9c3e0; font-size: 13px; margin-top: 22px; }

/* ---------- Fenêtres modales ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(12, 20, 48, .55); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-overlay.show { opacity: 1; }
.modal { background: var(--white); width: 100%; max-width: 460px; border-radius: 12px; overflow: hidden; transform: translateY(12px) scale(.98); transition: transform .18s; border-top: 5px solid var(--navy); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-overlay.show .modal { transform: none; }
.modal-success { border-top-color: var(--ok); }
.modal-error, .modal-danger { border-top-color: var(--red); }
.modal-warning { border-top-color: var(--gold); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.modal-head h2 { font-size: 18px; flex: 1; }
.modal-x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--ink-2); cursor: pointer; padding: 0 4px; border-radius: 4px; }
.modal-x:hover { color: var(--red); }
.modal-body { padding: 8px 20px 16px; overflow-y: auto; }
.modal-body p { margin: 0 0 12px; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px 20px; background: var(--paper); border-top: 1px solid var(--line); }
.code-card { border: 2px dashed var(--navy); border-radius: var(--radius-m); padding: 14px 16px; margin: 6px 0 12px; background: var(--navy-soft); }
.code-card div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; align-items: baseline; }
.code-card span { color: var(--ink-2); font-size: 13.5px; }
.code-big { font-size: 22px; letter-spacing: .08em; color: var(--navy-deep); }
.small { font-size: 13px; }

#print-area { display: none; }

/* ---------- Adaptation mobile ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s; }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(12,20,48,.45); z-index: 35; }
    .main { margin-left: 0; }
    .burger { display: inline-flex; }
    .topbar { padding: 10px 14px; flex-wrap: wrap; }
    .topbar-right { width: 100%; justify-content: space-between; order: 3; }
    .user-meta { display: none; }
    .etab-switch { flex: 1; }
    .etab-switch select { max-width: none; width: 100%; }
    .content { padding: 18px 14px 30px; }
    .footer { padding: 14px; }
    .row-2, .row-3, .check-grid { grid-template-columns: 1fr; gap: 0 16px; }
    .check-grid { gap: 10px; }
    .panel { padding: 16px; }
    .table-wrap { margin: 0 -16px; padding: 0 16px; }
    .filters { width: 100%; }
    .filters > * { flex: 1 1 100%; }
    .filters input, .filters select { width: 100%; }
    .input-icon input[type=search] { min-width: 0; }
    .toolbar > .btn { width: 100%; }
    /* Tableaux en fiches sur téléphone */
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr { border: 1px solid var(--line); border-radius: var(--radius-s); margin-bottom: 12px; padding: 6px 12px; }
    .table-cards td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    .table-cards td::before { content: attr(data-label); color: var(--ink-2); font-size: 13px; text-align: left; font-weight: 500; }
    .table-cards td.actions { justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
    .table-cards td.actions::before { content: none; }
    .table-cards tr.is-child td:first-child { padding-left: 0; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
    .info-list div { grid-template-columns: 1fr; gap: 2px; }
    .stats { gap: 10px; }
    .stat { padding: 14px; }
    .stat strong { font-size: 22px; }
}

/* ---------- Paramétrage ---------- */
.param-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--line); margin-bottom: 10px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; margin-bottom: -2px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-size: 14.5px; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--navy); }
.tabs a.active { color: var(--navy); font-weight: 600; border-bottom-color: var(--red); }
.year-select { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; font-size: 14px; color: var(--ink-2); }
.year-select select { width: auto; }
.param-etab { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13.5px; margin: 0 0 18px; }
.param-etab .ico { width: 16px; height: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.split > .panel { margin-bottom: 22px; }
.narrow { max-width: 560px; }
.stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--navy); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-s); margin-bottom: 8px; border-left: 4px solid; }
.checklist li span { flex: 1; }
.checklist .check-error { background: var(--red-soft); border-color: var(--red); color: #7c0d11; }
.checklist .check-warning { background: var(--gold-soft); border-color: var(--gold); color: #5f4700; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--white); font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; text-align: left; }
.pick:hover { border-color: var(--navy); background: var(--navy-soft); }
.pick-child { margin-left: 26px; width: calc(100% - 26px); }
.input-sm { max-width: 120px; padding: 6px 9px !important; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1; min-width: 0; }
.input-suffix span { display: flex; align-items: center; padding: 0 10px; border: 1px solid #c5cde0; border-left: 0; border-radius: 0 var(--radius-s) var(--radius-s) 0; background: var(--paper); color: var(--ink-2); font-size: 14px; }
.input-sm-wrap { max-width: 170px; }
.input-sm-wrap[hidden] { display: none; }
.table tr.group-row td { background: var(--navy-soft); color: var(--navy); font-weight: 600; font-size: 13.5px; padding: 7px 12px; }
.table tr.row-error td { background: #fff7f7; }
.table td.has-error input { border-color: var(--red); }
.badge-warn { background: var(--gold-soft); color: #7a5b00; }
.badge-danger { background: var(--red-soft); color: var(--red); }
.btn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.check-input { width: 18px; height: 18px; accent-color: var(--navy); }
@media (max-width: 1100px) {
    .split { grid-template-columns: 1fr; }
    .stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .year-select { width: 100%; }
    .year-select select { flex: 1; }
    .table-cards tr.group-row { border: 0; padding: 0; margin: 14px 0 6px; }
    .table-cards tr.group-row td { display: block; text-align: left; border-radius: var(--radius-s); }
    .table-cards tr.group-row td::before { content: none; }
    .input-sm, .input-sm-wrap { max-width: 150px; }
}


/* ---------- Élèves ---------- */
.row-4 { display: grid; grid-template-columns: 2fr 1fr 1.3fr 1.5fr; gap: 12px; }
.parent-row { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 14px 14px 8px; margin-bottom: 12px; background: var(--paper); }
.parent-row.has-error { border-color: var(--red); }
.parent-row .field { margin-bottom: 8px; }
.parent-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.photo-field { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.photo-field input[type=file] { width: auto; }
.photo-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; border: 2px solid var(--line); }
ul.plain { margin: 6px 0 10px; padding-left: 18px; }
.eleve-head { display: flex; align-items: center; gap: 18px; }
.eleve-head h2 { font-size: 22px; color: var(--navy); }
.eleve-head p { margin: 4px 0 0; }
.eleve-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--gold); }
.eleve-initiales { display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 28px; font-weight: 600; }
.parent-list { list-style: none; margin: 0 0 20px; padding: 0; }
.parent-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
h3.sub { font-size: 15px; margin: 20px 0 8px; color: var(--navy); }
.steps-list { margin: 0 0 18px; padding-left: 20px; color: var(--ink-2); }
.steps-list li { margin-bottom: 6px; }
@media (max-width: 860px) { .row-4 { grid-template-columns: 1fr; gap: 0; } .eleve-head { align-items: flex-start; } .eleve-photo { width: 64px; height: 64px; } }

/* ---------- Documents imprimables ---------- */
body.print-page { background: #e9ecf3; padding: 20px 10px; }
.print-bar { max-width: 210mm; margin: 0 auto 14px; display: flex; gap: 10px; }
.sheet { background: #fff; max-width: 210mm; min-height: 270mm; margin: 0 auto; padding: 14mm; color: #000; font-size: 11pt; box-shadow: 0 2px 10px rgba(20,33,61,.12); }
.sheet-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--red); padding-bottom: 10px; margin-bottom: 14px; }
.sheet-head div { flex: 1; display: flex; flex-direction: column; }
.sheet-head strong { font-size: 16pt; color: var(--navy); }
.sheet-head span { font-size: 9.5pt; color: #333; }
.sheet-photo { width: 30mm; height: 36mm; object-fit: cover; border: 1px solid #999; }
.sheet-title { font-size: 15pt; text-align: center; margin: 6px 0 14px; color: var(--navy); }
.sheet-sub { font-size: 12pt; margin: 16px 0 6px; color: var(--navy); }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th, .sheet-table td { border: 1px solid #9aa3b5; padding: 5px 7px; text-align: left; vertical-align: top; }
.sheet-table th { background: #eef1f7; font-weight: 600; width: 20%; }
.sheet-list th { width: auto; }
.sheet-access { border: 2px dashed var(--navy); border-radius: 6px; padding: 10px 14px; margin-top: 18px; }
.sheet-access h2 { font-size: 12pt; margin: 0 0 6px; color: var(--navy); }
.sheet-access p { margin: 4px 0; }
.sheet-access .big { font-size: 14pt; letter-spacing: .06em; }
.sheet-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 26px; }
.sheet-sign div { flex: 1; border-top: 1px solid #555; padding-top: 6px; min-height: 26mm; font-size: 10pt; }
.sheet-foot { margin-top: 18px; font-size: 8.5pt; color: #555; text-align: center; }
.cards-print { max-width: 210mm; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; }
.access-card { background: #fff; border: 1px dashed #555; padding: 5mm; font-size: 10.5pt; break-inside: avoid; }
.access-card p { margin: 2px 0; }
.access-head { display: flex; gap: 8px; align-items: center; border-bottom: 2px solid var(--red); padding-bottom: 4px; margin-bottom: 6px; }
.access-head div { display: flex; flex-direction: column; }
.access-head strong { color: var(--navy); }
.access-head span { font-size: 9pt; }
@page { size: A4; margin: 10mm; }
@media print {
    body.print-page { background: #fff; padding: 0; }
    .no-print { display: none !important; }
    .sheet { box-shadow: none; padding: 0; min-height: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Impression ---------- */
@media print {
    body.print-modal > *:not(#print-area) { display: none !important; }
    body.print-modal #print-area { display: block; }
    .sidebar, .topbar, .footer, .burger, .form-actions, td.actions, th.actions { display: none !important; }
    .main { margin: 0; }
    body { background: #fff; }
    .panel { border: 0; padding: 0; }
}
.fiche { font-family: var(--font); color: #000; max-width: 148mm; margin: 0 auto; border: 2px solid var(--navy); padding: 10mm; border-radius: 4mm; }
.fiche-head { display: flex; align-items: center; gap: 5mm; border-bottom: 2px solid var(--red); padding-bottom: 4mm; margin-bottom: 6mm; }
.fiche-head img { width: 22mm; height: 22mm; }
.fiche-head strong { font-size: 15pt; color: var(--navy); display: block; }
.fiche-row { display: flex; justify-content: space-between; padding: 2.5mm 0; border-bottom: 1px dotted #999; font-size: 12pt; }
.fiche-code { font-family: var(--mono); font-size: 18pt; font-weight: 700; letter-spacing: .08em; }
.fiche-note { font-size: 9.5pt; margin-top: 6mm; color: #333; }

/* ---------- Personnel (étape 4) ---------- */
.aff-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.aff-line + .aff-line { border-top: 1px dashed var(--line); }
.aff-tools { display: inline-flex; align-items: center; gap: 6px; }
.aff-tools .input-sm { width: 64px; }
.aff-bar { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.label-spacer { display: block; margin-bottom: 6px; }
.matrice th, .matrice td { white-space: nowrap; font-size: 13px; vertical-align: top; }
.matrice thead th { position: sticky; top: 0; }
.matrice tbody th { text-align: left; font-weight: 600; }
.matrice .cell-off { background: var(--paper); }
.matrice .cell-name { display: block; }
@media (max-width: 720px) {
    .aff-line { flex-wrap: wrap; }
}

/* ---------- Emplois du temps (étape 5) ---------- */
.edt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.edt { display: grid; gap: 0 4px; min-width: 100%; }
.edt-corner, .edt-day { position: sticky; top: 0; z-index: 2; background: var(--white, #fff); }
.edt-day { display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 600; font-size: 13px; color: var(--navy); padding: 6px 2px; border-bottom: 2px solid var(--navy); }
.edt-add { padding: 2px 6px; min-height: 0; }
.edt-hours { position: relative; }
.edt-hours span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--ink-2, #555); }
.edt-hours span:first-child { transform: none; }
.edt-col { position: relative; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
    background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-repeat: repeat-y; }
.edt-item { position: absolute; left: 3px; right: 3px; display: flex; flex-direction: column; gap: 0; overflow: hidden; text-align: left;
    padding: 3px 6px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); font: inherit; font-size: 12px; line-height: 1.25; color: #14213d; }
button.edt-item { cursor: pointer; }
button.edt-item:hover, button.edt-item:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; z-index: 1; }
.edt-item strong { font-size: 12.5px; }
.edt-item span, .edt-item strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edt-time { font-size: 11px; opacity: .8; }
.edt-salle { font-size: 11px; font-style: italic; }
.edt-orphan { border: 2px dashed #b45309; }
.edt-c0 { background: #dbeafe; } .edt-c1 { background: #fee2e2; } .edt-c2 { background: #dcfce7; } .edt-c3 { background: #fef3c7; }
.edt-c4 { background: #ede9fe; } .edt-c5 { background: #cffafe; } .edt-c6 { background: #fce7f3; } .edt-c7 { background: #e5e7eb; }
.edt-form fieldset { margin: 0 0 16px; }
.edt-form legend { font-size: 14px; font-weight: 500; color: inherit; border: 0; padding: 0; margin: 0 0 6px; }
.edt-form .check { display: flex; margin: 0 0 6px; }
.day-picks { display: flex; flex-wrap: wrap; gap: 4px; }
.day-pick { margin: 0; cursor: pointer; }
.day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.day-pick span { display: inline-block; min-width: 30px; text-align: center; padding: 4px 6px; border: 1px solid #c5cde0; border-radius: 6px; font-size: 12px; }
.day-pick input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.day-pick input:focus-visible + span { outline: 3px solid var(--gold); }
.check-grid-7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sheet-center { text-align: center; margin: -8px 0 10px; }
@page edt { size: A4 landscape; margin: 8mm; }
.sheet-edt { page: edt; max-width: 297mm; min-height: 0; }
.sheet-edt .edt-day { position: static; }
@media print {
    .sheet-edt { page-break-after: always; break-after: page; }
    .sheet-edt:last-of-type { page-break-after: auto; break-after: auto; }
    .edt-wrap { overflow: visible; }
    .edt-item { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .edt-col { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.edt-wrap { padding-bottom: 10px; }
.edt-form .field > label { display: block; }
.edt-form .field > label > input, .edt-form .field > label > select { margin-top: 6px; font-weight: 400; }
.input-sm[type=time] { width: 110px; }

/* ---------- Paiements (étape 6) ---------- */
.stat-alert strong { color: var(--red); }
.is-cancelled td { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.35); }
.is-cancelled td .badge, .is-cancelled td small { text-decoration: none; }
.alloc { margin-top: 6px; }
.alloc p { margin: 4px 0 0; }
.recu { background: #fff; color: #000; margin: 0 auto 16px; padding: 10mm; border: 2px solid var(--navy); border-radius: 4mm; font-size: 10.5pt; position: relative; }
.recu-a5 { max-width: 148mm; }
.recu-a4 { max-width: 190mm; font-size: 12pt; }
.recu-head { display: flex; align-items: center; gap: 4mm; border-bottom: 2px solid var(--red); padding-bottom: 3mm; margin-bottom: 4mm; }
.recu-head img { width: 18mm; height: 18mm; }
.recu-head > div:first-of-type { flex: 1; display: flex; flex-direction: column; }
.recu-head strong { color: var(--navy); font-size: 13pt; }
.recu-head span { font-size: 8.5pt; }
.recu-num { text-align: right; display: flex; flex-direction: column; }
.recu-num span { font-size: 8pt; letter-spacing: .08em; }
.recu-num strong { font-family: var(--mono); font-size: 11pt; color: #000; }
.recu-mark { position: absolute; top: 34mm; right: 10mm; transform: rotate(-12deg); border: 2px solid var(--navy); color: var(--navy); padding: 1mm 4mm; font-weight: 700; letter-spacing: .15em; margin: 0; }
.recu-annule { border-color: var(--red); color: var(--red); }
.recu-table { width: 100%; border-collapse: collapse; }
.recu-table th, .recu-table td { text-align: left; padding: 1.6mm 2mm; border-bottom: 1px dotted #999; vertical-align: top; }
.recu-table th { width: 32%; font-weight: 600; color: #333; }
.recu-montant { margin: 5mm 0 3mm; padding: 3mm 4mm; border: 2px solid var(--navy); border-radius: 2mm; display: flex; flex-direction: column; gap: 1mm; }
.recu-montant span { font-size: 9pt; text-transform: uppercase; letter-spacing: .06em; }
.recu-montant strong { font-size: 17pt; color: var(--navy); }
.recu-montant em { font-size: 9.5pt; }
.recu-reste { margin: 2mm 0; }
.recu-sign { display: flex; gap: 8mm; margin-top: 6mm; }
.recu-sign div { flex: 1; border-top: 1px solid #555; padding-top: 2mm; min-height: 16mm; font-size: 9pt; }
.recu-foot { margin-top: 4mm; font-size: 7.5pt; color: #555; text-align: center; }
@media print {
    .recu { margin: 0 auto; break-after: page; page-break-after: always; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .recu:last-of-type { break-after: auto; page-break-after: auto; }
    .is-cancelled td { text-decoration: line-through; }
}

/* ---------- Suivi (étape 7) ---------- */
.appel-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.appel-list { list-style: none; margin: 0; padding: 0; }
.appel-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.appel-row.is-absent { background: #fdecec; }
.appel-row.is-retard { background: #fff7e0; }
.appel-choices { display: inline-flex; align-items: center; gap: 6px; }
.appel-opt { margin: 0; cursor: pointer; }
.appel-opt input { position: absolute; opacity: 0; pointer-events: none; }
.appel-opt > span { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 38px; border: 1px solid #c5cde0; border-radius: 8px; font-weight: 700; background: #fff; }
.appel-present input:checked + span { background: #15803d; border-color: #15803d; color: #fff; }
.appel-absent input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.appel-retard input:checked + span { background: #b45309; border-color: #b45309; color: #fff; }
.appel-opt input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 1px; }
.appel-opt input:disabled + span { opacity: .6; cursor: default; }
.appel-heure { width: 110px; }
.obs-list { list-style: none; margin: 0; padding: 0; }
.obs { padding: 10px 0; border-bottom: 1px solid var(--line); }
.obs p { margin: 6px 0; white-space: normal; }
.obs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.obs-grave { border-left: 4px solid var(--red); padding-left: 10px; }
.notice-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- Notes et bulletins (étape 8) ---------- */
.notes-grid th, .notes-grid td { white-space: nowrap; vertical-align: middle; }
.notes-grid tbody th { text-align: left; font-weight: 600; }
.note-input { width: 68px; padding: 6px 8px; text-align: center; border: 1px solid #c5cde0; border-radius: 6px; font: inherit; }
.note-input.is-saved { background: #f1f5ff; }
.note-input[readonly] { background: #eef0f4; color: #333; border-style: dashed; }
.note-input.is-invalid { border-color: var(--red); background: #fdecec; }
.row-total td, .row-total th { border-top: 2px solid var(--navy); font-weight: 600; }
.sheet-wide { max-width: 285mm; }
.ar { font-family: "Traditional Arabic", "Amiri", "Noto Naskh Arabic", "Arabic Typesetting", Tahoma, "Segoe UI", sans-serif; font-size: 1.08em; }
.bulletin { background: #fff; color: #000; max-width: 192mm; margin: 0 auto 16px; padding: 7mm; border: 2px solid var(--navy); position: relative; font-size: 9.5pt; }
.bul-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4mm; align-items: center; border-bottom: 2px solid var(--red); padding-bottom: 3mm; }
.bul-head img { width: 20mm; height: 20mm; }
.bul-fr, .bul-ar { display: flex; flex-direction: column; font-size: 8.5pt; }
.bul-ar { text-align: right; font-family: "Traditional Arabic", "Amiri", "Noto Naskh Arabic", Tahoma, sans-serif; font-size: 10pt; }
.bul-fr strong, .bul-ar strong { color: var(--navy); font-size: 11pt; }
.bul-title { text-align: center; font-size: 13pt; color: var(--navy); margin: 3mm 0; }
.bul-mark { top: 30mm; }
.bul-id, .bul-notes { width: 100%; border-collapse: collapse; margin: 2mm 0; }
.bul-id th, .bul-id td, .bul-notes th, .bul-notes td { border: 1px solid #777; padding: 1.3mm 1.8mm; text-align: left; vertical-align: middle; }
.bul-id th { background: #eef1f8; width: 22%; font-weight: 600; }
.bul-notes thead th { background: var(--navy); color: #fff; text-align: center; font-size: 8.5pt; }
.bul-notes thead th .ar { color: #fff; }
.bul-notes .num { text-align: center; }
.bul-mat { font-weight: 600; }
.bul-notes tfoot th { background: #eef1f8; }
.bul-res { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; margin: 3mm 0; }
.bul-res div { border: 2px solid var(--navy); border-radius: 2mm; padding: 2mm; display: flex; flex-direction: column; align-items: center; text-align: center; }
.bul-res span { font-size: 8.5pt; }
.bul-res strong { font-size: 12pt; color: var(--navy); }
.bul-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; margin-top: 4mm; }
.bul-sign div { border-top: 1px solid #555; padding-top: 1.5mm; min-height: 18mm; text-align: center; font-size: 8.5pt; }
@media print {
    .bulletin { margin: 0 auto; break-after: page; page-break-after: always; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .bulletin:last-of-type { break-after: auto; page-break-after: auto; }
}

/* ---------- Pointage (étape 10) ---------- */
.pt-pass { display: inline-flex; align-items: center; gap: 4px; margin: 0 8px 4px 0; font-family: var(--mono); font-size: 13px; }
.pt-actions { margin-top: 4px; }
body.borne { background: var(--navy); min-height: 100vh; margin: 0; }
.borne-wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; color: #fff; }
.borne-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.borne-head > div:first-of-type { flex: 1; display: flex; flex-direction: column; }
.borne-head strong { font-size: 22px; }
.borne-clock { font-size: 40px; font-weight: 700; font-family: var(--mono); }
.borne-msg { padding: 16px 18px; border-radius: 12px; font-size: 20px; font-weight: 600; margin-bottom: 14px; }
.borne-msg.is-ok { background: #15803d; } .borne-msg.is-err { background: var(--red); }
.borne-form { background: #fff; color: var(--ink); border-radius: 16px; padding: 18px; }
.borne-form label { font-weight: 600; }
.borne-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 42vh; overflow-y: auto; margin: 8px 0 16px; }
.borne-name { margin: 0; cursor: pointer; }
.borne-name input { position: absolute; opacity: 0; pointer-events: none; }
.borne-name > span { display: block; padding: 14px 12px; border: 2px solid #c5cde0; border-radius: 10px; font-size: 16px; }
.borne-name input:checked + span { border-color: var(--navy); background: #e8edf9; }
.borne-name input:focus-visible + span { outline: 3px solid var(--gold); }
.borne-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.borne-btns .btn { font-size: 26px; font-weight: 800; padding: 22px; color: #fff; border: 0; border-radius: 14px; justify-content: center; }
.borne-in { background: #15803d; } .borne-out { background: #b45309; }
.borne-exit { margin-top: 24px; color: #cfd8f0; }
.borne-exit summary { cursor: pointer; }
.borne-exit form { margin-top: 10px; }
.borne-exit input { max-width: 220px; }

/* ---------- Espace parents et messagerie (étape 11) ---------- */
body.parent-app { background: var(--paper); margin: 0; }
.p-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--navy); color: #fff; }
.p-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.p-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.p-brand small { opacity: .8; }
.p-logout { color: #fff; }
.p-logout span { margin-left: 4px; }
.p-nav { display: flex; gap: 4px; padding: 6px 12px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 0; z-index: 5; }
.p-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; white-space: nowrap; font-weight: 500; }
.p-nav a.active { background: #e8edf9; color: var(--navy); }
.p-nav svg { width: 18px; height: 18px; }
.p-main { max-width: 900px; margin: 0 auto; padding: 16px; }
.p-title { font-size: 22px; color: var(--navy); margin: 4px 0 12px; }
.p-foot { text-align: center; color: var(--ink-2); font-size: 13px; padding: 20px; }
.p-cards { display: grid; gap: 14px; }
.p-card-head { display: flex; gap: 12px; align-items: center; }
.p-card-head h2 { margin: 0; font-size: 18px; }
.p-card-head p { margin: 2px 0 0; }
.p-kpis { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.p-kpis li { background: var(--paper); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.p-kpis strong { font-size: 18px; color: var(--navy); }
.p-kpis li.is-alert strong { color: var(--red); }
.p-kpis span { font-size: 13px; color: var(--ink-2); }
.p-links { display: flex; flex-wrap: wrap; gap: 6px; }
.p-tabs { overflow-x: auto; margin-bottom: 12px; }
.p-conv { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.p-apercu { color: var(--ink-2); font-size: 14px; }
.msg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 12px; border-radius: 12px; }
.msg-me { align-self: flex-end; background: #e8edf9; }
.msg-them { align-self: flex-start; background: #fff7e0; border: 1px solid #f3e2a8; }
.msg-meta { font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.msg-body { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 560px) { .msg { max-width: 95%; } }
@media (max-width: 560px) {
    .p-nav { gap: 2px; padding: 6px 8px; }
    .p-nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 12px; justify-content: center; }
    .p-logout span { display: none; }
}

/* ---------- Rapports (étape 12) ---------- */
.btn-wa { background: #1f9d55; color: #fff; border-color: #1f9d55; }
.btn-wa:hover { background: #17864a; color: #fff; }
.sheet-rapport { max-width: 200mm; }
.sheet-rapport table { page-break-inside: auto; }
.sheet-rapport tr { page-break-inside: avoid; }

/* ---------- Tableau de bord (étape 13) ---------- */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
nav.segmented { display: inline-flex; border: 1px solid #c5cde0; border-radius: 8px; overflow: hidden; }
nav.segmented a { padding: 8px 14px; color: var(--ink); text-decoration: none; font-weight: 500; }
nav.segmented a.active { background: var(--navy); color: #fff; }
.today { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.today a { display: flex; flex-direction: column; padding: 10px 12px; background: var(--paper); border-radius: 10px; text-decoration: none; color: inherit; }
.today strong { font-size: 20px; color: var(--navy); }
.today span { font-size: 13px; color: var(--ink-2); }
.today a.is-alert strong, .kpi.is-alert strong, .txt-alert { color: var(--red); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi > span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.kpi strong { font-size: 24px; color: var(--navy); line-height: 1.2; }
.kpi small { font-size: 12px; color: var(--ink-2); }
.kpi.is-alert { border-color: #f1b7b9; border-left: 4px solid var(--red); }
.kpi-flag { color: var(--red); font-weight: 700; }
.dash-grid { align-items: start; }
.dash-sub { font-size: 14px; margin: 14px 0 6px; color: var(--navy); }
.viz { width: 100%; height: auto; display: block; font-family: var(--font); }
.viz-grid { stroke: #e6e9f0; stroke-width: 1; }
.viz-base { stroke: #b9c1d3; stroke-width: 1; }
.viz-axis { fill: #6b7690; font-size: 11px; }
.viz-label { fill: #14213d; font-size: 12px; }
.viz-value { fill: #4a5775; font-size: 12px; }
.viz-bar { fill: var(--navy); }
.viz-f { fill: #eb6834; }
.viz-g { fill: #2a78d6; }
.viz-hit:hover .viz-bar { fill: #2f4a96; }
.viz-hit:hover rect[fill="transparent"] { fill: rgba(27, 47, 107, .05); }
.viz-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 6px; }
.sw-f { background: #eb6834; } .sw-g { background: #2a78d6; }
.print-page .welcome, .print-page .panel, .print-page .kpis, .print-page .notice { max-width: 190mm; margin-left: auto; margin-right: auto; }
@media print {
    .dash-grid { display: block; }
    .dash-grid .panel, .kpi { break-inside: avoid; page-break-inside: avoid; }
    .kpis { grid-template-columns: repeat(4, 1fr); }
    .viz-bar, .viz-f, .viz-g, .sw { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.dash-grid > *, .kpis > * { min-width: 0; }
.dash-grid .table-wrap { overflow-x: auto; }
.print-page .dash-print-head { max-width: 190mm; margin: 0 auto 10px; }
