/* Portail Atlantique · SOS Abidjan — thème clair uniquement */
:root {
    --bleu: #2d59a1;
    --bleu-fonce: #1f427c;
    --bleu-clair: #eaf1fb;
    --texte: #1e2533;
    --texte-2: #5b6474;
    --bord: #e3e7ee;
    --fond: #f4f6fa;
    --blanc: #fff;
    --vert: #138a52;
    --vert-clair: #e3f5ec;
    --orange: #b26a00;
    --orange-clair: #fff3dc;
    --rouge: #c62f4b;
    --rouge-clair: #fde8ec;
    --gris-clair: #eef0f4;
    --menu-largeur: 250px;
}

html { color-scheme: light; }
body { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--texte); font-size: .925rem; }
a { color: var(--bleu); }
.btn-primary { --bs-btn-bg: var(--bleu); --bs-btn-border-color: var(--bleu); --bs-btn-hover-bg: var(--bleu-fonce); --bs-btn-hover-border-color: var(--bleu-fonce); --bs-btn-active-bg: var(--bleu-fonce); }
.btn-outline-primary { --bs-btn-color: var(--bleu); --bs-btn-border-color: var(--bleu); --bs-btn-hover-bg: var(--bleu); --bs-btn-hover-border-color: var(--bleu); }
.text-2 { color: var(--texte-2) !important; }
.is-hidden { display: none !important; }

