/* ============================================================
   Suivi des distinctions honorifiques — feuille de style commune
   Identité : bleu marine institutionnel, or, crème, sobre et aéré.
   ============================================================ */

:root{
  --navy:#1a2744; --navy-lt:#243358; --navy-dk:#101a30;
  --gold:#b8932a; --gold-lt:#f5ead4; --gold-mid:#e8d090;
  --bg:#f2f0eb; --bg2:#e8e5de; --white:#ffffff;
  --text:#1a1e2e; --text2:#4a5068; --text3:#8a90a8;
  --border:#dcd8ce; --border2:#c8c4b8;
  --green:#1a5a32; --green-lt:#e8f5ed;
  --red:#a32d2d; --red-lt:#faeaea;
  --amber:#8a6b1a; --amber-lt:#f7edd4;
  --blue:#1a4a8a; --blue-lt:#e8f0fa;
  --shadow:rgba(26,39,68,0.10);
  --sidebar-w:230px;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:'Source Sans 3',-apple-system,BlinkMacSystemFont,sans-serif;
  background:var(--bg); color:var(--text); font-size:15px; line-height:1.55;
}
a{color:var(--navy);}
h1,h2,h3{font-family:'Libre Baskerville',serif; color:var(--navy); margin:0 0 8px;}
.mono{font-family:'IBM Plex Mono',monospace;}

