:root {
  --fond: #f6f5f2; --carte: #fff; --texte: #1f2328; --doux: #6b7280; --bord: #e5e2dc;
  --accent: #b45309; --accent-fonce: #92400e; --ok: #15803d; --ok-fond: #dcfce7;
  --rouge: #b91c1c; --rouge-fond: #fee2e2; --jaune-fond: #fef3c7;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--texte); }
a { color: var(--accent-fonce); }
.barre { background: #1f2328; color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 10px 16px; position: sticky; top: 0; z-index: 5; }
.barre .marque { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.barre nav { display: flex; flex-wrap: wrap; gap: 2px; }
.barre nav a { color: #e5e7eb; text-decoration: none; padding: 6px 9px; border-radius: 6px; }
.barre nav a:hover { background: #374151; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grille { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 12px 14px; }
.kpi .v { font-size: 26px; font-weight: 700; }
.kpi .l { color: var(--doux); font-size: 13px; }
.kpi.alerte { background: var(--rouge-fond); border-color: #fca5a5; color: var(--rouge); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--doux); }
.table-scroll { overflow-x: auto; }
tr.retard td { background: var(--rouge-fond); }
tr.retard td:first-child { border-left: 4px solid var(--rouge); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eee; white-space: nowrap; }
.badge.rouge { background: var(--rouge); color: #fff; }
.badge.ok { background: var(--ok-fond); color: var(--ok); }
.badge.pb { background: var(--rouge-fond); color: var(--rouge); }
.badge.plan { background: var(--jaune-fond); color: var(--accent-fonce); }
.doux { color: var(--doux); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.flash.ok { background: var(--ok-fond); color: var(--ok); }
.flash.erreur { background: var(--rouge-fond); color: var(--rouge); }
.btn, button { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover, button:hover { background: var(--accent-fonce); }
.btn.sec, button.sec { background: #fff; color: var(--texte); border: 1px solid var(--bord); }
.btn.danger, button.danger { background: var(--rouge); }
.btn.petit, button.petit { padding: 4px 9px; font-size: 13px; }
form.ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfcac2; border-radius: 7px; background: #fff; width: 100%; }
form.ligne input, form.ligne select { width: auto; }
.champs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.entete { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.entete h1 { margin: 0; }
/* planning */
.planning { display: grid; grid-template-columns: 130px repeat(5, minmax(150px, 1fr)); gap: 6px; min-width: 900px; }
.planning .tete { font-weight: 700; font-size: 13px; padding: 6px; }
.planning .case { background: var(--carte); border: 1px solid var(--bord); border-radius: 8px; padding: 6px; min-height: 90px; }
.planning .case.ferie { background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 6px, #fff 6px, #fff 12px); }
.planning .case.plein { border-color: var(--ok); }
.rdv { display: block; font-size: 12.5px; padding: 4px 6px; border-radius: 6px; margin-bottom: 4px; text-decoration: none; color: var(--texte); background: var(--jaune-fond); border-left: 3px solid var(--accent); }
.rdv.realisee { background: var(--ok-fond); border-left-color: var(--ok); }
.rdv.retard { background: var(--rouge-fond); border-left-color: var(--rouge); }
.rdv .sect { color: var(--doux); }
.jauge { font-size: 11px; color: var(--doux); float: right; }
/* tournée technicien */
.visite { display: flex; gap: 12px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--bord); padding: 12px 0; }
.visite:last-child { border-bottom: 0; }
.heure { font-size: 20px; font-weight: 700; min-width: 64px; }
/* signature */
.signature-zone { border: 2px dashed #cfcac2; border-radius: 8px; background: #fff; touch-action: none; width: 100%; height: 200px; display: block; }
.choix { display: flex; gap: 10px; flex-wrap: wrap; }
.choix label { display: flex; gap: 8px; align-items: center; border: 1px solid var(--bord); border-radius: 8px; padding: 10px 14px; font-weight: 600; cursor: pointer; background: #fff; }
.choix input { width: auto; }
/* stats */
.barre-h { height: 10px; background: #eee; border-radius: 99px; overflow: hidden; min-width: 80px; }
.barre-h span { display: block; height: 100%; background: var(--accent); }
td.num, th.num { text-align: right; }
.cal td { text-align: center; font-size: 13px; padding: 5px 3px; }
.cal td.bas { background: var(--rouge-fond); color: var(--rouge); font-weight: 700; }
.cal td.atteint { background: var(--ok-fond); color: var(--ok); font-weight: 700; }
.cal td.we { color: #c4c4c4; }
pre { white-space: pre-wrap; font: inherit; margin: 0; }
@media (max-width: 640px) {
  main { padding: 12px; }
  .barre { position: static; }
  .barre nav a { padding: 5px 7px; font-size: 14px; }
  th.opt, td.opt { display: none; }
}
@media print { .barre, .actions, .flash { display: none; } }
