:root {
  --fond: #efe9df;
  --carte: #fbf8f3;
  --ligne: #ddd3c4;
  --texte: #1f1c19;
  --doux: #6f665b;
  --accent: #8a7357;
  --accent-fonce: #5e4d39;
  --noir: #1f1c19;
  --ok: #3f7a4e;
  --pause: #b7832f;
  --alerte: #a8432f;
  --rdv: #3c5d86;
  --rayon: 12px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte); }
body { font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0 0 .6rem; font-weight: 650; letter-spacing: .01em; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
a { color: var(--accent-fonce); }
.muted { color: var(--doux); font-size: .9em; }
.hidden { display: none !important; }

header.barre {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1rem; background: var(--noir); color: #f3ede3;
}
header.barre .marque { font-weight: 700; letter-spacing: .18em; }
header.barre nav { display: flex; gap: .3rem; margin-left: auto; flex-wrap: wrap; }
header.barre nav a { white-space: nowrap; color: #e4d9c8; text-decoration: none; padding: .35rem .7rem; border-radius: 8px; font-size: .92rem; }
header.barre nav a.actif, header.barre nav a:hover { background: #3a342e; color: #fff; }

main { padding: 1rem; max-width: 1400px; margin: 0 auto; }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 1rem; }
.grille { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grille.deux { grid-template-columns: 1.4fr 1fr; } }

button, .btn {
  font: inherit; border: 1px solid var(--ligne); background: #fff; color: var(--texte);
  padding: .55rem .9rem; border-radius: 10px; cursor: pointer; min-height: 42px;
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.principal { background: var(--noir); color: #fff; border-color: var(--noir); }
button.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
button.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
button.danger { color: var(--alerte); }
button.petit { min-height: 34px; padding: .3rem .6rem; font-size: .88rem; }
button.choix.actif { background: var(--noir); color: #fff; border-color: var(--noir); }

input, select, textarea {
  font: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid var(--ligne); border-radius: 10px; background: #fff; color: var(--texte);
}
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: .85rem; color: var(--doux); margin: .5rem 0 .2rem; }
label.case { display: flex; align-items: center; gap: .5rem; color: var(--texte); font-size: .92rem; }
label.case input { width: auto; }
.ligne-form { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }

.puce { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e9e1d4; color: var(--doux); }
.puce.dispo { background: #dcebdf; color: var(--ok); }
.puce.pause { background: #f3e5c9; color: var(--pause); }
.puce.absent { background: #e8e3dc; color: #8b847a; }
.puce.rdv { background: #dbe4f0; color: var(--rdv); }
.puce.qr { background: #eee3d3; color: var(--accent-fonce); }

.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { display: flex; align-items: center; gap: .7rem; padding: .7rem .2rem; border-bottom: 1px solid var(--ligne); flex-wrap: wrap; }
.liste > li:last-child { border-bottom: 0; }
.rang { width: 2rem; height: 2rem; border-radius: 50%; background: var(--noir); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; font-size: .9rem; }
.nom { font-weight: 600; }
.grow { flex: 1; min-width: 140px; }
.attente { font-variant-numeric: tabular-nums; font-weight: 650; }

.barbiers { display: flex; gap: .6rem; flex-wrap: wrap; }
.barbier-carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: .6rem .8rem; min-width: 170px; }
.barbier-carte .nom { font-size: 1rem; }

#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--noir); color: #fff; padding: .7rem 1.1rem; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; max-width: 92vw; }
#toast.vu { opacity: 1; }
#toast.erreur { background: var(--alerte); }

dialog { border: 0; border-radius: 16px; padding: 1.2rem; width: min(560px, 94vw); background: var(--carte); color: var(--texte); }
dialog::backdrop { background: rgba(20, 18, 15, .45); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--ligne); font-size: .93rem; }
th { color: var(--doux); font-weight: 600; font-size: .82rem; }
td input { padding: .35rem .5rem; }

/* ---- lot 1 ---- */
header.barre .qui { color: #bfb3a1; font-size: .85rem; }
.onglets { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--ligne); margin-bottom: 1rem; -webkit-overflow-scrolling: touch; }
.onglets button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; white-space: nowrap; min-height: 44px; color: var(--doux); }
.onglets button.actif { border-bottom-color: var(--noir); color: var(--texte); font-weight: 650; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.kpi { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: .7rem .8rem; }
.kpi .v { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .l { font-size: .78rem; color: var(--doux); }
.kpi .d { font-size: .76rem; margin-top: .15rem; color: var(--doux); }
.kpi .d.hausse { color: var(--ok); } .kpi .d.baisse { color: var(--alerte); }
.puce.alerte { background: #f4dcd6; color: var(--alerte); }
.puce.ok { background: #dcebdf; color: var(--ok); }
details.passage { border: 1px solid var(--ligne); border-radius: 10px; background: #fff; margin-bottom: .5rem; }
details.passage > summary { list-style: none; cursor: pointer; padding: .7rem .8rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
details.passage > summary::-webkit-details-marker { display: none; }
details.passage[open] > summary { border-bottom: 1px solid var(--ligne); }
.detail { padding: .6rem .8rem .8rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem 1rem; }
.detail div { font-size: .9rem; } .detail b { display: block; font-size: .74rem; color: var(--doux); font-weight: 600; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.galerie img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #ddd; cursor: zoom-in; }
.tableau { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tableau table { min-width: 560px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.graph { width: 100%; height: auto; display: block; }
.infobulle { position: fixed; pointer-events: none; background: var(--noir); color: #fff; padding: .35rem .55rem; border-radius: 8px; font-size: .8rem; z-index: 60; display: none; white-space: nowrap; }
.section { margin-top: 1rem; }
@media (max-width: 640px) {
  main { padding: .7rem; }
  header.barre { padding: .55rem .7rem; }
  header.barre nav { width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; }
  .ligne-form { grid-template-columns: 1fr; }
  .kpi .v { font-size: 1.25rem; }
  dialog { padding: 1rem; }
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

.puce.statut { background: #ece5da; color: var(--accent-fonce); }
.puce.statut.r2 { background: #ddd8cf; color: #3c362f; }
.puce.statut.r3 { background: #dfe6ec; color: #2d4152; }
.puce.statut.r4 { background: #1f1c19; color: #d9c29b; }
