/* Eco Capital — back-office (maquette)
   Même système de design que le site : bleu roi, azur, encre ; Archivo. */

:root {
  --roi: #2340b0; --roi-fonce: #1a3192; --azur: #1fa2f2; --azur-clair: #7cc8f8;
  --encre: #0b1b4f; --encre-2: #4a5680; --brume: #eaf3fe; --brume-2: #f5f8fd; --trait: #dfe7f3; --blanc: #fff;
  --soleil: #ffb31a; --vert: #12a36b; --rouge: #d6453d; --orange: #e98a15; --violet: #6a4fd8;
  --police: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px; --ease: cubic-bezier(.22, .8, .25, 1);
  --largeur-menu: 264px;
  --bs-body-font-family: var(--police); --bs-body-color: var(--encre);
}
html, body { height: 100%; }
body { font-family: var(--police); font-size: .9375rem; background: var(--brume-2); color: var(--encre); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-stretch: 112%; font-weight: 800; letter-spacing: -.015em; color: var(--encre); }
h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.05rem; font-stretch: 105%; margin: 0; }
a { color: var(--roi); }
:focus-visible { outline: 3px solid var(--azur); outline-offset: 2px; border-radius: 6px; }
.btn { border-radius: 10px; font-weight: 650; font-size: .875rem; padding: .55rem 1rem; }
.btn-roi { background: var(--roi); color: #fff; border: 0; }
.btn-roi:hover, .btn-roi:focus-visible { background: var(--roi-fonce); color: #fff; }
.btn-leger { background: var(--blanc); border: 1px solid var(--trait); color: var(--encre); }
.btn-leger:hover { border-color: var(--roi); color: var(--roi); }
.btn-vert { background: var(--vert); color: #fff; border: 0; }
.btn-vert:hover { background: #0e8a5a; color: #fff; }
.btn-rouge { background: #fff; color: var(--rouge); border: 1px solid #f1c5c2; }
.btn-rouge:hover { background: var(--rouge); color: #fff; }
.btn:disabled, .btn.disabled { opacity: .45; }
.form-control, .form-select { border-radius: 10px; border-color: var(--trait); font-size: .875rem; padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--azur); box-shadow: 0 0 0 3px rgba(31, 162, 242, .2); }
.form-label { font-weight: 650; font-size: .8125rem; color: var(--encre-2); }

/* Bandeau maquette */
.bandeau-maquette { position: sticky; top: 0; z-index: 1050; background: repeating-linear-gradient(135deg, #ffb31a, #ffb31a 14px, #ffc145 14px, #ffc145 28px);
  color: var(--encre); font-size: .8125rem; font-weight: 700; text-align: center; padding: .35rem 1rem; }

/* Mise en page */
.cadre { display: grid; grid-template-columns: var(--largeur-menu) 1fr; min-height: calc(100vh - 30px); }
.menu-lateral { background: linear-gradient(180deg, #0d2063 0%, var(--encre) 60%, #071238 100%); color: #c9d6f5; padding: 1.25rem .9rem;
  position: sticky; top: 30px; height: calc(100vh - 30px); overflow-y: auto; display: flex; flex-direction: column; }
.menu-lateral .marque { display: flex; align-items: center; gap: .7rem; padding: .25rem .5rem 1.25rem; color: #fff; text-decoration: none; }
.menu-lateral .marque img { height: 40px; width: auto; }
.menu-lateral .marque span { font-weight: 800; font-stretch: 112%; line-height: 1.1; font-size: .95rem; }
.menu-lateral .marque small { display: block; font-weight: 500; font-stretch: 100%; color: #8fa3d6; font-size: .72rem; }
.menu-lateral .groupe { font-size: .72rem; color: #7f93c7; font-weight: 600; padding: 1rem .75rem .4rem; }
.menu-lateral ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.menu-lateral a.lien { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px; color: #c9d6f5; text-decoration: none;
  font-weight: 600; font-size: .875rem; transition: background .2s, color .2s; }
.menu-lateral a.lien i { font-size: 1.05rem; width: 20px; text-align: center; color: #7fa3e8; }
.menu-lateral a.lien:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu-lateral a.lien[aria-current="page"] { background: linear-gradient(90deg, rgba(31, 162, 242, .25), rgba(31, 162, 242, .05)); color: #fff;
  box-shadow: inset 3px 0 0 var(--azur); }
.menu-lateral a.lien[aria-current="page"] i { color: var(--azur-clair); }
.menu-lateral .compteur { margin-left: auto; background: var(--azur); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: .1rem .5rem; }
.menu-lateral .pied-menu { margin-top: auto; padding: 1rem .5rem 0; font-size: .75rem; color: #7f93c7; }
.menu-lateral .pied-menu a { color: #b6c4ea; }
[data-reserve]:not(.autorise) { display: none !important; }

.principal { min-width: 0; display: flex; flex-direction: column; }
.barre-haut { position: sticky; top: 30px; z-index: 1000; background: rgba(245, 248, 253, .9); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--trait); padding: .75rem 1.75rem; display: flex; align-items: center; gap: 1rem; }
.barre-haut .recherche { position: relative; flex: 1; max-width: 420px; }
.barre-haut .recherche i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--encre-2); }
.barre-haut .recherche input { padding-left: 2.2rem; background: #fff; }
.barre-haut .role { display: flex; align-items: center; gap: .5rem; margin-left: auto; font-size: .8125rem; color: var(--encre-2); }
.barre-haut .role select { width: auto; font-weight: 650; color: var(--encre); }
.barre-haut .avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--roi), var(--azur)); font-size: .85rem; }
.btn-menu { display: none; border: 0; background: none; font-size: 1.5rem; color: var(--encre); padding: 0 .25rem; }
.contenu { padding: 1.75rem; flex: 1; }
.entete-page { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.entete-page p { margin: .25rem 0 0; color: var(--encre-2); }
.fil { font-size: .8125rem; color: var(--encre-2); margin-bottom: .35rem; }
.fil a { color: var(--encre-2); }

/* Cartes et indicateurs */
.carte { background: var(--blanc); border: 1px solid var(--trait); border-radius: var(--r); }
.carte-corps { padding: 1.25rem; }
.carte-entete { padding: 1rem 1.25rem; border-bottom: 1px solid var(--trait); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.kpi { position: relative; overflow: hidden; padding: 1.1rem 1.2rem; }
.kpi .libelle { color: var(--encre-2); font-size: .8125rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.kpi .libelle i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--c, var(--roi)); font-size: .9rem; }
.kpi .valeur { font-size: 2rem; font-weight: 800; font-stretch: 115%; margin-top: .5rem; line-height: 1; }
.kpi .detail { font-size: .78rem; color: var(--encre-2); margin-top: .35rem; }
.kpi::after { content: ""; position: absolute; right: -28px; top: -28px; width: 90px; height: 90px; border-radius: 50%; background: var(--c, var(--roi)); opacity: .07; }
a.kpi { text-decoration: none; color: inherit; transition: transform .25s var(--ease), box-shadow .25s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(11, 27, 79, .45); }
.grille-tdb { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.raccourcis { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.raccourci { display: flex; align-items: center; gap: .6rem; padding: .75rem; border-radius: 12px; border: 1px solid var(--trait); text-decoration: none;
  color: var(--encre); font-weight: 650; font-size: .8125rem; background: var(--brume-2); }
.raccourci i { color: var(--roi); font-size: 1.1rem; }
.raccourci:hover { border-color: var(--roi); color: var(--roi); }

/* Tableaux */
.table-admin { margin: 0; font-size: .875rem; }
.table-admin thead th { background: var(--brume-2); color: var(--encre-2); font-weight: 650; font-size: .78rem; border-bottom: 1px solid var(--trait);
  padding: .7rem 1rem; white-space: nowrap; }
.table-admin tbody td { padding: .8rem 1rem; vertical-align: middle; border-color: var(--trait); }
.table-admin tbody tr { transition: background .15s; }
.table-admin tbody tr.cliquable { cursor: pointer; }
.table-admin tbody tr.cliquable:hover { background: var(--brume-2); }
.ref { font-family: var(--police); font-weight: 700; font-size: .8rem; color: var(--roi); }
.personne { display: flex; align-items: center; gap: .6rem; }
.initiales { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 800; flex: none;
  color: var(--roi); background: var(--brume); }
.personne small { display: block; color: var(--encre-2); font-size: .75rem; }
.filtres { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filtres .form-select, .filtres .form-control { width: auto; min-width: 160px; }
.pagination-admin { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-top: 1px solid var(--trait);
  font-size: .8125rem; color: var(--encre-2); }
.pagination-admin .btn { padding: .35rem .7rem; }
.vide { text-align: center; padding: 3rem 1rem; color: var(--encre-2); }
.vide i { font-size: 2rem; color: var(--azur); display: block; margin-bottom: .5rem; }

/* Statuts */
.statut { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; white-space: nowrap; }
.statut::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.statut.nouveau { background: #e7f1fb; color: #1f6fd0; }
.statut.etude { background: #efedff; color: var(--violet); }
.statut.pieces { background: #fff3df; color: #b86b00; }
.statut.validation { background: #fdeefb; color: #b0369c; }
.statut.approuve { background: #e5f6ee; color: #0e8a5a; }
.statut.refuse { background: #fdecea; color: var(--rouge); }
.statut.cloture { background: #eef0f4; color: #5b6478; }
.service-pastille { display: inline-flex; align-items: center; gap: .4rem; font-size: .8125rem; }
.service-pastille i { color: var(--azur); }

/* Fiche dossier */
.grille-fiche { display: grid; grid-template-columns: 1fr 360px; gap: 1rem; align-items: start; }
.infos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.5rem; margin: 0; }
.infos dt { font-size: .75rem; color: var(--encre-2); font-weight: 600; }
.infos dd { margin: .15rem 0 0; font-weight: 650; }
.chrono { list-style: none; padding: 0; margin: 0; position: relative; }
.chrono::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--trait); }
.chrono li { position: relative; padding: 0 0 1.1rem 2.25rem; }
.chrono li::before { content: ""; position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  border: 3px solid var(--azur); }
.chrono li:first-child::before { background: var(--azur); box-shadow: 0 0 0 4px rgba(31, 162, 242, .2); }
.chrono .quand { font-size: .75rem; color: var(--encre-2); }
.chrono .quoi { font-weight: 650; }
.chrono .note { font-size: .8125rem; color: var(--encre-2); margin-top: .15rem; }
.piece { display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border: 1px solid var(--trait); border-radius: 12px; }
.piece + .piece { margin-top: .5rem; }
.piece i.ico { font-size: 1.3rem; color: var(--roi); }
.piece .nom { font-weight: 650; font-size: .85rem; }
.piece small { display: block; color: var(--encre-2); font-size: .75rem; }
.piece .etat { margin-left: auto; }
.actions-statut { display: grid; gap: .5rem; }
.verrou { display: flex; gap: .6rem; align-items: flex-start; background: #fff7e6; border: 1px solid #ffe2a8; border-radius: 12px; padding: .75rem .85rem;
  font-size: .8125rem; color: #6b4a00; }
.verrou i { color: #c98500; margin-top: .1rem; }
.info-role { font-size: .78rem; color: var(--encre-2); }

/* Messagerie */
.messagerie { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 220px); min-height: 480px; overflow: hidden; }
.conversations { border-right: 1px solid var(--trait); overflow-y: auto; }
.conversation { display: flex; gap: .7rem; padding: .85rem 1rem; border-bottom: 1px solid var(--trait); cursor: pointer; background: none; border-left: 0;
  border-right: 0; border-top: 0; width: 100%; text-align: left; }
.conversation:hover, .conversation[aria-current="true"] { background: var(--brume-2); }
.conversation[aria-current="true"] { box-shadow: inset 3px 0 0 var(--azur); }
.conversation .apercu { font-size: .78rem; color: var(--encre-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.conversation .non-lu { margin-left: auto; width: 9px; height: 9px; border-radius: 50%; background: var(--azur); flex: none; margin-top: .4rem; }
.fil-messages { display: flex; flex-direction: column; min-width: 0; }
.fil-messages .messages { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .6rem; background: var(--brume-2); }
.bulle-msg { max-width: 70%; padding: .65rem .9rem; border-radius: 14px; font-size: .875rem; line-height: 1.45; }
.bulle-msg small { display: block; font-size: .7rem; opacity: .7; margin-top: .25rem; }
.bulle-msg.client { background: #fff; border: 1px solid var(--trait); align-self: flex-start; border-bottom-left-radius: 4px; }
.bulle-msg.agent { background: var(--roi); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.saisie { display: flex; gap: .5rem; padding: .85rem; border-top: 1px solid var(--trait); background: #fff; }

/* Bandeaux d'information */
.alerte-info { display: flex; gap: .75rem; align-items: flex-start; border-radius: 12px; padding: .85rem 1rem; font-size: .85rem; margin-bottom: 1rem;
  background: var(--brume); border: 1px solid #cfe2fb; }
.alerte-info i { color: var(--roi); font-size: 1.1rem; }
.alerte-info.attention { background: #fff7e6; border-color: #ffe2a8; }
.alerte-info.attention i { color: #c98500; }

/* Permissions */
.matrice th, .matrice td { text-align: center; }
.matrice th:first-child, .matrice td:first-child { text-align: left; }
.matrice .oui { color: var(--vert); font-size: 1.1rem; }
.matrice .non { color: #c3cad8; font-size: 1.1rem; }
.matrice .partiel { color: var(--orange); font-size: .75rem; font-weight: 700; }

/* Barres de progression (cagnottes) */
.progression { height: 8px; background: var(--brume); border-radius: 8px; overflow: hidden; }
.progression span { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--roi), var(--azur)); }

/* Toast */
.toast-admin { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 2000; background: var(--encre); color: #fff; border-radius: 12px; padding: .8rem 1rem;
  display: flex; align-items: center; gap: .6rem; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .6); transform: translateY(20px); opacity: 0;
  transition: transform .3s var(--ease), opacity .3s; pointer-events: none; font-size: .875rem; }
.toast-admin.visible { transform: none; opacity: 1; }
.toast-admin i { color: #5be3a6; }

/* Connexion */
.page-connexion { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.connexion-visuel { position: relative; overflow: hidden; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(600px 400px at 70% 40%, rgba(31, 162, 242, .35), transparent 70%), linear-gradient(160deg, #0d2063, var(--encre) 55%, #060f33); }
.connexion-visuel img { width: 150px; }
.connexion-visuel h1 { color: #fff; font-size: 2.2rem; max-width: 16ch; }
.connexion-visuel p { color: #c3d3f7; max-width: 40ch; }
.connexion-visuel .disques-deco { position: absolute; right: -80px; bottom: -60px; width: 420px; height: 300px; }
.connexion-visuel .disques-deco::before, .connexion-visuel .disques-deco::after { content: ""; position: absolute; top: 0; width: 300px; height: 300px; border-radius: 50%; }
.connexion-visuel .disques-deco::before { left: 0; background: var(--roi); box-shadow: 0 0 80px rgba(58, 92, 224, .6); }
.connexion-visuel .disques-deco::after { right: 0; background: var(--azur); mix-blend-mode: screen; box-shadow: 0 0 80px rgba(31, 162, 242, .6); }
.connexion-form { display: grid; place-items: center; padding: 2rem; background: #fff; }
.connexion-form form { width: 100%; max-width: 380px; }

@media (max-width: 1199.98px) { .kpis { grid-template-columns: repeat(2, 1fr); } .grille-tdb, .grille-fiche { grid-template-columns: 1fr; } }
@media (max-width: 991.98px) {
  .cadre { grid-template-columns: 1fr; }
  .menu-lateral { position: fixed; left: 0; top: 30px; bottom: 0; width: var(--largeur-menu); z-index: 1040; transform: translateX(-100%);
    transition: transform .3s var(--ease); }
  .menu-ouvert .menu-lateral { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .4); }
  .btn-menu { display: block; }
  .messagerie { grid-template-columns: 1fr; height: auto; }
  .conversations { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--trait); }
  .page-connexion { grid-template-columns: 1fr; }
  .connexion-visuel { min-height: 260px; }
}
@media (max-width: 575.98px) {
  .contenu { padding: 1rem; } .barre-haut { padding: .6rem 1rem; } .kpis { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .kpi .valeur { font-size: 1.6rem; } .infos { grid-template-columns: 1fr; } .barre-haut .role span { display: none; }
  .barre-haut .recherche { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
.grille-tdb > *, .grille-fiche > *, .kpis > *, .contenu .d-grid > * { min-width: 0; }
.ref { white-space: nowrap; }
.table-admin .personne { min-width: 150px; }
.table-admin .service-pastille { white-space: nowrap; }
@media (max-width: 991.98px) { .menu-ouvert .principal { filter: brightness(.6); transition: filter .3s; } }

/* Version en production : pas de bandeau de maquette */
.live .cadre { min-height: 100vh; }
.live .menu-lateral { top: 0; height: 100vh; }
.live .barre-haut { top: 0; }
@media (max-width: 991.98px) { .live .menu-lateral { top: 0; } }
.alerte-succes { display: flex; gap: .75rem; align-items: flex-start; border-radius: 12px; padding: .85rem 1rem; font-size: .875rem; margin-bottom: 1rem;
  background: #e5f6ee; border: 1px solid #b9e6cf; color: #0b5e3e; }
.alerte-erreur { display: flex; gap: .75rem; align-items: flex-start; border-radius: 12px; padding: .85rem 1rem; font-size: .875rem; margin-bottom: 1rem;
  background: #fdecea; border: 1px solid #f6c6c1; color: #8a2a24; }
.alerte-erreur ul { margin: 0; padding-left: 1.1rem; }
.pagination { margin: 0; gap: .25rem; }
.pagination .page-link { border-radius: 8px; border-color: var(--trait); color: var(--encre); font-size: .8125rem; }
.pagination .active > .page-link { background: var(--roi); border-color: var(--roi); }
.utilisateur-menu { display: flex; align-items: center; gap: .6rem; }
.utilisateur-menu .nom { font-weight: 650; font-size: .875rem; line-height: 1.1; }
.utilisateur-menu small { display: block; color: var(--encre-2); font-size: .75rem; font-weight: 500; }
/* Les libellés masqués (visually-hidden) des tableaux restent dans la zone défilante : pas de débordement sur mobile */
.table-responsive { position: relative; }
