:root {
  --accent: #b45309;
  --accent-fonce: #92400e;
  --fond: #faf7f2;
  --carte: #ffffff;
  --texte: #2d3748;
  --gris: #718096;
  --bordure: #e2e8f0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--texte); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar { display: flex; align-items: center; gap: 24px; background: #1a202c; color: #fff; padding: 12px 24px; flex-wrap: wrap; }
.nav-brand a { color: #fff; font-weight: 700; font-size: 1.1rem; }
.nav-links { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.nav-links a { color: #cbd5e0; }
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 10px; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
h1 { margin-bottom: 16px; font-size: 1.6rem; }
h2 { margin: 24px 0 10px; font-size: 1.15rem; }

.entete-page { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.entete-page h1 { margin-bottom: 0; }

.cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.carte { background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 16px; text-align: center; color: var(--gris); }
.carte-chiffre { font-size: 1.6rem; font-weight: 700; color: var(--texte); }
.carte-accent { border-color: var(--accent); background: #fffbeb; }
.carte-accent .carte-chiffre { color: var(--accent); }

.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .deux-colonnes { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; background: var(--carte); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
th { background: #edf2f7; text-align: left; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--gris); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--bordure); }
tr:last-child td { border-bottom: none; }
.ligne-total td { background: #fffbeb; }
.table-totaux { max-width: 380px; margin-left: auto; }
.centre { text-align: center; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-brouillon { background: #edf2f7; color: #4a5568; }
.badge-envoye { background: #ebf8ff; color: #2b6cb0; }
.badge-accepte { background: #f0fff4; color: #276749; }
.badge-refuse { background: #fff5f5; color: #c53030; }

.btn { display: inline-block; padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 0.92rem; font-weight: 600; }
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--texte); }
.btn-danger { background: #c53030; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-block { width: 100%; margin-top: 14px; }

.filtres { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filtres input, .filtres select { padding: 8px 10px; border: 1px solid var(--bordure); border-radius: 8px; }

.formulaire { background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 20px; }
.grille-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .grille-form { grid-template-columns: 1fr; } }
.champ-large { grid-column: 1 / -1; }
.champ label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9rem; }
.champ input, .champ select, .champ textarea,
#table-lignes input, #table-lignes select,
.login-box input { width: 100%; padding: 8px 10px; border: 1px solid var(--bordure); border-radius: 8px; font-size: 0.95rem; }
.champ small { color: var(--gris); }
.actions { margin-top: 18px; display: flex; gap: 10px; }
.errorlist { color: #c53030; font-size: 0.85rem; list-style: none; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.alert-error, .alert-danger { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }

.login-box { max-width: 380px; margin: 8vh auto; background: var(--carte); border: 1px solid var(--bordure); border-radius: 12px; padding: 32px; text-align: center; }
.login-box h1 { margin-bottom: 4px; }
.login-box .sous-titre { color: var(--gris); margin-bottom: 20px; }
.login-box form { text-align: left; }
.login-box label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 0.9rem; }

.vide { color: var(--gris); font-style: italic; padding: 12px 0; }
.instructions { background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 16px; }
#table-lignes input[type="checkbox"] { width: auto; }

.badge-excellent { background: #f0fff4; color: #276749; }
.badge-ok { background: #ebf8ff; color: #2b6cb0; }
.badge-alerte { background: #fff5f5; color: #c53030; }
.badge-inconnu { background: #edf2f7; color: #4a5568; }
.carte-alerte { border-color: #c53030; background: #fff5f5; }
.carte-alerte .carte-chiffre { color: #c53030; }
.barre { background: #edf2f7; border-radius: 999px; height: 8px; width: 120px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.barre-remplie { background: var(--accent); border-radius: 999px; height: 8px; }

.nav-groupe { position: relative; }
.nav-groupe > span { color: #cbd5e0; cursor: pointer; }
.nav-groupe:hover > span { color: #fff; }
.nav-menu { display: none; position: absolute; top: 100%; left: 0; background: #2d3748; border-radius: 0 0 8px 8px; min-width: 170px; z-index: 50; padding: 6px 0; }
.nav-groupe:hover .nav-menu { display: block; }
.nav-menu a { display: block; padding: 8px 14px; color: #cbd5e0; }
.nav-menu a:hover { background: #4a5568; color: #fff; text-decoration: none; }
.navbar { position: relative; }