/* ---------- Layout général : sidebar + contenu ---------- */
.app-shell{display:flex; min-height:100vh;}
.sidebar{
  width:var(--sidebar-w); flex-shrink:0; background:var(--navy); color:#fff;
  display:flex; flex-direction:column; position:fixed; top:0; bottom:0; left:0; z-index:20;
}
.sidebar-brand{padding:26px 22px 18px;}
.sidebar-brand .label{font-family:'IBM Plex Mono',monospace; font-size:9px; letter-spacing:.2em; text-transform:uppercase; color:rgba(255,255,255,0.4); margin-bottom:6px;}
.sidebar-brand .title{font-family:'Libre Baskerville',serif; font-weight:700; font-size:17px; line-height:1.25;}
.sidebar-nav{flex:1; padding:6px 12px; overflow-y:auto;}
.sidebar-nav a{
  display:flex; align-items:center; gap:10px; padding:10px 12px; margin-bottom:2px;
  border-radius:8px; text-decoration:none; color:rgba(255,255,255,0.72); font-size:13.5px; font-weight:600;
}
.sidebar-nav a:hover{background:rgba(255,255,255,0.06); color:#fff;}
.sidebar-nav a.active{background:var(--gold); color:var(--navy);}
.sidebar-nav .icon{width:16px; text-align:center; flex-shrink:0;}
.sidebar-foot{padding:14px 22px 20px; border-top:1px solid rgba(255,255,255,0.1);}
.sidebar-foot .user-email{font-size:11px; color:rgba(255,255,255,0.55); word-break:break-all; margin-bottom:8px;}
.sidebar-foot button{
  width:100%; background:rgba(255,255,255,0.08); color:#fff; border:1px solid rgba(255,255,255,0.18);
  border-radius:8px; padding:8px; font-size:12px; cursor:pointer; font-family:'IBM Plex Mono',monospace; letter-spacing:.04em;
}
.sidebar-foot button:hover{background:rgba(255,255,255,0.16);}

.main{margin-left:var(--sidebar-w); flex:1; min-width:0;}
.topbar{
  background:var(--white); border-bottom:1px solid var(--border); padding:16px 32px;
  display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:10;
}
.topbar h1{font-size:20px; margin:0;}
.topbar .sub{color:var(--text3); font-size:12.5px; margin-top:2px; font-family:'IBM Plex Mono',monospace;}
.page{padding:28px 32px 80px; max-width:1600px; margin:0 auto;}

.mobile-toggle{display:none;}
@media(max-width:880px){
  .sidebar{transform:translateX(-100%); transition:transform .2s; width:250px;}
  .sidebar.open{transform:translateX(0);}
  .main{margin-left:0;}
  .mobile-toggle{display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; border-radius:8px; border:1px solid var(--border2); background:var(--white); cursor:pointer; margin-right:10px;}
  .page{padding:20px 16px 70px;}
  .topbar{padding:14px 16px;}
}

/* ---------- Cartes / badges génériques ---------- */
.card{background:var(--white); border:1px solid var(--border); border-radius:14px; padding:20px 22px; box-shadow:0 2px 8px var(--shadow);}
.card + .card{margin-top:14px;}
.card h3{font-size:15px; margin-bottom:14px;}
.card-title-row{display:flex; align-items:center; justify-content:space-between; margin-bottom:14px;}

.grid{display:grid; gap:14px;}
.grid-2{grid-template-columns:1fr 1fr;}
.grid-3{grid-template-columns:1fr 1fr 1fr;}
.grid-4{grid-template-columns:repeat(4,1fr);}
@media(max-width:900px){.grid-3,.grid-4{grid-template-columns:1fr 1fr;}}
@media(max-width:560px){.grid-2,.grid-3,.grid-4{grid-template-columns:1fr;}}

.badge{
  display:inline-block; font-family:'IBM Plex Mono',monospace; font-size:10px; font-weight:700;
  letter-spacing:.04em; text-transform:uppercase; padding:4px 10px; border-radius:14px; white-space:nowrap;
}
.badge.b-neutral{background:var(--bg2); color:var(--text2);}
.badge.b-amber{background:var(--amber-lt); color:var(--amber);}
.badge.b-green{background:var(--green-lt); color:var(--green);}
.badge.b-red{background:var(--red-lt); color:var(--red);}
.badge.b-blue{background:var(--blue-lt); color:var(--blue);}
.badge.b-gold{background:var(--gold-lt); color:#7a5c14;}

/* Statuts -> couleur */
.badge[data-statut="Brouillon"],.badge[data-statut="À compléter"],.badge[data-statut="Pièces manquantes"]{background:var(--amber-lt); color:var(--amber);}
.badge[data-statut="Prêt à envoyer"]{background:var(--blue-lt); color:var(--blue);}
.badge[data-statut="Envoyé"],.badge[data-statut="Accusé de réception reçu"],.badge[data-statut="En instruction"]{background:var(--bg2); color:var(--text2);}
.badge[data-statut="À relancer"]{background:var(--red-lt); color:var(--red);}
.badge[data-statut="Relancé"]{background:var(--gold-lt); color:#7a5c14;}
.badge[data-statut="Accepté"]{background:var(--green-lt); color:var(--green);}
.badge[data-statut="Refusé"]{background:var(--red-lt); color:var(--red);}
.badge[data-statut="Reporté"]{background:var(--bg2); color:var(--text2);}
.badge[data-statut="Archivé"]{background:var(--bg2); color:var(--text3);}

/* ---------- Indicateurs tableau de bord ---------- */
.stat-card{background:var(--white); border:1px solid var(--border); border-radius:14px; padding:16px 18px; box-shadow:0 2px 8px var(--shadow);}
.stat-card .num{font-family:'Libre Baskerville',serif; font-weight:700; font-size:28px; color:var(--navy);}
.stat-card .lbl{font-size:12px; color:var(--text3); margin-top:2px;}

/* ---------- Boutons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:6px; font-family:'IBM Plex Mono',monospace; font-size:11.5px;
  font-weight:600; letter-spacing:.04em; text-transform:uppercase; padding:9px 16px; border-radius:20px;
  border:1px solid var(--border2); background:var(--white); color:var(--text2); cursor:pointer; text-decoration:none;
}
.btn:hover{border-color:var(--navy); color:var(--navy);}
.btn-primary{background:var(--navy); color:#fff; border-color:var(--navy);}
.btn-primary:hover{background:var(--navy-lt); color:#fff;}
.btn-gold{background:var(--gold); color:var(--navy); border-color:var(--gold);}
.btn-gold:hover{background:var(--gold-mid);}
.btn-danger{background:var(--white); color:var(--red); border-color:var(--red-lt);}
.btn-danger:hover{background:var(--red-lt);}
.btn-sm{padding:6px 12px; font-size:10.5px;}
.btn[disabled]{opacity:.5; cursor:not-allowed;}

/* ---------- Formulaires ---------- */
label{display:block; font-size:12px; font-weight:600; color:var(--navy); margin-bottom:5px;}
.field{margin-bottom:14px;}
.field .hint{font-size:11.5px; color:var(--text3); margin-top:4px;}
input[type=text],input[type=email],input[type=tel],input[type=date],input[type=number],input[type=password],
select,textarea{
  width:100%; padding:10px 12px; border:1px solid var(--border2); border-radius:8px; font-size:14px;
  font-family:inherit; background:var(--white); color:var(--text);
}
textarea{resize:vertical; min-height:80px;}
input:focus,select:focus,textarea:focus{outline:none; border-color:var(--gold);}
.checkbox-row{display:flex; align-items:center; gap:8px;}
.checkbox-row input{width:auto;}

/* ---------- Tables ---------- */
table{width:100%; border-collapse:collapse; font-size:13.5px;}
th{
  text-align:left; font-family:'IBM Plex Mono',monospace; font-size:10.5px; letter-spacing:.05em; text-transform:uppercase;
  color:var(--text3); padding:8px 10px; border-bottom:2px solid var(--border); cursor:pointer; white-space:nowrap;
}
td{padding:10px; border-bottom:1px solid var(--border); vertical-align:middle;}
tr.row-link{cursor:pointer;}
tr.row-link:hover td{background:var(--bg);}

/* ---------- Onglets fiche dossier ---------- */
.tabs{display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:20px; overflow-x:auto;}
.tab-btn{
  font-family:'IBM Plex Mono',monospace; font-size:11px; font-weight:600; letter-spacing:.04em; text-transform:uppercase;
  padding:11px 16px; background:none; border:none; border-bottom:2px solid transparent; color:var(--text3); cursor:pointer; white-space:nowrap;
}
.tab-btn.active{color:var(--navy); border-bottom-color:var(--gold);}
.tab-panel{display:none;}
.tab-panel.active{display:block;}

/* ---------- Progress bar ---------- */
.progress-bar{height:8px; border-radius:6px; background:var(--bg2); overflow:hidden;}
.progress-bar > div{height:100%; background:var(--gold); transition:width .3s;}
.progress-label{font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--text2); margin-top:6px;}

/* ---------- Check-list ---------- */
.checklist-item{display:flex; align-items:center; gap:8px; padding:6px 0; font-size:13px;}
.checklist-item .mark{width:16px; text-align:center; font-weight:700;}
.checklist-item.ok .mark{color:var(--green);}
.checklist-item.ko .mark{color:var(--red);}

/* ---------- Timeline ---------- */
.timeline{list-style:none; margin:0; padding:0;}
.timeline li{display:flex; gap:12px; padding:9px 0; border-bottom:1px solid var(--border); font-size:13px;}
.timeline li:last-child{border-bottom:none;}
.timeline .t-date{font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--text3); white-space:nowrap; min-width:150px;}
.timeline .t-desc{color:var(--text2);}

/* ---------- Login ---------- */
.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--bg); padding:20px;}
.login-card{max-width:380px; width:100%; background:var(--white); border:1px solid var(--border); border-radius:16px; padding:36px 30px; box-shadow:0 4px 20px var(--shadow); text-align:center;}
.login-card .label{font-family:'IBM Plex Mono',monospace; font-size:10px; letter-spacing:.22em; text-transform:uppercase; color:var(--text3); margin-bottom:10px;}
.login-card h1{font-size:22px; margin-bottom:8px;}
.login-card p{color:var(--text2); font-size:13.5px; margin-bottom:24px;}
#g_id_button_container{display:flex; justify-content:center;}
.login-err{color:var(--red); font-size:12.5px; margin-top:16px; display:none;}

