:root {
  --vert: #23504d;
  --vert-fonce: #173836;
  --vert-pale: #e7efee;
  --vert-tres-pale: #f3f7f6;
  --fond: #f6f7f5;
  --carte: #ffffff;
  --texte: #1c2422;
  --texte-2: #5b6663;
  --texte-3: #8b9592;
  --ligne: #e3e7e5;
  --ligne-forte: #cdd4d1;
  --ambre: #a3650a;
  --ambre-pale: #fdf3e1;
  --rouge: #b42f2f;
  --rouge-pale: #fbeaea;
  --bleu: #1f5f9e;
  --bleu-pale: #e8f1fa;
  --succes: #1f7a4d;
  --succes-pale: #e6f4ec;
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(23, 56, 54, .06), 0 4px 16px rgba(23, 56, 54, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--vert); }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.sous-titre { color: var(--texte-2); margin: 0 0 24px; }
.muted { color: var(--texte-2); }
.petit { font-size: 13px; }
.tres-petit { font-size: 12px; }

/* En-tête */
.entete { background: var(--vert); color: #fff; }
.entete-int { max-width: 1180px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; height: 60px; }
.marque { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 650; letter-spacing: .01em; white-space: nowrap; }
.marque-logo { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 16px; }
.marque small { display: block; font-weight: 400; font-size: 11px; opacity: .7; letter-spacing: .04em; text-transform: uppercase; line-height: 1; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: rgba(255,255,255,.78); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.actif { color: #fff; background: rgba(255,255,255,.16); }
.nav a.cta { background: #fff; color: var(--vert); font-weight: 600; }
.nav a.cta:hover { background: var(--vert-pale); }
.profil { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; }
.profil form button { background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; font-size: 18px; padding: 4px; }
.profil form button:hover { color: #fff; }

.page { max-width: 1180px; margin: 0 auto; padding: 32px 20px 64px; }
.page-etroite { max-width: 620px; }

/* Cartes et grilles */
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 14px; padding: 20px 22px; box-shadow: var(--ombre); }
.carte + .carte { margin-top: 16px; }
.grille { display: grid; gap: 20px; }
.grille-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grille-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.entete-section { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.compteur { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--vert-pale); color: var(--vert); font-size: 12px; font-weight: 600; }

/* Listes */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--ligne); }
.liste li:first-child { border-top: 0; padding-top: 4px; }
.liste .grow { flex: 1; min-width: 0; }
.liste .titre { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vide { color: var(--texte-3); font-size: 14px; padding: 8px 0; }

/* Pastilles de statut */
.pastille { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 550; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.p-confirmee { background: var(--vert-pale); color: var(--vert); }
.p-en_attente { background: var(--ambre-pale); color: var(--ambre); }
.p-a_replanifier { background: var(--bleu-pale); color: var(--bleu); }
.p-annulee { background: #eee; color: #666; }
.p-tentative { background: transparent; color: var(--texte-2); border: 1px dashed var(--ligne-forte); }
.p-alerte { background: var(--rouge-pale); color: var(--rouge); }

/* Boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 550; padding: 9px 16px; border-radius: var(--rayon); border: 1px solid var(--ligne-forte); background: #fff; color: var(--texte); cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--vert-tres-pale); border-color: var(--vert); }
.btn:active { transform: scale(.98); }
.btn-principal { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn-principal:hover { background: var(--vert-fonce); border-color: var(--vert-fonce); }
.btn-petit { padding: 6px 11px; font-size: 13px; }
.btn-grand { width: 100%; padding: 14px 18px; font-size: 16px; }
.btn-lien { background: none; border: 0; color: var(--texte-2); padding: 6px 8px; }
.btn-lien:hover { background: none; color: var(--texte); text-decoration: underline; }
.btn-danger { color: var(--rouge); }
.btn-danger:hover { border-color: var(--rouge); background: var(--rouge-pale); }
.btn[disabled] { opacity: .55; pointer-events: none; }

label { display: block; font-size: 13px; font-weight: 550; color: var(--texte-2); margin: 0 0 6px; }
.champ { margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month], select, textarea {
  width: 100%; font: inherit; color: var(--texte); background: #fff; border: 1px solid var(--ligne-forte); border-radius: var(--rayon); padding: 10px 12px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--vert); box-shadow: 0 0 0 3px rgba(35, 80, 77, .15); }
.aide { font-size: 12px; color: var(--texte-3); margin-top: 5px; }
.erreur-champ { font-size: 13px; color: var(--rouge); margin-top: 5px; }
.case { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--texte); font-weight: 400; }

/* Messages */
.flash { border-radius: var(--rayon); padding: 12px 16px; margin-bottom: 20px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.flash-succes { background: var(--succes-pale); color: var(--succes); }
.flash-erreur { background: var(--rouge-pale); color: var(--rouge); }
.flash-info { background: var(--bleu-pale); color: var(--bleu); }
.flash-ambre { background: var(--ambre-pale); color: var(--ambre); }

/* Écran Planifier */
.recherche { position: relative; }
.recherche i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--texte-3); font-size: 20px; }
.recherche input { padding: 14px 16px 14px 44px; font-size: 17px; border-radius: 12px; }
.batiment { display: flex; gap: 14px; align-items: center; background: var(--vert-tres-pale); border: 1px solid var(--vert-pale); border-radius: 12px; padding: 14px 16px; margin: 14px 0 0; }
.batiment-icone { width: 40px; height: 40px; border-radius: 10px; background: var(--vert); color: #fff; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.jours { display: flex; gap: 6px; flex-wrap: wrap; }
.jour-btn { min-width: 52px; padding: 8px 0; font: inherit; font-size: 14px; border-radius: var(--rayon); border: 1px solid var(--ligne-forte); background: #fff; color: var(--texte-2); cursor: pointer; }
.jour-btn.exclu { background: var(--rouge-pale); color: var(--rouge); border-color: #efc4c4; text-decoration: line-through; }
.jour-btn.prefere { background: var(--succes-pale); color: var(--succes); border-color: #b9dfca; }
.proposition { text-align: left; }
.proposition .etiquette { font-size: 13px; color: var(--texte-2); margin-bottom: 2px; }
.proposition .date { font-size: 28px; font-weight: 650; letter-spacing: -.015em; line-height: 1.2; }
.proposition .raison { color: var(--texte-2); margin: 6px 0 16px; display: flex; gap: 6px; align-items: flex-start; }
.phrase { background: var(--fond); border-radius: var(--rayon); padding: 12px 14px; font-size: 14px; line-height: 1.6; position: relative; margin-bottom: 14px; }
.phrase button { position: absolute; top: 8px; right: 8px; }
.actions-decision { display: grid; gap: 8px; }
.remplacement { border: 1px solid #efd9b0; background: var(--ambre-pale); }
.detail-admin { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--ligne-forte); font-size: 12px; color: var(--texte-3); }
.chargement { display: flex; align-items: center; gap: 10px; color: var(--texte-2); padding: 18px 0; }
.rond { width: 18px; height: 18px; border: 2px solid var(--vert-pale); border-top-color: var(--vert); border-radius: 50%; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.cache { display: none !important; }
.etape { animation: apparait .18s ease-out; }
@keyframes apparait { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Calendrier */
.semaine { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.jour-col { background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; min-height: 220px; display: flex; flex-direction: column; }
.jour-col.aujourdhui { border-color: var(--vert); box-shadow: 0 0 0 1px var(--vert); }
.jour-col.ferme { background: repeating-linear-gradient(-45deg, #fafafa, #fafafa 8px, #f3f3f3 8px, #f3f3f3 16px); }
.jour-tete { padding: 10px 12px; border-bottom: 1px solid var(--ligne); display: flex; justify-content: space-between; align-items: baseline; }
.jour-tete b { font-size: 15px; }
.jour-corps { padding: 8px; display: grid; gap: 6px; align-content: start; flex: 1; }
.bloc { display: block; text-decoration: none; color: inherit; border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.35; border-left: 3px solid var(--vert); background: var(--vert-tres-pale); }
.bloc:hover { filter: brightness(.97); }
.bloc.en_attente { border-left-color: var(--ambre); background: var(--ambre-pale); }
.bloc.tentative { border: 1px dashed var(--ligne-forte); border-left: 3px dashed var(--texte-3); background: transparent; color: var(--texte-2); border-radius: 0 8px 8px 0; }
.bloc .h { font-weight: 600; }
.bloc .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bloc .v { color: var(--texte-2); font-size: 12px; }
.note-jour { font-size: 12px; color: var(--texte-2); padding: 6px 8px; }

/* Horaire */
.journee { margin-bottom: 18px; }
.journee-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; flex-wrap: wrap; }
.arret { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--ligne); }
.arret:first-child { border-top: 0; }
.arret .heure { width: 64px; flex-shrink: 0; font-weight: 600; }

/* Tableaux */
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th { text-align: left; font-size: 12px; font-weight: 600; color: var(--texte-2); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--ligne-forte); }
.tableau td { padding: 12px 10px; border-bottom: 1px solid var(--ligne); vertical-align: top; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau .nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau tfoot td { font-weight: 650; border-top: 2px solid var(--texte); }
.defile { overflow-x: auto; }

.chiffre { font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: var(--vert); line-height: 1.1; }

/* Connexion */
.ecran-simple { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--vert); }
.boite { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 32px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.boite .marque { color: var(--vert); margin-bottom: 22px; }
.boite .marque-logo { background: var(--vert); color: #fff; }

@media (max-width: 900px) {
  .semaine { grid-template-columns: 1fr; }
  .jour-col { min-height: 0; }
  .entete-int { gap: 12px; }
  .marque span.texte-marque { display: none; }
}
@media (max-width: 560px) {
  .page { padding: 22px 16px 48px; }
  h1 { font-size: 21px; }
  .proposition .date { font-size: 23px; }
  .carte { padding: 16px; }
}
@media print {
  .entete, .pas-imprimer { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .carte { box-shadow: none; border: 0; padding: 0; }
}