/* ---------- Structure ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--menu-largeur); flex-shrink: 0; background: var(--blanc); border-right: 1px solid var(--bord); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding-bottom: 1rem; transition: width .15s; z-index: 1030; }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-brand { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; padding: 1.1rem 1.3rem 1rem; border-bottom: 1px solid var(--bord); text-decoration: none; flex-shrink: 0; }
.sidebar-brand .logo-complet { display: block; height: 48px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; }
.sidebar-brand .logo-icone { width: 36px; height: 36px; display: none; }
.sidebar-brand .titre { font-size: .72rem; line-height: 1.2; color: var(--texte-2); white-space: nowrap; }
.sidebar-section { padding: .85rem 1.3rem .3rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-2); font-weight: 600; }
.sidebar-nav { list-style: none; margin: 0; padding: 0 .6rem; }
.sidebar-nav a { display: flex; align-items: center; gap: .65rem; padding: .5rem .7rem; border-radius: 8px; color: var(--texte); text-decoration: none; font-weight: 500; white-space: nowrap; }
.sidebar-nav a span { overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav a:hover { background: var(--fond); }
.sidebar-nav a.active { background: var(--bleu-clair); color: var(--bleu); }
.sidebar-nav a i { font-size: 1.05rem; width: 1.2rem; text-align: center; flex-shrink: 0; }
.sidebar-nav .compteur { margin-left: auto; background: var(--orange); color: #fff; border-radius: 999px; font-size: .7rem; padding: .05rem .45rem; font-weight: 600; }

html.menu-reduit .sidebar { width: 64px; }
html.menu-reduit .sidebar .titre, html.menu-reduit .sidebar-section, html.menu-reduit .sidebar-nav span, html.menu-reduit .sidebar-nav .compteur { display: none; }
html.menu-reduit .sidebar-nav a { justify-content: center; }
html.menu-reduit .sidebar-brand { align-items: center; padding: 1rem 0; }
html.menu-reduit .sidebar-brand .logo-complet { display: none; }
html.menu-reduit .sidebar-brand .logo-icone { display: block; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--blanc); border-bottom: 1px solid var(--bord); padding: .6rem 1.4rem; display: flex; align-items: center; gap: .8rem; position: sticky; top: 0; z-index: 1020; }
.topbar h1 { font-size: 1.1rem; margin: 0; font-weight: 600; }
.topbar .bouton-menu { border: 0; background: transparent; font-size: 1.3rem; color: var(--texte-2); padding: .1rem .3rem; }
.topbar .compte { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bleu); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; }
.role { font-size: .7rem; padding: .1rem .45rem; border-radius: 999px; background: var(--gris-clair); color: var(--texte-2); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.role.role-admin { background: var(--bleu-clair); color: var(--bleu); }
.role.role-sos { background: var(--bleu); color: #fff; }
.app-content { padding: 1.4rem; flex: 1; }
.app-footer { padding: .8rem 1.4rem; color: var(--texte-2); font-size: .78rem; display: flex; justify-content: space-between; border-top: 1px solid var(--bord); background: var(--blanc); }

@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.15); }
    html.menu-ouvert .sidebar { transform: none; }
    html.menu-reduit .sidebar { width: var(--menu-largeur); }
    html.menu-reduit .sidebar .titre, html.menu-reduit .sidebar-section, html.menu-reduit .sidebar-nav span { display: block; }
    html.menu-reduit .sidebar-nav .compteur { display: inline-block; }
    html.menu-reduit .sidebar-nav a { justify-content: flex-start; }
    html.menu-reduit .sidebar-brand { align-items: flex-start; padding: 1.1rem 1.3rem 1rem; }
    html.menu-reduit .sidebar-brand .logo-complet { display: block; }
    html.menu-reduit .sidebar-brand .logo-icone { display: none; }
    .app-content { padding: 1rem; }
    .topbar { padding: .6rem 1rem; }
}

/* ---------- Panneaux ---------- */
.panneau { background: var(--blanc); border: 1px solid var(--bord); border-radius: 12px; }
.panneau + .panneau { margin-top: 1.1rem; }
.panneau-tete { padding: .9rem 1.1rem; border-bottom: 1px solid var(--bord); display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.panneau-tete h2 { font-size: 1rem; margin: 0; font-weight: 600; }
.panneau-tete .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.panneau-corps { padding: 1.1rem; }

.tuile { background: var(--blanc); border: 1px solid var(--bord); border-radius: 12px; padding: 1rem 1.1rem; height: 100%; display: block; color: inherit; text-decoration: none; }
a.tuile:hover { border-color: var(--bleu); }
.tuile .libelle { color: var(--texte-2); font-size: .8rem; font-weight: 500; }
.tuile .valeur { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; }
.tuile .detail { color: var(--texte-2); font-size: .78rem; margin-top: .2rem; }
.tuile.attention { border-left: 4px solid var(--orange); }
.tuile.danger { border-left: 4px solid var(--rouge); }
.tuile.ok { border-left: 4px solid var(--vert); }

/* ---------- Tableaux ---------- */
.table-portail { margin: 0; }
.table-portail thead th { background: #f8f9fc; color: var(--texte-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; border-bottom: 1px solid var(--bord); white-space: nowrap; }
.table-portail td { vertical-align: middle; border-color: var(--bord); }
.table-portail tbody tr:hover { background: #fafbfd; }
.table-portail .nom { font-weight: 600; color: var(--texte); text-decoration: none; }
.table-portail .nom:hover { color: var(--bleu); }
.table-portail .sous { color: var(--texte-2); font-size: .78rem; }
.table-vide { text-align: center; color: var(--texte-2); padding: 2.5rem 1rem !important; }

/* Boutons des lignes : toujours empilés */
.row-actions { display: flex; flex-direction: column; gap: .3rem; align-items: stretch; min-width: 110px; }
.row-actions .btn { white-space: nowrap; }

/* ---------- Badges ---------- */
.badge-statut { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; }
.badge-statut i { font-size: .75rem; }
.badge-success { background: var(--vert-clair); color: var(--vert); }
.badge-warning { background: var(--orange-clair); color: var(--orange); }
.badge-danger { background: var(--rouge-clair); color: var(--rouge); }
.badge-neutral { background: var(--gris-clair); color: var(--texte-2); }
.badge-info { background: var(--bleu-clair); color: var(--bleu); }
.badge-formule { display: inline-block; min-width: 48px; text-align: center; font-weight: 700; font-size: .78rem; padding: .18rem .5rem; border-radius: 6px; }
.formule-90 { background: #f1ecfb; color: #6b3fb5; }
.formule-70 { background: #e6f4f7; color: #12738a; }
.formule-80 { background: var(--bleu-clair); color: var(--bleu); }
.formule-100 { background: var(--vert-clair); color: var(--vert); }
.alerte-donnee { font-size: .72rem; color: var(--orange); }

/* ---------- Filtres ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filtres .form-control, .filtres .form-select { min-width: 140px; }
.filtres .recherche { flex: 1 1 240px; }

/* ---------- Fiches ---------- */
.fiche-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem 1.4rem; }
.fiche-grille .champ .libelle { color: var(--texte-2); font-size: .75rem; font-weight: 500; }
.fiche-grille .champ .valeur { font-weight: 500; word-break: break-word; }
.encart { border-radius: 10px; padding: .8rem 1rem; display: flex; gap: .7rem; align-items: flex-start; }
.encart i { font-size: 1.15rem; margin-top: .05rem; }
.encart-warning { background: var(--orange-clair); color: #6b4300; }
.encart-danger { background: var(--rouge-clair); color: #7c1830; }
.encart-info { background: var(--bleu-clair); color: #1b3a6e; }
.encart-success { background: var(--vert-clair); color: #0b5634; }

.diff td.avant { color: var(--rouge); text-decoration: line-through; text-decoration-color: rgba(198,47,75,.4); }
.diff td.apres { color: var(--vert); font-weight: 600; }

.chrono { list-style: none; padding: 0; margin: 0; }
.chrono li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid var(--bord); margin-left: .4rem; }
.chrono li::before { content: ""; position: absolute; left: -6px; top: .25rem; width: 10px; height: 10px; border-radius: 50%; background: var(--bleu); }
.chrono .quand { font-size: .75rem; color: var(--texte-2); }

/* ---------- Formulaires ---------- */
.form-label { font-weight: 500; font-size: .83rem; margin-bottom: .25rem; }
.form-label .requis { color: var(--rouge); }
.form-text { font-size: .75rem; }
.membre { border: 1px solid var(--bord); border-radius: 10px; padding: 1rem; background: #fbfcfe; position: relative; }
.membre + .membre { margin-top: .8rem; }
.membre-tete { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.membre-tete h3 { font-size: .95rem; margin: 0; font-weight: 600; }
.membre-tete .retirer { margin-left: auto; }
.barre-actions { position: sticky; bottom: 0; background: rgba(244,246,250,.95); backdrop-filter: blur(4px); padding: .8rem 0; margin-top: 1rem; display: flex; gap: .6rem; justify-content: flex-end; border-top: 1px solid var(--bord); z-index: 10; }

/* Validation de masse */
.barre-selection { position: sticky; top: 57px; z-index: 15; background: var(--bleu); color: #fff; border-radius: 10px; padding: .6rem 1rem; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .8rem; }
.membres-mini { margin: .35rem 0 0; padding: 0; list-style: none; font-size: .8rem; color: var(--texte-2); }
.membres-mini li { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

/* Pagination */
.pagination-portail { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: .8rem 1.1rem; border-top: 1px solid var(--bord); font-size: .82rem; color: var(--texte-2); }
.pagination { margin: 0; }
.page-link { color: var(--bleu); }
.page-item.active .page-link { background: var(--bleu); border-color: var(--bleu); }

/* Mot de passe affiché une fois */
.mdp-unique { font-family: ui-monospace, Consolas, monospace; font-size: 1.25rem; letter-spacing: .08em; background: var(--blanc); border: 1px dashed var(--vert); border-radius: 8px; padding: .3rem .8rem; display: inline-block; }

/* ---------- Connexion ---------- */
.auth-body { background: linear-gradient(135deg, #1f427c 0%, #2d59a1 55%, #3f74c7 100%); min-height: 100vh; }
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-carte { width: 100%; max-width: 430px; background: var(--blanc); border-radius: 16px; box-shadow: 0 20px 60px rgba(9,25,56,.35); overflow: hidden; }
.auth-tete { padding: 1.6rem 1.8rem 1rem; text-align: center; }
.auth-cadre { width: 100%; max-width: 430px; }
.auth-cadre.auth-large { max-width: 640px; }
.auth-large .auth-carte { max-width: none; }
.auth-logos { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.auth-logos img { height: 46px; max-width: 46%; object-fit: contain; }
.auth-logos .trait { width: 1px; height: 38px; background: var(--bord); flex-shrink: 0; }
.auth-tete .partenaires { margin-top: .7rem; font-size: .8rem; color: var(--texte-2); }
.auth-tete .partenaires strong { color: var(--texte); }
.auth-corps { padding: .4rem 1.8rem 1.8rem; }
.auth-corps h1 { font-size: 1.3rem; font-weight: 700; margin-bottom: .2rem; }
.auth-corps .sous-titre { color: var(--texte-2); font-size: .85rem; margin-bottom: 1.2rem; }
.auth-champ { position: relative; }
.auth-champ > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--texte-2); }
.auth-champ .form-control { padding-left: 2.3rem; height: 44px; }
.auth-champ .oeil { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--texte-2); padding: .3rem .5rem; }
.auth-legal { text-align: center; color: rgba(255,255,255,.8); font-size: .75rem; margin-top: 1rem; }

/* ---------- Fenêtres (modals) et messages ---------- */
/* La page chargée est enveloppée dans .modal-fragment : il doit se comporter comme .modal-content
   (colonne flexible) pour que seul le corps défile, titre en haut et boutons en bas toujours visibles. */
.fenetre .modal-fragment { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: 100%; }
.fenetre .modal-fragment .modal-body { overflow-y: auto; min-height: 0; }
.fenetre .modal-header { background: var(--blanc); flex-shrink: 0; }
.fenetre .modal-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.modal-page { background: var(--fond); }
.modal-page .barre-actions { margin: 1rem -1rem -1rem; padding: .8rem 1rem; bottom: -1rem; background: rgba(244,246,250,.97); }
.modal-page .panneau + .panneau { margin-top: 1rem; }
.toasts { position: fixed; top: 70px; right: 1rem; z-index: 1090; width: min(420px, calc(100vw - 2rem)); display: flex; flex-direction: column; gap: .5rem; }
.toasts .alert { margin: 0; }

@media print {
    .sidebar, .topbar, .app-footer, .barre-actions, .btn, .filtres { display: none !important; }
    .app-content { padding: 0; }
}
