.reports-school-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: var(--color-overlay);
}
.reports-school-preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(96vw, 92rem);
  max-height: 94vh;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}
.reports-school-preview__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.reports-school-preview__bar > div {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.reports-school-preview__bar > div:first-child {
  display: grid;
  gap: var(--space-1);
}
.reports-school-preview__bar small {
  color: var(--color-text-muted);
}
.reports-school-preview__body {
  overflow: auto;
  padding: var(--space-5);
  background: var(--color-surface-soft);
}
.reports-school-preview-state {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  min-height: 18rem;
  align-content: center;
  color: var(--color-text-muted);
  text-align: center;
}
.reports-school-document {
  display: grid;
  gap: var(--space-5);
  width: min(100%, 86rem);
  margin: 0 auto;
  padding: var(--space-6);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.reports-school-document__head {
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-text);
  text-align: center;
}
.reports-school-document__head > strong {
  font-size: var(--font-size-lg);
}
.reports-school-document__head h2 {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-xl);
  text-transform: uppercase;
}
.reports-school-document__head span,
.reports-school-document__head small,
.reports-school-note,
.reports-school-document footer {
  color: var(--color-text-muted);
}
.reports-school-section {
  display: grid;
  gap: var(--space-2);
}
.reports-school-section h3 {
  margin: 0;
  text-align: center;
  text-decoration: underline;
}
.reports-school-table-wrap {
  overflow-x: auto;
}
.reports-school-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
}
.reports-school-table th,
.reports-school-table td {
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  vertical-align: top;
}
.reports-school-table thead th,
.reports-school-table tfoot th,
.reports-school-table .is-total td,
.reports-school-table .is-final td {
  background: var(--color-surface-soft);
  font-weight: 800;
}
.reports-school-table .is-final td {
  font-size: var(--font-size-base);
}
.reports-school-table .is-number {
  text-align: right;
  white-space: nowrap;
}
.reports-school-table td small {
  display: block;
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}
.reports-school-table-wrap--wide {
  border: 1px solid var(--color-border);
}
.reports-school-monthly {
  min-width: 72rem;
}
.reports-school-monthly th:first-child,
.reports-school-monthly td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 12rem;
  background: var(--color-surface);
}
.reports-school-monthly thead th:first-child,
.reports-school-monthly tfoot th:first-child {
  background: var(--color-surface-soft);
}
.reports-school-note {
  margin: 0;
  font-size: var(--font-size-xs);
  line-height: 1.45;
}
.reports-school-balance {
  width: min(100%, 46rem);
  margin: 0 auto;
}
.reports-school-document footer {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
  text-align: center;
}
@page schoolReport {
  size: A4 landscape;
  margin: 8mm 8mm 12mm;
  @bottom-center{content:"Page " counter(page) " / " counter(pages);color:var(--color-text-muted);font-family:var(--font-sans);font-size:9pt}
}

@media print {
  html[data-print-document="reports-school-export"] .reports-school-print-root {
    page: schoolReport;
    width: 100%;
    font-size: 9.5pt;
  }
  html[data-print-document="reports-school-export"] .reports-school-print-root small {
    font-size: 8.5pt;
  }
  html[data-print-document="reports-school-export"] .reports-school-document {
    width: 100%;
    gap: 5mm;
    padding: 0;
    box-shadow: none;
  }
  html[data-print-document="reports-school-export"] .reports-school-section {
    break-inside: avoid;
  }
  html[data-print-document="reports-school-export"] .reports-school-section--wide {
    break-inside: auto;
  }
  html[data-print-document="reports-school-export"] .reports-school-table-wrap {
    overflow: visible;
  }
  html[data-print-document="reports-school-export"] .reports-school-monthly {
    min-width: 0;
    font-size: 8.5pt;
  }
  html[data-print-document="reports-school-export"] .reports-school-table th,
  html[data-print-document="reports-school-export"] .reports-school-table td {
    padding: 1.4mm;
  }
  html[data-print-document="reports-school-export"] .reports-school-monthly th,
  html[data-print-document="reports-school-export"] .reports-school-monthly td {
    padding: 1.2mm 1.4mm;
    white-space: nowrap;
  }
  html[data-print-document="reports-school-export"] .reports-school-monthly th:first-child,
  html[data-print-document="reports-school-export"] .reports-school-monthly td:first-child {
    position: static;
    min-width: 0;
  }
}

