:root {
  --bleu: #0d3b66;
  --bleu-clair: #1b5e9b;
  --or: #f4b400;
  --or-fonce: #c98a00;
  --vert: #1b8a5a;
  --rouge: #c0392b;
  --gris: #6b7280;
  --gris-clair: #f3f5f8;
  --bord: #e2e8f0;
  --texte: #1f2937;
  --ombre: 0 2px 8px rgba(13, 59, 102, 0.08);
  --ombre-fort: 0 8px 28px rgba(13, 59, 102, 0.16);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--texte);
  background: var(--gris-clair);
  line-height: 1.55;
}

a { color: var(--bleu-clair); }

/* En-tete -------------------------------------------------------------- */
header.app {
  background: linear-gradient(120deg, var(--bleu) 0%, var(--bleu-clair) 100%);
  color: #fff;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--ombre);
}
header.app .logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--or); color: var(--bleu);
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px; flex: none;
}
header.app .brand {
  background: #fff; border-radius: 10px; padding: 7px 14px; flex: none;
  display: flex; align-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
header.app .brand img { height: 40px; display: block; }
header.app h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
header.app .sub { font-size: .8rem; opacity: .85; margin: 0; }
header.app .spacer { flex: 1; }
header.app a.nav { color: #fff; text-decoration: none; font-size: .9rem; opacity: .9; }
header.app a.nav:hover { opacity: 1; text-decoration: underline; }

main { max-width: 1024px; margin: 0 auto; padding: 28px 20px 60px; }

.fil { font-size: .85rem; color: var(--gris); margin-bottom: 18px; }
.fil a { text-decoration: none; }

h2.titre { color: var(--bleu); margin: 0 0 6px; font-size: 1.5rem; }
p.intro { color: var(--gris); margin: 0 0 26px; max-width: 70ch; }

/* Cartes des axes (accueil) ------------------------------------------- */
.axes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.axe {
  background: #fff; border: 1px solid var(--bord); border-radius: var(--radius);
  padding: 26px 22px; text-decoration: none; color: inherit;
  box-shadow: var(--ombre); transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 12px;
}
.axe:hover { transform: translateY(-4px); box-shadow: var(--ombre-fort); }
.axe .ico {
  width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  font-size: 28px; background: rgba(13,59,102,.08);
}
.axe.or .ico { background: rgba(244,180,0,.16); }
.axe.vert .ico { background: rgba(27,138,90,.12); }
.axe h3 { margin: 0; color: var(--bleu); font-size: 1.12rem; }
.axe p { margin: 0; color: var(--gris); font-size: .92rem; }
.axe .go { margin-top: auto; color: var(--or-fonce); font-weight: 700; font-size: .9rem; }

/* Cartes & formulaires ------------------------------------------------- */
.carte {
  background: #fff; border: 1px solid var(--bord); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--ombre); margin-bottom: 22px;
}
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .grille2 { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
label .opt { color: var(--gris); font-weight: 400; }
.champ { margin-bottom: 16px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--bord); border-radius: 10px;
  font-size: .98rem; font-family: inherit; background: #fff; color: var(--texte);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--bleu-clair); box-shadow: 0 0 0 3px rgba(27,94,155,.15);
}
textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--bleu); color: #fff; border: none; border-radius: 10px;
  padding: 12px 22px; font-size: 1rem; font-weight: 600; font-family: inherit;
  transition: background .15s;
}
.btn:hover { background: var(--bleu-clair); }
.btn.or { background: var(--or); color: var(--bleu); }
.btn.or:hover { background: var(--or-fonce); color: #fff; }
.btn.ghost { background: #fff; color: var(--bleu); border: 1px solid var(--bord); }
.btn.ghost:hover { background: var(--gris-clair); }
.btn.sm { padding: 7px 14px; font-size: .85rem; }
.btn.danger { background: var(--rouge); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.recherche { display: flex; gap: 10px; }
.recherche input { flex: 1; }
@media (max-width: 520px) { .recherche { flex-direction: column; } }

/* Resultats / tableaux ------------------------------------------------- */
.resultat {
  border: 1px solid var(--bord); border-radius: 12px; padding: 14px 16px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 14px; background: #fff;
}
.resultat .nom { font-weight: 700; color: var(--bleu); }
.resultat .meta { font-size: .85rem; color: var(--gris); }
.resultat .spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--bord); }
th { color: var(--gris); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr.clic { cursor: pointer; }
tr.clic:hover { background: var(--gris-clair); }

/* Badges --------------------------------------------------------------- */
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: .76rem; font-weight: 700;
}
.badge.recense { background: rgba(27,138,90,.14); color: var(--vert); }
.badge.en_attente { background: rgba(244,180,0,.18); color: var(--or-fonce); }
.badge.valide { background: rgba(27,138,90,.14); color: var(--vert); }
.badge.rejete { background: rgba(192,57,43,.12); color: var(--rouge); }

/* Messages ------------------------------------------------------------- */
.alerte {
  padding: 13px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem;
  display: none;
}
.alerte.show { display: block; }
.alerte.ok { background: rgba(27,138,90,.1); color: var(--vert); border: 1px solid rgba(27,138,90,.3); }
.alerte.err { background: rgba(192,57,43,.08); color: var(--rouge); border: 1px solid rgba(192,57,43,.3); }
.alerte.info { background: rgba(27,94,155,.08); color: var(--bleu); border: 1px solid rgba(27,94,155,.25); }

.note { font-size: .82rem; color: var(--gris); }
.vide { text-align: center; color: var(--gris); padding: 30px; }

/* Tableau de bord agent ------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: #fff; border: 1px solid var(--bord); border-radius: 12px; padding: 18px; box-shadow: var(--ombre); }
.stat .n { font-size: 1.8rem; font-weight: 800; color: var(--bleu); }
.stat .l { font-size: .82rem; color: var(--gris); }
.onglets { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.onglet { padding: 9px 18px; border-radius: 10px; border: 1px solid var(--bord); background: #fff; cursor: pointer; font-weight: 600; font-size: .9rem; }
.onglet.actif { background: var(--bleu); color: #fff; border-color: var(--bleu); }

/* Modale --------------------------------------------------------------- */
.modale-fond {
  position: fixed; inset: 0; background: rgba(13,59,102,.45); display: none;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto;
}
.modale-fond.show { display: flex; }
.modale { background: #fff; border-radius: var(--radius); max-width: 640px; width: 100%; box-shadow: var(--ombre-fort); }
.modale header { background: var(--bleu); color: #fff; padding: 16px 22px; border-radius: var(--radius) var(--radius) 0 0; display: flex; align-items: center; }
.modale header h3 { margin: 0; font-size: 1.05rem; }
.modale header .x { margin-left: auto; cursor: pointer; font-size: 1.4rem; opacity: .8; }
.modale .corps { padding: 22px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; font-size: .9rem; margin-bottom: 18px; }
.kv dt { color: var(--gris); }
.kv dd { margin: 0; font-weight: 600; }

footer.app { text-align: center; color: var(--gris); font-size: .8rem; padding: 24px; }
.spinner { display:inline-block; width:16px; height:16px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ====================================================================== */
/* Tableau de bord temps réel (mur d'affichage)                           */
/* ====================================================================== */
body.dash { background: linear-gradient(135deg, #0d3b66 0%, #103a5e 60%, #0a2f52 100%); color: #fff; height: 100vh; overflow: hidden; }
/* Mise en page "plein écran" : tout tient dans la hauteur de la fenêtre. */
.dash-wrap { max-width: 1800px; height: 100vh; margin: 0 auto; padding: 14px 26px 16px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.dash-head { display: flex; align-items: center; gap: 18px; padding: 0 0 12px; border-bottom: 1px solid rgba(255,255,255,.15); flex: none; }
.btn-fs { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 9px 16px; font-size: .9rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-fs:hover { background: rgba(255,255,255,.2); }
.dash-head .brand { background:#fff; border-radius:10px; padding:7px 14px; }
.dash-head .brand img { height: 42px; display:block; }
.dash-head h1 { font-size: 1.4rem; margin: 0; }
.dash-head .sub { margin: 0; font-size: .85rem; opacity: .75; }
.dash-head .spacer { flex: 1; }
.dash-clock { text-align: right; font-variant-numeric: tabular-nums; }
.dash-clock .h { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.dash-clock .maj { font-size: .76rem; opacity: .8; margin-top: 4px; }
.dash-clock .cd { font-size: .72rem; opacity: .65; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; flex: none; }
.kpi { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 14px 18px; backdrop-filter: blur(4px); }
.kpi .v { font-size: clamp(1.6rem, 2.4vw, 2.4rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .85rem; opacity: .82; margin-top: 6px; }
.kpi .s { font-size: .76rem; opacity: .65; margin-top: 2px; }
.kpi.or { background: linear-gradient(135deg, rgba(244,180,0,.22), rgba(244,180,0,.08)); border-color: rgba(244,180,0,.4); }
.kpi.or .v { color: var(--or); }
.kpi.vert .v { color: #58d39a; }
.kpi.rouge .v { color: #ff8a7a; }

.dash-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; flex: 1; min-height: 0; }
@media (max-width: 1000px) { .dash-cols { grid-template-columns: 1fr; } }
.panel { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 14px 18px; }
.dash-cols .panel { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.panel h2 { font-size: 1rem; margin: 0 0 10px; color: #fff; flex: none; }

.progress-wrap { flex: none; padding: 12px 18px; }
.progress-bar { height: 22px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--or), #ffd34d); border-radius: 999px; transition: width .8s ease; min-width: 2px; }
.progress-lbl { display:flex; justify-content: space-between; font-size: .85rem; opacity: .85; margin-bottom: 6px; }

.bar-row { display: grid; grid-template-columns: 150px 1fr 200px; align-items: center; gap: 12px; margin-bottom: 7px; font-size: .82rem; }
.bar-row .pcode { font-weight: 700; }
.bar-track { background: rgba(255,255,255,.1); border-radius: 8px; height: 18px; overflow: hidden; }
.bar-val { background: linear-gradient(90deg,#3aa0ff,#58d39a); height: 100%; border-radius: 8px; transition: width .8s ease; }
.bar-num { text-align: right; font-variant-numeric: tabular-nums; opacity: .9; }

.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini .m { background: rgba(255,255,255,.06); border-radius: 12px; padding: 14px; text-align: center; }
.mini .m .n { font-size: 1.5rem; font-weight: 800; }
.mini .m .t { font-size: .76rem; opacity: .78; margin-top: 4px; }
.dash-login { max-width: 360px; margin: 12vh auto; background: rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.2); padding: 26px; border-radius: 16px; }
.dash-login input { margin-bottom: 12px; }

/* Message de confirmation de recensement (consultation publique) */
@keyframes clignote { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.confirme {
  margin: 18px 0; padding: 22px 24px; border-radius: 14px;
  background: rgba(27,138,90,.12); border: 2px solid var(--vert);
  text-align: center;
}
.confirme .gros {
  font-size: clamp(1.3rem, 3.5vw, 2.1rem); font-weight: 800; color: var(--vert);
  line-height: 1.3; animation: clignote 1s steps(1,end) infinite;
}
.confirme .nom { color: var(--bleu); }
.confirme .sous { margin-top: 12px; font-size: clamp(1.2rem, 2.6vw, 1.7rem); font-weight: 800; color: var(--rouge); }
.resultat.clic { cursor: pointer; transition: background .15s, border-color .15s; }
.resultat.clic:hover { background: var(--gris-clair); border-color: var(--bleu-clair); }