/* ---------- Empty / loading / toast ---------- */
.empty{text-align:center; color:var(--text3); font-size:13px; padding:30px;}
.toast{position:fixed; bottom:22px; left:50%; transform:translateX(-50%); background:var(--navy); color:#fff;
  padding:11px 22px; border-radius:20px; font-size:13px; display:none; z-index:100; box-shadow:0 4px 14px rgba(0,0,0,0.2);}
.save-indicator{font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--text3);}
.save-indicator.saved{color:var(--green);}
.save-indicator.dirty{color:var(--amber);}

/* ---------- Filtres / recherche ---------- */
.filter-bar{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; align-items:center;}
.filter-bar select,.filter-bar input[type=text]{width:auto; min-width:140px; padding:8px 10px; font-size:13px;}
.search-box{flex:1; min-width:200px;}

/* ---------- Modale ---------- */
.modal-overlay{position:fixed; inset:0; background:rgba(16,26,48,0.55); display:none; align-items:center; justify-content:center; z-index:50; padding:20px;}
.modal-overlay.open{display:flex;}
.modal{background:var(--white); border-radius:14px; max-width:560px; width:100%; max-height:88vh; overflow-y:auto; padding:26px 26px 22px; box-shadow:0 10px 40px rgba(0,0,0,0.25);}
.modal h3{margin-bottom:16px;}
.modal-actions{display:flex; justify-content:flex-end; gap:8px; margin-top:18px;}

/* ---------- Fiche dossier : en-tête ---------- */
.dossier-head{display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:22px;}
.dossier-head h1{font-size:24px; margin-bottom:4px;}
.dossier-head .sub{color:var(--text2); font-size:14px;}
.dossier-progress{min-width:220px;}

/* ---------- Wizard (nouvelle candidature) ---------- */
.wizard-steps{display:flex; gap:6px; margin-bottom:26px; flex-wrap:wrap;}
.wizard-step{font-family:'IBM Plex Mono',monospace; font-size:11px; font-weight:600; padding:7px 14px; border-radius:16px; background:var(--bg2); color:var(--text3);}
.wizard-step.active{background:var(--navy); color:#fff;}
.wizard-step.done{background:var(--gold-lt); color:#7a5c14;}
.wizard-nav{display:flex; justify-content:space-between; margin-top:24px;}

/* ---------- Documents ---------- */
.doc-item{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:11px 14px; border:1px solid var(--border); border-radius:10px; margin-bottom:8px; background:var(--white);}
.doc-item .doc-name{font-weight:600; color:var(--navy); font-size:13.5px;}
.doc-item .doc-meta{font-size:11.5px; color:var(--text3);}
.file-drop{border:2px dashed var(--border2); border-radius:10px; padding:22px; text-align:center; cursor:pointer; margin-bottom:14px;}
.file-drop:hover,.file-drop.drag{border-color:var(--gold); background:var(--gold-lt);}
.file-drop input{display:none;}

/* ---------- Print (fiche de synthèse) ---------- */
@media print{
  .sidebar,.topbar,.tabs,.no-print{display:none !important;}
  .main{margin-left:0;}
  .page{padding:0;}
  body{background:#fff;}
}

@media(max-width:560px){
  .dossier-head{flex-direction:column;}
}