@media (max-width: 64rem) {
  .reports-school-preview-backdrop {
    place-items: stretch;
    padding: 0;
  }
  .reports-school-preview {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .reports-school-preview__bar {
    position: sticky;
    top: 0;
    z-index: 3;
    flex-wrap: wrap;
    align-items: stretch;
    padding: var(--space-3);
    background: var(--color-surface);
  }
  .reports-school-preview__bar > div:last-child {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .reports-school-preview__bar .btn {
    min-height: 44px;
    white-space: normal;
  }
  .reports-school-preview__body {
    padding: var(--space-3);
    -webkit-overflow-scrolling: touch;
  }
  .reports-school-document {
    width: 100%;
    padding: var(--space-4);
  }
  .reports-school-table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
  }
}

@media (max-width: 30rem) {
  .reports-school-preview__bar > div:last-child {
    grid-template-columns: 1fr 1fr;
  }
  .reports-school-preview__bar > div:last-child .btn:last-child {
    grid-column: 1 / -1;
  }
  .reports-school-document {
    gap: var(--space-4);
    padding: var(--space-3);
  }
  .reports-school-document__head h2 {
    font-size: var(--font-size-lg);
  }
  .reports-school-table {
    font-size: var(--font-size-xs);
  }
  .reports-school-table th,
  .reports-school-table td {
    padding: var(--space-1) var(--space-2);
  }
}

/* P040 — rapport école plus compact et dernière feuille de situation */
.reports-school-document{gap:var(--space-3)}
.reports-school-section{gap:var(--space-1)}
.reports-school-section h3{text-decoration:none;padding-bottom:.3rem;border-bottom:1px solid var(--color-anthracite-300);font-size:var(--font-size-base)}
.reports-school-table th,.reports-school-table td{padding:.38rem .45rem}
.reports-school-table td small{margin-top:.18rem}
.reports-school-closing-page{display:grid;gap:var(--space-3);padding:var(--space-5);border:1px solid var(--color-border);background:var(--color-surface)}
.reports-school-closing-page>header{display:grid;justify-items:center;gap:.2rem;padding-bottom:var(--space-3);border-bottom:2px solid var(--color-text);text-align:center}
.reports-school-closing-page>header small{color:var(--color-text-muted);font-weight:800;text-transform:uppercase;letter-spacing:.05em}
.reports-school-closing-page>header h3{margin:0;padding:0;border:0;text-decoration:none;font-size:var(--font-size-xl);text-transform:uppercase}
.reports-school-closing-page>header p,.reports-school-closing-page>p{margin:0}
.reports-school-closing-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-4)}
.reports-school-closing-grid>article{display:grid;gap:var(--space-2);padding:var(--space-4);border:1px solid var(--color-dashboard-warm-border);background:var(--color-dashboard-warm-surface)}
.reports-school-closing-grid>article>span{color:var(--color-text-muted);font-size:var(--font-size-xs);font-weight:800;text-transform:uppercase}
.reports-school-closing-grid>article>strong{font-size:var(--font-size-lg);font-variant-numeric:tabular-nums}
.reports-school-closing-grid dl{display:grid;gap:var(--space-1);margin:0}
.reports-school-closing-grid dl div{display:flex;justify-content:space-between;gap:var(--space-3);padding-top:var(--space-2);border-top:1px solid var(--color-border)}
.reports-school-closing-grid dd{margin:0;font-weight:800;text-align:right}
.reports-school-closing-net{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);padding:var(--space-3);border-left:.2rem solid var(--color-dashboard-amber);background:var(--color-dashboard-warm-surface)}
.reports-school-closing-net span{font-size:var(--font-size-xs);font-weight:800;text-transform:uppercase}
.reports-school-signatures{margin-top:var(--space-3)}
@media(max-width:47.99rem){.reports-school-closing-grid{grid-template-columns:1fr}.reports-school-closing-page{padding:var(--space-3)}.reports-school-signatures{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:.55rem!important}.reports-school-signatures>div{min-height:6.4rem;padding:.5rem}}
@media print{
  html[data-print-document="reports-school-export"] .reports-school-document{gap:3.2mm}
  html[data-print-document="reports-school-export"] .reports-school-section h3{padding-bottom:1mm}
  html[data-print-document="reports-school-export"] .reports-school-table th,
  html[data-print-document="reports-school-export"] .reports-school-table td{padding:1.05mm}
  html[data-print-document="reports-school-export"] .reports-school-closing-page{break-before:page;page-break-before:always;min-height:calc(210mm - 16mm);align-content:start;padding:0;border:0}
  html[data-print-document="reports-school-export"] .reports-school-closing-grid{grid-template-columns:1fr 1fr}
  html[data-print-document="reports-school-export"] .reports-school-signatures{grid-template-columns:1fr 1fr!important}
}
