:root {
    --sidebar-w: 260px;
    --sidebar-bg: #0f2a43;
    --sidebar-link: #b8c7d8;
    --sidebar-active: #ffffff;
    --accent: #2563eb;
    --bg: #f1f4f9;
}

* { box-sizing: border-box; }
body { background: var(--bg); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    color: #fff; font-weight: 700; font-size: 1.1rem;
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { color: #38bdf8; font-size: 1.5rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .8rem 0; }
.sidebar-section {
    color: #6b85a3; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .08em; padding: .9rem 1.2rem .3rem;
}
.sidebar-link {
    display: flex; align-items: center; gap: .75rem;
    color: var(--sidebar-link); text-decoration: none;
    padding: .62rem 1.2rem; font-size: .95rem;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.sidebar-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-link.active { background: rgba(56,189,248,.14); color: var(--sidebar-active); border-left-color: #38bdf8; }
.sidebar-link i { font-size: 1.05rem; width: 1.3rem; text-align: center; }
.sidebar-sub { border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-sub .sidebar-link { padding: .42rem 1.2rem .42rem 2.6rem; font-size: .88rem; }
.sidebar-sub .sidebar-link i { font-size: .95rem; width: 1.1rem; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding: .4rem 0; }
.sidebar-footer .sidebar-link { color: #fca5a5; }

/* ===== Main ===== */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    background: #fff; border-bottom: 1px solid #e5e9f0;
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem 1.5rem;
    position: sticky; top: 0; z-index: 1030;
}
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.content { flex: 1; padding: 1.5rem; }

.footer {
    padding: .9rem 1.5rem; text-align: center;
    color: #8a93a6; font-size: .85rem;
    border-top: 1px solid #e5e9f0; background: #fff;
}

/* ===== Cartes ===== */
.card { border: 0; box-shadow: 0 1px 3px rgba(16,24,40,.08); border-radius: .75rem; }
.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-icon {
    position: absolute; right: 1rem; top: 1rem;
    width: 3rem; height: 3rem; border-radius: .75rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.stat-card .stat-value { font-size: 1.55rem; font-weight: 700; }

.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #5b6b81; background: #f8fafc; white-space: nowrap; }
.table td, .table th { vertical-align: middle; }
.avatar { width: 40px; height: 40px; object-fit: cover; border-radius: 50%; }

/* ===== Logo ===== */
.login-logo img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
}
.receipt-logo {
    width: 40px; height: 40px;
    object-fit: cover; border-radius: 50%;
    border: 1.5px solid #e5e9f0;
    box-shadow: 0 1px 3px rgba(16,24,40,.1);
}
.report-logo {
    width: 40px; height: 40px;
    object-fit: cover; border-radius: 50%;
    border: 1.5px solid #e5e9f0;
}

.badge-statut { font-size: .75rem; }
.fs-sm { font-size: .82rem; }

/* ===== Reçu ===== */
.receipt-page { max-width: 420px; margin: 0 auto; background:#fff; }
@media print {
    .sidebar, .topbar, .footer, .no-print { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff; }
}

/* ===== Responsive ===== */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 1039;
}
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main { margin-left: 0; }
    .content { padding: 1rem; }
    .topbar { padding: .6rem 1rem; }
}

/* ===== Login ===== */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
    background: linear-gradient(135deg, #0f2a43 0%, #1e40af 55%, #2563eb 100%); }
.login-wrapper { width: 100%; max-width: 430px; }
.login-brand { margin-bottom: 1.75rem; }
.login-logo {
    width: 76px; height: 76px; margin: 0 auto 1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    color: #fff; font-size: 2.4rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 .6rem 1.5rem rgba(0,0,0,.35), inset 0 -4px 8px rgba(0,0,0,.18);
    border: 3px solid rgba(255,255,255,.25);
}
.login-school-name {
    color: #fff; font-weight: 800; font-size: 1.7rem;
    letter-spacing: .03em; text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0,0,0,.35);
    margin-bottom: .35rem; line-height: 1.25;
}
.login-sigle { font-size: .7em; font-weight: 600; opacity: .85; letter-spacing: .02em; }
.login-tagline { color: #bfdbfe; font-size: .95rem; }
.login-tagline i { font-size: .65rem; vertical-align: middle; color: #facc15; }
.login-card { width: 100%; border: 0; border-radius: 1.15rem; box-shadow: 0 1.5rem 4rem rgba(0,0,0,.4); }
.login-card-title { font-weight: 700; color: #0f2a43; margin-bottom: .1rem; }
.login-card-subtitle { font-size: .88rem; }
.login-footer { color: #c7d6ee; font-size: .82rem; }
.login-footer a { color: #fff; }

/* Autocomplétion fonds sombres ok */
input, select, textarea { border-radius: .5rem !important; }
.btn { border-radius: .5rem; }
.page-title { margin-bottom: 1.25rem; font-weight: 600; }

/* ===== En-tête professionnel de documents ===== */
.doc-header {
    display: flex; gap: 1rem; align-items: center;
    border-bottom: 3px double #0f2a43;
    padding-bottom: .75rem; margin-bottom: 1rem;
}
.doc-header-logo img {
    width: 68px; height: 68px; object-fit: contain;
    border: 1px solid #dbe1ea; border-radius: 10px;
    background: #fff; padding: 3px;
}
.doc-header-infos { flex: 1; }
.doc-ecole { font-size: 1.28rem; font-weight: 800; color: #0f2a43; text-transform: uppercase; line-height: 1.1; }
.doc-sigle { font-size: 1rem; font-weight: 700; color: #2563eb; }
.doc-slogan { font-style: italic; color: #6b7280; font-size: .9rem; }
.doc-type, .doc-coords, .doc-adresse { font-size: .82rem; color: #4b5563; }
.doc-titre { text-align: center; margin: .4rem 0 1rem; }
.doc-titre-principal {
    font-weight: 800; font-size: 1.05rem; text-transform: uppercase;
    color: #0f2a43; letter-spacing: .04em;
    border-bottom: 2px solid #2563eb; display: inline-block; padding: 0 .5rem .25rem;
}
.doc-titre-secondaire { font-size: .85rem; color: #6b7280; margin-top: .15rem; }

/* Signature / cachet sur documents */
.signature-block { display: flex; justify-content: space-between; gap: 2rem; margin-top: 3rem; }
.signature-item { text-align: center; flex: 1; }
.signature-item .sig-place { margin-bottom: 3.2rem; }
.signature-item .sig-line { border-top: 1px solid #4b5563; padding-top: .25rem; font-size: .82rem; }
.cachet-img { max-width: 120px; max-height: 120px; object-fit: contain; margin-bottom: .5rem; }

/* ===== Aperçu / impression (formats) ===== */
body.print-preview .sidebar,
body.print-preview .topbar,
body.print-preview .footer,
body.print-preview .no-print,
body.print-preview .sidebar-overlay,
body.print-preview .print-footer { display: none !important; }
body.print-preview .main, body.print-preview .content { margin-left: 0 !important; padding: 0 !important; }
body.print-preview { background: #fff; }
body.print-preview .d-print-none { display: none !important; }
body.print-preview .d-print-block { display: block !important; }
body.print-preview.fmt-58 .content, body.print-preview.fmt-80 .content { max-width: 80mm; margin: 0 auto; padding: 0; }
body.print-preview.fmt-a5 .content { max-width: 148mm; margin: 0 auto; }
body.print-preview.fmt-a4 .content { max-width: 900px; margin: 0 auto; }

.pdoc { background: #fff; margin: 0 auto; font-size: .88rem; padding: .75rem; }
.fmt-a4 .pdoc, .pdoc.fmt-a4 { max-width: 900px; width: 100%; }
.fmt-a5 .pdoc, .pdoc.fmt-a5 { width: 148mm; max-width: 100%; }
.fmt-58 .pdoc, .pdoc.fmt-58 { width: 58mm; max-width: 100%; font-size: .68rem; }
.fmt-80 .pdoc, .pdoc.fmt-80 { width: 80mm; max-width: 100%; font-size: .70rem; }
.pdoc.fmt-58 .doc-header-logo img,
.pdoc.fmt-80 .doc-header-logo img { width: 46px; height: 46px; }
.pdoc.fmt-58 .signature-block,
.pdoc.fmt-80 .signature-block { margin-top: 1.8rem; }
.pdoc.fmt-58 .sig-place,
.pdoc.fmt-80 .sig-place { margin-bottom: 1.8rem; }
.pdoc.fmt-58 .table, .pdoc.fmt-80 .table { font-size: .72rem; }

@media print {
    body.pdoc-print .sidebar, body.pdoc-print .topbar, body.pdoc-print .footer, body.pdoc-print .no-print { display: none !important; }
    body.pdoc-print .main, body.pdoc-print .content { margin-left: 0 !important; padding: 0 !important; }
    body.pdoc-print { background: #fff; }
    .pdoc { margin: 0; padding: 0; width: 100%; box-shadow: none; border: none; }
}

/* Reçu : variante A4 */
.receipt-page { max-width: 420px; margin: 0 auto; background: #fff; }
.receipt-page.format-a4 { max-width: 820px; }

/* Pied de page imprimable */
.print-footer {
    text-align: center; font-size: .72rem; color: #6b7280;
    border-top: 1px solid #cbd5e1; padding-top: .35rem;
    visibility: hidden;
}

@media print {
    @page { margin: 16mm 12mm; }
    body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .card { box-shadow: none !important; border: 1px solid #e5e9f0; }
    .doc-header { margin-bottom: .75rem; }
    .signature-block { page-break-inside: avoid; }
}

/* ===== Centre des rapports ===== */
.report-hero {
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 60%);
    border: 1px solid #dbeafe; border-radius: .85rem; padding: 1.1rem 1.25rem;
}
.report-hero h2 { color: #1e3a8a; font-weight: 700; }
.report-hub-card {
    display: flex; flex-direction: column; gap: .35rem; height: 100%;
    padding: 1rem; background: #fff; border: 1px solid #e5e9f0; border-radius: .75rem;
    text-decoration: none; color: inherit; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.report-hub-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 .6rem 1.2rem rgba(15, 23, 42, .09);
    border-color: #bfdbfe; color: inherit;
}
.report-hub-icon {
    width: 42px; height: 42px; border-radius: .6rem;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.report-hub-title { font-weight: 600; color: #0f172a; line-height: 1.2; }
.report-hub-desc { font-size: .81rem; color: #64748b; line-height: 1.3; }

/* ===== En-tête, méta et actions des rapports ===== */
.report-header { margin-bottom: 1rem; }
.report-meta {
    border-top: 1px dashed #cbd5e1; border-bottom: 1px dashed #cbd5e1;
    padding: .5rem 0; margin-bottom: 1rem;
}
.report-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.signature-print .border-top { border-color: #94a3b8 !important; }

@media print {
    .report-actions { display: none !important; }
    .report-hub-card { break-inside: avoid; }
}


/* ===== Communiqu�s (administration + portail) ===== */
.communique-toolbar { display:flex; flex-wrap:wrap; gap:.3rem; border:1px solid #d1d5db; border-bottom:0; padding:.4rem; border-radius:.5rem .5rem 0 0; background:#f8fafc; }
.communique-toolbar button { min-width:2rem; padding:.25rem .5rem; font-size:.85rem; }
.com-commande { cursor:pointer; border:1px solid transparent; background:transparent; border-radius:.3rem; padding:.2rem .45rem; }
.com-commande:hover { background:#e2e8f0; border-color:#cbd5e1; }
.com-editor { min-height:340px; border:1px solid #d1d5db; border-radius:0 0 .5rem .5rem; padding:.9rem 1rem; background:#fff; overflow:auto; }
.com-editor:focus { outline:2px solid #93c5fd; outline-offset:-1px; }
.com-editor h1,.com-editor h2,.com-editor h3,.com-editor h4 { margin:.5rem 0 .25rem; }
.com-editor blockquote { border-left:4px solid #cbd5e1; margin:.5rem 0; padding-left:.75rem; color:#475569; }
.com-editor table { width:100%; border-collapse:collapse; margin:.5rem 0; }
.com-editor table th,.com-editor table td { border:1px solid #cbd5e1; padding:.35rem .5rem; }
.com-editor img { max-width:100%; height:auto; border-radius:.35rem; }
.communique-doc { max-width:820px; margin:0 auto; background:#fff; border:1px solid #e2e8f0; border-radius:.75rem; padding:2rem; box-shadow:0 1px 3px rgba(0,0,0,.08); }
.communique-banner { display:flex; align-items:center; gap:1rem; border-bottom:3px double #b45309; padding-bottom:.9rem; }
.communique-logo { width:72px; height:72px; object-fit:contain; border-radius:50%; }
.communique-school-name { font-size:1.35rem; font-weight:800; color:#334155; line-height:1.15; }
.communique-school-sigle { font-size:.85rem; letter-spacing:.18em; color:#92400e; font-weight:700; }
.communique-school-adresse { font-size:.78rem; color:#64748b; }
.communique-officiel { margin-top:1rem; border:2px solid #eab308; border-radius:.4rem; overflow:hidden; }
.communique-officiel-inner { background:linear-gradient(90deg,#fef9c3,#fde68a); color:#713f12; text-align:center; font-weight:800; letter-spacing:.3em; padding:.4rem; font-size:.95rem; text-transform:uppercase; }
.communique-style { display:inline-block; font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; padding:.22rem .6rem; border-radius:2rem; border:1px solid transparent; }
.communique-style-sm { font-size:.66rem; padding:.12rem .45rem; }
.communique-style-normal { background:#f1f5f9; color:#475569; border-color:#cbd5e1; }
.communique-style-information { background:#e0f2fe; color:#075985; border-color:#7dd3fc; }
.communique-style-important { background:#fef3c7; color:#92400e; border-color:#fcd34d; }
.communique-style-urgent { background:#fee2e2; color:#991b1b; border-color:#fca5a5; }
.communique-style-evenement { background:#e9d5ff; color:#5b21b6; border-color:#d8b4fe; }
.communique-meta { display:flex; flex-wrap:wrap; gap:.4rem .9rem; font-size:.8rem; color:#64748b; border-bottom:1px dashed #cbd5e1; padding:.6rem 0; }
.communique-body { padding-top:1rem; font-size:1rem; line-height:1.7; color:#1e293b; }
.communique-body p { margin-bottom:.8rem; }
.communique-body ul,.communique-body ol { padding-left:1.4rem; margin-bottom:.8rem; }
.communique-body a { color:#1d4ed8; }
.communique-signature { margin-top:2rem; border-top:1px solid #e2e8f0; padding-top:1rem; font-size:.92rem; }
.communique-cat { display:inline-block; background:#eef2ff; color:#3730a3; border:1px solid #c7d2fe; border-radius:2rem; padding:.18rem .6rem; font-size:.72rem; font-weight:600; }
.communique-pin { color:#d97706; }
.communique-card { border:1px solid #e2e8f0; border-radius:.7rem; padding:.95rem 1.05rem; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.05); transition:box-shadow .12s ease; }
.communique-card:hover { box-shadow:0 4px 12px rgba(0,0,0,.09); }
.communique-card-new { border-color:#f87171; }
.communique-card-title { font-weight:700; color:#0f172a; }
.communique-card-sub { font-size:.88rem; color:#64748b; }
.communique-card-head { font-size:.78rem; }
.communique-date { color:#94a3b8; font-size:.78rem; }
p#fulltext { max-width:500px; }
.editor-image-btn:hover { color:#1d4ed8; }
@media print {
    body.communique-print-page .no-print, .no-print { display:none !important; }
    .communique-doc { border:none; box-shadow:none; padding:0; max-width:none; }
}
