:root {
  --bleu: #1e3a5f;
  --bleu-clair: #eef3f8;
  --gris: #6b7280;
  --gris-clair: #f3f4f6;
  --bordure: #e5e7eb;
  --texte: #1f2937;
  --vert: #15803d;
  --orange: #b45309;
  --rouge: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--texte);
  background: #f8f9fb;
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Barre de navigation ---- */
nav.topbar {
  background: var(--bleu);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  flex-wrap: wrap;
}
nav.topbar .marque { font-weight: 700; padding: 12px 12px 12px 0; font-size: 15px; }
nav.topbar a { color: #cfdcec; text-decoration: none; padding: 12px 10px; display: inline-block; }
nav.topbar a:hover, nav.topbar a.actif { color: #fff; background: rgba(255,255,255,.08); }
nav.topbar .droite { margin-left: auto; display: flex; align-items: center; gap: 8px; }
nav.topbar .droite span { color: #cfdcec; font-size: 13px; }
nav.topbar form { display: inline; }
nav.topbar button {
  background: transparent; border: 1px solid #cfdcec55; color: #cfdcec;
  border-radius: 4px; padding: 5px 10px; cursor: pointer; font-size: 13px;
}
nav.topbar button:hover { color: #fff; border-color: #fff; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
main.large { max-width: 1280px; }

h1 { font-size: 21px; margin: 0 0 4px; color: var(--bleu); }
h2 { font-size: 16px; margin: 26px 0 10px; color: var(--bleu); }
.sous-titre { color: var(--gris); margin: 0 0 18px; }

/* ---- Cartes / blocs ---- */
.carte {
  background: #fff; border: 1px solid var(--bordure); border-radius: 8px;
  padding: 16px 18px; margin-bottom: 16px;
}
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grille-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 800px) { .grille-2, .grille-3 { grid-template-columns: 1fr; } }

/* ---- Tableaux ---- */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--bordure); vertical-align: top; }
th { background: var(--bleu-clair); color: var(--bleu); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafbfd; }
.table-scroll { overflow-x: auto; border: 1px solid var(--bordure); border-radius: 8px; }

/* ---- Formulaires ---- */
label { display: block; font-weight: 600; margin: 10px 0 3px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month],
input[type=number], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 5px;
  font: inherit; background: #fff;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93b4d6; border-color: var(--bleu); }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form > div { flex: 1; min-width: 140px; }

button, .btn {
  background: var(--bleu); color: #fff; border: none; border-radius: 5px;
  padding: 8px 16px; font: inherit; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: #2a4d7a; }
.btn-secondaire { background: #fff; color: var(--bleu); border: 1px solid var(--bleu); }
.btn-secondaire:hover { background: var(--bleu-clair); }
.btn-danger { background: var(--rouge); }
.btn-danger:hover { background: #991b1b; }
.btn-petit { padding: 4px 10px; font-size: 12.5px; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-brouillon { background: var(--gris-clair); color: var(--gris); }
.badge-finalise { background: #fef3c7; color: #92400e; }
.badge-transmis { background: #dbeafe; color: #1e40af; }
.badge-observations_recues { background: #ede9fe; color: #5b21b6; }
.badge-clos { background: #d1fae5; color: #065f46; }
.badge-ouvert { background: #fee2e2; color: var(--rouge); }
.badge-niveau1 { background: var(--gris-clair); color: var(--gris); }
.badge-niveau2 { background: #fef3c7; color: #92400e; }
.badge-niveau3 { background: #fee2e2; color: var(--rouge); }
.badge-positif { background: #d1fae5; color: #065f46; }
.badge-negatif { background: #fee2e2; color: var(--rouge); }
.badge-attente { background: #fef3c7; color: #92400e; }

/* ---- Notes ---- */
.note { display: inline-block; width: 26px; height: 26px; line-height: 26px; text-align: center;
  border-radius: 50%; font-weight: 700; color: #fff; font-size: 13px; }
.note-1 { background: var(--rouge); }
.note-2 { background: var(--orange); }
.note-3 { background: var(--vert); }
.note-4 { background: var(--bleu); }
.note-vide { background: var(--gris-clair); color: var(--gris); }
.ecart { background: #fef3c7 !important; }

/* ---- Messages ---- */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash-ok { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-erreur { background: #fee2e2; color: var(--rouge); border: 1px solid #fecaca; }
.bandeau-info { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }

.muted { color: var(--gris); font-size: 12.5px; }
.hash { font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; color: var(--gris); }
.bloc-titre { background: var(--bleu-clair); color: var(--bleu); font-weight: 700; padding: 6px 10px; border-radius: 5px; margin: 18px 0 8px; }
.ancres { font-size: 12px; color: var(--gris); margin-top: 3px; }
.ancres span { margin-right: 10px; }
.statistique { font-size: 26px; font-weight: 700; color: var(--bleu); }
.stat-libelle { color: var(--gris); font-size: 13px; }

/* ---- Dossiers collaborateurs ---- */
.dossier-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.dossier {
  background: #fff; border: 1px solid var(--bordure); border-left: 4px solid var(--bleu);
  border-radius: 8px; padding: 14px 16px; cursor: pointer;
  transition: box-shadow .12s, transform .12s;
  display: flex; flex-direction: column; gap: 10px;
}
.dossier:hover { box-shadow: 0 3px 12px rgba(30,58,95,.14); transform: translateY(-1px); }
.dossier-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dossier-stats { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.dossier-stats .badge { margin-right: 4px; }
.dossier-chiffre { font-size: 19px; font-weight: 700; color: var(--bleu); margin-right: 6px; }
.dossier-pied {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border-top: 1px solid var(--bordure); padding-top: 9px; margin-top: auto; font-size: 12.5px;
}

/* ---- Page de connexion ---- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bleu); }
.login-boite { background: #fff; border-radius: 10px; padding: 34px 38px; width: 380px; max-width: 92vw; }
.login-boite h1 { margin-bottom: 2px; }
