* { box-sizing: border-box; }
body { font-family: -apple-system, "Segoe UI", Arial, sans-serif; margin: 0; background: #f4f5f7; color: #222; }
h1, h2, h3 { margin: 0 0 8px; }

#ecranRole { text-align: center; padding: 70px 20px; }
#ecranRole h1 { color: #1a3c5e; font-size: 26px; }
.boutons-role { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.boutons-role button { padding: 16px 26px; font-size: 16px; border: none; border-radius: 8px; background: #1a3c5e; color: #fff; cursor: pointer; }
.boutons-role button:hover { background: #0f2740; }

header { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: #1a3c5e; color: #fff; }
header h1 { font-size: 18px; }
#badgeRole { background: rgba(255,255,255,.2); padding: 5px 12px; border-radius: 20px; font-size: 13px; }

nav { display: flex; gap: 4px; padding: 8px 14px; background: #fff; border-bottom: 1px solid #ddd; overflow-x: auto; }
nav button { padding: 9px 16px; border: none; background: none; cursor: pointer; font-size: 14px; border-radius: 6px; white-space: nowrap; }
nav button.actif { background: #1a3c5e; color: #fff; }

main { padding: 18px; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-header button, button.secondaire { padding: 9px 16px; background: #2b7a4b; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
button.secondaire { background: #556; margin-bottom: 10px; }

.tableau-conteneur { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
th { background: #eef1f4; white-space: nowrap; }
tr.ligne-retard { background: #fdecea; }
.tag-retard { background: #c0392b; color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 12px; }
td input, td select { width: 100%; min-width: 72px; padding: 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }

.note { font-size: 13px; color: #666; margin: 0 0 14px; }

.dashboard { display: flex; flex-wrap: wrap; gap: 14px; }
.carte { background: #fff; padding: 20px; border-radius: 10px; flex: 1; min-width: 190px; text-align: center; }
.carte.alerte { background: #fdecea; }
.carte .chiffre { font-size: 32px; font-weight: 700; display: block; color: #1a3c5e; }
.carte .label { font-size: 13px; color: #666; }
.carte.repartition { text-align: left; }
.carte.repartition ul { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.carte.repartition li { padding: 3px 0; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 14px; }
.modal-contenu { background: #fff; padding: 22px; border-radius: 10px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; }
.modal-contenu label { display: block; font-size: 13px; color: #555; margin: 10px 0 4px; }
.modal-contenu input, .modal-contenu select { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-actions button { padding: 9px 18px; border: none; border-radius: 6px; cursor: pointer; background: #2b7a4b; color: #fff; }
.modal-actions .annuler { background: #ddd; color: #333; }

.ligne-article { display: flex; gap: 5px; margin-bottom: 7px; align-items: center; }
.ligne-article select, .ligne-article input { flex: 1; min-width: 0; padding: 7px; font-size: 13px; }
.ligne-article .retirer { flex: 0 0 30px; background: #eee; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; padding: 6px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1a3c5e; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 200; max-width: 90%; }

@media (max-width: 700px) {
  .dashboard { flex-direction: column; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { margin-bottom: 12px; border: 1px solid #e2e2e2; border-radius: 8px; padding: 6px; background: #fff; }
  td { border: none; padding: 6px 8px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
  td::before { content: attr(data-label); font-weight: 600; color: #666; font-size: 12px; }
}
